Skip to content

Commit

Permalink
Update LKG
Browse files Browse the repository at this point in the history
  • Loading branch information
typescript-bot committed Jan 28, 2024
1 parent d3f2a17 commit e806758
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 26 deletions.
20 changes: 12 additions & 8 deletions lib/tsc.js
Expand Up @@ -3635,6 +3635,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
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";
Expand Down Expand Up @@ -3672,7 +3673,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
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 || {});
Expand Down Expand Up @@ -57482,7 +57483,7 @@ function createTypeChecker(host) {
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 */) {
Expand Down Expand Up @@ -57575,18 +57576,21 @@ function createTypeChecker(host) {
}
}
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) {
Expand Down Expand Up @@ -57684,10 +57688,10 @@ function createTypeChecker(host) {
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 */) {
Expand Down Expand Up @@ -57851,7 +57855,7 @@ function createTypeChecker(host) {
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)) {
Expand Down Expand Up @@ -57925,7 +57929,7 @@ function createTypeChecker(host) {
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 */) {
Expand Down
20 changes: 12 additions & 8 deletions lib/tsserver.js
Expand Up @@ -6659,6 +6659,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
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";
Expand Down Expand Up @@ -6696,7 +6697,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
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 || {});
Expand Down Expand Up @@ -62217,7 +62218,7 @@ function createTypeChecker(host) {
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 */) {
Expand Down Expand Up @@ -62310,18 +62311,21 @@ function createTypeChecker(host) {
}
}
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) {
Expand Down Expand Up @@ -62419,10 +62423,10 @@ function createTypeChecker(host) {
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 */) {
Expand Down Expand Up @@ -62586,7 +62590,7 @@ function createTypeChecker(host) {
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)) {
Expand Down Expand Up @@ -62660,7 +62664,7 @@ function createTypeChecker(host) {
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 */) {
Expand Down
2 changes: 1 addition & 1 deletion lib/typescript.d.ts
Expand Up @@ -205,7 +205,7 @@ declare namespace ts {
/**
* Request to reload the project structure for all the opened files
*/
interface ReloadProjectsRequest extends Message {
interface ReloadProjectsRequest extends Request {
command: CommandTypes.ReloadProjects;
}
/**
Expand Down
20 changes: 12 additions & 8 deletions lib/typescript.js
Expand Up @@ -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";
Expand Down Expand Up @@ -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 || {});
Expand Down Expand Up @@ -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 */) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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 */) {
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -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 */) {
Expand Down
3 changes: 2 additions & 1 deletion lib/typingsInstaller.js
Expand Up @@ -3069,6 +3069,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
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";
Expand Down Expand Up @@ -3106,7 +3107,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
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 || {});
Expand Down

0 comments on commit e806758

Please sign in to comment.