File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -228,3 +228,41 @@ recursiveSchemaWithArray.findOne({
228228 name : 3
229229 }
230230} ) ;
231+
232+ // Modeling A -> B -> A recursive type
233+ type One = {
234+ name : string ;
235+ two : Two ;
236+ } ;
237+
238+ type Two = {
239+ name : string ;
240+ three : Three ;
241+ } ;
242+
243+ type Three = {
244+ name : string ;
245+ one : One ;
246+ } ;
247+
248+ // Depth 11 does not get type assertion
249+ expectAssignable < Filter < One > > ( {
250+ 'two.three.one.two.three.one.two.three.one.two.name' : 3
251+ } ) ;
252+ // Depth 10 and below does
253+ expectNotAssignable < Filter < One > > ( {
254+ 'two.three.one.two.three.one.two.three.one.name' : 3
255+ } ) ;
256+
257+ // Depth 11 does not get type assertion
258+ expectAssignable < UpdateFilter < One > > ( {
259+ $set : {
260+ 'two.three.one.two.three.one.two.three.one.two.name' : 'a'
261+ }
262+ } ) ;
263+ // Depth 10 and below does
264+ expectNotAssignable < UpdateFilter < One > > ( {
265+ $set : {
266+ 'two.three.one.two.three.one.two.three.one.name' : 3
267+ }
268+ } ) ;
You can’t perform that action at this time.
0 commit comments