gpt4 book ai didi

typescript - 如何同时导出多个命名空间?

转载 作者:搜寻专家 更新时间:2023-10-30 22:00:44 26 4
gpt4 key购买 nike

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.jsontypings

关于typescript - 如何同时导出多个命名空间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42941599/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com