Typescript 使用导入中断扩展内部模块

Typescript 使用导入中断扩展内部模块,typescript,Typescript,这是我的设想。我正在跨多个文件定义一个模块“我的”。我使用引用路径包含来包含文件。但是,当我在其中一个文件中使用import时,内部模块中的名称不再解析。我需要明确引用模块名称 a.ts: module mine { export class A { } } /// <reference path="a.ts" /> /// <reference path="e.ts" /> import ext = module("ext"); module mine

这是我的设想。我正在跨多个文件定义一个模块“我的”。我使用引用路径包含来包含文件。但是,当我在其中一个文件中使用import时,内部模块中的名称不再解析。我需要明确引用模块名称

a.ts:

module mine {
    export class A {
    }
}
/// <reference path="a.ts" />
/// <reference path="e.ts" />
import ext = module("ext");
module mine {
    export class B extends A {
    }
}
e.ts:(我没有这个,通常是从网上下载的)

b.ts:

module mine {
    export class A {
    }
}
/// <reference path="a.ts" />
/// <reference path="e.ts" />
import ext = module("ext");
module mine {
    export class B extends A {
    }
}
但是,如果我删除b.ts中的import语句,一切正常。我的问题是,如何在导入另一个外部模块时扩展内部模块


我添加了e.T作为解释,但从技术上讲,e.T可以来自我通过tsd或从web下载的外部typescript定义文件。我特别要提到的问题是node.js断言模块。

这是TypeScript编译器中的一个错误——您的代码(或者至少应该)很好。这个问题刚刚在0.9分支中得到修复。

这是TypeScript编译器中的一个bug——您的代码是(或者至少应该是)好的。这个问题刚刚在0.9分支中得到解决