Loading topic
string | number means. Here you will restrict a union to specific values, so the compiler rejects anything outside a fixed set.6 min readstring | number, you know which members are accessible on a union before narrowing, and you are comfortable with type aliases and function signatures. If a union still feels unfamiliar, review the earlier chapters on union basics and common memb6 min readtypeof, in, a6 min read& operator builds a type from several others, what you can do with the 5 min readA & B syntax for intersections. It covers what happens when the types you combine disagree. Sometimes a single property turns into never. Sometimes the whole intersection turns into never6 min read& intersection operator and interface ... extends. It assumes you know basic TypeScript syntax, type aliases, object types, and how union and intersection types work (covered in earlier chapters). You will learn 6 min readswitch on its tag. If any of that is unfamiliar, review the earlier chapters on those topics first.5 min readtype Box<T> = { value: T }. It also assumes you know basic conditional types of the form T extends U ? X : Y, and you have read the earlier chapters on unions, intersections, and never. You do not need to know infer in depth, bu6 min read| and &. It assumes you know union and intersection types on object types, narrowing, and how function parameters and return types are annotated. It also assumes you have met the idea that a function's parameters are checked i6 min read