66 lines
1.1 KiB
Text
66 lines
1.1 KiB
Text
=== tests/cases/compiler/cyclicGenericTypeInstantiationInference.ts ===
|
|
function foo<T>() {
|
|
>foo : <T>() => { y2: any; }
|
|
>T : T
|
|
|
|
var z = foo<typeof y>();
|
|
>z : { y2: any; }
|
|
>foo<typeof y>() : { y2: any; }
|
|
>foo : <T>() => { y2: any; }
|
|
>y : { y2: any; }
|
|
|
|
var y: {
|
|
>y : { y2: any; }
|
|
|
|
y2: typeof z
|
|
>y2 : { y2: any; }
|
|
>z : { y2: any; }
|
|
|
|
};
|
|
return y;
|
|
>y : { y2: any; }
|
|
}
|
|
|
|
|
|
function bar<T>() {
|
|
>bar : <T>() => { y2: any; }
|
|
>T : T
|
|
|
|
var z = bar<typeof y>();
|
|
>z : { y2: any; }
|
|
>bar<typeof y>() : { y2: any; }
|
|
>bar : <T>() => { y2: any; }
|
|
>y : { y2: any; }
|
|
|
|
var y: {
|
|
>y : { y2: any; }
|
|
|
|
y2: typeof z;
|
|
>y2 : { y2: any; }
|
|
>z : { y2: any; }
|
|
}
|
|
return y;
|
|
>y : { y2: any; }
|
|
}
|
|
|
|
var a = foo<number>();
|
|
>a : { y2: any; }
|
|
>foo<number>() : { y2: any; }
|
|
>foo : <T>() => { y2: any; }
|
|
|
|
var b = bar<number>();
|
|
>b : { y2: any; }
|
|
>bar<number>() : { y2: any; }
|
|
>bar : <T>() => { y2: any; }
|
|
|
|
function test<T>(x: typeof a): void { }
|
|
>test : <T>(x: { y2: any; }) => void
|
|
>T : T
|
|
>x : { y2: any; }
|
|
>a : { y2: any; }
|
|
|
|
test(b);
|
|
>test(b) : void
|
|
>test : <T>(x: { y2: any; }) => void
|
|
>b : { y2: any; }
|
|
|