Unused @types files installed by node modules pollutes and breaks the main project · Issue #31148 · microsoft/TypeScript (original) (raw)
Even when we don't use it in the main project. For instance, I'm using del
package only in the build script file and it is .js file not .ts file.
https://github.com/falsandtru/pjax-api/blob/master/gulpfile.js
But it polluted and broke the main project:
https://travis-ci.org/falsandtru/pjax-api/jobs/525654172#L512
This is caused by sindresorhus/del@0361dcc.
You shouldn't automatically include unused/unimported @types files installed by node modules in the compile targets because they usually won't be used when they are not imported explicitly (regardless of direct or indirect). Or you should provide a way to exclude unexpected @types files by tsconfig.json to avoid this problem as a temporary workaround.
TypeScript Version: 3.4.0-dev.20190425
Search Terms:
Code
You can reproduce this problem also with https://github.com/falsandtru/spica.
- clone https://github.com/falsandtru/spica
- checkout v0.0.247.
- run
npm i
- run
npm i del@4.1.1
- run
gulp ts:dist
Expected behavior:
pass
Actual behavior:
TypeScript error: src/throttle.ts(7,5): Error TS2322: Type 'Timeout' is not assignable to type 'number'.
TypeScript error: src/throttle.ts(28,5): Error TS2322: Type 'Timeout' is not assignable to type 'number'.
Playground Link:
Related Issues: