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
classFoo{_foo: number=1getfoo(){returnthis._foo}setfoo(v){this._foo=v}}classBarextendsFoo{foo=123// ERROR, although useDefineForClassFields is false}
π Actual behavior
There is an error
π Expected behavior
There should be no error, because the legacy [[Set]] semantics are in play, and therefore it works as intended: the subclass calls the super class accessor.
I ended up finding that issue, and I left a comment stating my sentiment that the new behavior makes useDefineForClassFields essentially an obsolete option, and that the new behavior is not a good solution because it prevents declaring types for valid JavaScript code rather than expanding our static type abilities.
@RyanCavanaugh The irony is that it seems the motivation for the #37894 was the #34585, filed by the same author as this issue. Also see the updated discussion in the #37894, for example starting from here
Bug Report
π Search Terms
useDefineForClassFields override accessor with instance property (no results really, but related: #33509)
π Version & Regression Information
I'm in 4.1.3
β― Playground Link
playground
π» Code
π Actual behavior
There is an error
π Expected behavior
There should be no error, because the legacy [[Set]] semantics are in play, and therefore it works as intended: the subclass calls the super class accessor.
It should desugar to:
which is very similar to the output that you see in the playground.
Also it doesn't work with
declare
.The text was updated successfully, but these errors were encountered: