Return type checking for conditional expressions, which resolved a pattern that had needed an assertion since 2021.
function parse(input: string, strict: true): Order
function parse(input: string, strict: false): Order | null
function parse(input: string, strict: boolean): Order | null {
const result = decode(input)
return strict
? result ?? raise(new InvalidOrder(input))
: result
}
// 5.7 widened the conditional and needed an assertion
// on the return. 5.8 checks each branch against the
// matching signature.
Overloads with a boolean discriminant are a common shape and the compiler had been unable to check the implementation against them, which meant the assertion was load-bearing and unverified. Removing eleven assertions is a small change and each one was a place the type system had been told to stop looking.