-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Hi, it seems you are using & to merge two different types but that's not how it works in TypeScript, if you do A & B B properties won't overwrite A properties. If you want to do so you can do an helper type like type Merge<A, B> = Omit<A, keyof B> & B;.
This make typing non usable like so
It should say : all: [string, string, { [key: string]: string }][]; // TODO: see above comment on iterator``
Are you also sure that every single types of the object should me a string ? Key are always string sure, but values always string ? I can't put numbers ?
Shouldn't all those method be async too ? And all method is also not a method in types ?
I overwrote this type to :
type DocumentsDatabase<T, E extends object> = {
type: "documents";
put: (doc: E) => Promise<void>;
del: (key: string) => Promise<void>;
get: (key: string) => Promise<E | null>;
iterator: (args: { amount: number }) => Promise<Iterable<[string, string, E]>>;
query: (findFn: (doc: E) => boolean) => Promise<E[]>;
indexBy: T;
all: () => Promise<[string, string, E][]>;
};Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels