New: Cookbooks and AI ExplanationsStep-by-Step recipes to solve problems connected to Roadmaps and Cheat Sheets. Need more details? Use AI buttons for structured and simple explanations with concrete examples throughout the whole platform.Take a look
Interface or type? I never know.
What you'll have at the end
A one-line rule in your own words for when you reach for each one
You need
A TypeScript project with strict checking on, and at least one object shape you are about to name as either an interface or a type alias.
Not covered
Choosing between an enum and a plain string union for a fixed set of values, and forcing an exhaustive check over either, both separate decisions once the shape itself is settled.
Leans on
Enum or string union: picking the safer one
For deciding between an enum and a plain string union for a fixed set of values, a separate decision once you already know type is the right keyword to reach for.
Deriving a smaller type from a big interface with Pick
For once you've settled on a shape and need a smaller version of it carrying only some of its fields.
Checked 22 Aug 2026
Part of the TypeScript cookbook