File tree Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -111,12 +111,14 @@ export class AggregationCursor<TSchema = any> extends AbstractCursor<TSchema> {
111
111
explain =
112
112
typeof verbosity !== 'object'
113
113
? verbosity
114
- : 'timeoutMS' in verbosity
115
- ? undefined
116
- : ( verbosity as ExplainCommandOptions ) ;
114
+ : 'verbosity' in verbosity
115
+ ? verbosity
116
+ : undefined ;
117
+
117
118
timeout = typeof verbosity === 'object' && 'timeoutMS' in verbosity ? verbosity : undefined ;
118
119
} else {
119
- explain = verbosity as ExplainCommandOptions ;
120
+ // @ts -expect-error TS isn't smart enough to determine that if both options are provided, the first is explain options
121
+ explain = verbosity ;
120
122
timeout = options ;
121
123
}
122
124
Original file line number Diff line number Diff line change @@ -168,12 +168,13 @@ export class FindCursor<TSchema = any> extends AbstractCursor<TSchema> {
168
168
explain =
169
169
typeof verbosity !== 'object'
170
170
? verbosity
171
- : 'timeoutMS ' in verbosity
172
- ? undefined
173
- : ( verbosity as ExplainCommandOptions ) ;
171
+ : 'verbosity ' in verbosity
172
+ ? verbosity
173
+ : undefined ;
174
174
timeout = typeof verbosity === 'object' && 'timeoutMS' in verbosity ? verbosity : undefined ;
175
175
} else {
176
- explain = verbosity as ExplainCommandOptions ;
176
+ // @ts -expect-error TS isn't smart enough to determine that if both options are provided, the first is explain options
177
+ explain = verbosity ;
177
178
timeout = options ;
178
179
}
179
180
You can’t perform that action at this time.
0 commit comments