Home
Do you only export what is necessary?
  v1.0 Posted at 29/04/2016 5:55 AM by Tiago Araujo

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.

Related rules

    Do you feel this rule needs an update?

    If you want to be notified when this rule is updated, please enter your email address:

    Comments:

    Note: Social Media login for Yotpo is not working in IE or Safari, please use Chrome. We are waiting for Yotpo to fix it.