【发布时间】:2016-12-08 07:05:22
【问题描述】:
我正在向 NPM 注册表发布一个模块。
它是用 TypeScript 构建的(在 package.json 中使用 typings 属性,在我的 tsconfig.json 中使用 "declaration": true。
在构建 NPM 模块时,我需要以下 .d.ts 文件,这些文件是通过 typings 工具下载的:
- ES6 承诺
- MQTT.js
当我生成我的模块并将其包含在子项目中时,TypeScript 会警告我不要在模块中使用三斜杠引用。当我将 "declaration": true 添加到我的 tsconfig.json 时,TypeScript 添加了这些引用。
error TS2654:
Exported external package typings file cannot contain
tripleslash references.
如果我删除引用,我会收到类型错误(或重复标识符警告)。
发布具有子依赖项的 NPM 模块的正确方法是什么?
【问题讨论】:
标签: node.js typescript npm typescript-typings