Skip to content

Commit

Permalink
Merge branch 'TypesFix' of https://github.com/metafig/Dexie.js into m…
Browse files Browse the repository at this point in the history
…etafig-TypesFix
  • Loading branch information
dfahlander committed Feb 6, 2024
2 parents 8279f1f + ec840ba commit 92f3bed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/public/types/table-hooks.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ interface DeletingHookContext<T,Key> {
onerror?: (err: any) => void;
}

interface TableHooks<T=any,TKey=IndexableType> extends DexieEventSet {
interface TableHooks<T=any,TKey=IndexableType,TInsertType=T> extends DexieEventSet {
(eventName: 'creating', subscriber: (this: CreatingHookContext<T,TKey>, primKey:TKey, obj:T, transaction:Transaction) => void | undefined | TKey): void;
(eventName: 'reading', subscriber: (obj:T) => T | any): void;
(eventName: 'reading', subscriber: (obj:TInsertType) => T | any): void;
(eventName: 'updating', subscriber: (this: UpdatingHookContext<T,TKey>, modifications:Object, primKey:TKey, obj:T, transaction:Transaction) => any): void;
(eventName: 'deleting', subscriber: (this: DeletingHookContext<T,TKey>, primKey:TKey, obj:T, transaction:Transaction) => any): void;
creating: DexieEvent;
Expand Down
4 changes: 2 additions & 2 deletions src/public/types/table.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export interface Table<T=any, TKey=any, TInsertType=T> {
db: Dexie;
name: string;
schema: TableSchema;
hook: TableHooks<T, TKey>;
hook: TableHooks<T, TKey, TInsertType>;
core: DBCoreTable;

get(key: TKey): PromiseExtended<T | undefined>;
Expand Down Expand Up @@ -45,7 +45,7 @@ export interface Table<T=any, TKey=any, TInsertType=T> {
add(item: TInsertType, key?: TKey): PromiseExtended<TKey>;
update(
key: TKey | T,
changes: UpdateSpec<T> | ((obj: T, ctx:{value: any, primKey: IndexableType}) => void | boolean)): PromiseExtended<number>;
changes: UpdateSpec<TInsertType> | ((obj: T, ctx:{value: any, primKey: IndexableType}) => void | boolean)): PromiseExtended<number>;
put(item: TInsertType, key?: TKey): PromiseExtended<TKey>;
delete(key: TKey): PromiseExtended<void>;
clear(): PromiseExtended<void>;
Expand Down

0 comments on commit 92f3bed

Please sign in to comment.