Closed
Description
Current behavior
ERROR in /.../node_modules/fork-ts-checker-webpack-plugin/lib/hooks.d.ts(1,26):
TS7016: Could not find a declaration file for module 'webpack'. '/.../node_modules/webpack/lib/webpack.js' implicitly has an 'any' type.
Try `npm install @types/webpack` if it exists or add a new declaration (.d.ts) file containing `declare module 'webpack';`
ERROR in /.../node_modules/fork-ts-checker-webpack-plugin/lib/hooks.d.ts(2,43):
TS7016: Could not find a declaration file for module 'tapable'. '/.../node_modules/tapable/lib/index.js' implicitly has an 'any' type.
Try `npm install @types/tapable` if it exists or add a new declaration (.d.ts) file containing `declare module 'tapable';`
Version: typescript 3.6.3
Time: 5433ms
Expected behavior
No errors by default, or a peerDependencies
warning fired off, or a disclaimer in setup section of the README.
Steps to reproduce the issue
Not really sure, I just updated fork-ts-checker-webpack-plugin
to 1.5.0
from 0.5.2
and the error popped up.
The error doesn't show up in 1.3.1
because of the typings dependencies being added, then removed again in 1.3.2
.
The problematic declaration seems to be into lib/hooks.d.ts
, where webpack
and tapable
are types are imported.
import * as webpack from 'webpack';
import { AsyncSeriesHook, SyncHook } from 'tapable';
export declare type ForkTsCheckerHooks = 'serviceBeforeStart' | 'cancel' | 'serviceStartError' | 'waiting' | 'serviceStart' | 'receive' | 'serviceOutOfMemory' | 'emit' | 'done';
declare type ForkTsCheckerLegacyHookMap = Record<ForkTsCheckerHooks, string>;
export declare const legacyHookMap: ForkTsCheckerLegacyHookMap;
export declare function getForkTsCheckerWebpackPluginHooks(compiler: webpack.Compiler): Record<ForkTsCheckerHooks, SyncHook<any, any, any> | AsyncSeriesHook<any, any, any>>;
export {};
Manually adding the dependencies fix the errors.
Related:
- Could not find a declaration file for module 'webpack' #192
- fix: add @types dependencies for tapable + webpack #281
Environment
- fork-ts-checker-webpack-plugin: 1.5.0
- typescript: 3.6.3
- tslint: N/A
- eslint: 5.10.0
- webpack: 4.41.0
- os: Ubuntu 18.04.3 LTS