fork-ts-checker-webpack-plugin
fork-ts-checker-webpack-plugin copied to clipboard
Issues when importing plugin in TypeScript (`index.d.ts` vs `plugin.d.ts`)
Current behavior
I am using TypeScript to write some default configurations. When I import with import ForkTsCheckerWebpackPlugin from "fork-ts-checker-webpack-plugin";
, the line const forkTypeCheckingPlugin = new ForkTsCheckerWebpackPlugin()
is showing me some eslint issues from my IDE (using tsconfig.esm.json
from the gist below).
-
new
is shown as beingESLint: Unsafe construction of an any type value.(@typescript-eslint/no-unsafe-call)
-
forkTypeCheckingPlugin
is shown as beingESLint: Unsafe assignment of an
anyvalue.(@typescript-eslint/no-unsafe-assignment)
When compiling with TSC, I get Module [fork-ts-checker-webpack-plugin] can only be default-imported using the 'esModuleInterop' flag
(using tsconfig.cjs.json
from the gist below).
When I import using import { ForkTsCheckerWebpackPlugin } from "fork-ts-checker-webpack-plugin/lib/plugin.js";
I have no more issues.
Expected behavior
No issues shown either on IDE or tsc
when using the import ForkTsCheckerWebpackPlugin from "fork-ts-checker-webpack-plugin";
import statement when creating TypeScript package, using the most recent versions and configurations (TS 5, module resolution node16, etc.).
⚠ It might be a misconfiguration on my side for the IDE, even though I would prefer to no change any behavioral configuration such as esModuleInterop
or verbatimModuleSyntax
.
Steps to reproduce the issue
Using configuration shown in gist below,
- Import using
import ForkTsCheckerWebpackPlugin from "fork-ts-checker-webpack-plugin";
. - Create instance using
const forkTypeCheckingPlugin = new ForkTsCheckerWebpackPlugin()
.
Issue reproduction repository
https://gist.github.com/sharky98/94ac3a661e2862c5df5108152a00efd4
Environment
- fork-ts-checker-webpack-plugin: ^8.0.0
- typescript: ^5.0.4
- eslint: ^8.41.0
- webpack: ^5.84.0
- os: Windows 10