File tree Expand file tree Collapse file tree 1 file changed +21
-9
lines changed Expand file tree Collapse file tree 1 file changed +21
-9
lines changed Original file line number Diff line number Diff line change 1- import { expectAssignable , expectError , expectNotAssignable } from 'tsd' ;
1+ import { expectAssignable , expectError , expectNotAssignable , expectNotType } from 'tsd' ;
22
33import type { Collection , Filter , UpdateFilter } from '../../../../src' ;
44
55/**
66 * mutually recursive types are not supported and will not get type safety
77 */
88interface Author {
9- books : Book [ ] ;
10- favoritePublication : Book ;
119 name : string ;
10+ favoritePublication : Book ;
1211}
1312
1413interface Book {
15- author : Author ;
1614 title : string ;
17- published : Date ;
15+ author : Author ;
1816}
1917
20- declare const mutuallyRecursive : Collection < Author > ;
21- mutuallyRecursive . find ( { } ) ;
22- mutuallyRecursive . find ( {
23- b : { a : { b : { a : null } } }
18+ expectAssignable < Filter < Author > > ( {
19+ favoritePublication : {
20+ title : 'book title' ,
21+ author : {
22+ name : 'author name'
23+ }
24+ }
25+ } ) ;
26+ expectNotType < UpdateFilter < Author > > ( {
27+ $set : {
28+ favoritePublication : {
29+ title : 'a title' ,
30+ published : new Date ( ) ,
31+ author : {
32+ name : 23
33+ }
34+ }
35+ }
2436} ) ;
2537
2638// Extremely deep type checking for recursive schemas
You can’t perform that action at this time.
0 commit comments