Incorrect TS1219 warning
-- Temporary Fix. Shutdown Webstorm and deleted the .idea folders and it realised that the files it thought were broken weren't. Unfortunately new files are getting the warning until I repeat this. it's a massive pain in the a**e.
I'm having a minor annoyance with the latest version of webstorm, it's got a liberal smattering of TS1219 errors on my Angular 2 project targeting @Component() @Input() etc, but not in all files.
It compiles fine as I have the experimentalDecorators set to true, but it's annoying to have red splattered all over the place.
This one is fine:
This one isn't:
请先登录再写评论。
Do you mean that you get TS1219 errors despite having experimentalDecorators enabled in your tsconfig.json? What does your config look like? How many tsconfig.json files do you have in your project?
Also, please can you provide full output from TypeScript tool window, Errors tab, shown for the file that is red-highlighted? What IDE version do you work with?
I don't get the errors in compile, just in the IDE, lots of files are marked as having errors, and lots of lines are underlined in red. It gets in the way of spotting real errors.
I have 2 and they look like:
Where are these files located? What TypeScript version is chosen in Preferences | Languages & Frameworks | TypeScript?
Output from Error tab would still be appreciated
The files are located in, or a subfolder of a folder called app, which is located directly below the root.
Where do I find the error tab?
In TypeScript tool window
Ok this is what's showing up:
So, WebStorm has failed to find a tsconfig.json your file belongs to. What TypeScript version is chosen in Preferences | Languages & Frameworks | TypeScript? Do you have any symlinks/junctions in your project?
Typescript version is 2.2.2, there are no symlinks or junctions in the project.
Try using the bundled TypeScript instead - does the problem persist?
The issue goes away using the bundled version of typescript
I see. So it seems that the service support in 2016.3 is not compatible with TypeScript 2.2.2. Please try upgrading to 2017.1.2
I have the same issue with intelliJ 2017.2.1. I use the bundled version (2.4.1) and still get this annoying warning.
What warning, sorry? Is it about 'cannot find parent tsconfig.json' message? This warning indicates that file your are currently editing is not included in any tsconfig.json file
No. I am talking about the experimentalDecorators warning coloring the code in red even though it is enabled.
Most probably it's still the same issue - your current .ts file is not included in any tsconfig.json file, thus the default preferences are used for transpiling
I get this error ('cannot find parent tsconfig.json') just by using 2017.3 beta
If I run 2017.2.4 - no issue
Please provide a project that shows up the issue. Also, what TypeScript version is chosen in Settings | Languages & Frameworks | TypeScript?
I'm having this issue as well, Settings | Languages & Frameworks | TypeScript shows: "2.6.2 (node_modules)"
I'm running IntelliJ Ultimate, 2017.2
My tsconfig.json looks like:
And tslint.json:
Removing the `.idea.` folder and re-opening the project fixes it for a while, but the problem comes back, not sure what triggers it to return yet.
Ah, I just understood what you meant - apparently IntelliJ doesn't handle "include" in tsconfig.json the same as typescript does?
Adding an "include" section to tsconfig.json fixed the issue:
People will keep having this problem though, since not specifying "include" at all seems to common in several of the popular react+typescript boilerplate projects.
I got this tsconfig.json from https://github.com/mobxjs/mobx-react-typescript-boilerplate/blob/master/tsconfig.json
>apparently IntelliJ doesn't handle "include" in tsconfig.json the same as typescript does?
Not sure where this conclusion come from... IDEA handles it EXACTLY in the same way as the tsc compiler; moreover, it uses the typescript tsserver service for this, it's not the own IDE functionality. No "include" is required - everything that is not excluded is included
>Settings | Languages & Frameworks | TypeScript shows: "2.6.2 (node_modules)"
that's the issue - tsserver integration doesn't work with TypeScript 2.6 due to breaking API changes, it's fixed in 2017.3. You have to either upgrade IDEA or change the TypeScript version to the bundled one
Btw I'm experiencing same sort of issues (Tsconfig not found or it is not taken into account properly) with 2017.3, ts 2.6.2, but issues disappear if using bundles 2.6.1 version
I have a similar issue for a different error code, but don't know how to solve it. In my case the error is TS2551, it appears in each file and I am using Intellij. The error marks go away, as soon as I close the file and relaunch Intellij. After opening the ts-file again, error messages appear again. Any idea what I could do?
@Chris, could you please provide more details on your issue:
1) full output of Errors tab of TypeScript tool window,
2) tsconfig.json and its location,
3) version of TS selected in TS settings (Settings (Preferences) | Languages & Frameworks | TypeScript),
4) IDE version
Dear Oksana,
1) just realized there are actually two different errors:
2) sorry, I am not sure what you mean by tsconsig json? I am contributing to a project that had been set up already and never dealt with typescript before...
3) Bundled 2.8.1
4) Intellij Idea Ultimate (2018.1.5)
1) please provide a screenshot of the complete output of TS Errors tab.
2) it's a TypeScript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html
WebStorm 2018.1.4 still experiencing the same issue.
tsconfig.json :
{
"compilerOptions": {
"target": "es5",
"module": "es2015",
"noImplicitAny": true,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"declaration": false,
"sourceMap": true,
"noUnusedParameters": true,
"skipLibCheck": true,
"lib": [
"dom",
"dom.iterable",
"es7",
"scripthost",
"es2017"
],
"types": [
"node",
"jasmine",
"cordova-plugin-network-information",
"jest"
],
"baseUrl": ".",
"paths": {
"@mocks/*": ["src/common/core/mocks/*"],
"@common/*": ["src/common/*"]
}
},
"include": [
"src/**/*"
],
"exclude": [
"node_modules",
"coverage",
"resources",
"plugins",
"platforms",
"www"
],
"compileOnSave": false,
"atom": {
"rewriteTsconfig": false
},
"awesomeTypescriptLoaderOptions": {
"forkChecker": true,
"useWebpackText": true,
"useCache": true
}
}
Passing --tsConfigFile tsconfig.json to options fixes the issue.
I am also seeing the experimentalDecorators error in Intellij 2018.2.1. Adding --tsConfigFile tsconfig.json to options did not work for me. I have tried the bundled typescript version and or Angular Cli typescript version. Both have the same issue. This use to all work without issues in early versions of 2017. Now it has been rather flaky.
TSCONFIG.JSON
>Adding --tsConfigFile tsconfig.json to options did not work for me
options specified in this field are only respected if the project doesn't have any tsconfig.*.json files
>I am also seeing the experimentalDecorators error in Intellij 2018.2.1.
what file(s) is it shown for? Please provide a screenshot of Typescript tool window with the error
Please make sure that tsconfig.*.json file this file is included in has "experimentalDecorators" enabled. Note that tsconfig.app.json, tsconfig.spec.json, etc. are also considered (they were not respected in 2017.x)
> options specified in this field are only respected if the project doesn't have any tsconfig.*.json files
Thanks for informing about the options. I did not know that.
> what file(s) is it shown for? Please provide a screenshot of Typescript tool window with the error
Since commenting I tried a couple other things. I changed back to the bundled version and created a custom scope which points at my .ts locations. So far the warning has not came back. I am not sure what made the difference. If it was the change to use the bundled version (maybe needed some time to reindex everything? ) or if it was changing my project scope? If it comes back I will try to add some more details to this thread.