VS2015没有TypeScript模板,并且不支持Typescript [英] VS2015 does not have TypeScript template and it is not supporting typescript
问题描述
我正在使用Visual Studio 2015专业版.我已经使用npm安装了TypeScript.安装了TypeScript 2.0.3. 然后我尝试使用右键单击我项目的tsScript文件夹中的TypeScript文件->添加新项,但是我没有找到任何TS文件模板. 然后,我通过添加文本文件并将其扩展名从.txt更改为.ts并在此文件中粘贴一些TypeScript代码来进行变通.当我运行应用程序时,应用程序能够从此ts文件生成jsfile.但是问题是:ts文件中的文本颜色全为黑色.没有着色,没有智能,没有模块化.只是纯文本.
I am working on Visual Studio 2015 professional. I have installed TypeScript using npm. TypeScript 2.0.3 installed. Then i tried to add a TypeScript file using Right Click on a tsScript Folder of my Project -> Add New Item but i did not find any TS file template. Then I make a workaround by adding a text file and changed its extension from .txt to .ts and pasted some TypeScript code in this file. When i am running the application, application is able to generate jsfile from this ts file. But the problem is : the text color in the ts file is all black. There is no coloring, no intellisense, no modularation . It is just plain text.
我应该怎么做才能使ts文件能够被Visual Studio识别.下面是屏幕截图.
What can i do to make this ts file recognized to visual studio. Below is the screenshot.
tsconfig.json文件:
tsconfig.json File :
{
"compilerOptions": {
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "commonjs",
"noEmitOnError": true,
"noImplicitAny": false,
"outDir": "../Scripts/",
"removeComments": false,
"sourceMap": true,
"target": "es5",
"moduleResolution": "node"
},
"exclude": [
"node_modules",
"typings/index",
"typings/index.d.ts"
]
}
通过将我的Visual Studio 2015更新为Visual Studio 2015 Update 3解决了该问题.
推荐答案
如果您已经安装了TypeScript 2.03插件,但仍然没有看到所需的内容,则可能需要Visual Studio版本1.02的NodeJS工具(或更高版本),来自 https://www.visualstudio.com/vs/node-js/一个>.
If you have already installed the TypeScript 2.03 plugin, and still don't see what you want, you may need the NodeJS tools for Visual Studio, Version 1.02 (or later) from https://www.visualstudio.com/vs/node-js/.
我使用的TypeScript入门工具位于已安装的项目/NodeJS"中的"项目/添加新项"对话框中.您可能需要进入NodeJS项目才能使它们工作.
The TypeScript starters I use are under Project/Add New Item dialog Installed/NodeJS. You probably need to be in a NodeJS project to get these to work.
这篇关于VS2015没有TypeScript模板,并且不支持Typescript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!