Extending Interfaces
Extending Interfaces (π solution)
π¨βπΌ Beautiful! Interface extension keeps your types DRY.
Interestingly, you can use intersections with interfaces as well:
type AuditLog = Timestamps & {
action: string
userId: string
}
π¦ When to use extends vs intersection (
&):extends- Clear hierarchy, works with interfaces&- Ad-hoc combinations, works with any types
Both achieve similar results, but because
& works with both, it's recommended.

