Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

experimentalDecorators Typescript warning always present - Visual Studio 2017 Professional 15.7.4 #25823

Closed
pablonautic opened this issue Jul 20, 2018 · 17 comments

Comments

@pablonautic
Copy link

pablonautic commented Jul 20, 2018

Hi,
I've looked through the discussion at #9335 and seems that other people report the problem as well, though the original thread has been closed recently.

I have this issue (apart from a dozen of other TS errors I haven't been able to solve so far - maybe they are somehow correlated) in my pet project https://github.com/pablonautic/magiczny-miecz - please fill free to clone and build it.

The problem can be observed in \magiczny-miecz\MagicSword.Core\MagicSword.Core.Web\ClientApp\src\app\game\EventBus.ts line 6-7.

@kitsonk
Copy link
Contributor

kitsonk commented Jul 20, 2018

This is not a support forum.

Questions should be asked at StackOverflow or on Gitter.im.

As was repeated multiple times in that issue, your tsconfig.json does not specify files or an include glob that includes the file you are having issues with. Because people repeatedly were looking for basic support, the core team closed the issue.

Why did you ignore the issue template?

@pablonautic
Copy link
Author

pablonautic commented Jul 20, 2018

I am very kindly sorry, this is due to my frustration - I've been struggling for the last 4 hours to get anything working… without bigger successes.

To clarify - my tsconfig.json comes directly from the default ASP.NET Core Angular template, so below provide the proper description:

TypeScript Version: 2.9

Search Terms: experimentalDecorators

Code

Under VS 2017 -> Add new project -> ASP.NET Core 2.1 Web Project -> Angular application.

Add the file below anywhere in the /src folder:

import { Injectable } from "@angular/core";

@Injectable()
export class Foo {

}

Expected behavior:

Projects builds without problems.

Actual behavior:

Error TS1219 (TS) Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning. WebApplicationTest C:\Users\pawel_000\Documents\Visual Studio 2017\Projects\WebApplicationTest\WebApplicationTest\ClientApp\src\app\home\Foo.ts 4 Active

Playground Link:

Related Issues:

#9335

@kitsonk
Copy link
Contributor

kitsonk commented Jul 20, 2018

As was repeated multiple times in that issue, your tsconfig.json does not specify files or an include glob that includes the file you are having issues with. Because people repeatedly were looking for basic support, the core team closed the issue.

@pablonautic
Copy link
Author

pablonautic commented Jul 20, 2018

Doesn't the above imply that the default tsconfig.json should contain such entry? Or maybe it's just the wrong GH repo to report this? Or maybe it' not an issue at all?

P.S. Adding the include section, as described doesn't seem to affect the problem :(

@pablonautic
Copy link
Author

pablonautic commented Jul 24, 2018

Finally, I have figured out the problem.

Turned out that it's a side effect of a "feature" present in Visual Studio 2017: ignoring tsconfig.json when not set to Content.

That's exactly what happens after creating a new project using the ASP.NET Core Angular template - the build action of tsconfig.json defaults to None which causes this one and a dozen of other ts compilation errors (of course, in runtime, there are no problems).

Ergo, changing the action to Content and reloading the solution causes the problem to magically disappear.

@leevi1960
Copy link

Thank You pablonautic, this warning was driving me nuts. A simple change of the build option on tsconfig.json and problem solved !!

@zelwyn
Copy link

zelwyn commented Aug 12, 2018

Wow thanks @pablonautic , only I needed add

<ItemGroup>
    <Content Include="ClientApp\tsconfig.json">
      <CopyToOutputDirectory>Never</CopyToOutputDirectory>
    </Content>
  </ItemGroup>

in my .csproj and problem solved!!!

@tedterrill
Copy link

@pablonautic spent hours trying to figure out what was wrong and scouring SO for help. Seems like such a simple thing for the ASP.NET Core template to miss.

@robertdunaway
Copy link

I've been having the same problem. It's a bug in my opinion

kitsonk - don't be a jerk. Life is hard enough without people like you mistreating others. Be nice!
I'm sure you've been told this "multiple times".

@MintPlayer
Copy link

MintPlayer commented Apr 10, 2019

Is it that hard to have the Build action for tsconfig.json automatically set to Content?

This issue should probably be moved to https://github.com/aspnet/AspNetCore since the solution is changing the default csproj file.

<ItemGroup>
    <Content Include="ClientApp\tsconfig.json" />
</ItemGroup>

I don't mind changing the tsconfig build action for each new project, but it's always a good setting to have a working project template... Kinda looks unprofessional to have a project template in Visual Studio that's not compiling properly

@daiplusplus
Copy link

I'm having the same problem but in a "Folder" instead of a real Project+Solution. Because there's no project file the Properties window is blank and doesn't let me specify a build-action for the tsconfig.json files. I note this problem only started happening recently (perhaps since TypeScript 3.5 shipped?).

@marcelharder
Copy link

Thanks guys, by changing to content these warnings finally went away, after bothering me for weeks

@dbenitez-bcn
Copy link

I uncomment the "experimentalDecorators": true, line inside my tsconfig.json and the warning disappear.

@JoeSwindell
Copy link

This "Feature" is STILL present in the angular template. Set the build action of tsconfig.json to content, reload project and it now works.

@eaguilerai
Copy link

eaguilerai commented Jun 9, 2020

In my case I just needed to set Build Action of tsconfig.json to Content. But I did on the file's Properties window instead of the .njsproj file. Of course, the effects of doing it this way are the same.

@NicoJuicy
Copy link

I've been having this issue for over a month and looked it up regularly. Since Google mostly shows VS Code issues, i didn't find the solution.

Thank you, @pablonautic . Setting it as Content solved the issue.

@info-lvsys
Copy link

4 years later and this is issue is still present in Visual Studio. Thank you @pablonautic - was driving me nuts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests