The Inexact Superclass Problem
summary
Claims that TypeScript’s mixin pattern for first‑class classes and dynamic inheritance is type‑unsound, and demonstrates a concrete counterexample: a mixin accepts a base whose compile‑time interface expects M(): string but at runtime the actual superclass provides M(): number, so method N() calling M() fails. Shows JavaScript/TypeScript code morphing into a runtime type error, and points to a practical fix in CP via coercive upcast proxies that hide extra methods.
AI-written summary · about
chapters (7)
- 0:00Inexact superclass problem
- 2:29Static vs dynamic inheritance
- 13:56TypeScript’s dynamic inheritance
- 20:28Core of inexact superclass problem
- 25:58Concrete example and error
- 27:05Solutions and language design
- 28:50Q&A
related talks
28mJavaScript inheritance: beyond the basics
45mTypes in Prototypes
27mThe TypeScript Completeness Conundrum
01h 05mBusy TypeScript Developer’s Guide to Advanced TypeScript
16mHidden Inheritance: An Inline Caching Design for TypeScript Performance
01h 02mExploring TypeScript
15mYou Might Not Need Classes
20mTypeScript and ES6
