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:



1
42 comments

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

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

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

>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

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

0

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

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

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

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

0

Hi Elena, I have generated a project from a v7 NG CLI. After adding some new components, I cannot get the error message. I have a feeling it's some old NG cli set-up or package that is causing this problem. If I do track it down I'll post the answer here. cheers.

1

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

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