1

How can I combine multiple files into a single module ? Say I have a folder with multiple typescript classes e.g.

app
  module1
    foo1.ts
    foo2.ts
    ....
    module1.ts

In any classes which uses any of the module1 defined classes, I would like to be able to include the dependencies using a single import like

import {Foo1, Foo2} from "./module1/module1"

rather than importing individual classes like

 import {Foo1} from "./module1/foo1"
 import {Foo2} from "./module1/foo2"

How can I do this ?

1 Answer 1

2

Not sure if this is the correct way, but it seems to work for what I need in module1.ts simply define export for the classes

export * from "./foo1";
export * from "./foo2";
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.