added explicit types to update query

pull/44/head
Rob Mayer 1 year ago
parent a0fa8da53c
commit 43d6285831
  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 projection?: any
): Nedb.Cursor<T>; ): Nedb.Cursor<T>;
update<T extends Schema>( update<T extends Schema, O extends Nedb.UpdateOptions>(
query: any, query: any,
updateQuery: any, updateQuery: any,
options?: Nedb.UpdateOptions, options?: O,
callback?: ( callback?: (
err: Error | null, err: Error | null,
numberOfUpdated: number, 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 upsert: boolean | null
) => void ) => void
): void; ): void;
updateAsync<T extends Schema>( updateAsync<T extends Schema, O extends Nedb.UpdateOptions>(
query: any, query: any,
updateQuery: any, updateQuery: any,
options?: Nedb.UpdateOptions options?: O
): Promise<{ ): Promise<{
numAffected: number; 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; upsert: boolean;
}>; }>;

Loading…
Cancel
Save