import type { DexieTablePrimaryKeyField, DexieTablePrimaryKeyType, KeysOf } from "./DexieTablePrimaryKeyTypes" import type Dexie from "dexie" import type { ClassConstructor } from "@3fv/guard" /** * Defines a table's configuration, specifically the `class` constructor, * primary key field(s) and the index signature * * @template {object} T, {DexieTablePrimaryKeyField} PrimaryKeyField */ export type DexieTableConfig< T extends {}, PrimaryKeyField extends KeysOf > = [ClassConstructor, PrimaryKeyField, string?, DexieTableOptions?] /** * Infer table config from object and table name */ export type DexieTableConfigInferred = Config extends DexieTableConfig< infer T, infer Field > ? Dexie.Table> : never /** * Creates `Dexie.Table` with a `T` type and `KeyType` * * @see Dexie.Table */ export type DexieTable< T extends {}, PrimaryKeyField extends KeysOf > = Dexie.Table> export interface DexieTableOptions { mapToClass: boolean } export type DexieTableOptionsArg = Partial