Wun Code
TypeScript

Advanced Types

Learn generics, discriminated unions and utility types, and see how the type system becomes a tool for designing your program.

Start the trackFree, no sign-up needed

What you'll learn

  • GenericsThe return type follows the input type
  • Generic constraintsRequire only what you need
  • Indexed access with keyofA key that exists and a value of the right type
  • Deriving typesOne type that all the others come from
  • Discriminated unionsAn impossible state can't be written
  • Covering every caseA forgotten case stops the build
  • Type guardsFrom unknown to a type you can trust
  • Looping over keysA type built from another type's keys
  • as const and satisfiesCheck the shape without widening the type
  • Promise typesEvery await gets its own type

Track contents

10 lessons, 2 hours in total
  1. 1GenericsTypeScriptThe return type follows the input type
  2. 2Generic constraintsTypeScriptRequire only what you need
  3. 3Indexed access with keyofTypeScriptA key that exists and a value of the right type
  4. 4Deriving typesTypeScriptOne type that all the others come from
  5. 5Discriminated unionsTypeScriptAn impossible state can't be written
  6. 6Covering every caseTypeScriptA forgotten case stops the build
  7. 7Type guardsTypeScriptFrom unknown to a type you can trust
  8. 8Looping over keysTypeScriptA type built from another type's keys
  9. 9as const and satisfiesTypeScriptCheck the shape without widening the type
  10. 10Promise typesTypeScriptEvery await gets its own type