// @strict: true // Repro from #35655 interface Box { data: T } type BoxTypes = Box<{ x: string }> | Box<{ y: string }>; type BoxFactoryFactory = TBox extends Box ? { (arg: T): BoxFactory | undefined } : never; interface BoxFactory { getBox(): A, } declare const f: BoxFactoryFactory; const b = f({ x: "", y: "" })?.getBox(); if (b) { const x = b.data; }