Do you only export what is necessary?

Updated by Brady Stroud [SSW] 1 year ago. See history

123

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.

acknowledgements
related rules