What is a Visual Studio TypeScript virtual project? And how can I get rid of it if I am going from the outside?

The first part of this question is the most important. Visual Studio and TypeScript and TypeScript Virtual Projects have a lot of questions about the stack, but I didnโ€™t find anything, which explains what TypeScript Virtual Projects are, what they do for me and what to do when they are โ€œon the go.โ€ I never found an official Microsoftโ€™s documentation on this issue, so it would be great if someone from this team or next to the team could answer. " TypeScript Virtual Projects "remained in VS 2017, and I see the same problems as in VS 2015.

The second part of the question ... I am trying to use Visual Studio 2015 with an Angular 2 and TypeScript application, but I am using Webpack as an external TS compiler and build. For the most part, it works, but from time to time, TypeScript virtual projects give errors in the output window and in the code, although I can successfully compile. Most of them cannot find imports @ angular / core, etc. It is confusing that TS Virtual Project sometimes also captures real errors. Do I need a virtual project to check intellisense and compile?

My current state is that I am doing 2 compilations to try to keep the TypeScript virtual project happy, even sometimes it even complains. The first build uses tsc as part of the VS build, but then I do my usual Webpack build using SourceMaps for debugging. This seems to work in 90% of cases, and the remaining 10%, when TS Virtual Project gets in the way, is so frustrating, and since they are still in Visual Studio 2017, it is important to know what is happening.

The ultimate goal is to use Visual Studio as my editor and debugger (with all its great features) with intellisense and compilation checking, but use an external TypeScript construct like Webpack to create / merge, etc.

Thanks.

+5
source share
1 answer

Adding the following option to tsconfig.json helped me:

"compilerOptions": { "watch": true, ... 

And don't forget to add

 <TypeScriptCompileBlocked>true</TypeScriptCompileBlocked> 

to any <PropertyGroup> file of your project.

0
source

Source: https://habr.com/ru/post/1264587/


All Articles