-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Description
Suggestion
π Search Terms
Ignore files directories type checking
β Viability Checklist
My suggestion meets these guidelines:
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
- This feature would agree with the rest of TypeScript's Design Goals.
β Suggestion
Add an option like
nocheck: ["external-files/**"]
for tsconfig.json that effectively works like adding // @ts-nocheck to each and every matching file.
π Motivating Example
"Do you have a problem with types in files by external authors and have no way to solve it? Have you begged and asked for a fix only to be ignored? Now you can add "nocheck" to tsconfig.json and ignore the problems you cannot solve."
π» Use Cases
The skipLibCheck option in tsconfig.json allows us to deal with problems in types in dependencies by not performing checks on those files. In our case (Vaadin) we also get dependencies from other locations (Java jar files) and they will not end up in node_modules because other tools like Vite assume that dependencies inside node_modules will not change and thus will not hot deploy changes from there. So the files get put in another folder, let's say external-files/**.
We however have the same problem that skipLibCheck to my understanding tries to solve: Sometimes the TS author either just writes incorrect TS that still works or she is using less strict options in tsconfig.json (e.g. other author uses noUnusedLocals": false and project uses noUnusedLocals": true). This leads to problems when including the TS files in another project and compiling that: the project won't compile even though it would work perfectly well.