Where we're going we don't need JavaScript - Programming with Type Annotations
Peter Kröner - 2 years ago
TypeScript's type annotations are more than just an addition to JavaScript - they are in fact a programming language in their own right! Types are essentially variables, generics work like function arguments and TypeScript's type annotations as a whole are a fully-features, functional DSL, embedded in JavaScript. And it's worth learning how to use this secret language! If we apply a programming mindset to types, we can unlock hidden superpowers that most TS users know very little about, but that have the potential to change how you think about types. This talk guides you through the implementation of a fairly basic message bus that we supercharge with type-level programming. Learn how mapped types, discriminated unions, conditional types and other advanced features to make the message bus type safe, simple to maintain and easy to use. By treating type annotations as a programming language, this talk opens up a new perspective on thinking in types for everyday TypeScript development.