也许这是显而易见的,但我到处检查(除了正确的地方),谷歌它。什么都没有。
当前回答
如果你想知道在一个特定的项目中使用了什么版本的Typescript,去你的package-lock。json文件。你会发现这样的东西:
"typescript": {
"version": "3.5.3"
}
其他回答
如果你只为Visual Studio安装了TypeScript,那么:
启动Visual Studio命令提示符 输入tsc -v并按Enter
Visual Studio 2017版本15.3及以上将TypeScript版本绑定到单个项目,正如这个答案所指出的:
右键单击解决方案资源管理器中的项目节点 单击“属性” 进入TypeScript Build选项卡
你可以在Visual Studio 2013中的NuGet Package Manager Console中运行它。
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配置版本
如果你想知道在一个特定的项目中使用了什么版本的Typescript,去你的package-lock。json文件。你会发现这样的东西:
"typescript": {
"version": "3.5.3"
}
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.
推荐文章
- 如何为构造函数定制Visual Studio的私有字段生成快捷方式?
- 从元组/数组值派生联合类型
- 如何在Angular2 ngSwitch语句中使用typescript enum值
- 为什么Visual Studio 2015/2017/2019测试运行器没有发现我的xUnit v2测试
- Visual Studio复制项目
- 找到合成属性@panelState。请在您的应用程序中包含“BrowserAnimationsModule”或“NoopAnimationsModule”。
- Angular 2+和debounce
- 如何在iis7应用程序池中设置。net Framework 4.5版本
- 在TypeScript箭头函数中指定返回类型
- 如何使用jQuery与TypeScript
- Angular 2模板中的标签是什么意思?
- Typescript接口-可能使“一个或另一个”属性要求?
- 如何扩展/继承组件?
- Visual Studio - Resx文件默认“内部”为“公共”
- 在Visual Studio 2010中有快速查找文件的方法吗?