Changed type evaluator to elide NoReturn from union generated from or or and operator.

This commit is contained in:
Eric Traut 2021-10-30 11:51:20 -07:00
parent c70cee87ea
commit 4685207d28

View File

@ -9680,7 +9680,9 @@ export function createTypeEvaluator(importLookup: ImportLookup, evaluatorOptions
(rightSubtypeExpanded, rightSubtypeUnexpanded) => { (rightSubtypeExpanded, rightSubtypeUnexpanded) => {
// If the operator is an AND or OR, we need to combine the two types. // If the operator is an AND or OR, we need to combine the two types.
if (operator === OperatorType.And || operator === OperatorType.Or) { if (operator === OperatorType.And || operator === OperatorType.Or) {
return combineTypes([leftSubtypeUnexpanded, rightSubtypeUnexpanded]); return removeNoReturnFromUnion(
combineTypes([leftSubtypeUnexpanded, rightSubtypeUnexpanded])
);
} }
// The other boolean operators always return a bool value. // The other boolean operators always return a bool value.
return getBuiltInObject(errorNode, 'bool'); return getBuiltInObject(errorNode, 'bool');