Enabling Decorators Support in TypeScript 1.5, Visual Studio 2015

Finally installed VS2015, I got the following error in my TypeScript project:

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

Ok. So, how exactly do you do this if you're not the one invoking the TSC compile action? Visual Studio TypeScript plugin is invoking the compiler option. Hmm. tsconfig.json compiler config doens't seem to be picked up by the TypeScript plug-in.

To enable decorator support, unload your TypeScript project. Right click, Edit Project .csproj. Find the TypeScript compiler option section and add the following (Line 14 and 15):

Code Snippet
  1. <PropertyGroup Condition="'$(Configuration)' == 'Debug'">
  2.   <TypeScriptModuleKind>amd</TypeScriptModuleKind>
  3.   <TypeScriptCompileOnSaveEnabled>True</TypeScriptCompileOnSaveEnabled>
  4.   <TypeScriptTarget>ES5</TypeScriptTarget>
  5.   <TypeScriptNoImplicitAny>False</TypeScriptNoImplicitAny>
  6.   <TypeScriptRemoveComments>False</TypeScriptRemoveComments>
  7.   <TypeScriptOutFile />
  8.   <TypeScriptOutDir />
  9.   <TypeScriptGeneratesDeclarations>False</TypeScriptGeneratesDeclarations>
  10.   <TypeScriptNoEmitOnError>True</TypeScriptNoEmitOnError>
  11.   <TypeScriptSourceMap>True</TypeScriptSourceMap>
  12.   <TypeScriptMapRoot />
  13.   <TypeScriptSourceRoot />
  14.   <TypeScriptEmitDecoratorMetadata>True</TypeScriptEmitDecoratorMetadata>
  15.   <TypeScriptExperimentalDecorators>True</TypeScriptExperimentalDecorators>
  16. </PropertyGroup>

Also, seems like the TypeScript 1.5 RTM plugin will respect the decorator compile options when you use SAVE-ON-COMPILE. :)

Hope that helps,
Brian Chavez

2 Comments Filed Under [ ASP.NET ]

Comments

# re: Enabling Decorators Support in TypeScript 1.5, Visual Studio 2015
Gravatar The full set of options and how they related to tsc.exe command-line switches can be found here:

github.com/...
Left by WisdomGuidedByExperience on 8/2/2015 6:20 PM
# re: Enabling Decorators Support in TypeScript 1.5, Visual Studio 2015
Gravatar Didn't realize that the tsconfig.json was not recognized by Visual Studio. Your solution worked for me. Thanks.
Left by Greg Gum on 8/22/2015 8:21 PM

Leave Your Comment

Title*
Name*
Email (never displayed)
 (will show your gravatar)
Url
Comment*

Please add 5 and 4 and type the answer here:

Preview Your Comment.