Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS2015 RTM Angular2/TypeScript problems

How do I fix the errors being reported by VS2015 below?

I am using VS2015 RTM and I've created a very simple angular 2 web app (as seen on angular.io). When I build the solution, I get the following two errors:

  • error TS1148: Build: Cannot compile modules unless the '--module' flag is provided.

I tried to fix this by using a tsconfig.json but with no joy.

  • error TS1219: Build: Experimental support for decorators is a feature that is subject to change in a future release. Specify '--experimentalDecorators' to remove this warning.

I tried to fix this by adding a TypeScriptExperimentalDecorators element the csproj file and setting it to true, but it didn't remove the error.

Any suggestions?

like image 294
Bonneville Avatar asked Jul 30 '15 20:07

Bonneville


2 Answers

Same issue here. Found this workaround:

  1. Change "Microsoft.TypeScript.Default.props" ("C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\TypeScript) changing/adding the following properties:
<TypeScriptModuleKind>AMD</TypeScriptModuleKind>
<TypeScriptEmitDecoratorMetadata>True</TypeScriptEmitDecoratorMetadata>
<TypeScriptExperimentalDecorators>True</TypeScriptExperimentalDecorators>
  1. Add/change the same properties in project file

Note: The experimental decorators looks to be enabled only if they are enabled in both the files.

like image 63
Rox Avatar answered Sep 27 '22 23:09

Rox


For TS1219 look here: http://dotnetspeak.com/2015/06/angular-2-in-visual-studio-2015-with-typescript

You can set the TypeScriptExperimentalDecorators property to true in the project file.

like image 33
Marc Schluper Avatar answered Sep 28 '22 23:09

Marc Schluper