9

从 TypeScript 1.6.2 开始,有一个长期“缺陷”的“修复”,它使得无法将相关模块导入环境模块,现在我的一些代码正在破坏。我们利用 AMD 环境,其中我们有一个插件模块,当在 Node 下执行时加载 CommonJS 模块。特别是,我使用 Intern 作为测试框架并开发了一些设计为仅用作 CommonJS 模块的东西。

例如,我曾经有这样的声明:

declare module 'intern/dojo/node!../../index' {
    import * as dtsGenerator from '../../index';
    export = dtsGenerator
}

但现在我明白了Import or export declaration in an ambient module declaration cannot reference module through relative module name.

我无法弄清楚如何在我的环境模块中为我的项目中包含的东西绝对解析一个模块。当然,以下表示index无法找到:

declare module 'intern/dojo/node!../../index' {
    import * as dtsGenerator from 'index';
    export = dtsGenerator
}
4

1 回答 1

1

To dismiss errors, you can now use:

declare module '*';
于 2018-06-28T18:24:33.827 回答