Hi,
I've looked through the discussion at https://github.com/Microsoft/TypeScript/issues/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.
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?
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\homeFoo.ts 4 Active
Playground Link:
Related Issues:
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.
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 :(
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.
Thank You pablonautic, this warning was driving me nuts. A simple change of the build option on tsconfig.json and problem solved !!
Wow thanks @pablonautic , only I needed add
<ItemGroup>
<Content Include="ClientApp\tsconfig.json">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content>
</ItemGroup>
in my .csproj and problem solved!!!
@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.
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".
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
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?).
Thanks guys, by changing to content these warnings finally went away, after bothering me for weeks
I uncomment the "experimentalDecorators": true,
line inside my tsconfig.json
and the warning disappear.
This "Feature" is STILL present in the angular template. Set the build action of tsconfig.json to content, reload project and it now works.
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.
Most helpful comment
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 toNone
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.