Loading topic
string, number, arrays, and object types. You should also know the difference between let and const, and understand union types and literal types such as "left" | "right".3 min readlet and const, union types, and typeof in type positions.3 min readlet and const. This chapter focuses on how as const changes the inferred type of an object literal.3 min readlet and const. You should also know that a tuple is an array type with a fixed number of positions, where each position can have a different type.3 min readlet versus const, union types, literal types, and typeof and keyof in type positions. It also assumes you have seen as const. The goal is to make one runtime value the source of truth for both your program data and a TypeScript union.3 min readas const. A readonly value cannot be changed through that type. This protects the caller from functions that might mutate their input.3 min readlet and const, union and literal types, and type operators such as typeof and keyof.2 min readtypeof, and keyof. You should also know the difference between a type annotation and a type assertion.3 min readtypeof, and keyof. This chapter compares two ways to represent a fixed set of named values: a plain object with as const and a TypeScript enum.3 min readtypeof, and keyof. It also assumes you understand that as const preserves literal types and adds readonly.3 min read