> Markdown version of [/videos/496-advanced-typing-in-typescript?t=5](https://www.wearedevelopers.com/videos/496-advanced-typing-in-typescript?t=5). 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). --- # Advanced Typing in TypeScript Can you map JavaScript's unpredictable patterns into strongly typed systems? Learn to build a Pandas-like dataframe in TypeScript that catches complex schema mismatches strictly at compile time. - **Speakers:** Lars Hupel - **Event:** World Congress 2022 - **Published:** June 15, 2022 - **Duration:** 28:44 - **URL:** https://www.wearedevelopers.com/videos/496-advanced-typing-in-typescript ## Summary This presentation explores advanced TypeScript capabilities by mapping JavaScript's dynamic patterns into strongly typed systems, culminating in a prototype for a Pandas-like dataframe library. The session begins by dissecting DOM typings, specifically how `addEventListener` leverages string literals, the `keyof` operator, and indexed access types to dynamically change event handler signatures based on the event name. This demonstrates TypeScript's core strength: providing structural typing and deep inference to safely support JavaScript's inherently flexible and sometimes unpredictable patterns. Motivated by the runtime type errors often encountered in Python's Pandas dataframes, the speaker architects a TypeScript data pipeline where tables are strictly parameterized by structural record types. By defining columns generically, the library ensures that data operations strictly enforce homogeneous column types. The prototype showcases methods for selecting, calculating, and dropping columns, with TypeScript automatically inferring the shape and types of mutated dataframes—such as neatly deducing that multiplying two numerical columns computes a newly typed `number` series without explicit annotation. A critical engineering insight emerges regarding the friction between robust API design and internal library implementation. While the resulting consumer-facing API delivers flawless autocomplete and robust compile-time safety, the internal mechanics of complex generic transformations often outpace the compiler's tracking capabilities, necessitating manual type assertions under the hood. Ultimately, the methodology reveals how developers can build highly ergonomic, structurally typed data querying tools that catch schema mismatches at compile time rather than deeper within a runtime stack trace. **Keywords:** advanced typescript patterns, structural typing, type inference mechanics, typescript keyof operator, string literal types, dom event typings, pandas dataframe architecture, data pipeline type safety, typescript record utility, indexed access types, generic type assertions, compile-time schema validation, strongly typed dataframes, javascript type coercion, developer api ergonomics ## Chapters 1. **Core design principles and features of TypeScript** (00:05) — An overview of why TypeScript goes beyond simple data annotations to support dynamic behavior through structural typing and inference. 1. **Typing DOM events with advanced pattern mapping** (04:23) — How TypeScript handles complex overload scenarios and dynamically maps event types based on predefined string literals. 1. **Evaluating Python Pandas for data type safety** (10:22) — An exploration of common data science workflows and the lack of shape validation in traditional dataset libraries. 1. **Structuring a strongly typed table interface** (14:36) — Designing a reliable table schema model by leveraging generic type parameters and anonymous record types. 1. **Implementing the table and series type interfaces** (19:06) — Mapping strictly validated record keys to series elements to ensure that column operations conform to exact types. 1. **Validating typed dataframe operations in a node environment** (21:30) — Executing type-safe column selections, computations, and removals on tabular data to verify compiler inference rules. 1. **Handling partial objects and dynamic column type inference** (26:02) — Clarifying approaches to initialize all properties of a partial object and confirming that dynamic column additions resolve automatically. ## Related Moments - [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") - [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 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") - [TypeScript ecosystem integrations and AI code completion](https://www.wearedevelopers.com/videos/325-1-2-3-fastify) (from "1, 2, 3... Fastify!") ## Related Articles - [Exploring TypeScript: Benefits for Large-Scale JavaScript Projects](https://www.wearedevelopers.com/magazine/554-exploring-typescript-benefits-for-large-scale-javascript-projects) - [What is TypeScript?](https://www.wearedevelopers.com/magazine/47-what-is-typescript) - [Dev Digest 159: AI Pipelines, 10x Faster TypeScript, How to Interview](https://www.wearedevelopers.com/magazine/563-dev-digest-159-ai-pipelines-10x-faster-typescript-how-to-interview) - [Dev Digest 130 - The Diablo is in the details](https://www.wearedevelopers.com/magazine/470-dev-digest-130-the-diablo-is-in-the-details) ## Related Jobs - [Software Engineer](https://www.wearedevelopers.com/jobs/ext/1377585-software-engineer) at **Bitpanda** - [Software Engineer](https://www.wearedevelopers.com/jobs/ext/1304673-software-engineer) at **Bitpanda** - [Senior Software Engineer, Angular (B2C Web Platform)](https://www.wearedevelopers.com/jobs/ext/1927757-senior-software-engineer-angular-b2c-web-platform) at **Bitpanda** - [Senior Software Engineer, React (Investing & Trading)](https://www.wearedevelopers.com/jobs/ext/1937625-senior-software-engineer-react-investing-trading) at **Bitpanda** - [Backend Engineer, Python (Web3)](https://www.wearedevelopers.com/jobs/ext/1934515-backend-engineer-python-web3) 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**