Incorrect typescript handling after upgrade to Webstorm 2024.1.5

After upgrading from `2024.1.3` to `2024.1.5`, all ours tsx files wrongly interpret `tsconfig.json` (or not find it at all?) and show errors in IDE.

In version `2024.1.3` everything works fine.

- `TS17004: Cannot use JSX unless the --jsx flag is provided.`

- `TS2705: An async function or method in ES5/ES3 requires the Promise constructor. Make sure you have a declaration for the Promise constructor or include ES2015 in your --lib option.`

Maybe it's references issue?

 

Our `tsconfig.json` file:
 

{
  "files": [],
  "references": [{ "path": "./tsconfig.src.json" }, { "path": "./tsconfig.webpack.json" }]
}

// tsconfig.src.json

{
  "compilerOptions": {
    "baseUrl": "./src/js",
    "exactOptionalPropertyTypes": false,
    "experimentalDecorators": true,
    "jsx": "react",
    "lib": ["dom", "es2023", "esnext"],
    "module": "es6",
    "moduleResolution": "node",
    "skipLibCheck": true
  },
  "extends": ["@tsconfig/node20", "./tsconfig.base"],
  "include": ["./src/js", "./types"]
}

// tsconfig.base.json

{
  "compilerOptions": {
    "allowJs": true,
    "checkJs": false,
    "noEmit": true,
    "noErrorTruncation": true,
    "noImplicitReturns": false,
    "resolveJsonModule": true,
    "skipDefaultLibCheck": true,
    "skipLibCheck": false,
    "types": []
  },
  "extends": ["./node_modules/@tsconfig/strictest/tsconfig.json"]
}

2
12 comments

Yep, everything works ok now. Thanks

1

Did you try adding both tsconfig.src.json and tsconfig.webpack.json to the Settings | Editor | File Types | TypeScript Config file type patterns list? The built-in compiler service uses the nearest tsconfig.*.json file the current *.ts file is included in, traversing the folders tree up to the project root. tsconfig.*.json here is a file with a name matching one of the patterns configured in Settings | Editor | File Types | TypeScript Config file type.

0

EDIT:

My bad, i was in “Typescript”, not in "Typescript Config". After removing base, everything works ok now. 

 

Than you

------

 

Hi Elena,

thank you for the fast response.

Unfortunately your suggestion doest not help, same error.

 

All ours tsconfig files are in project root folder and no other (even nested) config files are used.

 

0

Hello Elena,

Thank you for your suggestion. It was not about adding something to it but rather about removing tsconfig.base.json.

In my opinion, WebStorm took tsconfig.base.json as the root TS config instead of tsconfig.json. However, after removing tsconfig.base.json from the configuration, everything seems to be fine.

Thank you very much.

0

My bad, i was in “Typescript”, not in "Typescript Config". After removing base, everything works ok now. 

0
Fine, glad to hear it works for you now!
0

Something relating to this in Webstorm 2024.1.5 seems to have broken our codebase.

We rely on tsconfig.json precedence so that:

  • Webstorm finds the nearest tsconfig.json, which in turn uses relative path resolution so that we resolve against the source of our various libraries
  • We use tsconfig.lib.json for producing artifacts during our build process
  • We use tsconfig.spec.json for our tests

It seems that this release of Webstorm has introduced some kind of feature relating to recognition of tsconfig.json. But - there does not seem to be any ordering or precedence. So, if we have more than one match, which one is the one that gets used?

Our work-around in the short term is to make sure that the Webstorm configuration does not include tsconfig.lib.json or tsconfig.spec.json - but, I am not sure what else that might break.

0

 Please could you check if updating to 2024.2 Beta makes things any better for you?

0

The related issue in 2024.2.0.1 version 
Not working Typescript error handling

0

Barotov Asadbek do you have a sample project you can share that reproduces the issue?

0

I am already downgrade my webstorm to work correctly with TS, but i will try to share any sample project

0
Thank you, looking forward to it!
0

Please sign in to leave a comment.