Import Interface from Exported Typescript Namespace

282 views Asked by At

I am using a third party library which exports interfaces inside namespaces in its index.d.ts file.

export namespace Ns {
  interface Foo {
    ...
  }

  interface Bar {
    ...
  }

export namespace AnotherNs {
  interface Foo {
    ...
  }

  interface Bar {
    ...
  }

How can I import the interfaces Foo from one of the namespace into my code?

Doing the following gives ts error Cannot use namespace 'Ns' as a value.

import { Ns } from "lib";

const foo: Ns.Foo = ...;
0

There are 0 answers