type-driven development
Type-driven development uses types to express a design before filling in its implementation.
Use this when Invalid state combinations keep spreading through the code.
without the term
“Our request object can be loading and errored and have data all at the same time, which makes no sense. Can you set up the types so those impossible combinations can't even happen?”
with the term · How do you ask a model for type-driven development?
Use type-driven development for this request state. Make invalid combinations unrepresentable and test validation at the untrusted input boundary.
What is type-driven development?
You write the types for valid states first, so impossible combinations fail to compile, then implement against them. Data from outside the program still needs runtime validation.
Why does type-driven development matter when vibe coding?
Optional fields and broad types can hide an incomplete model.
How do you do type-driven development?
Model valid states and transitions, then implement against those contracts.
What goes wrong with type-driven development?
Assuming a type assertion validates data received at runtime.