@@ -13361,7 +13361,7 @@ namespace ts {
13361
13361
return true;
13362
13362
}
13363
13363
13364
- function removeRedundantLiteralTypes(types: Type[], includes: TypeFlags) {
13364
+ function removeRedundantLiteralTypes(types: Type[], includes: TypeFlags, reduceVoidUndefined: boolean ) {
13365
13365
let i = types.length;
13366
13366
while (i > 0) {
13367
13367
i--;
@@ -13372,7 +13372,7 @@ namespace ts {
13372
13372
flags & TypeFlags.NumberLiteral && includes & TypeFlags.Number ||
13373
13373
flags & TypeFlags.BigIntLiteral && includes & TypeFlags.BigInt ||
13374
13374
flags & TypeFlags.UniqueESSymbol && includes & TypeFlags.ESSymbol ||
13375
- flags & TypeFlags.Undefined && includes & TypeFlags.Void ||
13375
+ reduceVoidUndefined && flags & TypeFlags.Undefined && includes & TypeFlags.Void ||
13376
13376
isFreshLiteralType(t) && containsType(types, (<LiteralType>t).regularType);
13377
13377
if (remove) {
13378
13378
orderedRemoveItemAt(types, i);
@@ -13440,7 +13440,7 @@ namespace ts {
13440
13440
}
13441
13441
if (unionReduction & (UnionReduction.Literal | UnionReduction.Subtype)) {
13442
13442
if (includes & (TypeFlags.Literal | TypeFlags.UniqueESSymbol) || includes & TypeFlags.Void && includes & TypeFlags.Undefined) {
13443
- removeRedundantLiteralTypes(typeSet, includes);
13443
+ removeRedundantLiteralTypes(typeSet, includes, !!(unionReduction & UnionReduction.Subtype) );
13444
13444
}
13445
13445
if (includes & TypeFlags.StringLiteral && includes & TypeFlags.TemplateLiteral) {
13446
13446
removeStringLiteralsMatchedByTemplateLiterals(typeSet);
0 commit comments