diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 9ed6f52c38c..f71c629fc95 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -16939,7 +16939,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { if (includes & (TypeFlags.Enum | TypeFlags.Literal | TypeFlags.UniqueESSymbol | TypeFlags.TemplateLiteral | TypeFlags.StringMapping) || includes & TypeFlags.Void && includes & TypeFlags.Undefined) { removeRedundantLiteralTypes(typeSet, includes, !!(unionReduction & UnionReduction.Subtype)); } - if (includes & TypeFlags.StringLiteral && includes & TypeFlags.TemplateLiteral) { + if (unionReduction === UnionReduction.Subtype && (includes & TypeFlags.StringLiteral && includes & TypeFlags.TemplateLiteral)) { removeStringLiteralsMatchedByTemplateLiterals(typeSet); } if (unionReduction === UnionReduction.Subtype) {