In TypeScript, I’ve found throwing a runtime error is often a sign of poorly...


In TypeScript, I’ve found throwing a runtime error is often a sign of poorly designed types.

So I strive to design types so that runtime errors aren’t possible.

The exception: Runtime data. Zod validates the app's input at runtime (HTTP calls, reading the URL, cookies, etc).

View original on X