TypeScript
Learn TypeScript end to end. Types, interfaces, generics, classes, modules, utility and mapped types, declaration files, and the compiler.
18 lessons, in order
- 120 min
Hello, TypeScript
Here is a small JavaScript program that is completely broken, and that JavaScript will happily run:
What TypeScript isTsc compile stepRunning a .ts fileThe play button - 225 min
Type Basics
You can already run a .ts file. Now let's meet the basic building blocks: the primitive types TypeScript ships with, plus the two escape hatches (any...
Primitive typesStringNumberBooleanNullUndefined+3 - 325 min
Arrays and Tuples
A single value is rarely enough. You have a list of temperatures, a list of names, a list of prices. And the moment you have a list, a new kind of...
Array typesReadonly arraysTuple typesFixed-length tuplesNamed tuple elements - 425 min
Object Types and Interfaces
Primitives and arrays carry you a long way, but most real data has a shape: a user has a name and an age, a request has a method and a path, a result...
Object literal typesInterface keywordRequired vs optional propertiesStructural typingExcess property checks - 525 min
Functions
Functions are where most of the bugs live and where types pay off the most. A function's signature (its parameters and its return type) is a contract...
Parameter typesReturn typesVoid returnDefault parametersRest parametersFunction type expressions+1 - 625 min
Union and Literal Types
Some values are not one thing. A function that looks up a user either finds one or does not. A form field holds either a number the user typed or...
Union typesString literal typesNumeric literal typesLiteral narrowing with as constUnion of object shapes - 730 min
Type Narrowing
A union says "this value is one of several types". Narrowing is the compiler's process of figuring out which one, based on the runtime checks you...
Typeof narrowingTruthiness narrowingEquality narrowingIn operator narrowingInstanceof narrowingDiscriminated unions+1 - 820 min
Type Aliases vs Interfaces
You have been writing object shapes inline, and it has been fine because the shapes were small. Now here is a function signature from a real codebase:
Type aliasesInterface declarationsExtending interfacesIntersection typesDeclaration mergingWhen to pick which - 925 min
Optional, Readonly, and Nullable
The single most common runtime error in JavaScript reads like this:
Optional propertiesReadonly propertiesNon-null assertion operatorOptional chainingNullish coalescingStrictNullChecks - 1020 min
Enums
Some values come from a short, fixed list. An order is pending, shipped or delivered. A log line is debug, info, warn or error. A direction is up,...
Numeric enumsString enumsConst enumsEnums vs string literal unionsReverse mapping caveats - 1130 min
Generics
You need a function that takes an array and returns its first element. Easy:
Generic functionsGeneric interfacesType parametersType inference for genericsBounded generics with extendsDefault type parameters - 1225 min
Classes
Here is a bank account written as a plain object:
Class declarationsConstructorsInstance propertiesAccess modifiers (public, private, protected)Readonly fieldsParameter properties+1 - 1325 min
Inheritance and Abstract Classes
You have written three classes for a payments system: CardPayment, BankTransfer and Voucher. All three have an amount, a currency and a createdAt....
Extends keywordSuper callsMethod overrideAbstract classesAbstract methodsImplements with interface - 1425 min
Modules
Every TypeScript file is its own module. The moment a file has an import or export, its top-level names stop being globals and become module-scoped....
ES module syntaxNamed exportsDefault exportType-only importsRe-exportsModule resolution basics - 1530 min
Utility Types
TypeScript ships with a small library of generic types that take a type as input and return a transformed type as output. They have unassuming names...
Partial<T>Required<T>Readonly<T>Pick<T, K>Omit<T, K>Record<K, V>+2 - 1630 min
Mapped and Conditional Types
The utility types you just used (Partial, Pick, Record, ReturnType) are all built from two language features: mapped types for transforming the keys...
Keyof operatorMapped types syntaxKey remapping with asConditional typesInfer keywordDistributive conditional types - 1725 min
Declaration Files and Libraries
You install a library, import it, and your editor lights up with autocomplete, parameter hints and the exact shape of every return value. You install...
.d.ts filesDefinitelyTyped (@types packages)Ambient declarationsDeclare moduleTypeRoots and types option - 1830 min
tsconfig and the Compiler
tsconfig.json is the file the TypeScript compiler reads to figure out what to compile and how. There are over a hundred options, but a real project...
Tsconfig.jsonStrict modeTarget and libModule and moduleResolutionOutDir and rootDirIncremental and watch+1
Learn TypeScript in your language
Every lesson, quiz, and tutor reply renders in your language. The AI tutor matches the language you ask in.
Roles that use TypeScript
See how hiring teams interview engineers on TypeScript, in production-like environments.
Frontend Engineer (React, Angular, Vue)
Hire frontend engineers in real workspaces with Vite, real component libraries and real performance budgets. Live or take-home, fully recorded.
See the interviewFull Stack Developer
Hire full stack developers in real apps with real APIs, real UIs and real tests. Live or take-home, fully recorded.
See the interviewWeb Application Engineer
Hire web application engineers in real apps with real routes, real auth and real test suites. Live or take-home, fully recorded.
See the interview