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

Ignore errors from libs in node_modules folders #110

Merged

Conversation

BendingBender
Copy link
Collaborator

@BendingBender BendingBender commented May 29, 2021

I've tried a few different things here but it seems that ignoring diagnostics from node_modules folders is a good enough workaround.

An actual solution for this would be support from tsc to allow type-checking project-local .d.ts files while skipping .d.ts files from node_modules. The way things are right now, skipLibCheck will disable type-checking .d.ts files everywhere which we definitely don't want. On the other hand, skipping type-checking for types from node_modules would bring enormous performance improvements, most time is spent by checking types there.

I've also tried to mess a bit with tsc, mostly by monkey-patching stuff. The problem is that it's pretty much impossible to know in advance which .d.ts files are required to correctly type check an application and which ones not. It mostly boils down to .d.ts files exposing stuff in the global scope or declaring modules with different names than the module they belong to. Most other cases should be discoverable by analyzing for imports, <reference ... directives and the like.

Fixes #45
Fixes #76
Fixes #30

@sindresorhus sindresorhus merged commit 3b61da7 into tsdjs:main Jun 1, 2021
@BendingBender BendingBender deleted the ignore-errors-from-node-modules branch June 1, 2021 11:55
gabmontes added a commit to gabmontes/p-do-whilst that referenced this pull request Aug 23, 2024
[email protected] reports errors in files within the node_modules folder. This is a known problem solved in tsdjs/tsd#110 and released in [email protected]. With the new version, all the checks pass.
gabmontes added a commit to gabmontes/p-do-whilst that referenced this pull request Aug 23, 2024
`[email protected]` reports errors in files within the node_modules folder. This is a known problem solved in tsdjs/tsd#110 and released in `[email protected]`. But with that new version, `xo` fails to load `@typescript-eslint/parser`. Using `[email protected]` solves all the errors.
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.

tsd throws errors inside node_modules Ignoring node_modules Module should not venture outside directory
2 participants