a.ts
export namespace NSA {
export function fnA() {}
}
b.ts
export namespace NSB {
export function fnB() {}
}
我想像这样从一个文件中将它们一起导出,
合并.ts
export * from "./a.ts";
export * from "./b.ts";
然后像这样在我的应用中引用它,
应用程序组件.ts
import {NSB} from 'merged';
当我尝试上述操作时,无法在合并中找到 NSA{} 或 NSB{}
最佳答案
when I try the above it's not able to find NSA{} or NSB{} in merged
它按预期工作。提示为什么它不适合你:
- 重启你的IDE
- 在终端上测试
- 确保你的
package.json
有typings
关于typescript - 如何同时导出多个命名空间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42941599/