Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typescript errors #317

Merged
merged 1 commit into from
Aug 31, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ declare module "monk" {
};
type DropIndexInput<T> = CreateIndexInput<T> & string[];
type DropIndexOptions = CommonOptions & { maxTimeMS?: number };
type FindOptions = FindOneOptions & { rawCursor?: boolean };
type FindOptions<T> = FindOneOptions<T> & { rawCursor?: boolean };
type RemoveOptions = CommonOptions & SingleMulti;
type StatsOptions = { scale: number; session?: ClientSession };

Expand Down Expand Up @@ -196,63 +196,66 @@ declare module "monk" {
// Raw
find(
query: FilterQuery<T>,
options?: FindOptions & { rawCursor: true }
options?: FindOptions<T> & { rawCursor: true }
): Promise<FindRawResult<T>>;
find(
query: FilterQuery<T>,
options: FindOneOptions & { rawCursor: true },
options: FindOneOptions<T> & { rawCursor: true },
callback: Callback<FindRawResult<T>>
): void;
// Normal
find(query?: FilterQuery<T>, options?: FindOptions): Promise<FindResult<T>>;
find(
query?: FilterQuery<T>,
options?: FindOptions<T>
): Promise<FindResult<T>>;
find(
query: FilterQuery<T>,
options: FindOneOptions,
options: FindOneOptions<T>,
callback: Callback<FindResult<T>>
): void;

findOne(
query?: FilterQuery<T>,
options?: FindOneOptions
options?: FindOneOptions<T>
): Promise<FindOneResult<T>>;
findOne(
query: FilterQuery<T>,
options: FindOneOptions,
options: FindOneOptions<T>,
callback: Callback<FindOneResult<T>>
): void;

findOneAndDelete(
query: FilterQuery<T>,
options?: FindOneAndDeleteOption
options?: FindOneAndDeleteOption<T>
): Promise<FindOneResult<T>>;
findOneAndDelete(
query: FilterQuery<T>,
options: FindOneAndDeleteOption,
options: FindOneAndDeleteOption<T>,
callback: Callback<FindOneResult<T>>
): void;

// Update
findOneAndUpdate(
query: FilterQuery<T>,
update: UpdateQuery<T> | Partial<T>,
options?: FindOneAndUpdateOption & { replaceOne?: false }
options?: FindOneAndUpdateOption<T> & { replaceOne?: false }
): Promise<FindOneResult<T>>;
findOneAndUpdate(
query: FilterQuery<T>,
update: UpdateQuery<T> | Partial<T>,
options?: FindOneAndUpdateOption & { replaceOne?: false },
options?: FindOneAndUpdateOption<T> & { replaceOne?: false },
callback?: Callback<FindOneResult<T>>
): void;
// Replace
findOneAndUpdate(
query: FilterQuery<T>,
update: T,
options?: FindOneAndReplaceOption & { replaceOne: true }
options?: FindOneAndReplaceOption<T> & { replaceOne: true }
): Promise<FindOneResult<T>>;
findOneAndUpdate(
query: FilterQuery<T>,
update: T,
options: FindOneAndReplaceOption & { replaceOne: true },
options: FindOneAndReplaceOption<T> & { replaceOne: true },
callback: Callback<FindOneResult<T>>
): void;

Expand Down