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
Readonly vs. litteral type breaking change? #12148
classA{readonlyn=0;constructor(){this.n=1;// Type '1' is not assignable to type '0'}}classB{constructor(readonlyn=0){}}classCextendsB{constructor(){super(1);// Argument of type '1' is not assignable to parameter of type '0 | undefined'.}}
Expected behavior:
Is this behavior expected (breaking change vs 2.0.8)?
To me this should be valid, particularly the 2nd case.
Activity
falsandtru commentedon Nov 10, 2016
#11409
mhegazy commentedon Nov 14, 2016
All parameter initializes should be widened to their base (e.g. class
B), property initializes (e.g. classA) are intentional breaking change.sandersn commentedon Nov 16, 2016
Fix is up at #12312