Skip to content

Commit d964b7f

Browse files
Merge pull request #317 from cupcakearmy/master
Fix typescript errors
2 parents c271436 + b4f8924 commit d964b7f

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

index.d.ts

+16-13
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ declare module "monk" {
4242
};
4343
type DropIndexInput<T> = CreateIndexInput<T> & string[];
4444
type DropIndexOptions = CommonOptions & { maxTimeMS?: number };
45-
type FindOptions = FindOneOptions & { rawCursor?: boolean };
45+
type FindOptions<T> = FindOneOptions<T> & { rawCursor?: boolean };
4646
type RemoveOptions = CommonOptions & SingleMulti;
4747
type StatsOptions = { scale: number; session?: ClientSession };
4848

@@ -196,63 +196,66 @@ declare module "monk" {
196196
// Raw
197197
find(
198198
query: FilterQuery<T>,
199-
options?: FindOptions & { rawCursor: true }
199+
options?: FindOptions<T> & { rawCursor: true }
200200
): Promise<FindRawResult<T>>;
201201
find(
202202
query: FilterQuery<T>,
203-
options: FindOneOptions & { rawCursor: true },
203+
options: FindOneOptions<T> & { rawCursor: true },
204204
callback: Callback<FindRawResult<T>>
205205
): void;
206206
// Normal
207-
find(query?: FilterQuery<T>, options?: FindOptions): Promise<FindResult<T>>;
207+
find(
208+
query?: FilterQuery<T>,
209+
options?: FindOptions<T>
210+
): Promise<FindResult<T>>;
208211
find(
209212
query: FilterQuery<T>,
210-
options: FindOneOptions,
213+
options: FindOneOptions<T>,
211214
callback: Callback<FindResult<T>>
212215
): void;
213216

214217
findOne(
215218
query?: FilterQuery<T>,
216-
options?: FindOneOptions
219+
options?: FindOneOptions<T>
217220
): Promise<FindOneResult<T>>;
218221
findOne(
219222
query: FilterQuery<T>,
220-
options: FindOneOptions,
223+
options: FindOneOptions<T>,
221224
callback: Callback<FindOneResult<T>>
222225
): void;
223226

224227
findOneAndDelete(
225228
query: FilterQuery<T>,
226-
options?: FindOneAndDeleteOption
229+
options?: FindOneAndDeleteOption<T>
227230
): Promise<FindOneResult<T>>;
228231
findOneAndDelete(
229232
query: FilterQuery<T>,
230-
options: FindOneAndDeleteOption,
233+
options: FindOneAndDeleteOption<T>,
231234
callback: Callback<FindOneResult<T>>
232235
): void;
233236

234237
// Update
235238
findOneAndUpdate(
236239
query: FilterQuery<T>,
237240
update: UpdateQuery<T> | Partial<T>,
238-
options?: FindOneAndUpdateOption & { replaceOne?: false }
241+
options?: FindOneAndUpdateOption<T> & { replaceOne?: false }
239242
): Promise<FindOneResult<T>>;
240243
findOneAndUpdate(
241244
query: FilterQuery<T>,
242245
update: UpdateQuery<T> | Partial<T>,
243-
options?: FindOneAndUpdateOption & { replaceOne?: false },
246+
options?: FindOneAndUpdateOption<T> & { replaceOne?: false },
244247
callback?: Callback<FindOneResult<T>>
245248
): void;
246249
// Replace
247250
findOneAndUpdate(
248251
query: FilterQuery<T>,
249252
update: T,
250-
options?: FindOneAndReplaceOption & { replaceOne: true }
253+
options?: FindOneAndReplaceOption<T> & { replaceOne: true }
251254
): Promise<FindOneResult<T>>;
252255
findOneAndUpdate(
253256
query: FilterQuery<T>,
254257
update: T,
255-
options: FindOneAndReplaceOption & { replaceOne: true },
258+
options: FindOneAndReplaceOption<T> & { replaceOne: true },
256259
callback: Callback<FindOneResult<T>>
257260
): void;
258261

0 commit comments

Comments
 (0)