@@ -18,7 +18,7 @@ and limitations under the License.
18
18
19
19
// src/compiler/corePublic.ts
20
20
var versionMajorMinor = "5.3";
21
- var version = "5.3.2 ";
21
+ var version = "5.3.3 ";
22
22
23
23
// src/compiler/core.ts
24
24
var emptyArray = [];
@@ -3678,7 +3678,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
3678
3678
TypeFlags2[TypeFlags2["InstantiablePrimitive"] = 406847488] = "InstantiablePrimitive";
3679
3679
TypeFlags2[TypeFlags2["Instantiable"] = 465829888] = "Instantiable";
3680
3680
TypeFlags2[TypeFlags2["StructuredOrInstantiable"] = 469499904] = "StructuredOrInstantiable";
3681
- TypeFlags2[TypeFlags2["ObjectFlagsType"] = 138117121 ] = "ObjectFlagsType";
3681
+ TypeFlags2[TypeFlags2["ObjectFlagsType"] = 3899393 ] = "ObjectFlagsType";
3682
3682
TypeFlags2[TypeFlags2["Simplifiable"] = 25165824] = "Simplifiable";
3683
3683
TypeFlags2[TypeFlags2["Singleton"] = 67358815] = "Singleton";
3684
3684
TypeFlags2[TypeFlags2["Narrowable"] = 536624127] = "Narrowable";
@@ -15971,7 +15971,7 @@ function getClassLikeDeclarationOfSymbol(symbol) {
15971
15971
return (_a = symbol.declarations) == null ? void 0 : _a.find(isClassLike);
15972
15972
}
15973
15973
function getObjectFlags(type) {
15974
- return type.flags & 138117121 /* ObjectFlagsType */ ? type.objectFlags : 0;
15974
+ return type.flags & 3899393 /* ObjectFlagsType */ ? type.objectFlags : 0;
15975
15975
}
15976
15976
function isUMDExportSymbol(symbol) {
15977
15977
return !!symbol && !!symbol.declarations && !!symbol.declarations[0] && isNamespaceExportDeclaration(symbol.declarations[0]);
@@ -56944,7 +56944,7 @@ function createTypeChecker(host) {
56944
56944
}
56945
56945
}
56946
56946
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));
56948
56948
if (templates.length) {
56949
56949
let i = types.length;
56950
56950
while (i > 0) {
@@ -57344,19 +57344,14 @@ function createTypeChecker(host) {
57344
57344
function getConstituentCountOfTypes(types) {
57345
57345
return reduceLeft(types, (n, t) => n + getConstituentCount(t), 0);
57346
57346
}
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
- }
57354
57347
function getTypeFromIntersectionTypeNode(node) {
57355
57348
const links = getNodeLinks(node);
57356
57349
if (!links.resolvedType) {
57357
57350
const aliasSymbol = getAliasSymbolForTypeNode(node);
57358
57351
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));
57360
57355
links.resolvedType = getIntersectionType(types, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol), noSupertypeReduction);
57361
57356
}
57362
57357
return links.resolvedType;
@@ -57568,11 +57563,6 @@ function createTypeChecker(host) {
57568
57563
}
57569
57564
function createTemplateLiteralType(texts, types) {
57570
57565
const type = createType(134217728 /* TemplateLiteral */);
57571
- type.objectFlags = getPropagatingFlagsOfTypes(
57572
- types,
57573
- /*excludeKinds*/
57574
- 98304 /* Nullable */
57575
- );
57576
57566
type.texts = texts;
57577
57567
type.types = types;
57578
57568
return type;
@@ -57867,7 +57857,15 @@ function createTypeChecker(host) {
57867
57857
}
57868
57858
function isPatternLiteralPlaceholderType(type) {
57869
57859
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;
57871
57869
}
57872
57870
return !!(type.flags & (1 /* Any */ | 4 /* String */ | 8 /* Number */ | 64 /* BigInt */)) || isPatternLiteralType(type);
57873
57871
}
@@ -57884,7 +57882,7 @@ function createTypeChecker(host) {
57884
57882
return !!(getGenericObjectFlags(type) & 8388608 /* IsGenericIndexType */);
57885
57883
}
57886
57884
function getGenericObjectFlags(type) {
57887
- if (type.flags & ( 3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */) ) {
57885
+ if (type.flags & 3145728 /* UnionOrIntersection */) {
57888
57886
if (!(type.objectFlags & 2097152 /* IsGenericTypeComputed */)) {
57889
57887
type.objectFlags |= 2097152 /* IsGenericTypeComputed */ | reduceLeft(type.types, (flags, t) => flags | getGenericObjectFlags(t), 0);
57890
57888
}
@@ -57896,7 +57894,7 @@ function createTypeChecker(host) {
57896
57894
}
57897
57895
return type.objectFlags & 12582912 /* IsGenericType */;
57898
57896
}
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);
57900
57898
}
57901
57899
function getSimplifiedType(type, writing) {
57902
57900
return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : type;
@@ -58922,7 +58920,7 @@ function createTypeChecker(host) {
58922
58920
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);
58923
58921
target.instantiations.set(id, result);
58924
58922
const resultObjectFlags = getObjectFlags(result);
58925
- if (result.flags & 138117121 /* ObjectFlagsType */ && !(resultObjectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
58923
+ if (result.flags & 3899393 /* ObjectFlagsType */ && !(resultObjectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
58926
58924
const resultCouldContainTypeVariables = some(typeArguments, couldContainTypeVariables);
58927
58925
if (!(getObjectFlags(result) & 524288 /* CouldContainTypeVariablesComputed */)) {
58928
58926
if (resultObjectFlags & (32 /* Mapped */ | 16 /* Anonymous */ | 4 /* Reference */)) {
@@ -63636,8 +63634,8 @@ function createTypeChecker(host) {
63636
63634
if (objectFlags & 524288 /* CouldContainTypeVariablesComputed */) {
63637
63635
return !!(objectFlags & 1048576 /* CouldContainTypeVariables */);
63638
63636
}
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 */) {
63641
63639
type.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (result ? 1048576 /* CouldContainTypeVariables */ : 0);
63642
63640
}
63643
63641
return result;
@@ -66155,10 +66153,10 @@ function createTypeChecker(host) {
66155
66153
if (isMatchingConstructorReference(right)) {
66156
66154
return narrowTypeByConstructor(type, operator, left, assumeTrue);
66157
66155
}
66158
- if (isBooleanLiteral(right)) {
66156
+ if (isBooleanLiteral(right) && !isAccessExpression(left) ) {
66159
66157
return narrowTypeByBooleanComparison(type, left, right, operator, assumeTrue);
66160
66158
}
66161
- if (isBooleanLiteral(left)) {
66159
+ if (isBooleanLiteral(left) && !isAccessExpression(right) ) {
66162
66160
return narrowTypeByBooleanComparison(type, right, left, operator, assumeTrue);
66163
66161
}
66164
66162
break;
0 commit comments