Episode 384: Boris Cherny on TypeScript.mp3

Topics covered
Popular Clips
Episode Highlights
TypeScript Intro
, author of "Programming TypeScript," introduces TypeScript as a unique language that compiles to JavaScript, offering a robust type system. He highlights its structural, static, strong, and gradually typed nature, which sets it apart from other languages. TypeScript's popularity is evident, with significant growth in usage and a vast number of type definitions available for third-party libraries 1.
TypeScript is a really, really weird language that works exceptionally well in practice.
---
Boris encourages developers to explore TypeScript further through resources like the TypeScript handbook and his book 2.
Type System
TypeScript's type system is fully structural, aligning with JavaScript's dynamic nature. explains that this system allows for flexibility, enabling developers to define types that can be reused across different parts of a program 3. The static nature of TypeScript ensures type verification at compile time, reducing runtime errors and enhancing code reliability.
With TypeScript, these kinds of errors are surfaced to compile time.
---
This strong typing system supports a variety of types, including numbers, strings, arrays, and classes, providing developers with a versatile toolkit for building robust applications 4.
Structural Typing
Structural typing in TypeScript offers significant flexibility, allowing functions to accept arguments of different types as long as they share the same structure. describes this as a key advantage over nominal typing, which requires explicit type declarations 5. This approach aligns with JavaScript's duck typing, where the focus is on the behavior of objects rather than their explicit types.
If it looks like a duck, walks like a duck, and quacks like a duck, it's a duck.
---
Developers can use type aliases or interfaces to define reusable shapes, enhancing code maintainability and readability 6.
Related Episodes


Episode 28: Type Systems
Answers 383 questions

Episode 402: Rich Harris on the Svelte JavaScript Framework
Answers 383 questions

Episode 140: Newspeak and Pluggable Types with Gilad Bracha
Answers 383 questions

SE-Radio Episode 248: Axel Rauschmayer on JavaScript and ECMAScript 6
Answers 383 questions

SE-Radio Episode 323: Lin Clark on WebAssembly
Answers 383 questions

SE Radio 557: Timothy Beamish on React and Next.js
Answers 383 questions

SE-Radio Episode 296: Type Driven Development with Edwin Brady
Answers 383 questions

Episode 36: Interview Guy Steele
Answers 383 questions

Episode 86: Interview Dave Thomas
Answers 383 questions

Episode 46: Refactoring Pt. 1
Answers 383 questions

Episode 97: Interview Anders Hejlsberg
Answers 383 questions

SE Radio 553: Luca Casonato on Deno
Answers 383 questions

Episode 55: Refactoring Pt. 2
Answers 383 questions

Episode 394: Chris McCord on Phoenix LiveView
Answers 383 questions














