TypeScript: JavaScript with types

Catch mistakes before your code runs. Types, interfaces, generics, narrowing and the advanced types used in large apps.

Intermediate to expert · 11 lessons · about 110 minutes

Start the track
  1. Type annotations IntermediateTell TypeScript what kind of value each variable holds, and let it catch mistakes for you.7 min
  2. Typed functions IntermediateGive parameters and return values types, and use optional and default parameters.8 min
  3. Arrays and tuples IntermediateType lists of values, and fixed-length tuples where each position has its own type.8 min
  4. Objects and interfaces IntermediateDescribe the shape of objects with interfaces, with optional and read-only properties.9 min
  5. Union types and narrowing IntermediateAccept more than one type, and let TypeScript follow your checks to know which one you have.9 min
  6. Literal types and type aliases IntermediateAllow only specific values, name your own types, and make the compiler check every case.9 min
  7. Generics AdvancedWrite one function that works with any type while keeping full type safety.11 min
  8. Classes and access modifiers AdvancedBuild classes with private state, read-only fields and generic types, and make them implement interfaces.11 min
  9. Discriminated unions AdvancedModel data that comes in several shapes, and have the compiler prove you handled them all.12 min
  10. Utility types AdvancedDerive new types from existing ones with Partial, Pick, Omit, Readonly and Record.11 min
  11. keyof, mapped and conditional types ExpertWrite types that compute other types, the way libraries type their APIs.15 min
Track project · Reviewed by a mentor · PremiumProject: Library loans systemBuild a fully typed lending system for a school library, with loan rules, overdue books and results the compiler checks for you.