mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 12:51:30 -05:00
Fix narrowTypeBySwitchOnDiscriminant function
This commit is contained in:
@@ -12914,7 +12914,7 @@ namespace ts {
|
||||
const discriminantType = getUnionType(clauseTypes);
|
||||
const caseType =
|
||||
discriminantType.flags & TypeFlags.Never ? neverType :
|
||||
replacePrimitivesWithLiterals(filterType(type, t => isTypeComparableTo(discriminantType, t)), discriminantType);
|
||||
replacePrimitivesWithLiterals(filterType(type, t => areTypesComparable(discriminantType, t)), discriminantType);
|
||||
if (!hasDefaultClause) {
|
||||
return caseType;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user