Using auto-accessor with readonly
or declare
should raise an error
#51820
Labels
Milestone
readonly
or declare
should raise an error
#51820
Bug Report
π Search Terms
auto accessor readonly declare
π Version & Regression Information
Version 4.9.3
β― Playground Link
Playground link with relevant code
π» Code
π Actual behavior
No TypeScript error is shown, neither for
readonly
nor fordeclare
.readonly
is completely ignored, i.e. writing to the property also does not result in an error.π Expected behavior
In the auto-accessor PR description, it is explicitly stated that
So I'd expect a corresponding TypeScript error message for both accessor declarations in the example above.
Once using
readonly
on an accessor raises an error, it is correct to ignore this for further analysis, so the current behavior to not report an error when trying to write to the property is correct and should remain as-is.The text was updated successfully, but these errors were encountered: