I am thoroughly confused by Typescript versioning as it relates to Visual Studio 2019. I have a .NET Core 2.2.x project which utilizes Typescript. When I edit any .ts file, I get the following warning (in the error list):
Your project is built using TypeScript 3.4, but the TypeScript language service version currently in use by Visual Studio is 3.4.3. Your project may be using TypeScript language features that will result in errors when compiling with this version of the TypeScript compiler. To remove this warning, install the TypeScript 3.4.3 SDK or update the TypeScript version in your project's properties.
It claims that my project is built using TypeScript 3.4, but package.json specifically lists "typescript": "3.4.3"
.
Then it asks to install TypeScript SDK 3.4.3, which I have from here. I also npm install -g typescript
previously, so running tsc -v
yields Version 3.4.3
.
What am I missing?
Visual Studio 2019 provides rich support for JavaScript development, both using JavaScript directly, and also using the TypeScript programming language, which was developed to provide a more productive and enjoyable JavaScript development experience, especially when developing projects at scale.
Tip: To get a specific TypeScript version, specify @version during npm install. For example, for TypeScript 3.6. 0, you would use npm install --save-dev [email protected] . To preview the next version of TypeScript, run npm install --save-dev typescript@next .
I had a similar problem as you describe but in the Task Runner Explorer.
Assumptions: TypeScript is should be in your PATH variables (you can check by running 'tsc -v' from a normal command prompt.
Since quite a while, Visual Studio allows you to choose the TypeScript version to use on a per-project basis (right-click project => Properties => tab 'Typescript Build'). Here you could choose an officially installed version but also 'Use latest available'.
In Visual Studio Options you can specify the locations and order in which 'External Web Tools' are used when building web projects using 3rd party tools. In that list, you will probably find an item '$(PATH)'. I moved it to the top of the list, which makes the globally installed TypeScript version the first to be found when searching for it.
I hope this applies for your situation as well.
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