mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-11-18 20:11:14 +00:00
Check if switch statements are exhaustive when their expressions is generic with a literal type constraint (#60644)
This commit is contained in:
1 parent
97177722b8
commit
14c65b3119
5 files changed
+618
-1
No files matched your search
@@ -38682,7 +38682,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
// A missing not-equal flag indicates that the type wasn't handled by some case.
|
||||
return !someType(operandConstraint, t => getTypeFacts(t, notEqualFacts) === notEqualFacts);
|
||||
}
|
||||
const type = checkExpressionCached(node.expression);
|
||||
const type = getBaseConstraintOrType(checkExpressionCached(node.expression));
|
||||
if (!isLiteralType(type)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user