All posts
Blog/TypeScript at the boundary
TypeScriptArchitecture
7 min read

TypeScript at the boundary

Using strict types where data enters your app — APIs, forms, env — and staying pragmatic everywhere else.

Article

The highest return on TypeScript investment is at boundaries: parse and validate external data once, then trust narrow types inside your domain.

Zod, Valibot, or hand-written guards — pick one pattern and reuse it. The goal is not perfect coverage on day one; it is to make invalid states unrepresentable after the parser.

Inside the app, inference and generics do most of the work. I avoid `any` at the edges and prefer `unknown` plus narrowing when shape is uncertain.