1

SomeClass.ts:

export interface SomeClass {
  print(): void;
}

external-types.d.ts

import { SomeClass } from "./SomeClass";
declare module "printer" {
  // How to export SomeClass from this module?
  // I have several other interfaces spread across
  // files that I want to export from here.
}

The solution I am not looking for is, moving the interface into module declaration. Because I have lot of interfaces across files and I simply want to import and re-export them from the module.

Andrey Tyukin
  • 43,673
  • 4
  • 57
  • 93
lch
  • 4,569
  • 13
  • 42
  • 75
  • Have you tried `export { SomeClass } from './SomeClass'`? – yqlim Mar 02 '22 at 01:27
  • yup. that did not work. `Import or export declaration in an ambient module declaration cannot reference module through relative module name` – lch Mar 02 '22 at 01:31
  • Can you use [import type expressions](https://devblogs.microsoft.com/typescript/announcing-typescript-2-9-rc/#import-types) as in [this answer](https://stackoverflow.com/a/66768386/1426891)? – Jeff Bowman Mar 02 '22 at 01:42

0 Answers0