【发布时间】:2015-07-23 23:35:31
【问题描述】:
我是 typescript 新手,正在尝试启动 hapi.js 项目,但在我的代码中尝试 require('boom') 时出现错误
Duplicate identifier 'Boom'
/// <reference path="../typings/tsd.d.ts" />
var config = require('../config'),
User = require('../models/user'),
Boom = require('boom'),
joi = require('joi');
我的 tsd.json
{
"version": "v4",
"repo": "borisyankov/DefinitelyTyped",
"ref": "master",
"path": "typings",
"bundle": "typings/tsd.d.ts",
"installed": {
"node/node.d.ts": {
"commit": "846a250e0a6f5e6adf6347ee4ca442a9d1abd8fc"
},
"hapi/hapi.d.ts": {
"commit": "846a250e0a6f5e6adf6347ee4ca442a9d1abd8fc"
},
"bluebird/bluebird.d.ts": {
"commit": "846a250e0a6f5e6adf6347ee4ca442a9d1abd8fc"
},
"boom/boom.d.ts": {
"commit": "846a250e0a6f5e6adf6347ee4ca442a9d1abd8fc"
},
"pg/pg.d.ts": {
"commit": "846a250e0a6f5e6adf6347ee4ca442a9d1abd8fc"
}
}
我在我的 tsd 中添加了 boom 和 hapi - 如果 hapi 也引用了 boom 是否会导致某种循环错误?
我应该如何在 typescript 中引用这些库?
【问题讨论】:
标签: javascript typescript hapijs