fork-ts-checker-webpack-plugin giving errors about @types and Mocha
Asked Answered
L

0

9

I'm using ts-loader and fork-fs-checker-webpack-plugin in a project, and it's complaining about node_modules/@types, for example:

ERROR in D:/temp/temp-vscode/temp-electron/application-volume-    change/node_modules/@types/react/index.d.ts
ERROR in D:/temp/temp-vscode/temp-electron/application-volume-change/node_modules/@types/react/index.d.ts(2288,19):
TS2320: Interface 'Element' cannot simultaneously extend types 'ReactElement<any>' and 'ReactElement<any>'.
  Named property 'type' of types 'ReactElement<any>' and 'ReactElement<any>' are not identical.

And also about it, describe, expect, etc. with errors such as:

TS2304: Cannot find name 'describe'.
TS2304: Cannot find name 'expect'.

I have tried to exclude the directories in tsconfig.json:

"exclude": [
  "node_modules",
  "node_modules/@types"
]

And (part of) my webpack.config:

const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
...
rules: [
  {
    test: /\.tsx?$/,
    exclude: /node_modules/,
    use: [
      {
        loader: 'ts-loader',
        options: {
          transpileOnly: true,
          happyPackMode: true,
        },
      },
    ],
  },
]
...
plugins: [
  new ForkTsCheckerWebpackPlugin()
]

Versions:

"webpack": "^4.16.0"
"ts-loader": "^4.4.2"
"fork-ts-checker-webpack-plugin": "^0.4.3"
Lamarckism answered 14/7, 2018 at 13:18 Comment(2)
Having a similar problem. Did you find a solution for this?Decani
I don't think so! The question is more than a one year old, and, honestly, I don't remember the context I asked this question for :(Lamarckism

© 2022 - 2024 — McMap. All rights reserved.