Composing Classes with TypeScript
summary
Argues that composition replaces brittle inheritance and shows concrete code that moves from a tangled superclass graph to an entity+component model, using a Pixel Weather demo that renders canvas sprites from the OpenWeatherMap API. Uses TypeScript features (generics, interfaces, experimental decorators avoided), ts-jest for on‑the‑fly testing, Rollup bundling, and a stubbed CanvasRenderingContext2D for unit tests. Demonstrates image renderable and loopable components and shows type‑checked constructor injection.
AI-written summary · about
chapters (9)
- 0:00Start
- 3:00TypeScript - A Brief Primer
- 8:46Inheritance in TypeScript
- 15:53Tight Coupling
- 17:33Difficult to Test
- 18:28impossible to Scale
- 25:56The Benefits of Composition
- 27:28Testing Components
- 29:22Summary
related talks
21mSuper TypeScript II Turbo – FP Remix
34mNot Your Uncle’s Clean Code (TypeScript Edition)
51mTypeScript - Beyond the Basics
49mTypescript + React
28mBuilding Considerate React Component APIs with TypeScript
42mTypeScript Patterns for Better React Components
27mAdvanced TypeScript: elegant solutions to common problems
41mIntroduction to TypeScript
