> Markdown version of [/videos/455-where-we-re-going-we-don-t-need-javascript-programming-with-type-annotations?t=1381](https://www.wearedevelopers.com/videos/455-where-we-re-going-we-don-t-need-javascript-programming-with-type-annotations?t=1381). Every page supports `.md` or `Accept: text/markdown`. Links point to the HTML versions so they work for humans too. Agent guide: [/agents.md](https://www.wearedevelopers.com/agents.md). --- # Where we're going we don't need JavaScript - Programming with Type Annotations What if you could encode complex business logic entirely without JavaScript? Master TypeScript's Turing-complete type system to enforce strict, zero-runtime API contracts. - **Speakers:** [Peter Kröner](https://www.wearedevelopers.com/@peter-kroner) - **Event:** World Congress 2022 - **Published:** June 15, 2022 - **Duration:** 29:30 - **URL:** https://www.wearedevelopers.com/videos/455-where-we-re-going-we-don-t-need-javascript-programming-with-type-annotations ## Summary Treating TypeScript's type annotations purely as static checkers underutilizes their potential as a functional, set-based programming language. Anchored by the ongoing debate over the Turing completeness of the TypeScript type system, this approach advocates for encoding core business logic entirely at the type level. The practical catalyst for this paradigm is the underlying complexity of building browser extensions, where fragmented elements—like background scripts and devtools panels—interact through fragile, distributed message passing via the postMessage API. To tame this message-passing complexity, type-level programming bridges declarative rules with operational execution. By mapping variables to type aliases, functions to generics, and conditionals to extends clauses, developers can create robust business protocols. In modern message routing architectures, applying generic constraints and the keyof operator to accurately map a message kind to its specific payload guarantees that every dispatched message adheres strictly to predefined discriminated unions. This prevents invalid payloads at compile time without relying on unmaintainable function overloads. Deriving production API signatures directly from these base-truth type rules introduces robust type-level automation. Notable takeaways include harnessing TypeScript's foundational set theory—treating the never type as an empty set and understanding all types effectively as iterable unions—to naturally filter and transform data objects. This advanced logic management is completely erased during compilation, eliminating runtime performance penalties while seamlessly delegating the heavy lifting of API contract enforcement to the compiler. **Keywords:** typescript type annotations, type-level programming, set-based functional programming, turing complete type systems, browser extension architecture, distributed message passing, postmessage api typing, generic type functions, keyof operator constraints, discriminated union types, api contract enforcement, conditional typing syntax, typescript empty set never, payload map structures, business logic type automation ## Chapters 1. **Comparing JavaScript variables to TypeScript type annotations** (00:21) — How generic abstractions function as dynamic value factories rather than static variable assignments. 1. **Mapping standard JavaScript structures into TypeScript object definitions** (02:33) — Translating conventional arrays, record objects, and index configurations into purely abstract definitions. 1. **Filtering sets using logic conditionals and the never type** (06:12) — Utilizing explicit empty bounds and condition branches to build strict structural filters. 1. **Deriving programmatic business logic exclusively through pure type abstractions** (09:27) — Formulating standalone definitions to enforce reliable protocol consistency across extensive software boundaries. 1. **Establishing structured message routing protocols across distributed browser extensions** (13:46) — Structuring explicit communication parameters to synchronize operations securely between isolated runtime layers. 1. **Constraining generic function parameters utilizing the primary keyof operator** (18:25) — Extracting runtime string variations natively to prevent incorrect component requests and mismatches. 1. **Automating broad codebase validations via consistent type level constructs** (23:01) — Establishing deeply integrated verification environments relying exclusively upon strict set-based mathematical rules. 1. **Managing compilation performance and implementation specifics of advanced typing** (25:07) — Evaluating potential compiler sluggishness, syntax usage tradeoffs, and internal definition readability strategies. ## Related Moments - [Introduction to basic TypeScript capabilities and type annotations](https://www.wearedevelopers.com/videos/696-don-t-compromise-on-speedy-delivery-nor-type-safety-by-choosing-typescript) (from "Don't compromise on speedy delivery nor type-safety by choosing TypeScript") - [Core design principles and features of TypeScript](https://www.wearedevelopers.com/videos/496-advanced-typing-in-typescript) (from "Advanced Typing in TypeScript") - [The origins and early problems solved by TypeScript](https://www.wearedevelopers.com/videos/100061-typescript-features-that-changed-the-game) (from "TypeScript Features That Changed the Game") - [Exploring the benefits of type safety and TypeScript migration](https://www.wearedevelopers.com/videos/1302-wearedevelopers-live-dishonest-charts-britcss-debugging-with-ai) (from "WeAreDevelopers LIVE - Dishonest Charts, BritCSS, Debugging with AI") - [Core takeaways for end-to-end TypeScript development](https://www.wearedevelopers.com/videos/1580-end-to-end-typescript-completing-the-modern-development-stack) (from "End-to-End TypeScript: Completing the Modern Development Stack") - [Deciding when to adopt or avoid TypeScript](https://www.wearedevelopers.com/videos/127-vuejs-and-typescript-working-together-like-peanut-butter-and-jelly) (from "Vuejs and TypeScript- Working Together like Peanut Butter and Jelly") ## Related Articles - [What is TypeScript?](https://www.wearedevelopers.com/magazine/47-what-is-typescript) - [Exploring TypeScript: Benefits for Large-Scale JavaScript Projects](https://www.wearedevelopers.com/magazine/554-exploring-typescript-benefits-for-large-scale-javascript-projects) - [Dev Digest 136 - No JS(on) of mine](https://www.wearedevelopers.com/magazine/482-dev-digest-136-no-js-on-of-mine) - [Dev Digest 124 - None like it hot](https://www.wearedevelopers.com/magazine/460-dev-digest-124-none-like-it-hot) ## Related Jobs - [Senior Software Engineer](https://www.wearedevelopers.com/jobs/ext/15942-senior-software-engineer) at **GitHub** - [Software Engineer](https://www.wearedevelopers.com/jobs/ext/1304673-software-engineer) at **Bitpanda** - [Agile Full Stack Engineer](https://www.wearedevelopers.com/jobs/48325-agile-full-stack-engineer) at **synava GmbH** - [Software Engineer](https://www.wearedevelopers.com/jobs/ext/1377585-software-engineer) at **Bitpanda** - [Software Engineer, React & Angular (Broker Web Platform](https://www.wearedevelopers.com/jobs/ext/1558399-software-engineer-react-angular-broker-web-platform) at **Bitpanda** - [Software Engineer, React (Bitpanda Broker)](https://www.wearedevelopers.com/jobs/ext/1444421-software-engineer-react-bitpanda-broker) at **Bitpanda**