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

5

19

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.

Octopod answered 14/12, 2016 at 14:21 Comment(7)
PhpStorm version? TypeScript compiler version?Pompea
@Pompea typescript 2.1, phpstorm2016.2Octopod
please try upgrading to 2016.3.1. TypeScript 2.1 is not supported in 2016.2Pompea
@Pompea Same problem with TypeScript 3.0.3 and PhpStorm 2018.2.2 for ts-jest but I've found that enabling the "TypeScript Language service" in project settings makes the problem go away, although I'm not sure why.Hankins
Phpstorm? I guess you mean WebstormSherburn
@DiWang I mean both. PhpStorm includes the features of WebStorm.Octopod
Not a solution that's fun, but for me I saw I had an update to Intellij and then my same error went awayFossiliferous
M
14

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.

Manzo answered 31/12, 2019 at 21:40 Comment(0)
B
12

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

Benally answered 22/6, 2023 at 7:59 Comment(2)
How have I never seen this 🤯Dearth
What dark magic is this... 🤯 It worked for me 🤷🏻Lynlyncean
C
7

It might be caused by disabled Typescript language service.

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

Charpoy answered 10/3 at 12:14 Comment(2)
I had to update my node interpreter from v18 to v20 and workedYolanthe
I didn't have a node interpreter chosen, but looking at this setting made the problem obvious.Gog
D
4

I needed to add @types/node

  "devDependencies": {
    "@types/node": "^16.11.19",
    ...
Dearth answered 20/7, 2023 at 21:6 Comment(0)
V
0

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

Vesture answered 23/8, 2023 at 14:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.