Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

exporting types in an export = environment

I am creating a typings.d.ts file for a module that has no typings. However it would be good to get access to some of the types inside the declaration.

This seems to be not possible when I use the export =

declare module 'test' {

  export = class Test {
  }

  export interface ITestObj { // this gives an error because of the above export
    key : string;
    secret : string;
  }

}

Is there another way in which I can structure my typings file so I can also export the types as well.


NOTE: The above structure of export = class Test is required as that is how the module is working.

like image 927
Kevin Upton Avatar asked Jan 31 '26 05:01

Kevin Upton


1 Answers

You asked:

Is there another way in which I can structure my typings file so I can also export the types as well? The above structure of export = class Test is required as that is how the module is working.

Unfortunately, what you want is not supported. From the docs:

The export = syntax specifies a single object that is exported from the module.

In other words, if the module uses export =, then the module can export only one object.

like image 133
Shaun Luttin Avatar answered Feb 01 '26 21:02

Shaun Luttin