-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
jsconfig.json not respecting the exclude directory. #42797
Comments
Imported files are always included, and I would guess that you indirectly import the url module via React. You can try running the CLI with the |
Here's the initial output from
|
In 4.2+ you can also run |
This issue has been marked as 'Question' and has seen no recent activity. It has been automatically closed for house-keeping purposes. If you're still waiting on a response, questions are usually better suited to stackoverflow. |
I've run with
And this is the output when pointing to a
|
Please don't allow bots to auto-close an in-progress ticket. |
I started with jsconfig.json, but I stumbled upon a know issue [1] where tsc would throw typing errors from node_modules. I could work this around by adding @types/xml2js, which worked, but made no sense outside of the context of this tsc issue, so I opted for switching to tsconfig.json. [1]: microsoft/TypeScript#42797
This issue is closed but is still happening, even when the project has only a jsconfig.json file. I've refiled in #50862. |
This is a first result when searching, the solution is this:
Downside is that type inference doesn't work as well if you chuck that to jsconfig.json It's explained in the #50862 better, but solution is simply: add property to jsconfig.json {
"compilerOptions": {
"checkJs": true,
"strict": true,
"module": "CommonJS",
"resolveJsonModule": true,
"maxNodeModuleJsDepth": 0 // <--- ADD THIS
}, Another solution is to call typechecking your project files like this: tsc -p jsconfig.json --maxNodeModuleJsDepth 0 This way you can have |
Bug Report
🔎 Search Terms
jsconfig.json exclude
jsconfig.json node_modules
🕗 Version & Regression Information
tested typescript versions 4.0.0, 4.1.5, 4.3.0-dev.20210214
💻 Code
There's a sample repo here https://github.com/roebuk/jsconfig-issue
Clone, install dependencies, then run the two different npm scripts:
🙁 Actual behavior
Running
tsc -p jsconfig.json
should respect the"exclude": ["node_modules"]
settings and not report errors withinnode_modules
.🙂 Expected behavior
It should not report errors within node_modules, just like the running
tsc -p tsconfig.json
The text was updated successfully, but these errors were encountered: