You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
classC{a(f: (a: C)=>C): void{}}classDextendsC{p: boolean=true;a(f: (a: D)=>D): void{// should throw an error here.console.log(this.p);this.p=f(newD()).p;// type is boolean, but value is undefined.console.log(this.p);}}constc: C=newD();c.a(()=>newC());
The text was updated successfully, but these errors were encountered:
falsandtru
changed the title
strictFunctionTypes option doesn't strictly check callbacks
strictFunctionTypes option should strictly check callback parameters of override methods
Oct 7, 2017
This is working as intended. As explained here, in --strictFunctionTypes mode we still check parameters of methods and constructors bivariantly. So, there is no error here:
As @aluanhaddad mentioned at #19004 (comment).
cc @ahejlsberg
TypeScript Version: master
Code
Expected behavior:
error
Actual behavior:
The text was updated successfully, but these errors were encountered: