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
classBase{prop: number;baseMethod(){this.prop=4321;}}classDerivedextendsBase{readonlyprop: number=1234;// this could also be an accidental name collisionderivedMethod(){this.baseMethod();}}letx=newDerived();console.log(x.prop);// prints 1234x.derivedMethod();console.log(x.prop);// prints 4321
Expected behavior:
Trying to re-declare prop as readonly in Derived should error:
A writable property cannot be overriden by a readonly property
Actual behavior:
No error, prop can be reassigned in the base class.