Skip to content

Commit

Permalink
fix(types): use correct count function definition (#51)
Browse files Browse the repository at this point in the history
* fix(types): use correct count function definition

Based on the [definition]
(https://github.com/mongoist/mongoist/blob/master/lib/cursor.js#L62),
count does not take any arguments and returns a promise that resolves
to a number. Flow should reflect that.

* chore(types): remove unused cursor count options

These are no longer used.
  • Loading branch information
Garret Meier committed Aug 4, 2020
1 parent e9a3ff1 commit d8d1cf0
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions index.js.flow
Original file line number Diff line number Diff line change
Expand Up @@ -451,14 +451,6 @@ type AggregationOptions = $ReadOnly<{|
session?: ClientSession,
|}>;

declare type CursorCountOptions = $ReadOnly<{|
skip?: number,
limit?: number,
maxTimeMS?: number,
hint?: string,
readPreference?: ReadPreference,
|}>;

// https://github.com/facebook/flow/issues/2753
declare export class Cursor<Doc> extends stream$Readable {
constructor(cursorFactory: () => Promise<InternalCursor>): Cursor<Doc>;
Expand All @@ -467,7 +459,7 @@ declare export class Cursor<Doc> extends stream$Readable {
batchSize(value: number): this;
close(): Promise<mixed>;
collation(value: CollationParam): this;
count(applySkipLimit: boolean, options: CursorCountOptions): Promise<number>;
count(): Promise<number>;
destroy(): Promise<mixed>;
explain(): Promise<mixed>;
forEach(fn: (doc: Doc) => mixed): Promise<void>;
Expand Down

0 comments on commit d8d1cf0

Please sign in to comment.