也许这是显而易见的,但我到处检查(除了正确的地方),谷歌它。什么都没有。
当前回答
tsc -v命令在Windows Path变量的SDK目录集中读取TypeScript编译器版本。这并不一定反映安装的最新版本,因为Path变量没有随着后续安装而更新。
VS.NET用来编译TypeScript的版本在项目的配置中:
< TypeScriptToolsVersion > 1。5 < / TypeScriptToolsVersion >
为了更详细地解释这一点,我创建了下面的帖子,其中有关于安装的TypeScript版本的细节,以及VS.NET使用哪个版本来编译TypeScript文件。
TypeScript安装的版本和Visual Studio使用的版本?
我还在Microsoft Connect上添加了一个特性请求,以便更容易地查看和切换VS.NET中的TypeScript目标版本。这并不是一个真正的TypeScript特性请求,而是一个VS.NET IDE增强。
允许从项目属性IDE切换TypeScript配置版本
其他回答
As far as I understand VS has nothing to do with TS installed by NPM. (You may notice after you install TS using NPM, there is no tsc.exe file). VS targets only tsc.exe installed by TS for VS extension, which installes TS to c:\Program Files (x86)\Microsoft SDKs\TypeScript\X.Y. You may have multiple folders under c:\Program Files (x86)\Microsoft SDKs\TypeScript. Set TypeScriptToolsVersion to the highest version installed. In my case I had folders "1.0", "1.7", "1.8", so I set TypeScriptToolsVersion = 1.8, and if you run tsc - v inside that folder you will get 1.8.3 or something, however, when u run tsc outside that folder, it will use PATH variable pointing to TS version installed by NPM, which is in my case 1.8.10. I believe TS for VS will always be a little behind the latest version of TS you install using NPM. But as far as I understand, VS doesnt know anything about TS installed by NPM, it only targets whateve versions installed by TS for VS extensions, and the version specified in TypeScriptToolsVersion in your project file.
对于非命令行方法,你可以打开扩展和更新窗口(工具->扩展和更新),并在安装下搜索Typescript For Microsoft Visual Studio扩展
tsc -v命令在Windows Path变量的SDK目录集中读取TypeScript编译器版本。这并不一定反映安装的最新版本,因为Path变量没有随着后续安装而更新。
VS.NET用来编译TypeScript的版本在项目的配置中:
< TypeScriptToolsVersion > 1。5 < / TypeScriptToolsVersion >
为了更详细地解释这一点,我创建了下面的帖子,其中有关于安装的TypeScript版本的细节,以及VS.NET使用哪个版本来编译TypeScript文件。
TypeScript安装的版本和Visual Studio使用的版本?
我还在Microsoft Connect上添加了一个特性请求,以便更容易地查看和切换VS.NET中的TypeScript目标版本。这并不是一个真正的TypeScript特性请求,而是一个VS.NET IDE增强。
允许从项目属性IDE切换TypeScript配置版本
在Visual Studio 2015上,只需访问:help/about Microsoft Visual Studio 然后你会看到这样的东西:
微软Visual Studio企业2015 版本14.0.24720.00更新1 微软。net框架 版本4.6.01055
...
打印稿1.7.6.0 TypeScript for Microsoft Visual Studio
....
在命令提示符中,只需输入以下命令的1,然后按Enter:
tsc - v 或 tsc - version 或 tsc -版本
注意:请确保已将Typescript添加到环境变量path中 执行命令前,请先查看:如何设置环境 变量。
推荐文章
- Typescript接口-可能使“一个或另一个”属性要求?
- 如何扩展/继承组件?
- Visual Studio - Resx文件默认“内部”为“公共”
- 在Visual Studio 2010中有快速查找文件的方法吗?
- 错误:'types'只能在.ts文件中使用- Visual Studio Code使用@ts-check
- Typescript ReferenceError: exports没有定义
- Nuget连接尝试失败“无法为源加载服务索引”
- 在Visual Studio中查看多个项目/解决方案
- Visual Studio打开默认浏览器,而不是Internet Explorer
- React组件中使用TypeScript的默认属性值
- Angular 5 -复制到剪贴板
- TypeScript枚举对象数组
- csproj文件中的“Service Include”是干什么用的?
- 如何在Visual Studio中找到堆栈跟踪?
- 使用不同的Web。在开发和生产环境中进行配置