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"]
}
Please sign in to leave a comment.
Yep, everything works ok now. Thanks
Did you try adding both
tsconfig.src.json
andtsconfig.webpack.json
to the Settings | Editor | File Types | TypeScript Config file type patterns list? The built-in compiler service uses the nearesttsconfig.*.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.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.
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 oftsconfig.json
. However, after removingtsconfig.base.json
from the configuration, everything seems to be fine.Thank you very much.
My bad, i was in “Typescript”, not in "Typescript Config". After removing base, everything works ok now.
Something relating to this in Webstorm 2024.1.5 seems to have broken our codebase.
We rely on tsconfig.json precedence so that:
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.
Please could you check if updating to 2024.2 Beta makes things any better for you?
The related issue in 2024.2.0.1 version
Not working Typescript error handling
Barotov Asadbek do you have a sample project you can share that reproduces the issue?
I am already downgrade my webstorm to work correctly with TS, but i will try to share any sample project