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
{{ message }}
Repository navigation
strictFunctionTypes option should strictly check callback parameters of override methods #19007
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());
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:
Activity
ahejlsberg commentedon Oct 7, 2017
This is working as intended. As explained here, in
--strictFunctionTypesmode we still check parameters of methods and constructors bivariantly. So, there is no error here:But an error is reported here:
As I explain here, we can't tighten this any further without causing
Array<T>and other core types to become invariant.falsandtru commentedon Oct 7, 2017
I see, thanks for your explanation.