Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从导出的Typescript命名空间导入接口_Typescript_Typescript Namespace - Fatal编程技术网

从导出的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 = ...;