TypeScript · Senior · Question 70 of 75
How do you prevent consumers from depending on internal types of your library?
- ✓Correct answer: Expose a deliberate public API (entry points via
exports), mark internals with@internaland strip them with tools like API Extractor - 2Make all types
any - 3Put everything in one file
Explanation
Every exported type becomes part of the semver contract; a smaller surface makes changes safer.