使用TypeScript编写node项目的疑惑
请问怎么在.ts中引用node系统库呢,如http、fs等,没有他们的d.ts啊
import http = require(“http”)
ts编译时候报错Cannot find module ‘http’
ps: 如果是常用的第三方库,webstorm里面有集成,找到对应的d.ts加上就好了 /// <reference path="../../libs/underscore.browser.d.ts"/>
7 回复
typings install http --ambient --save typings ERR! message Unable to find “http” for “dt” in the registry
我在webstorm里面也找了,没有http的dt, 其他的node系统库也没有,怎么破?
@louislve 检查下node.d.ts是不是正确安装,webstorm我没用过,不知道是怎么引用.d.ts的,你可以把下载下来的node.d.ts放到指定目录,ts文件里的reference的path指向那个地址就好。http是node里的,你装了node.d.ts就有。