How to import all classes in one file and use them from there typescript

Viewed 10831

For example, I have a class A.ts

export class A(){
    public constructor() {}
    public method() : string {
         return "hello from A";
    }
}

and class B.ts

export class B(){
    public constructor() {}

    public method() : string {
         return "hello from B";
    }

    public static methodStatic() : string {
        return "hello from static B";
    }
}

then I want to import all of them in ONE file Headers.ts

imports {A} from    "../A_path";
imports * as b from "../B_path";

//Or just to export it? Make it public.
export * from "../A_path";
export * from "../B_path";

Headers.ts will contain only imports/exports, no class implementation or any other code. And then my problem: I want to use A and B classes in app.ts calling them over Headers.ts file.

import * as headers from './HEADERS_path';
headers.A.method();
headers.B.method();

how to do this?

2 Answers
Related