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

Update README for optional TS type checking #2548

Merged
merged 1 commit into from May 1, 2020
Merged

Update README for optional TS type checking #2548

merged 1 commit into from May 1, 2020

Conversation

hueter
Copy link
Contributor

@hueter hueter commented Apr 21, 2020

closes #2547

@gauravtiwari gauravtiwari merged commit 260295a into rails:master May 1, 2020
@aried3r
Copy link
Contributor

aried3r commented May 4, 2020

Hey @hueter, thanks for the guide! I was wondering, I switched to the lastest webpacker and followed your guide, however I was facing a lot of type errors.

I found TypeStrong/fork-ts-checker-webpack-plugin#128 and added "skipLibCheck": true to tsconfig.js. Did you also have to do that in your setup? It seems that this is true in ts-loader.

Maybe we should add it to the guide as well, WDYT?

@hueter
Copy link
Contributor Author

hueter commented May 4, 2020

hi @aried3r no problem, glad it was useful!

Full context (forgive me if you know all this already, feel free to skip this part 😉 ): the skipLibCheck is actually just a TypeScript compiler setting that varies per project -- I don't have it enabled on mine. It checks that the npm packages from node_modules that you're importing don't have type errors, which can usually be avoided by:

  • installing the DefinitelyTyped (@types/packagename)
  • in some cases by manually adding type declarations
  • in rare cases by downgrading/upgrading packages if they have type errors in certain releases (currently I get type errors from GraphQL 15 so I haven't upgraded that from 14.6 for instance).

Interesting that skipLibCheck was enabled in ts-loader settings previously; I'm not sure why they did that. But in regards to your question, I think it's a personal preference like the other TS configs like strict: true, etc. My PR was just concerned with adding the ability to do type checking at all with the new setup, not necessarily to prescribe what should be type checked. That being said, you do have a point that it was the rule before, so it might be helpful context to note in the "migrating" section of the docs if you want to add it! 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How to do TypeScript type checking in 5.1+?
3 participants