-
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
Enable "useDefineForClassFields" in tsc --init #39311
Comments
I think this is a good idea. @ahejlsberg @DanielRosenwasser thoughts? |
Three concerns we should discuss:
We have existing features with non-compliant emit, iteration for example, and errors to prevent the non-compliance from being observed, so there's precedence for prioritising good emit over standards compliance. If we had multiple |
I added it to the recommended tsconfig base: tsconfig/bases#15 |
From discussion in the design meeting: We decided not to do this until Currently the default target is ES5, which we need to rethink -- in my opinion, ES2015 at least should be the default. |
Search Terms
useDefineForClassFields, tsc --init, tsconfig
Suggestion
tsc --init
's generatedtsconfig.json
should include"useDefineForClassFields": true
Use Cases
All major web and non-web engines now ship Define-style semantics.
So the safest approach is to ensure new TypeScript projects use standard web-compatible behavior.
Examples
It looks like we just need to add one line here. I am happy to send a PR.
Checklist
My suggestion meets these guidelines:
The text was updated successfully, but these errors were encountered: