u/gavrehin r/typescript • Recommends
Understanding TypeScript's Structural Type System
88K subscribers • 110 videos on Hallway • Conference channel
Intermediate. Assumes working knowledge.
15K views8 years ago1 recommendation
Programming languagesTypeScriptLanguage design and type systems
Drew Colthorp explains how TypeScript's structural type system differs from nominal systems and how it fits JavaScript.
I was wrong. I thought TypeScript was something like a Java-ey type system layered atop JavaScript, bringing a dose of brittleness and losing the flexibility I appreciated about the warty-yet-ubiquitous multi-paradigm language. But that's not it at all! TypeScript radically improves the JavaScript development experience by providing a flexible, light-weight type system for modern EcmaScript. It does so while maintaining a delicate balance: adding a way to enforce assumptions and invariants without removing the flexibility prized by dynamic language developers. This works because TypeScript's type system is structural and not nominal - that is, based on shapes of data instead of identities of types. Come see what's cool and exciting about TypeScript's defining feature. We'll show what differentiates a structural type system from a nominal one; how key features of TypeScript provide a powerful language to express invariants about your system; and how TypeScript leverages its knowledge of what code implies about the shapes of data to avoid most of the type system nuisances that put some developers off of statically typed languages. Drew ColthorpWhat people say. Recommended as an excellent explanation of structural typing in TypeScript.
u/gavrehin r/typescript • Recommends
u/oilshellin r/ProgrammingLanguages • Mentions
On “Do any languages have novel ways to represent data?”