Skip to content

Commit 63717cf

Browse files
Bump version to 5.3.3 and LKG
1 parent 4c2afa7 commit 63717cf

File tree

8 files changed

+83
-86
lines changed

8 files changed

+83
-86
lines changed

Diff for: lib/tsc.js

+23-25
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ and limitations under the License.
1818

1919
// src/compiler/corePublic.ts
2020
var versionMajorMinor = "5.3";
21-
var version = "5.3.2";
21+
var version = "5.3.3";
2222

2323
// src/compiler/core.ts
2424
var emptyArray = [];
@@ -3678,7 +3678,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
36783678
TypeFlags2[TypeFlags2["InstantiablePrimitive"] = 406847488] = "InstantiablePrimitive";
36793679
TypeFlags2[TypeFlags2["Instantiable"] = 465829888] = "Instantiable";
36803680
TypeFlags2[TypeFlags2["StructuredOrInstantiable"] = 469499904] = "StructuredOrInstantiable";
3681-
TypeFlags2[TypeFlags2["ObjectFlagsType"] = 138117121] = "ObjectFlagsType";
3681+
TypeFlags2[TypeFlags2["ObjectFlagsType"] = 3899393] = "ObjectFlagsType";
36823682
TypeFlags2[TypeFlags2["Simplifiable"] = 25165824] = "Simplifiable";
36833683
TypeFlags2[TypeFlags2["Singleton"] = 67358815] = "Singleton";
36843684
TypeFlags2[TypeFlags2["Narrowable"] = 536624127] = "Narrowable";
@@ -15971,7 +15971,7 @@ function getClassLikeDeclarationOfSymbol(symbol) {
1597115971
return (_a = symbol.declarations) == null ? void 0 : _a.find(isClassLike);
1597215972
}
1597315973
function getObjectFlags(type) {
15974-
return type.flags & 138117121 /* ObjectFlagsType */ ? type.objectFlags : 0;
15974+
return type.flags & 3899393 /* ObjectFlagsType */ ? type.objectFlags : 0;
1597515975
}
1597615976
function isUMDExportSymbol(symbol) {
1597715977
return !!symbol && !!symbol.declarations && !!symbol.declarations[0] && isNamespaceExportDeclaration(symbol.declarations[0]);
@@ -56944,7 +56944,7 @@ function createTypeChecker(host) {
5694456944
}
5694556945
}
5694656946
function removeStringLiteralsMatchedByTemplateLiterals(types) {
56947-
const templates = filter(types, (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t) && t.types.every((t2) => !(t2.flags & 2097152 /* Intersection */) || !areIntersectedTypesAvoidingPrimitiveReduction(t2.types)));
56947+
const templates = filter(types, (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t));
5694856948
if (templates.length) {
5694956949
let i = types.length;
5695056950
while (i > 0) {
@@ -57344,19 +57344,14 @@ function createTypeChecker(host) {
5734457344
function getConstituentCountOfTypes(types) {
5734557345
return reduceLeft(types, (n, t) => n + getConstituentCount(t), 0);
5734657346
}
57347-
function areIntersectedTypesAvoidingPrimitiveReduction(types, primitiveFlags = 4 /* String */ | 8 /* Number */ | 64 /* BigInt */) {
57348-
if (types.length !== 2) {
57349-
return false;
57350-
}
57351-
const [t1, t2] = types;
57352-
return !!(t1.flags & primitiveFlags) && t2 === emptyTypeLiteralType || !!(t2.flags & primitiveFlags) && t1 === emptyTypeLiteralType;
57353-
}
5735457347
function getTypeFromIntersectionTypeNode(node) {
5735557348
const links = getNodeLinks(node);
5735657349
if (!links.resolvedType) {
5735757350
const aliasSymbol = getAliasSymbolForTypeNode(node);
5735857351
const types = map(node.types, getTypeFromTypeNode);
57359-
const noSupertypeReduction = areIntersectedTypesAvoidingPrimitiveReduction(types);
57352+
const emptyIndex = types.length === 2 ? types.indexOf(emptyTypeLiteralType) : -1;
57353+
const t = emptyIndex >= 0 ? types[1 - emptyIndex] : unknownType;
57354+
const noSupertypeReduction = !!(t.flags & (4 /* String */ | 8 /* Number */ | 64 /* BigInt */) || t.flags & 134217728 /* TemplateLiteral */ && isPatternLiteralType(t));
5736057355
links.resolvedType = getIntersectionType(types, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol), noSupertypeReduction);
5736157356
}
5736257357
return links.resolvedType;
@@ -57568,11 +57563,6 @@ function createTypeChecker(host) {
5756857563
}
5756957564
function createTemplateLiteralType(texts, types) {
5757057565
const type = createType(134217728 /* TemplateLiteral */);
57571-
type.objectFlags = getPropagatingFlagsOfTypes(
57572-
types,
57573-
/*excludeKinds*/
57574-
98304 /* Nullable */
57575-
);
5757657566
type.texts = texts;
5757757567
type.types = types;
5757857568
return type;
@@ -57867,7 +57857,15 @@ function createTypeChecker(host) {
5786757857
}
5786857858
function isPatternLiteralPlaceholderType(type) {
5786957859
if (type.flags & 2097152 /* Intersection */) {
57870-
return !isGenericType(type) && some(type.types, (t) => !!(t.flags & (2944 /* Literal */ | 98304 /* Nullable */)) || isPatternLiteralPlaceholderType(t));
57860+
let seenPlaceholder = false;
57861+
for (const t of type.types) {
57862+
if (t.flags & (2944 /* Literal */ | 98304 /* Nullable */) || isPatternLiteralPlaceholderType(t)) {
57863+
seenPlaceholder = true;
57864+
} else if (!(t.flags & 524288 /* Object */)) {
57865+
return false;
57866+
}
57867+
}
57868+
return seenPlaceholder;
5787157869
}
5787257870
return !!(type.flags & (1 /* Any */ | 4 /* String */ | 8 /* Number */ | 64 /* BigInt */)) || isPatternLiteralType(type);
5787357871
}
@@ -57884,7 +57882,7 @@ function createTypeChecker(host) {
5788457882
return !!(getGenericObjectFlags(type) & 8388608 /* IsGenericIndexType */);
5788557883
}
5788657884
function getGenericObjectFlags(type) {
57887-
if (type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */)) {
57885+
if (type.flags & 3145728 /* UnionOrIntersection */) {
5788857886
if (!(type.objectFlags & 2097152 /* IsGenericTypeComputed */)) {
5788957887
type.objectFlags |= 2097152 /* IsGenericTypeComputed */ | reduceLeft(type.types, (flags, t) => flags | getGenericObjectFlags(t), 0);
5789057888
}
@@ -57896,7 +57894,7 @@ function createTypeChecker(host) {
5789657894
}
5789757895
return type.objectFlags & 12582912 /* IsGenericType */;
5789857896
}
57899-
return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ | 268435456 /* StringMapping */) && !isPatternLiteralType(type) ? 8388608 /* IsGenericIndexType */ : 0);
57897+
return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) && !isPatternLiteralType(type) ? 8388608 /* IsGenericIndexType */ : 0);
5790057898
}
5790157899
function getSimplifiedType(type, writing) {
5790257900
return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : type;
@@ -58922,7 +58920,7 @@ function createTypeChecker(host) {
5892258920
result = target.objectFlags & 4 /* Reference */ ? createDeferredTypeReference(type.target, type.node, newMapper, newAliasSymbol, newAliasTypeArguments) : target.objectFlags & 32 /* Mapped */ ? instantiateMappedType(target, newMapper, newAliasSymbol, newAliasTypeArguments) : instantiateAnonymousType(target, newMapper, newAliasSymbol, newAliasTypeArguments);
5892358921
target.instantiations.set(id, result);
5892458922
const resultObjectFlags = getObjectFlags(result);
58925-
if (result.flags & 138117121 /* ObjectFlagsType */ && !(resultObjectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
58923+
if (result.flags & 3899393 /* ObjectFlagsType */ && !(resultObjectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
5892658924
const resultCouldContainTypeVariables = some(typeArguments, couldContainTypeVariables);
5892758925
if (!(getObjectFlags(result) & 524288 /* CouldContainTypeVariablesComputed */)) {
5892858926
if (resultObjectFlags & (32 /* Mapped */ | 16 /* Anonymous */ | 4 /* Reference */)) {
@@ -63636,8 +63634,8 @@ function createTypeChecker(host) {
6363663634
if (objectFlags & 524288 /* CouldContainTypeVariablesComputed */) {
6363763635
return !!(objectFlags & 1048576 /* CouldContainTypeVariables */);
6363863636
}
63639-
const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */) && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
63640-
if (type.flags & 138117121 /* ObjectFlagsType */) {
63637+
const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
63638+
if (type.flags & 3899393 /* ObjectFlagsType */) {
6364163639
type.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (result ? 1048576 /* CouldContainTypeVariables */ : 0);
6364263640
}
6364363641
return result;
@@ -66155,10 +66153,10 @@ function createTypeChecker(host) {
6615566153
if (isMatchingConstructorReference(right)) {
6615666154
return narrowTypeByConstructor(type, operator, left, assumeTrue);
6615766155
}
66158-
if (isBooleanLiteral(right)) {
66156+
if (isBooleanLiteral(right) && !isAccessExpression(left)) {
6615966157
return narrowTypeByBooleanComparison(type, left, right, operator, assumeTrue);
6616066158
}
66161-
if (isBooleanLiteral(left)) {
66159+
if (isBooleanLiteral(left) && !isAccessExpression(right)) {
6616266160
return narrowTypeByBooleanComparison(type, right, left, operator, assumeTrue);
6616366161
}
6616466162
break;

0 commit comments

Comments
 (0)