I've been trying to get typescript configured in Visual Studio for months.
I cannot find a definitive, reliable, and complete specification for how to get Typescript installed or configured in Visual Studio Enterprise 2015 so that I never fall into the trap of having my x.ts files popping up in a 'miscellaneous' Virtual project separate from the virtual project that contains the lib.d.ts and the tsconfig.json.
That condition results in a loss of intellisense, the need to return to universal triple-slash referencing, and fundamentally uncommittable code in any commercial development or other production-linked environment. In short, it makes typescript a non-starter for a professional developer.
The state of googling on this subject has improved in 2016 over what it was in 2014 and 2015, but the most definitive information is still on Microsoft's Typescript Github issues list, but these answers are too specific to be unambiguous enough to serve as a general guide. The other best definitions are Scott Logic's discussion and the Typescript site's tutorial on ASP.NET 4 projects.
I have set the TypescriptVersion variable to the correct version in VS2015's MS SDKs Typescript folders. In my case that is 15.0 (despite the fact that the MSBuild version of Typescript is 18.0). So I no longer receive the irritating error regarding that.
I have a proper tsconfig.json file matching the one described in the Typescript Site's ASP.NET 4 project.
I have a VS2015-generated lib.d.ts file and my Virtual Project name that contains the lib.d.ts and tsconfig.json files is named myproject(tsconfig.json). All of this is expected.
However as soon as I add a blank 'base.ts' file to my Scripts/common folder, I get another Typescript Virtual project named 'Miscellaneous' that contains a lib.es6.d.ts file and my new base.ts.
This means that VS2015 recognizes my new empty .ts file as a 'loose file', not associated with the typescript compilation context. Scott Logic's post, mentioned above, goes into a good amount of depth regarding this topic, but for a more sophisticated purpose.
I need to know what is going on to produce this unworkable result, how to prevent it, and how to reliably configure typescript in ASP.NET 4 projects, both new projects and existing projects so that this unworkable situation never happens or can be quickly and reliably corrected.
If you have any information on this, or any experience that intersects with something that might provide even part of an explanation, I welcome your response.
I had the same problem. After a lot of trial and error, I fixed it by adding the following options to tsconfig.json:
{
"compilerOptions": {
"watch": true
},
"include": ["**/*"]
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With