Closed
Description
TypeScript Version: nightly 2.1.0-dev.20160918
Code
// @noImplicitAny: true
class M {
constructor(fn: () => any) { }
}
const a = new M(() => a); // ERROR: 'a' implicitly has type 'any'...
Expected behavior:
No errors. Inferred type of a
is M
.
The expression new M(...)
always has type M
, it does not depend on the argument used in M
's constructor.
Actual behavior:
Compiler error as shown in code comment.