Fixed an issue with string mappings over generic intersections not being deferred in conditional types (#55856)

This commit is contained in:
Mateusz Burzyński
2023-10-26 06:36:11 -07:00
committed by GitHub
parent aa9b695344
commit 41ebfbf0aa
4 changed files with 136 additions and 1 deletions
+1 -1
View File
@@ -18008,7 +18008,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
function isPatternLiteralPlaceholderType(type: Type): boolean {
if (type.flags & TypeFlags.Intersection) {
return some((type as IntersectionType).types, t => !!(t.flags & (TypeFlags.Literal | TypeFlags.Null | TypeFlags.Undefined)) || isPatternLiteralPlaceholderType(t));
return !isGenericType(type) && some((type as IntersectionType).types, t => !!(t.flags & (TypeFlags.Literal | TypeFlags.Nullable)) || isPatternLiteralPlaceholderType(t));
}
return !!(type.flags & (TypeFlags.Any | TypeFlags.String | TypeFlags.Number | TypeFlags.BigInt)) || isPatternLiteralType(type);
}