Advanced TypeScript Type Utilities - Basarat Ali Syed - NDC Sydney 2022

preview_player
Показать описание
TypeScript is quickly becoming the dominant way to write maintainable JavaScript. To keep up with its adaption it had to evolve a pretty powerful type system.

This session will start off with a tour of powerful features like lookup types, mapped types, and conditional types that allow TypeScript types to be highly expressive. These features will incrementally build on each other till we arrive at the full ability to explore the built-in Type Utilities in TypeScript like Partial, Readonly, Omit, Exclude, etc. We will also look at how you can build your own utilities.

We wrap up with real-world libraries that make use of these powerful type functions to provide typesafe schema validation and RPC style API calls over HTTP.

Check out more of our featured speakers and talks at
Рекомендации по теме
Комментарии
Автор

I had a lot of fun preparing and presenting this. As always, thank you for hosting me ❤️🌹

basarat
Автор

00:00 Introduction
01:36 Aliases
03:56 Generics
06:56 Alias with Generics
07:47 Generic Type Function
09:44 Intesection Types
14:42 Lookup Types
17:15 Literal Unions

mamtachahal
Автор

Types have a hierarchy from top to bottom. `unknown` is the top type, `never` is the bottom type. `any` is magically both top and bottom at the same time.

barneylaurance
Автор

Don’t use <T>. Use <MeaningfulName>

johnzdanis