Loading topic
if and switch statements and have strict: true in your tsconfig.json. You don't need to know how narrowing works yet. A later chapter c5 min readstring | number, and if and switch statements. It also assumes strict: true in your tsconfig.json. Without strict mode, null and undefined are silently allowed in every type, and seve5 min readif and switch statements, and strict: true is on in your tsconfig.json. It covers which property can act as the tag of a discriminated union and how to choose one that works well.5 min readstrict: true in your tsconfig.json. Without strict mode, the errors shown below do not appear and the pattern loses most of its value.5 min readif and switch work, and your tsconfig.json has "strict": true. It also assumes you have seen a discriminated union defined, which is a union of object types that each carry a literal-typed tag property. Here you will see 5 min readswitch. It also assumes strict: true is set in tsconfig.json. Here you will learn how the compiler can prove that every variant is handled, and how to make a forgotten case fail the build.5 min readif and switch statements, and compile with strict: true. It also assumes you have seen a discriminated union (an object type with a literal kind or status property) and how switch narrows it. Here you use that pattern to de5 min readstrict: true is on. It also assumes you have a discriminated union like the Shape type from earlier chapters. Here you will learn how to pull pieces out of a union without copying them by hand.5 min readswitch or if. It also assumes you know how generic functions and type aliases like Array<T> work, and that strict is on in your tsconfig.4 min readif and switch use to narrow the type. It also assumes strict: true in your tsconfig.json. Narrowing on the discriminant and the never exhaustiveness check fr6 min readswitch, and that your tsconfig.json has strict: true. It covers the mistakes that most often make narrowing stop working, hide a missing case, or let bad data into a typed value.4 min readswitch and if. It also assumes strict: true in your tsconfig. Built-in narrowing works when the compiler already knows the value is a Shape. A custom type guard covers the case where it doesn't, such as pa5 min readswitch, never exhaustiveness checks, and the Result type. It also assumes strict: true in your tsconfig. The goal is to connect a union type to data the compiler cannot see: JSON from a network 5 min read