From 3577103db9a114bb51a718d247a91230b2343ab7 Mon Sep 17 00:00:00 2001 From: dfahlander Date: Wed, 7 Feb 2024 09:09:17 +0100 Subject: [PATCH] Revert "Propsal to replace #1764" This reverts commit 1bfb4a6e998d9ed4761f70d681f2058f4d956e7c. --- src/public/types/pojo.d.ts | 10 ---------- src/public/types/table-hooks.d.ts | 9 ++++----- 2 files changed, 4 insertions(+), 15 deletions(-) delete mode 100644 src/public/types/pojo.d.ts diff --git a/src/public/types/pojo.d.ts b/src/public/types/pojo.d.ts deleted file mode 100644 index 58aaebf57..000000000 --- a/src/public/types/pojo.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { MethodProps } from "./insert-type"; - -/** Pojo is the stored representation of a class instance where methods are stripped away. - * - * Given T is a class or interface with methods, Pojo is a type that omits the methods. - * Used represent the data stored in indexedDB, when objects are provided to reading-hook - * and other API surfaces before they are returned to the user in the form of a class instance - * with methods attached on its prototype. - */ -export type Pojo = Omit>; diff --git a/src/public/types/table-hooks.d.ts b/src/public/types/table-hooks.d.ts index 40844eb00..23b6b281c 100644 --- a/src/public/types/table-hooks.d.ts +++ b/src/public/types/table-hooks.d.ts @@ -2,7 +2,6 @@ import { DexieEventSet } from "./dexie-event-set"; import { DexieEvent } from "./dexie-event"; import { Transaction } from "./transaction"; import { IndexableType } from "./indexable-type"; -import { Pojo } from "./pojo"; interface CreatingHookContext { onsuccess?: (primKey: Key) => void; @@ -20,10 +19,10 @@ interface DeletingHookContext { } interface TableHooks extends DexieEventSet { - (eventName: 'creating', subscriber: (this: CreatingHookContext, primKey:TKey, obj:TInsertType, transaction:Transaction) => void | undefined | TKey): void; - (eventName: 'reading', subscriber: (obj:Pojo) => Pojo | any): void; - (eventName: 'updating', subscriber: (this: UpdatingHookContext,TKey>, modifications:Object, primKey:TKey, obj:T, transaction:Transaction) => any): void; - (eventName: 'deleting', subscriber: (this: DeletingHookContext,TKey>, primKey:TKey, obj:Pojo, transaction:Transaction) => any): void; + (eventName: 'creating', subscriber: (this: CreatingHookContext, primKey:TKey, obj:T, transaction:Transaction) => void | undefined | TKey): void; + (eventName: 'reading', subscriber: (obj:TInsertType) => T | any): void; + (eventName: 'updating', subscriber: (this: UpdatingHookContext, modifications:Object, primKey:TKey, obj:T, transaction:Transaction) => any): void; + (eventName: 'deleting', subscriber: (this: DeletingHookContext, primKey:TKey, obj:T, transaction:Transaction) => any): void; creating: DexieEvent; reading: DexieEvent; updating: DexieEvent;