Closed
Description
function foo<T>() {
var z = foo<typeof y>();
var y: {
y2: typeof z
};
return y;
}
function bar<T>() {
var z = bar<typeof y>();
var y: {
y2: typeof z;
}
return y;
}
var a = foo<number>();
var b = bar<number>();
a = b;
Because the type parameter T is in scope when we encounter the anonymous type for y
, a new type is created for the type of y
. But each time foo/bar is called, yet a different type for y
is created inside that call!
@ahejlsberg and I are leaning towards a solution that classifies such anonymous types (with type parameters in scope) as References, and give them targets. That way, isDeeplyNestedGeneric will bottom out and detect recursion.
We may need a similar mechanism in the display writer.