TypeScript · Lesson 113 of 120
Performance of Types
Keep it simple.
Very clever types can slow down the compiler and your editor, and confuse your teammates. Most of the time, simple types are the best types.

- Clever types
- Slow and confusing
- Simple is best
Keeping it fast
Name complex types with aliases or interfaces, so the compiler can reuse them. Avoid deeply recursive conditional types. Prefer interfaces when extending objects. And add return types to big exported functions.
| key | value |
|---|---|
| Name | complex types |
| Avoid | deep recursion |
| Extend | with interfaces |
| Exports | explicit return types |
Keeping it readable
If a type needs a long comment to explain, simplify it. A little repetition is better than a puzzle. Write types for the reader, not to show off.
| key | value |
|---|---|
| Long explanation | simplify |
| Repetition | sometimes fine |
| Audience | the reader |
| Goal | clear, not clever |
Summary
Simple, named types keep the compiler fast, and your team happy. Next, reading library types.
Key takeaways- Name types
- Avoid deep recursion
- Clear, not clever
Next up: Reading Library Types — understand .d.ts