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:



42 comments
Comment actions Permalink

>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)

0
Comment actions Permalink

Nope.. I spoke to soon. Their back. This is with the bundled version, 3.0.1.


The typescript console complains about pretty much every file that has a decorator in it.

 

It seems to do better with 2.9.2 for some reason?

0
Comment actions Permalink

please provide screenshot of typescript toolwindow with this error.

>This is with the bundled version, 3.0.1.

it's likely not related to the Typescript version; different order of files opening can affect this. For example, let you have a file dir1/foo.ts included in dir1/tsconfig.json that has experimentalDecorators enabled, and file dir2/bar.ts, with dir2/tsconfig.json without this property, where foo.ts imports bar.ts. If you open foo.ts first, its config will be used for bar.ts as well, as any files that are referenced by files included via the "files" or "include" properties are also included in processing. But if you open bar.ts first, you will see the error

0
Comment actions Permalink

This is how the error appears:

 

Is there anyway of turning this message off for good. I'm not sure the line mentioned has anything "experimental" about it. This with the latest version of IntelliJ.

0
Comment actions Permalink

>Is there anyway of turning this message off for good

you can add // @ts-ignore comment above the statement that causes the error. See comments in https://github.com/Microsoft/TypeScript/issues/9448.

>I'm not sure the line mentioned has anything "experimental" about it. 

and what is the result of compiling this same file with tsc in terminal?

0
Comment actions Permalink

Hi Elena, there is nothing in the terminal regarding this when compiled.

0
Comment actions Permalink

what command do you run in terminal when compiling?

Try running `tsc --listFiles --p <path to your tsconfig.json>` - can you see the file in question in the list of files consumed by the compiler?

0
Comment actions Permalink

Hi Elena, this is an angular project so some of this is removed from the command line. In the config in the project I see:

"experimentalDecorators": true,


Also this is a library and not a standard angular project, so that may well have something to do with it.

 

 

0
Comment actions Permalink

Angular performs its own preprocessing, results of webpack build differ from the standard tsc behavior

>Also this is a library and not a standard angular project, so that may well have something to do with it.

I don't have such errors reported for Angular libs.

Can you share a project that can be used to recreate the issue?

0
Comment actions Permalink

Hi Elena, I will see if I can arrange a share.

0
Comment actions Permalink

could be caused by having some other tsconfig.*.json which extends the main tsconfig.json, and it seems Webstorm can't recognize the extended tsconfig.*.json even the "experimentDecarator" flag is set in the main one.

0
Comment actions Permalink

>Webstorm can't recognize the extended tsconfig.*.json 

it should work

Please provide the details about your setup, WebStorm version being used, etc

0

Please sign in to leave a comment.