Skip to content
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

Set TSConfig Lib Defaults #5684

Closed
Timer opened this issue Nov 2, 2018 · 8 comments
Closed

Set TSConfig Lib Defaults #5684

Timer opened this issue Nov 2, 2018 · 8 comments

Comments

@Timer
Copy link
Contributor

Timer commented Nov 2, 2018

Let's just turn on everything. Something like ['dom', 'dom.iterable', 'esnext']?

@ianschmitz
Copy link
Contributor

As long as that doesn't confuse people about what browser APIs are actually available in their target browsers. You could also set target to es6 and it would infer some reasonable libs for you (but again APIs would probably break in IE11)

@Timer
Copy link
Contributor Author

Timer commented Nov 2, 2018

We keep getting issues of people confused why TypeScript is telling them about valid errors. 😅
I figure if people know about lib and how it works, they'll know to switch it to what they actually want.

That's why I'm OK with an everything-evergreen-on-by-default behavior.

@ianschmitz
Copy link
Contributor

Yeah good call. I actually ran into an obscure error reported because of it yesterday when porting to react-scripts since I was using async / await. It complained about Promise not being available but the formatting was really strange.

@ianschmitz
Copy link
Contributor

May want to double check what's included in esnext lib, because i think it includes stage 0 proposals?

@Timer
Copy link
Contributor Author

Timer commented Nov 2, 2018

Eh, they're just browser APIs I don't think it's a big deal.

@ndbroadbent
Copy link

Thanks for this! It would be really awesome if this could be released in a new create-react-app version, because I just spent a really long time trying to figure out why I was getting type errors with Array.includes, etc. It would have been awesome if my default tsconfig.json had these libs by default. But oh well, it was a great way to learn how it all works.

@wafisher
Copy link

What's the process for including these changes in my project? I just put in my own lib line for now but I'd rather this were created/enforced by verifyTypeScriptSetup.js. Do I just wait for the next CRA release and update?

@JLarky
Copy link

JLarky commented Jan 8, 2019

What's the process for including these changes in my project? I just put in my own lib line for now but I'd rather this were created/enforced by verifyTypeScriptSetup.js. Do I just wait for the next CRA release and update?

I think it will be used as default in case if you don't have tsconfig.json file yet. Putting it manually is the right way of doing it, since you might choose to use different lib value for your project, i.e more restrictive one like ["dom", "es6", "es2017.object"]

@lock lock bot locked and limited conversation to collaborators Jan 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants