-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding a compilerOption to disable error on property override accessor in 4.0.beta #39401
Comments
I agree. Some old version .d.ts files for 3rd-party library may contain unprecise definitions, such as declaring accessors as properties, for example, PIXI.js v4.x:
So extending this class will cause an error:
Since changing all these legacy definition files is a lot of works, a compiler option will be of much help. |
Any updates on this? Or how to circle around the pixijs error? 🤔 |
Having the exact issue here. Stuck below 4.x with no option to update without major overhauls. |
When designing a class, it is impossible for one to know who will extend their class in 10 years and for what reason. Just because you can't think of a reason to extend some functionality today doesn't mean it won't be needed in the unforeseeable future by someone else. This is why in C++ it's good practice to make your attributes private and write Languages like Python and C# tackle this issue with |
I would argue this shouldn't even be considered an error in the first place, the whole point of an accessor is that it's supposed to be indistinguishable from a regular property to external consumers. |
Just ran into this issue, I'm also using a library that defines a property and I would like to override it with an accessor but I cannot. |
Search Terms
property override accessor
Suggestion
Previously in 3.9, property can override an accessor with no emit errors. And in 4.0 beta, a break change was introduced by #33509.
It's reasonable to report an error on property override accessor in most case, but I'm using
experimentalDecorators
to inject a property accessor in prototype.Currently I cannot find a solution for this use case, so I'm suggesting to add a new compilerOption to disable this check(strictOnly?) for compatibility.
Use Cases
Checklist
My suggestion meets these guidelines:
The text was updated successfully, but these errors were encountered: