[英]How to use TypeScript definitions in VS 2015
I am trying to create a TypeScript NodeJS project in VS 2015, I have installed Typings, and have used it to install TypeScript definitions for express and other node frameworks 我正在尝试在VS 2015中创建TypeScript NodeJS项目,已经安装了Typings,并已使用它来安装Express和其他节点框架的TypeScript定义。
However, when I use /// <reference path="Scripts/typings/globals/express/index.d.ts" />
in my .ts
file, I do not receive any intellisense when trying to use express. 但是,当我在.ts
文件中使用/// <reference path="Scripts/typings/globals/express/index.d.ts" />
时,尝试使用express时不会收到任何智能提示。 There are no errors, and it finds the definition file. 没有错误,它会找到定义文件。
How can I get the TypeScript definitions to work? 如何使TypeScript定义起作用?
Turns out I was using this syntax: var express = require('express');
原来我正在使用这种语法: var express = require('express');
When I should have been using this: import express = require('express');
当我应该一直使用它时: import express = require('express');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.