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 -> C -> D -> A recursive type
233+ type A = {
234+ name : string ;
235+ b : B ;
236+ } ;
237+
238+ type B = {
239+ name : string ;
240+ c : C ;
241+ } ;
242+
243+ type C = {
244+ name : string ;
245+ d : D ;
246+ } ;
247+
248+ type D = {
249+ name : string ;
250+ a : A ;
251+ } ;
252+
253+ expectAssignable < Filter < A > > ( {
254+ 'b.c.d.a.b.c.d.a.b.name' : 'a'
255+ } ) ;
256+
257+ expectNotAssignable < Filter < A > > ( {
258+ 'b.c.d.a.b.c.d.a.b.name' : 2
259+ } ) ;
260+
261+ expectAssignable < Filter < A > > ( {
262+ 'b.c.d.a.b.c.d.a.b.c.name' : 2
263+ } ) ;
264+
265+ // why does this blow up
266+ expectNotAssignable < UpdateFilter < A > > ( {
267+ $set : { 'b.c.d.a.b.c.d.a.b.c.name' : 'a' }
268+ } ) ;
You can’t perform that action at this time.
0 commit comments