从导出的Typescript命名空间导入接口
我正在使用一个第三方库,该库在其从导出的Typescript命名空间导入接口,typescript,typescript-namespace,Typescript,Typescript Namespace,我正在使用一个第三方库,该库在其index.d.ts文件中导出名称空间内的接口 export namespace Ns { interface Foo { ... } interface Bar { ... } export namespace AnotherNs { interface Foo { ... } interface Bar { ... } 如何将接口Foo从一个命名空间导入到代码中 执行以下操作会导致ts错误
index.d.ts
文件中导出名称空间内的接口
export namespace Ns {
interface Foo {
...
}
interface Bar {
...
}
export namespace AnotherNs {
interface Foo {
...
}
interface Bar {
...
}
如何将接口Foo从一个命名空间导入到代码中
执行以下操作会导致ts错误无法将命名空间“Ns”用作值。
import { Ns } from "lib";
const foo: Ns.Foo = ...;