-
Notifications
You must be signed in to change notification settings - Fork 3
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
Use "target": "es6" in default tsconfig.json, because create-react-app includes polyfills for IE9+ #2
Conversation
…es polyfills for IE9+, so TypeScript should use these ES6 type definitions
Hey @ndbroadbent I don't think this change should be applied to the checker. It should apply to the Remember the checker is written in TypeScript; the change here would just change how the checker js was emitted for use by webpack. i.e. It shouldn't have any bearing on the issue you're facing. |
It's probably worth making this change in the |
Hi @johnnyreilly, ok thanks! I'm trying to think how to do that. What do you think about a new
Then |
Whoops, sorry, I got confused! I had opened this file from react-scripts in the wrong editor window and I thought it belonged to Anyway, sorry to bother you! |
Sorry, forgot to reply! They support the latest stable ES features from |
Probably worth using https://www.typescriptlang.org/docs/handbook/compiler-options.html |
Haha NOOOOOOO someone already fixed this 9 days ago to use "esnext", but they didn't release that change yet. Haha that's so frustrating: facebook/create-react-app#5684 |
Here's the issue I just experienced with
create-react-app
: facebook/create-react-app#5771To summarize: TypeScript was giving me type errors because I wanted to use ES6 functions like
Array.fill
andObject.assign
. I discovered thatcreate-react-app
uses Babel for all of the JS compilation, and they just strip the types. They use this package to do type-checking in a separate process. They also already include polyfills to support IE9+, so it's fine to use the "es6" target in the defaulttsconfig.json
(which tells TypeScript to use ES6 type definitions.)