The document discusses various advanced TypeScript techniques including branded types, type predicates, assertion functions, classes, generics, extracting types from external libraries, and more.
Download as TXT, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
37 views
Advanced TypeScript Patterns
The document discusses various advanced TypeScript techniques including branded types, type predicates, assertion functions, classes, generics, extracting types from external libraries, and more.
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2
Advanced Workshop Welcome
What is a Branded Type?
Form Validation with Branded Types Assigning Branded Types to Values Using Branded Types as Entity Id�s Add Branded Types to Functions and Models Creating Reusable Validity Checks with Branded Types and Type Helpers Combine Type Helpers with Branded Types Creating Validation Boundaries with Branded Types Using Branded Types to Validate Code Logic Using Index Signatures with Branded Types Indexing an Object with Branded Types TypeScript's Global Scope Add a Function to the Global Scope Add Functionality to Existing Global Interfaces Use Declaration Merging to Add Functionality to the Global Window Add Types to Properties of Global Namespaced Interfaces Typing process.env in the NodeJS Namespace Colocating Types for Global Interfaces Solving the Colocation Problem with Globals Filtering with Type Predicates Use a Type Predicate to Filter Types Checking Types with Assertion Functions Ensure Valid Types with an Assertion Function Avoiding TypeScript's Most Confusing Error Declare Assertion Functions Properly to Avoid Confusing Errors Combining Type Predicates with Generics Filtering with Type Predicates and Generics Combining Brands and Type Predicates Checking for Validity with Brands and Type Predicates Combining Brands with Assertion Functions Validate Types with Brands and Assertions Classes as Types and Values Using Classes in TypeScript Dive into Classes with Type Predicates Simplifying TypeScript with Type Predicates Assertion Functions and Classes Leverage Assertion Functions for Better Inference in Classes Class Implementation Following the Builder Pattern TRPC's Creator on the Builder Pattern Create a Type Safe Map with the Builder Pattern Getters and Setters in the Builder Pattern Debugging the Builder Pattern Default Generics in the Builder Pattern Building Chainable Middleware with the Builder Pattern The Power of Generics and the Builder Pattern Subclassing in Zod Where Do External Types Come From? Extract Types to Extend an External Library Retrieve Function Parameters from an External Library Navigating Lodash's Type Definitions Finding Proper Type Arguments and Generics with Lodash Passing Type Arguments with Lodash Navigating Express's Type Definitions Add Query Params to an Express Request Make an Express Request Function Generic Browsing Zod's Types Create a Runtime and Type Safe Function with Generics and Zod Infer Runtime Arguments from a Zod Schema Override External Library Types Create a Declarations File to Override Types Identity Functions as an Alternative to the `as const` Narrowing in an Identity Function for Better Inference Add Constraints to an Identity Function Constraining and Narrowing an Identity Function Specifying Where Inference Should Not Happen Fix Inference Issues with F.NoInfer Find the Generic Flow of an Identity Function Avoid Duplicate Code in an Identity Function with Generics Reverse Mapped Types Inference Inception in an Identity Function Merge Dynamic Objects with Global Objects Add Objects to the Global Scope Dynamically Narrowing with an Array Narrowing with Arrays and Generics Create a Type-Safe Request Handler with Zod and Express Type-Safe Request Handlers with Zod and Express Building a Dynamic Reducer Dynamic Reducer with Generic Types Custom JSX Elements Adding Custom Elements to JSX.IntrinsicElements