【发布时间】:2014-05-09 13:20:31
【问题描述】:
我有一个类似以下结构的东西
export module Foo {
export var DEBUG = false;
}
module Foo.Utils {
export function fooFunc() : void { if(Foo.DEBUG) doIt() }
}
这很好用。我可以毫无问题地做Foo.Utils.fooFunc()。
问题是 WebStorm 突出显示对 Foo.Utils 的引用并说“私有成员不可访问”。然后我尝试导出模块以避免此错误,但现在打字稿编译器出错并给了我
The property 'DEBUG' does not exist on value of type 'typeof Foo'.
Warning: Task "typescript:all" failed. Use --force to continue.
为什么会发生这种情况,我怎样才能实现在子模块中引用 Foo.DEBUG 的预期目标,同时保持模块非私有?
【问题讨论】:
标签: module typescript