Wrong types ?
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 3
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
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][]>;
};
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the DocumentsDatabase type definition in this TypeScript definitions repository and compare its merge, iterator, query, and all signatures with the reported usage. Resolve the intended property overriding, value types, async behavior, and tuple shapes, then verify the declarations against representative TypeScript usage or existing checks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100