TypeScript · Foundations
Learn TypeScript
The syntax and the mental model. Short, runnable, no fluff.
Learn the Basics
01
Hello, World!
Your first TypeScript file, and the two commands that check it and run it.
02
Variables and Types
TypeScript is JavaScript plus a type checker. This is where the types start — and where you stop writing var.
03
Arrays
TypeScript arrays are JavaScript arrays with an element type — `string[]` rather than a bag of anything.
04
Manipulating Arrays
Arrays can also function as a stack. The push and pop methods insert and remove variables from the end of an array.
05
Operators
The arithmetic, comparison and logical operators, and the two TypeScript-relevant ones: ?? and ?.
06
Conditions
The if statement allows us to check if an expression is equal to true or false, and execute different code according to the result.
07
Loops
for, for...of, for...in and while — and which one to reach for.
08
Objects
Objects hold keyed values, and in TypeScript the set of keys and their types is part of the type.
09
Functions
Functions are code blocks that can have arguments, and function have their own scope.
10
Pop-up Boxes
There are three types of pop-up boxes in javascript: confirm, alert, and prompt.
11
Callbacks
Passing a function to another function — and typing its signature so the parameters come out inferred.
12
Arrow Functions
Arrow functions are a feature of ES6, their behavior are generally the same of a function.
Advanced Tutorials
01
Object Oriented JavaScript
JavaScript uses functions as classes to create objects using the new keyword.
02
Function Context
Functions in JavaScript run in a specific context, and using the this variable we have access to it.
03
Inheritance
JavaScript uses prototype based inheritance.
04
Destructuring
Destructuring is a feature of ES6, introduced for making easier and cleaner some repetitive operations and assignments made in JS.
The Type System
01
Functions and Signatures
A function signature is the most valuable annotation you will write — it is a contract the compiler enforces at every call site.
02
Interfaces and Type Aliases
Naming the shape of your data is the point at which TypeScript starts paying for itself.
03
Union Types and Narrowing
A union says a value is one of several things. Narrowing is how you prove which one — and it is the most distinctively TypeScript skill there is.
04
Generics
A generic is a type with a hole in it. They look intimidating and the everyday use is genuinely simple.
05
Classes and Access Modifiers
TypeScript adds real access control, parameter properties and interface implementation to JavaScript classes.
06
Async and Promises
Typing asynchronous code, and the lint rule that catches the most common bug in TypeScript and JavaScript alike.
07
tsconfig and Strictness
The most important file in a TypeScript project. Four flags beyond strict do most of the real bug-catching, and all four are off by default.
Get the TypeScript agent pack
A battle-tested AGENTS.md, the review checklist, and the failure-mode cheat sheet for TypeScript. One email, then occasional updates when the tooling shifts. No course pitch.
AGENTS.md now — no email needed.