Series
The TypeScript type system
Control flow analysis, narrowing, conditional types, and the places where the checker stops following an argument that a reader would have accepted.
- Parts
- 2
- Latest
- №01
Language internalsType-Level Narrowing: How TypeScript Decides What You Meant
Control flow analysis is a graph walk over your code. Knowing what widens a type again explains most of the errors that look wrong.
- №02
Language internalsYour Conditional Type Answered Twice. Both Answers Are Right.
A naked type parameter splits its union before the conditional runs, so IsArray<string[] | number> comes back as 'no' | 'yes'. Read out of TypeScript 7.0.2.