TSTypeScript · Lesson 3 of 10
Interfaces & Type Aliases
Interfaces and type aliases both let you name a shape. The difference is subtle — interfaces are open (extendable), type aliases are closed. In practice, use whichever your team prefers. The important thing is using them.
✦ Tip
Use literal union types like `"active" | "inactive"` instead of plain strings wherever you have a fixed set of values. TypeScript will then catch typos at compile time, and your editor will autocomplete the valid values.
Use literal union types like `"active" | "inactive"` instead of plain strings wherever you have a fixed set of values. TypeScript will then catch typos at compile time, and your editor will autocomplete the valid values.