Loading topic
? and readonly modifiers on a property change that relation. The 4 min readconst and let differ in JavaScript. It explains why a value that looks right can fail to be assigned to a union of literals, and how to fix it.4 min readA | B) or an intersection (A & B).4 min readT[], tuples, and readonly arrays relate to each other as source and target types.4 min readstrictFunctionTypes rule for function parameters, and the idea of variance from the earlier chapters. It covers how the compiler decides whether Box<string> can be used where Box<string | number> is expected, and how generi3 min readpublic, private, and protected modifiers. Here you will see where classes follow th3 min readenum declaration. Enums are a special case in the compatibility rules. They behave like structural types in some places and like nominal typ4 min readstrictFunctionTypes. A type system is sound if a program that passes the checker can never hold a value whose runtime type differs from its static type. TypeScript does not aim for that. Its design goals li4 min readexpr as T, which is looser than assignability but not unlimited.4 min read