Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues when importing plugin in TypeScript (index.d.ts vs plugin.d.ts) #816

Open
sharky98 opened this issue Jun 1, 2023 · 0 comments
Open
Labels

Comments

@sharky98
Copy link

sharky98 commented Jun 1, 2023

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 being ESLint: Unsafe construction of an any type value.(@typescript-eslint/no-unsafe-call)
  • forkTypeCheckingPlugin is shown as being ESLint: Unsafe assignment of an any value.(@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,

  1. Import using import ForkTsCheckerWebpackPlugin from "fork-ts-checker-webpack-plugin";.
  2. 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
@sharky98 sharky98 added the bug label Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant