2016-08-20 102 views

回答

0

首先,安装 '分型':npm install typings --global

然后,在命令行(在你的项目的根),使用分型安装” .D。 TS温斯顿文件':

typings install winston --source dt --save --global 

的分型文件将被加入到typings/global/winston文件夹中的项目。现在,添加以下到您的“app.js”文件的顶部:

/// <reference path="typings/globals/winston/index.d.ts"/> 

现在,您可以使用温斯顿记录是这样的:

var winston = require('winston'); 

winston.level = 'debug'; 
winston.debug('Debug messages are written to the console with the default logger.'); 

我加入了“FS-etxra” NPM包到项目,然后按照上述相同的方式添加类型。由此产生的项目可以在以下截图中看到:

Visual Studio Screenshot

相关问题