File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -496,7 +496,7 @@ export type NestedPaths<Type> = Type extends
496496 | { _bsontype : string }
497497 ? [ ]
498498 : Type extends ReadonlyArray < infer ArrayType >
499- ? [ number , ...NestedPaths < ArrayType > ]
499+ ? [ ] | [ number , ...NestedPaths < ArrayType > ]
500500 : Type extends Map < string , any >
501501 ? [ string ]
502502 : // eslint-disable-next-line @typescript-eslint/ban-types
Original file line number Diff line number Diff line change @@ -204,6 +204,14 @@ expectNotType<Filter<PetModel>>({ 'playmates.0.name': 123 });
204204expectNotType < Filter < PetModel > > ( { 'laps.foo' : 'string' } ) ;
205205expectNotType < Filter < PetModel > > ( { 'treats.0' : 123 } ) ;
206206
207+ /// it should not accept wrong types for nested document array fields
208+ expectError < Filter < PetModel > > ( {
209+ treats : {
210+ $elemMatch : true
211+ }
212+ } ) ;
213+ expectError < Filter < PetModel > > ( { treats : 123 } ) ;
214+
207215// Nested arrays aren't checked
208216expectNotType < Filter < PetModel > > ( { 'meta.deep.nestedArray.0' : 'not a number' } ) ;
209217
You can’t perform that action at this time.
0 commit comments