We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
"readonly", "iife"
No response
class Foo { readonly bar: string = ""; constructor() { (() => { this.bar = "test"; })(); } }
Fails with Cannot assign to 'bar' because it is a read-only property. error
Cannot assign to 'bar' because it is a read-only property.
Should work in exactly same way as:
class Foo { readonly bar: string = ""; constructor() { this.bar = "test"; } }
I assume that's expected for some reason, and I'd love to learn what are the logical grounds for that
The text was updated successfully, but these errors were encountered:
Essentially another duplicate of #9998. #58729 would likely fix this. This was nonsense, as pointed out by jcalz.
Sorry, something went wrong.
@MartinJohns arenβt IIFEs already inlined for CFA? Iβm guessing initialization of readonly fields must be handled separately.
readonly
(Also, I don't see how #58729 would help; at the very least, merely running that same code in a TS with some version of that PR in it doesn't seem to change anything. Not sure where adding immediate/deferred would make sense there either.)
immediate
deferred
You're right, my mistake. I swear I saw this issue before, but can't find it. :-/
Successfully merging a pull request may close this issue.
π Search Terms
"readonly", "iife"
π Version & Regression Information
β― Playground Link
No response
π» Code
π Actual behavior
Fails with
Cannot assign to 'bar' because it is a read-only property.
errorπ Expected behavior
Should work in exactly same way as:
Additional information about the issue
I assume that's expected for some reason, and I'd love to learn what are the logical grounds for that
The text was updated successfully, but these errors were encountered: