Merge pull request #44 from RobMayer/update-types

explicit return/callback type for update based on options
master
tex0l 11 months ago committed by GitHub
commit 1eeda8f1a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      index.d.ts

12
index.d.ts vendored

@ -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;
}>;

Loading…
Cancel
Save