Skip to content

Commit

Permalink
Merge pull request #44 from RobMayer/update-types
Browse files Browse the repository at this point in the history
explicit return/callback type for update based on options
  • Loading branch information
tex0l authored Jan 11, 2024
2 parents bc10dde + 43d6285 commit 1eeda8f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,25 +105,25 @@ declare class Nedb<Schema = Record<string, any>> extends EventEmitter {
projection?: any
): Nedb.Cursor<T>;

update<T extends Schema>(
update<T extends Schema, O extends Nedb.UpdateOptions>(
query: any,
updateQuery: any,
options?: Nedb.UpdateOptions,
options?: O,
callback?: (
err: Error | null,
numberOfUpdated: number,
affectedDocuments: Document<T> | Document<T>[] | null,
affectedDocuments: O['returnUpdatedDocs'] extends true ? O['multi'] extends true ? Document<T>[] | null : Document<T> | null : null,
upsert: boolean | null
) => void
): void;

updateAsync<T extends Schema>(
updateAsync<T extends Schema, O extends Nedb.UpdateOptions>(
query: any,
updateQuery: any,
options?: Nedb.UpdateOptions
options?: O
): Promise<{
numAffected: number;
affectedDocuments: Document<T> | Document<T>[] | null;
affectedDocuments: O['returnUpdatedDocs'] extends true ? O['multi'] extends true ? Document<T>[] | null : Document<T> | null : null;
upsert: boolean;
}>;

Expand Down

0 comments on commit 1eeda8f

Please sign in to comment.