k0pernikus
k0pernikus

Reputation: 66430

How to resolve "Corresponding file not included in tsconfig.json" error in WebStorm?

I am using highland.js and have installed it with its type definition:

jq .dependencies package.json | grep highland
  "@types/highland": "https://registry.npmjs.org/@types/highland/-/highland-1.14.30.tgz",
  "highland": "^2.9.0",

I am using PhpStorm (which uses the WebStorm component for TypeScript).

When I typehint for:

Highland.Stream<any>

PhpStorm complains about the Stream:

Corresponding file not included in tsconfig.json

Screenshot of the error

Yet the go to declaration works and it jumps to node_modules/@types/highland/index.d.ts:367:

interface Stream<R> extends NodeJS.EventEmitter { ... }

I can compile the code fine with tsc without errors and it's working as expected. What is PhpStorm's / WebStorm's problem?

$ jq . tsconfig.json
{
  "compilerOptions": {
    "module": "commonjs",
    "lib": [
      "es2016",
      "dom"
    ],
    "target": "es6",
    "noImplicitAny": true,
    "sourceMap": true,
    "outDir": "dist",
    "strictNullChecks": true,
    "skipLibCheck": true,
    "types": [
      "node",
      "mocha",
      "chai",
      "sinon"
    ]
  },
  "exclude": [
    "node_modules",
    "src/typings-custom/main.d.ts"
  ]
}

I tried adding highland to types to no avail, and I have no idea what the error is telling me.

Upvotes: 22

Views: 31216

Answers (6)

user19315471
user19315471

Reputation: 600

It might be caused by disabled Typescript language service.

Open Settings | Languages & Frameworks | TypeScript
Enable Typescript language service

Upvotes: 7

Tim Nguyen
Tim Nguyen

Reputation: 71

Updating Webstorm to the latest version fixed this issue for me.

Upvotes: 0

Mark Swardstrom
Mark Swardstrom

Reputation: 18070

I needed to add @types/node

  "devDependencies": {
    "@types/node": "^16.11.19",
    ...

Upvotes: 4

selan
selan

Reputation: 1235

Just go to File > Repair IDE and works as well.

Upvotes: 25

MattR
MattR

Reputation: 159

I had the same issue with Webstorm 2018. I closed and reopened Webstorm and, voilà: the red lines were gone! I just needed to refresh Webstorm I guess. Since Webstorm and PHPStorm are both under the same umbrellas, maybe this will work for you as well.

Upvotes: 14

Related Questions