My general setup is this:
Visual Studio 2015
.NET Framework 4.5.2
I would like to start refactoring some client-side code from javascript to typescript. To start this process, I:
v3.1.2
All's good except one of my type alias declarations. I made a simple demonstration of the error at the top of my file to show the issue.
Visual Studio has no problem with a string literal type alias
, but doesn't like the numeric literal type alias
.
Visual Studio is reporting the version of TypeScript installed as 1.8.36.0
.
In typescript 1.8, numeric literal type aliases aren't implemented yet, only string literal aliases .
Visual Studio 2015 will let you update your version of TypeScript tools to a newer one (though not the newest version, since the team has since moved on from supporting 2015).
typescript 3.1.1
into the search bar. That is the most recent version that Visual Studio 2015 supports as of this writing.It should now be using the version of typescript that you installed. You can check what version it's using under Help > About Microsoft Visual Studio .
If it didn't install correctly, edit the relevant .csproj file and change the contents of the element TypeScriptToolsVersion
from 1.8
to 3.1
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.