从导出的 Typescript 命名空间导入接口

cpp*_*ner 7 typescript typescript-namespace

我正在使用第三方库,该库在其index.d.ts文件中导出命名空间内的接口。

export namespace Ns {
  interface Foo {
    ...
  }

  interface Bar {
    ...
  }

export namespace AnotherNs {
  interface Foo {
    ...
  }

  interface Bar {
    ...
  }
Run Code Online (Sandbox Code Playgroud)

如何将接口 Foo 从命名空间之一导入到我的代码中?

执行以下操作会出现 ts 错误Cannot use namespace 'Ns' as a value.

import { Ns } from "lib";

const foo: Ns.Foo = ...;
Run Code Online (Sandbox Code Playgroud)