mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-16 07:13:45 -05:00
Properly reduce intersections of string literal and template literal types (#41162)
* Properly reduce single element intersections * Add regression test * Accept new baselines
This commit is contained in:
@@ -13373,6 +13373,9 @@ namespace ts {
|
||||
includes & TypeFlags.VoidLike && includes & (TypeFlags.DisjointDomains & ~TypeFlags.VoidLike)) {
|
||||
return neverType;
|
||||
}
|
||||
if (includes & TypeFlags.TemplateLiteral && includes & TypeFlags.StringLiteral && extractRedundantTemplateLiterals(typeSet)) {
|
||||
return neverType;
|
||||
}
|
||||
if (includes & TypeFlags.Any) {
|
||||
return includes & TypeFlags.IncludesWildcard ? wildcardType : anyType;
|
||||
}
|
||||
@@ -13424,12 +13427,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (includes & TypeFlags.TemplateLiteral && includes & TypeFlags.StringLiteral && extractRedundantTemplateLiterals(typeSet)) {
|
||||
result = neverType;
|
||||
}
|
||||
else {
|
||||
result = createIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
|
||||
}
|
||||
result = createIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
|
||||
}
|
||||
intersectionTypes.set(id, result);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user