The Type System: What You Know, What's New, and What's Weird
My project: Hermes IDE | GitHub Me: gabrielanhaia You'll reach for class hierarchies and abstract classes. Stop. TypeScript has something better for most of those cases. In Post 1, we covered the b...

Source: DEV Community
My project: Hermes IDE | GitHub Me: gabrielanhaia You'll reach for class hierarchies and abstract classes. Stop. TypeScript has something better for most of those cases. In Post 1, we covered the big mental shifts: structural typing, type erasure, null vs undefined, how overloading isn't really overloading. That was the "prepare yourself" post. This one is where we actually build things with the type system. I'll split it by feel: the stuff that'll be instantly familiar, the stuff that's genuinely new, and the stuff that'll trip you up because it looks familiar but behaves differently. Primitives, Arrays, Objects: The Familiar Stuff I'll keep this short because you already know what types are. const name: string = "Gabriel"; const age: number = 31; const isActive: boolean = true; No int vs float vs double. It's all number. There's also bigint if you need arbitrary precision, but number covers 99% of cases. Arrays have two syntaxes: const ids: number[] = [1, 2, 3]; const names: Array<