TypeScript
TypeScript Foundations
Add a type system to JavaScript: catch mistakes while you write, and model data so wrong states cannot be represented.
Helpful before you begin (optional -- you can start this course now): JavaScript Fundamentals
Who it's for
Developers comfortable with JavaScript who keep hitting bugs that a type system would have caught, and anyone joining a codebase that already uses TypeScript.
What you'll be able to do
- Annotate variables, functions, arrays, and objects so the compiler checks your intent
- Model data with interfaces, unions, and literal types instead of loose strings
- Narrow a union safely and handle values that might be null or undefined
- Write reusable generic functions and apply built-in utility types
Not started — 12 lessons, no account required.
Start this coursePractice this course →Add to a study plan →Interview questions →
From JavaScript to TypeScript
Why a type system pays for itself, and the syntax you will use constantly.
Describing data
Typing the two shapes almost all real data takes, then naming them.
Handling variation and absence
Values that could be one of several types, or missing entirely.
Reusable types
Typing behaviour, then writing types that work for many shapes at once.
- 22 min
Typing Functions
Annotate parameters, returns, optional and default arguments, and functions passed as values.
- 26 min
Generics
Write one function or type that works for many types without giving up checking.
- 22 min
Utility Types
Derive new types from existing ones with Partial, Pick, Omit, Record, and Readonly.
Precision and untrusted data
Narrowing types to exact values, and proving the shape of data you did not create.
- 20 min
Literal Types and const Assertions
Constrain a value to an exact set, and stop TypeScript widening the types you wanted narrow.
- 24 min
unknown, Type Guards, and Safe Assertions
Handle data whose shape you cannot trust, and learn why `as` is the escape hatch of last resort.
- 26 min
Modelling a Domain So Wrong States Cannot Exist
Bring the course together: use discriminated unions to make impossible states unrepresentable.
Where to go next
Optional -- these build well on what you just learned, but any course can come next.