TypeScript/tests/cases/compiler/typeParameterLeak.ts
Anders Hejlsberg a8944e6844
Fix type parameter leak (#35949)
* Fix cloneSignature to include unionSignatures property

* Add regression test
2020-01-03 07:54:38 -10:00

21 lines
423 B
TypeScript

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