TypeScript tutorial
JavaScript with static types for dependable code.
23 lessonsExamples and guided walkthroughs
Course contents
Programming fundamentals
0102030405
TypeScript Types
Describe values before runtime.
TypeScript Union Types and Narrowing
Accept more than one type and narrow it safely with typeof.
TypeScript literal types and as const
Build a union of allowed strings from an object or array and make switch statements exhaustive.
TypeScript unknown and user-defined type guards
Validate parsed JSON at run time and let the compiler trust the result only after the check.
TypeScript tuples, readonly, and optional chaining
Return fixed-shape pairs, protect arrays from change, and read nested optional values safely.
Object-oriented programming
Data structures and algorithms
08091011
TypeScript Generics
Write one function that keeps the type of whatever it receives.
TypeScript generic stack and queue
Write containers that work for any element type and keep it checked.
TypeScript generic binary search tree
Order any type with a comparator function and collect the values in sorted order.
TypeScript typed comparators and multi-key sorting
Build comparators from a key with keyof, and combine them to sort by several fields.