1
我有一个打字稿外部定义文件(foo.d.ts):为什么导入TypeScript模块不允许使用现有的模块扩展?
declare module foo {
export class bar {
}
}
然后我用它像这样(在baz.ts):
/// <reference path="foo.d.ts" />
module foo {
class baz extends bar {
}
}
到目前为止好。但是,当我输入编译为AMD的模块编译减免一些其他的打字稿文件:
module foo {
class baz extends bar { // Error: could not find symbol "bar"
}
}
import T1 = module("test1"); // Removing this line resolves the compilation error
被导入的AMD文件是一个简单的:
export var NAME = "NAME";
有谁知道这是故意的吗?为什么import
以这种方式破坏我的代码?