Do you only export what is necessary?

Last updated by TiagoAraujo almost 8 years ago.See history

Each file in TypeScript is a module, and each module can export whatever members it wants.  However, if you export everything, you run the risk of having to increment major versions (when using semantic versioning), or having your module used in unintended ways.

Only export the types necessary to reduce your API surface.  Often, this means exporting interfaces over implementations.

We open source. Powered by GitHub