如何为特定版本的node.js安装d.ts?

时间:2016-05-06 18:29:35

标签: typescript tsd

使用tsd命令运行此命令 tsd安装节点

它在typings / node / node.d.ts中安装定义文件但是我可以看到这个定义文件是针对node.js版本4的

Node.js v4.x API

如何为节点版本5.11.0安装tsd?

1 个答案:

答案 0 :(得分:2)

似乎你可以安装这样的特定类型:

  

npm install --save @ types / node @ 4.0.30

对于我们的项目,我们需要匹配aws Lambda支持的节点版本(目前为4.0.3)。

不确定如何获取可用类型的列表,但是当我输入的值不正确时,npm反馈列出了可用的类型:

npm ERR! notarget 
["4.0.15-alpha","4.0.16-alpha","4.0.21-alpha","4.0.22-alpha","4.0.23-alpha","4.0.24-alpha","4.0.25-alpha","4.0.26-alpha","4.0.27-alpha","4.0.28-alpha","4.0.29","4.0.30","6.0.31","6.0.32","6.0.33","6.0.34","6.0.35","6.0.36","6.0.37","6.0.38","6.0.39","6.0.40","6.0.41","6.0.42","6.0.43","6.0.44","6.0.45","6.0.46","6.0.47"]

从这里我找到了我需要的最新版本的4.x.