Closed
Description
var x = function f() { return f; };
var x = function () { var y; return y; };
We get the following error message:
Subsequent variable declarations must have the same type. Variable 'x' must be of type '() => any', but here has type '() => any'.
This is essentially the same as #463. The first declaration of x has type () => typeof f
, but because f is not in the global scope, we say it is any, even though it is clearly not.
We have a similar problem for function declarations (and likely for module instances and class constructors):
function g() {
return function f() {
return f;
};
}
var numberFn = <() => number>(g());
We get the following error on the type assertion:
Neither type '() => number' nor type '() => any' is assignable to the other.
But in fact '() => number' is assignable to '() => any'!