Hyper Typing
Published on: 2025-07-04 12:41:51
I argue that simpler types, or even type generation, often lead to a more practical and enjoyable developer experience despite being less "perfect".
In this article, I talk about an inherent trade-off in TypeScript's type system: stricter types are safer, but often more complex. I describe a phenomenon I call "hyper-typing", where libraries - in pursuit of perfect type safety - end up with overly complex types that are hard-to-understand, produce cryptic errors, and paradoxically even lead to unsafe workarounds.
TypeScript’s type system is gradual: when describing a JavaScript value with TypeScript, you can be more or less accurate, ranging from saying that the value could be anything ( any ), to describing in absolute detail what the value is under different conditions.
Consider for example this function which prints the property of an object - if it exists:
function printProperty ( obj , key ) { if ( typeof obj === "object" && obj !== null && Object. hasOwn (obj, key)) { console.
... Read full article.