Skip to content

Commit 616b7ca

Browse files
committed
perf: reduce instantiations by avoiding FilterQuery on non-records in a way that is compatible with #15671
1 parent 66915ea commit 616b7ca

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

types/query.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ declare module 'mongoose' {
1010
* { age: { $gte: 30 } }
1111
* ```
1212
*/
13-
type RootFilterQuery<T> = FilterQuery<T> | Query<any, any> | Types.ObjectId;
13+
type RootFilterQuery<T> = IsItRecordAndNotAny<T> extends true ? FilterQuery<T> | Query<any, any> | Types.ObjectId : FilterQuery<Record<string, any>> | Query<any, any> | Types.ObjectId;
1414

1515
type FilterQuery<T> = ({ [P in keyof T]?: Condition<T[P]>; } & RootQuerySelector<T> & { _id?: Condition<string>; });
1616

0 commit comments

Comments
 (0)