Skip to content

Total TS

Posted on:September 23, 2022 at 03:22 PM

Value level vs type level

Creating types from other types

1: Type tansformations

1.1 Inference basics

1.1.1 How to get the return type of a function

1.1.2 Extract Function Parameters Into A Type

1.1.3 Extract The Awaited Result of a Promise

1.1.4 Create a Union Type From an Object’s Keys

1.2 Unions and Indexing

1.2.1 Understand The Terminology Around Unions

1.2.2 Extracting Members of a Discriminated Union

1.2.3 Excluding Parts of a Discriminated Union

1.2.4 Resolve an Object’s Values as Literal Types

1.2.5 Create a UnionType From an Object’s Values

1.2.6 Create Unions out of Array Values

1.3 Template Literals

1.3.1 Only Allow Specified String Patterns

1.3.2 Extract Union Strings Matching a Pattern

1.3.3 Create a Union of Strings with all possible permutations of two unions

Splitting a string into a tuple

Create an Object Whose Keys Are Derived From a Union

Transform String Literals To Uppercase

1.4: Type helpers (Generics)

1.4.1 Creating a Maybe Type Helper

1.4.2 Ensure Type Safety in a Type Helper