MΓ³dulo 01 Β· TypeScript for the Backend β LecciΓ³n 2 de 3 Β· ~11 min
Describing shapes: interface & type
Naming the shape of your data
A backend is mostly data with a shape: a walker has an id, a name, a price. A booking has a walker, a status, maybe a note. TypeScript lets you name that shape once and reuse it everywhere β the same instinct as a Swift struct.
Two tools do this: interface and type. For describing an object's fields they're nearly interchangeable. A common convention: interface for object shapes you might extend, type for unions and aliases (you'll meet unions in a moment). Like Swift structs, these shapes are compile-time only β erased before Node runs.