【发布时间】:2016-10-13 01:28:20
【问题描述】:
我试图在我的节点模块中添加一个打字稿声明文件,但在 VS Code 的另一个项目中使用它时遇到错误:
导出的外部包类型文件 .../ttk.d.ts 不是模块
有问题的 ttk.d.ts 文件是 here。
奇怪的是,在 VS Code 中,我使用声明文件自动完成。有谁知道我做错了什么?
编辑:这是导入模块的测试文件:
const ttk = require('ttk');
const t = ttk.factory();
const r = t`Hello, ${'@name'}!`;
const s = r({ name: 'World' });
console.log(s);
【问题讨论】:
-
如何导入?
-
使用该代码更新帖子。类型在 package.json 中定义:github.com/maexsoftware/ttk/blob/ttk.d.ts/package.json#L26
-
修复了帖子中到 tkk.d.ts 的死链接;您上面评论中 package.json 的历史链接是 here
标签: typescript visual-studio-code typescript-typings