Update LKG

This commit is contained in:
TypeScript Bot
2024-01-28 10:24:38 +00:00
parent d3f2a17e7a
commit e80675868d
5 changed files with 39 additions and 26 deletions

View File

@@ -4412,6 +4412,7 @@ ${lanes.join("\n")}
TypeFlags2[TypeFlags2["NonPrimitive"] = 67108864] = "NonPrimitive";
TypeFlags2[TypeFlags2["TemplateLiteral"] = 134217728] = "TemplateLiteral";
TypeFlags2[TypeFlags2["StringMapping"] = 268435456] = "StringMapping";
TypeFlags2[TypeFlags2["Reserved1"] = 536870912] = "Reserved1";
TypeFlags2[TypeFlags2["AnyOrUnknown"] = 3] = "AnyOrUnknown";
TypeFlags2[TypeFlags2["Nullable"] = 98304] = "Nullable";
TypeFlags2[TypeFlags2["Literal"] = 2944] = "Literal";
@@ -4449,7 +4450,7 @@ ${lanes.join("\n")}
TypeFlags2[TypeFlags2["IncludesWildcard"] = 8388608 /* IndexedAccess */] = "IncludesWildcard";
TypeFlags2[TypeFlags2["IncludesEmptyObject"] = 16777216 /* Conditional */] = "IncludesEmptyObject";
TypeFlags2[TypeFlags2["IncludesInstantiable"] = 33554432 /* Substitution */] = "IncludesInstantiable";
TypeFlags2[TypeFlags2["IncludesConstrainedTypeVariable"] = 268435456 /* StringMapping */] = "IncludesConstrainedTypeVariable";
TypeFlags2[TypeFlags2["IncludesConstrainedTypeVariable"] = 536870912 /* Reserved1 */] = "IncludesConstrainedTypeVariable";
TypeFlags2[TypeFlags2["NotPrimitiveUnion"] = 36323331] = "NotPrimitiveUnion";
return TypeFlags2;
})(TypeFlags || {});
@@ -59971,7 +59972,7 @@ ${lanes.join("\n")}
if (flags & 465829888 /* Instantiable */)
includes |= 33554432 /* IncludesInstantiable */;
if (flags & 2097152 /* Intersection */ && getObjectFlags(type) & 67108864 /* IsConstrainedTypeVariable */)
includes |= 268435456 /* IncludesConstrainedTypeVariable */;
includes |= 536870912 /* IncludesConstrainedTypeVariable */;
if (type === wildcardType)
includes |= 8388608 /* IncludesWildcard */;
if (!strictNullChecks && flags & 98304 /* Nullable */) {
@@ -60064,18 +60065,21 @@ ${lanes.join("\n")}
}
}
function removeStringLiteralsMatchedByTemplateLiterals(types) {
const templates = filter(types, (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t));
const templates = filter(types, isPatternLiteralType);
if (templates.length) {
let i = types.length;
while (i > 0) {
i--;
const t = types[i];
if (t.flags & 128 /* StringLiteral */ && some(templates, (template) => isTypeMatchedByTemplateLiteralType(t, template))) {
if (t.flags & 128 /* StringLiteral */ && some(templates, (template) => isTypeMatchedByTemplateLiteralOrStringMapping(t, template))) {
orderedRemoveItemAt(types, i);
}
}
}
}
function isTypeMatchedByTemplateLiteralOrStringMapping(type, template) {
return template.flags & 134217728 /* TemplateLiteral */ ? isTypeMatchedByTemplateLiteralType(type, template) : isMemberOfStringMapping(type, template);
}
function removeConstrainedTypeVariables(types) {
const typeVariables = [];
for (const type of types) {
@@ -60173,10 +60177,10 @@ ${lanes.join("\n")}
if (includes & (32 /* Enum */ | 2944 /* Literal */ | 8192 /* UniqueESSymbol */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) || includes & 16384 /* Void */ && includes & 32768 /* Undefined */) {
removeRedundantLiteralTypes(typeSet, includes, !!(unionReduction & 2 /* Subtype */));
}
if (includes & 128 /* StringLiteral */ && includes & 134217728 /* TemplateLiteral */) {
if (includes & 128 /* StringLiteral */ && includes & (134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */)) {
removeStringLiteralsMatchedByTemplateLiterals(typeSet);
}
if (includes & 268435456 /* IncludesConstrainedTypeVariable */) {
if (includes & 536870912 /* IncludesConstrainedTypeVariable */) {
removeConstrainedTypeVariables(typeSet);
}
if (unionReduction === 2 /* Subtype */) {
@@ -60340,7 +60344,7 @@ ${lanes.join("\n")}
while (i > 0) {
i--;
const t = types[i];
if (!(t.flags & 134217728 /* TemplateLiteral */))
if (!(t.flags & (134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */)))
continue;
for (const t2 of literals) {
if (isTypeSubtypeOf(t2, t)) {
@@ -60414,7 +60418,7 @@ ${lanes.join("\n")}
if (strictNullChecks && includes & 98304 /* Nullable */ && includes & (524288 /* Object */ | 67108864 /* NonPrimitive */ | 16777216 /* IncludesEmptyObject */) || includes & 67108864 /* NonPrimitive */ && includes & (469892092 /* DisjointDomains */ & ~67108864 /* NonPrimitive */) || includes & 402653316 /* StringLike */ && includes & (469892092 /* DisjointDomains */ & ~402653316 /* StringLike */) || includes & 296 /* NumberLike */ && includes & (469892092 /* DisjointDomains */ & ~296 /* NumberLike */) || includes & 2112 /* BigIntLike */ && includes & (469892092 /* DisjointDomains */ & ~2112 /* BigIntLike */) || includes & 12288 /* ESSymbolLike */ && includes & (469892092 /* DisjointDomains */ & ~12288 /* ESSymbolLike */) || includes & 49152 /* VoidLike */ && includes & (469892092 /* DisjointDomains */ & ~49152 /* VoidLike */)) {
return neverType;
}
if (includes & 134217728 /* TemplateLiteral */ && includes & 128 /* StringLiteral */ && extractRedundantTemplateLiterals(typeSet)) {
if (includes & (134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) && includes & 128 /* StringLiteral */ && extractRedundantTemplateLiterals(typeSet)) {
return neverType;
}
if (includes & 1 /* Any */) {