Dummy function that casts a type for the remaining scope.
function (aOrB:"A"|"B") { if (aOrB.includes("A")) {// non narrowing condition castType<"A">(aOrB) } else { castType<"B">(aOrB) }} Copy
function (aOrB:"A"|"B") { if (aOrB.includes("A")) {// non narrowing condition castType<"A">(aOrB) } else { castType<"B">(aOrB) }}
Ideally this would return the value as well, but due to #34636 and #40562] this cannot be expressed in the type system.
Dummy function that casts a type for the remaining scope.
Ideally this would return the value as well, but due to #34636 and #40562] this cannot be expressed in the type system.