When using the checkJs/allowJs TS compiler options and compiling via ts-loader, I am getting extraneous compile errors (as compared to running tsc standalone).
I have created a small test case here where you can try this for yourself, with the simplest possible reproduction case: https://github.com/OliverJAsh/ts-loader-check-js
Run tsc and you will get one compile error, but run webpack and you will get many more—all from within node_modules.
Example
If I only enable allowJs. Here we have extraneous errors from TS declaration files within node_modules:
ERROR in /Users/OliverJAsh/Development/temp/ts-loader-check-js/node_modules/@types/react-redux/index.d.ts
(14,23): error TS2694: Namespace '"/Users/OliverJAsh/Development/temp/ts-loader-check-js/node_modules/redux/es/index"' has no exported member 'Store'.
ERROR in /Users/OliverJAsh/Development/temp/ts-loader-check-js/node_modules/@types/react-redux/index.d.ts
(15,26): error TS2694: Namespace '"/Users/OliverJAsh/Development/temp/ts-loader-check-js/node_modules/redux/es/index"' has no exported member 'Dispatch'.
…
If I enable both allowJs and checkJs. Here we have extraneous errors from JS files within node_modules:
ERROR in /Users/OliverJAsh/Development/temp/ts-loader-check-js/node_modules/redux/es/applyMiddleware.js
(1,23): error TS2339: Property 'assign' does not exist on type 'ObjectConstructor'.
ERROR in /Users/OliverJAsh/Development/temp/ts-loader-check-js/node_modules/redux/es/combineReducers.js
(75,9): error TS2304: Cannot find name 'process'.
…
If I run tsc --noEmit. This error is expected and not extraneous, unlike others.
tsc
node_modules/@types/react-redux/index.d.ts(179,31): error TS2314: Generic type 'Component<P, S>' requires 2 type argument(s).
When using the
checkJs/allowJsTS compiler options and compiling viats-loader, I am getting extraneous compile errors (as compared to runningtscstandalone).I have created a small test case here where you can try this for yourself, with the simplest possible reproduction case: https://github.com/OliverJAsh/ts-loader-check-js
Run
tscand you will get one compile error, but runwebpackand you will get many more—all from withinnode_modules.Example
If I only enable
allowJs. Here we have extraneous errors from TS declaration files withinnode_modules:If I enable both
allowJsandcheckJs. Here we have extraneous errors from JS files withinnode_modules:If I run
tsc --noEmit. This error is expected and not extraneous, unlike others.