【问题标题】:Relative Modules in Ambient Modules环境模块中的相关模块
【发布时间】:2018-06-29 06:50:58
【问题描述】:

从 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
}

【问题讨论】:

  • 你有没有想过如何做到这一点?

标签: typescript typescript1.6


【解决方案1】:

要消除错误,您现在可以使用:

declare module '*';

【讨论】:

  • 你能说得更具体点吗?
猜你喜欢
  • 2016-09-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-03-07
  • 1970-01-01
相关资源
最近更新 更多