Reexport class in Typescript

I found answer by myself

https://www.typescriptlang.org/docs/handbook/modules.html @Re-exports

Code to do what I wanted

//c.ts
export {A} from "a";
export {B} from "b";

Default export

Assuming you have file

//d.ts
export default class D{}

Re-export have to look like this

//reexport.ts
export { default } from "d";

or

//reexport.ts
export { default as D } from "d";

What happens here is that you're saying "I want to re-export the default export of module "D" but with the name of D


For anyone not wanting to deal with default you re-export an imported module like so

import {A} from './A.js';
import {B} from './B.js';

const C = 'some variable'

export {A, B, C}

This way you can export all the variables you either imported or declared in this file.

Taken from here

Tags:

Typescript