TypeScriptGenerics2

(0:00:00)Improving Type Inference with Additional Generics (0:02:52)How tRPC Handles Inheritable Generics (0:06:25)Refactoring Generics for a Cleaner API (0:08:02)Create a Factory Function to Apply Type Arguments to All Child Functions (0:10:13)The Partial Inference Problem (0:12:05)A Workaround for The Lack of Partial Inference (0:16:02)What is a Function Overload? (0:16:43)Understanding Function Overloads (0:17:50)Function Overloads vs. Conditional Types (0:18:22)Match Return Types with Function Overloads (0:21:50)Debugging Overloaded Functions (0:23:08)Specifying Types for an Overloaded Function (0:27:00)Function Overloads vs. Union Types (0:27:45)When to Use Overloads and Unions (0:29:47)Generics in Function Overloads (0:30:30)Typing Different Function Use Cases (0:33:19)Solving an Inference Mystery (0:34:19)The Inference Mystery Solved (0:40:28)Use Function Overloads to Infer Initial Data (0:41:45)Split Functions Into Two Different Call Signatures (0:43:55)The “Instantiated with Subtype“ Error (0:45:43)Handling Default Arguments with Function Overloads (0:49:34)Make An Infinite Scroll Function Generic with Correct Type Inference (0:50:51)Introduce a Type Parameter to Ensure Type Consistency (0:55:53)Create a Function with a Dynamic Number of Arguments (0:57:27)Use a Tuple to Represent a Dynamic Number of Arguments (1:01:11)Create a Pick Function (1:02:20)Extracting Object Properties with Reduce and Generics (1:10:14)Create a Form Validation Library (1:12:15)Add Strong Typing and Proper Error Handling to a Form Validator (1:18:49)Improve a Fetch Function to Handle Missing Type Arguments (1:20:09)Modify a Generic Type Default for Improved Error Messages (1:22:04)Typing a Function Composition with Overloads and Generics (1:24:25)Using Overloads and Generics to Type Function Composition (1:30:18)Build an Internationalization Library (1:32:49)Extract Types from Strings for an Internationalization Library
Back to Top