Skip to content

Commit abdac8d

Browse files
committed
fix merge issues from reverting #13993
1 parent 5337da9 commit abdac8d

File tree

2 files changed

+20
-19
lines changed

2 files changed

+20
-19
lines changed

types/inferschematype.d.ts

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -269,17 +269,18 @@ type ResolvePathType<PathValueType, Options extends SchemaTypeOptions<PathValueT
269269
PathValueType extends 'decimal128' | 'Decimal128' | typeof Schema.Types.Decimal128 ? Types.Decimal128 :
270270
IfEquals<PathValueType, Schema.Types.Decimal128> extends true ? Types.Decimal128 :
271271
IfEquals<PathValueType, Types.Decimal128> extends true ? Types.Decimal128 :
272-
IfEquals<PathValueType, BigInt> extends true ? bigint :
273-
PathValueType extends 'bigint' | 'BigInt' | typeof Schema.Types.BigInt ? bigint :
274-
PathValueType extends 'uuid' | 'UUID' | typeof Schema.Types.UUID ? Buffer :
275-
IfEquals<PathValueType, Schema.Types.UUID> extends true ? Buffer :
276-
PathValueType extends MapConstructor | 'Map' ? Map<string, ResolvePathType<Options['of']>> :
277-
IfEquals<PathValueType, typeof Schema.Types.Map> extends true ? Map<string, ResolvePathType<Options['of']>> :
278-
PathValueType extends ArrayConstructor ? any[] :
279-
PathValueType extends typeof Schema.Types.Mixed ? any:
280-
IfEquals<PathValueType, ObjectConstructor> extends true ? any:
281-
IfEquals<PathValueType, {}> extends true ? any:
282-
PathValueType extends typeof SchemaType ? PathValueType['prototype'] :
283-
PathValueType extends Record<string, any> ? ObtainDocumentType<PathValueType, any, { typeKey: TypeKey }> :
284-
unknown,
272+
IfEquals<PathValueType, Schema.Types.BigInt> extends true ? bigint :
273+
IfEquals<PathValueType, BigInt> extends true ? bigint :
274+
PathValueType extends 'bigint' | 'BigInt' | typeof Schema.Types.BigInt | typeof BigInt ? bigint :
275+
PathValueType extends 'uuid' | 'UUID' | typeof Schema.Types.UUID ? Buffer :
276+
IfEquals<PathValueType, Schema.Types.UUID> extends true ? Buffer :
277+
PathValueType extends MapConstructor | 'Map' ? Map<string, ResolvePathType<Options['of']>> :
278+
IfEquals<PathValueType, typeof Schema.Types.Map> extends true ? Map<string, ResolvePathType<Options['of']>> :
279+
PathValueType extends ArrayConstructor ? any[] :
280+
PathValueType extends typeof Schema.Types.Mixed ? any:
281+
IfEquals<PathValueType, ObjectConstructor> extends true ? any:
282+
IfEquals<PathValueType, {}> extends true ? any:
283+
PathValueType extends typeof SchemaType ? PathValueType['prototype'] :
284+
PathValueType extends Record<string, any> ? ObtainDocumentType<PathValueType, any, { typeKey: TypeKey }> :
285+
unknown,
285286
TypeHint>;

types/models.d.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ declare module 'mongoose' {
223223
/** Creates a `countDocuments` query: counts the number of documents that match `filter`. */
224224
countDocuments(
225225
filter?: FilterQuery<TRawDocType>,
226-
options?: (mongodb.CountOptions & Omit<MongooseSpecificQueryOptions, 'lean' | 'timestamps'>) | null
226+
options?: (mongodb.CountOptions & Omit<MongooseQueryOptions<TRawDocType>, 'lean' | 'timestamps'>) | null
227227
): QueryWithHelpers<
228228
number,
229229
THydratedDocumentType,
@@ -255,7 +255,7 @@ declare module 'mongoose' {
255255
*/
256256
deleteMany(
257257
filter?: FilterQuery<TRawDocType>,
258-
options?: (mongodb.DeleteOptions & Omit<MongooseSpecificQueryOptions, 'lean' | 'timestamps'>) | null
258+
options?: (mongodb.DeleteOptions & Omit<MongooseQueryOptions<TRawDocType>, 'lean' | 'timestamps'>) | null
259259
): QueryWithHelpers<
260260
mongodb.DeleteResult,
261261
THydratedDocumentType,
@@ -280,7 +280,7 @@ declare module 'mongoose' {
280280
*/
281281
deleteOne(
282282
filter?: FilterQuery<TRawDocType>,
283-
options?: (mongodb.DeleteOptions & Omit<MongooseSpecificQueryOptions, 'lean' | 'timestamps'>) | null
283+
options?: (mongodb.DeleteOptions & Omit<MongooseQueryOptions<TRawDocType>, 'lean' | 'timestamps'>) | null
284284
): QueryWithHelpers<
285285
mongodb.DeleteResult,
286286
THydratedDocumentType,
@@ -690,7 +690,7 @@ declare module 'mongoose' {
690690
replaceOne<ResultDoc = THydratedDocumentType>(
691691
filter?: FilterQuery<TRawDocType>,
692692
replacement?: TRawDocType | AnyObject,
693-
options?: (mongodb.ReplaceOptions & MongooseSpecificQueryOptions) | null
693+
options?: (mongodb.ReplaceOptions & MongooseQueryOptions<TRawDocType>) | null
694694
): QueryWithHelpers<UpdateWriteOpResult, ResultDoc, TQueryHelpers, TRawDocType, 'replaceOne'>;
695695

696696
/** Schema the model uses. */
@@ -700,14 +700,14 @@ declare module 'mongoose' {
700700
updateMany<ResultDoc = THydratedDocumentType>(
701701
filter?: FilterQuery<TRawDocType>,
702702
update?: UpdateQuery<TRawDocType> | UpdateWithAggregationPipeline,
703-
options?: (mongodb.UpdateOptions & Omit<MongooseSpecificQueryOptions, 'lean'>) | null
703+
options?: (mongodb.UpdateOptions & Omit<MongooseQueryOptions<TRawDocType>, 'lean'>) | null
704704
): QueryWithHelpers<UpdateWriteOpResult, ResultDoc, TQueryHelpers, TRawDocType, 'updateMany'>;
705705

706706
/** Creates a `updateOne` query: updates the first document that matches `filter` with `update`. */
707707
updateOne<ResultDoc = THydratedDocumentType>(
708708
filter?: FilterQuery<TRawDocType>,
709709
update?: UpdateQuery<TRawDocType> | UpdateWithAggregationPipeline,
710-
options?: (mongodb.UpdateOptions & Omit<MongooseSpecificQueryOptions, 'lean'>) | null
710+
options?: (mongodb.UpdateOptions & Omit<MongooseQueryOptions<TRawDocType>, 'lean'>) | null
711711
): QueryWithHelpers<UpdateWriteOpResult, ResultDoc, TQueryHelpers, TRawDocType, 'updateOne'>;
712712

713713
/** Creates a Query, applies the passed conditions, and returns the Query. */

0 commit comments

Comments
 (0)