Visual Studio 2015 RC Typescript experimental decorators error
Visual Studio 2015 supports tsconfig files starting with Typescript version 1.8. Create tsconfig.json file at the root of your project and add experimentalDecorators
compiler option.
Example:
{ "compileOnSave": true, "compilerOptions": { "module": "commonjs", "sourceMap": true, "experimentalDecorators": true }}
For older versions:
https://github.com/Microsoft/TypeScript/issues/3934
If you have a project file, tsconfig will not be honored. the project file takes precedence. We are still flushing the integration story between a VS project and a tsconfig as you can specify compiler options in both.
so to disable the error message, right-click on project file, unload project, then right-click edit the project file, At the end of the file there should be a config section, add:
<PropertyGroup Condition="'$(Configuration)' == 'Debug'"> .... <TypeScriptExperimentalDecorators>true</TypeScriptExperimentalDecorators></PropertyGroup>
save and reload.
You may also need TypeScriptEmitDecoratorMetadata to map --emitDecroatorMetadata
Upgrade your IDE to the latest version. Then create tsconfig.json file at the root of your project if you don't already have one. Then add experimentalDecorators
as a compiler option.
Example:
{ "version": "1.5.0", "compilerOptions": { "target": "es5", "module": "commonjs", "declaration": false, "noImplicitAny": false, "removeComments": true, "noLib": false, "emitDecoratorMetadata": true, "sourceMap": true, "listFiles": true, "outDir": "dist", "experimentalDecorators": true }}
In Visual Studio 2015 you have to enable TypeScriptExperimentalDecorators
in your TypeScript project file.
Unload the project file and then add this line:
<TypeScriptExperimentalDecorators>True</TypeScriptExperimentalDecorators>
I copied in the complete PropertyGroup so you can find where to add it:
<PropertyGroup Condition="'$(Configuration)' == 'Debug'"> <TypeScriptRemoveComments>false</TypeScriptRemoveComments> <TypeScriptSourceMap>true</TypeScriptSourceMap> <TypeScriptTarget>ES5</TypeScriptTarget> <TypeScriptJSXEmit>None</TypeScriptJSXEmit> <TypeScriptCompileOnSaveEnabled>True</TypeScriptCompileOnSaveEnabled> <TypeScriptNoImplicitAny>False</TypeScriptNoImplicitAny> <TypeScriptModuleKind>System</TypeScriptModuleKind> <TypeScriptOutFile /> <TypeScriptOutDir /> <TypeScriptGeneratesDeclarations>False</TypeScriptGeneratesDeclarations> <TypeScriptNoEmitOnError>True</TypeScriptNoEmitOnError> <TypeScriptMapRoot /> <TypeScriptSourceRoot /> <TypeScriptExperimentalDecorators>True</TypeScriptExperimentalDecorators></PropertyGroup>