Types basics

This part is the type notes themselves: strings, numbers and booleans first, then any, unknown and never, arrays and tuples, type aliases and interfaces, and the unions and literal values that replace a plain string. Every example is checked by the compiler before it runs.

05 Basic types annotate strings, numbers and booleans, and let TypeScript infer what it already knows Open 06 any, unknown, never any opts out of checking, unknown forces a check first, never marks code that cannot return Open 07 Arrays and tuples string[] and Array syntax, tuples for fixed pairs, and readonly arrays Open 08 Type aliases name reusable types with type, compose them into objects, and compare them with interfaces Open 09 Interfaces object shapes with interfaces, optional and readonly members, and one interface extending another Open 10 Unions and literals unions, narrowing with typeof, literal values, and when a union beats an enum Open

Lessons