πŸ‘¨β€πŸ’Ό This is your chance to practice everything you've learned! This single file contains challenges covering all the TypeScript concepts from the workshop.

What You'll Practice

This exercise covers:
  1. Type Aliases & Interfaces - Creating reusable type definitions
  2. Union & Intersection Types - Combining and narrowing types
  3. Literal Types - Preserving specific values with as const
  4. Generics & Constraints - Writing flexible, reusable functions
  5. Discriminated Unions - Modeling complex state with type safety
  6. Any vs Unknown - Working safely with unknown data
  7. Complex Combinations - Putting it all together

Getting Started

🐨 Open
index.ts
and work through each section. Each section has 🐨 instructions explaining what to implement.
πŸ’° Start with the type definitions - they'll help TypeScript guide you as you implement the functions.
πŸ’° Use the test code at the bottom to verify your implementations work correctly.

Structure

The file is organized into sections. Work through them in order:
  1. Type Aliases & Interfaces - Build the foundation
  2. Union & Intersection Types - Combine types safely
  3. Literal Types - Create single sources of truth
  4. Generics & Constraints - Write reusable code
  5. Discriminated Unions - Model complex state
  6. Any vs Unknown - Handle unknown data safely
  7. Complex Combinations - Apply everything together

Tips

πŸ’° Don't worry about getting everything perfect on the first try. Experiment and learn!
πŸ’° Use TypeScript's error messages to guide you - they'll tell you what's missing or incorrect.
πŸ’° The discriminated union sections are great for practicing exhaustive checking with never.
πŸ’° Generic constraints ensure your functions work correctly with any type that meets the requirements.

No Tests, No Solutions

πŸ“ This is pure practice time! There are no tests or solutions. The goal is to build confidence by applying what you've learned. Try different approaches, make mistakes, and learn from them.

Please set the playground first