Closed
Description
As @aluanhaddad mentioned at #19004 (comment).
cc @ahejlsberg
TypeScript Version: master
Code
class C {
a(f: (a: C) => C): void {
}
}
class D extends C {
p: boolean = true;
a(f: (a: D) => D): void { // should throw an error here.
console.log(this.p);
this.p = f(new D()).p; // type is boolean, but value is undefined.
console.log(this.p);
}
}
const c: C = new D();
c.a(() => new C());
Expected behavior:
error
Actual behavior:
$ node built/local/tsc.js index.ts --strictFunctionTypes && node index.js
true
undefined