Loading topic
string, number, boolean, bigint and symbol. It assumes you know basic JavaScript syntax, can run code with tsc or an editor that reports TypeScript errors, and know what a data type is. The earlier chapter on static typing expl4 min readtsc or an editor that shows types on hover. It also assumes you know what string, number, and boolean are. The examples assume "strict": true in tsconfig.json, which is the setting most projects use.5 min read"Ada" for a const and string for a let that holds the same value. It also covers the places where this surprises people, such as object properties and function arguments. It assumes you can read basic TypeScript annotations and know that TypeScript4 min readtsc or use a TypeScript-aware editor. It covers how TypeScript types arrays, how tuples differ from arrays, and the errors people hit most often.4 min readstring, number, boolean), how type annotations and inference work, and that strictNullChecks is on. Everything below assumes "strict": true in tsconfig.json, which is the default for new projects created with tsc --init.4 min readtsc or use a TypeScript-aware editor. The examples assume strict mode is on, which includes noImplicitAny and strictNullChecks.4 min readtsc or an editor that reports TypeScript errors, and have read the earlier chapters on primitives, inference, and literal types. By the end you should know what strictNullChecks changes, how to handle values that might be missing,5 min readtsc or a TypeScript-aware editor, and have read the earlier chapters on inference and on const versus let widening. It covers literal types, union types, and the compiler errors people most often hit when combining them. Narrowi5 min readnull and undefined behave under strictNullChecks. Turn on strict in your tsconfig.json before you try the examples.4 min readtypeof narrowing, and what strict mode turns on in tsconfig.json. Both any and unknown describe a value whose type you don't know. They differ in what the compiler lets you do with that value.4 min readvoid and never. It assumes you can already type function parameters and return values. It also assumes you know unions, basic narrowing with typeof and ===, and that strictNullChecks is on (it is part 5 min read(a: number) => string, you know how inference works for variables, and you have used map, filter, or forEach. It covers how TypeScript types a function expression from the place where you wrote it, and what breaks when you move that fu4 min readany and unknown. It covers type assertions: what they do, when they are justified, and how they cause bugs.4 min readconst and let infer different types, how arrays and tuples are typed, what readonly does on a property, and how literal unions work. Here you will learn how a const assertion (as const) stops TypeScript from widening the literals in an expression. 4 min readsatisfies operator, which checks a value against a type without changing the type TypeScript infers for it. It assumes you know how inference works for const and let, how literal types widen, how union types and narrowing work, and what as const does. It also assumes 4 min read