TypeScriptExperimentalDecorators=true not working in VS2013 with TypeScript 1.8.5
TypeScript Version: 1.8.5 Visual Studio 2013 Version: 12.0.40629.00 Update 5
Code The code is available via a codeproject article, called "First Angular2 App with TypeScript and Visual Studio 2013." I downloaded the code, unblocked it, opened it in VS2013 and ran it. http://www.codeproject.com/Articles/1060262/First-Angular-App-with-TypeScript-and-Visual-Studi
Expected behavior: When the application is Cleaned in Visual Studio 2013, and then rebuilt, it should regenerate javascript from typescript and then run if there are no errors. The problem is that there are errors that were probably not there in a prior version of TypeScript.
Actual behavior: The first time the application builds, it gets me to upgrade TypeScript to 1.8.5. The first time it runs, the application works successfully, I believe because the custom tool does not need to run as there have been no changes to the typescript file.
Changing the typescript file will cause typescript to return "Build: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning."
This is in spite of having the TypeScriptExperimentalDecorators option set to true in the csproj file.
But there is no need to even change the typescript file. Simply cleaning the code appears to cause the failure.
The (poor) workaround is to tick the box to allow the code to be generated even if there's an error. Obviously this is bad especially if there are real errors needing to be corrected.
Based on the number of demonstration apps out there I believe this option was working at some stage but is not working presently.
I'm having a similar problem too.
Visual Studio 2015 Version 14.0.25123.00 Update 2 Typescript 1.8.29.0 as reported in Help About
I currently have experimentalDecorators set to true in tsconfig.json but Visual Studio is ignoring the tsconfig.json. Happened after I updated to Update 2 and installed the latest version of Typescript.
@tonywr71 this sample is working fine for me in VS 2013, with TS 1.8.5 installed. it fails at run time in IE because of Map implementation, but seems to work fine on Chrome and Edge.
@jmojiwat i can not reproduce this issue either. can you share a project, or steps to get to the state you are observing.
Did you clean the build? It worked fine until I cleaned the build. It was only the regeneration that caught the problem. Anyhow, I have uploaded a zip of the app that I have just tested and it is failing.
Let me know if you still can't reproduce it and I'll see if I can accommodate you further.
Ok, I just went to the source of the problem and it turned out that when I exported the Contact class it built successfully (the Contact class was missing an export keyword.) Maybe this was just disguising one problem with an error for another?
note sure i understand. the Contact class does not need to be exported. you are calling bootstrap on it in the same module. so loading this module should cause Contact to be registered anyways.
Yea, it was just a hunch - I don't know why that changed anything. But that code I sent was before I made that change, so you should still see the experimentalDecorators problem.
On Wed, Apr 6, 2016 at 10:06 AM, Mohamed Hegazy [email protected] wrote:
note sure i understand. the Contact class does not need to be exported. you are calling bootstrap on it in the same module. so loading this module should cause Contact to be registered anyways.
— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/Microsoft/TypeScript/issues/7784#issuecomment-206042014
@mhegazy Just to be sure, I've turned off Resharper.
I have some Aurelia code written in Typescript. The Aurelia packages are located in node_modules folder. If I compile the app without tsconfig.json, I don't get any compile errors:
The "main.ts" file looks like this:

The "app.ts" file looks like this:

If I have a tsconfig.json file present, I get compile errors and complaints about not being able to find modules.
This is what my tsconfig.json looks like:
{
"compileOnSave": true,
"compilerOptions": {
"module": "commonjs",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"outDir": "client/app",
"removeComments": true,
"sourceMap": true,
"target": "es5",
"rootDir": "client/src",
"moduleResolution": "node"
},
"exclude": [
"typings/main",
"typings/main.d.ts"
]
}
And the code now looks like this:
main.ts

app.ts

The compile errors I get are:
TS2307 cannot find modules, TS1219 Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning, TS1148 Cannot compile modules unless the '--module' flag is provided with a valid module type. Consider setting the 'module' compiler option in a 'tsconfig.json' file
Visual Studio seems to know the existence of the tsconfig.json file, but not parsing the settings in it.
Thanks for looking into this Mohamed Hegazy.
sorry for the delay. if you do not have a tsconfig.json it is using the settings in your project file. if you add a tsconfig.json, it is used instead. so we need to look at the difference between configurations between the two. so can you remove the tsconfig.json, build and share the build log.
@mhegazy sorry for not responding sooner. i think i managed to sort out my problem. the error message threw me off too as the source of the problem was not what the error message described.
the tsc compiler doesn't like it if there are duplicate d.ts definitions (even if they are excluded from the project).
just using exclude in tsconfig.json didn't help (because of the way the d.ts files were structured) so i had to resort to explicitly stating every typescript file that needs to be compiled.
also, always check that Build Action for tsconfig.json is set to Content when typescript files that used to compile, stops compiling. otherwise you will be left wondering why tsc isn't obeying tsconfig.json when building within Visual Studio, but works fine in the command line. (This one got me on a wild goose chase adventure).
thanks just the same for looking into this. cheers!
Looks like the issue has been addressed then. @tonywr71 let us know if you are still running into issues and will reopen the issue.
Just re-install the Typescript it will get fixed.