@typescript-deploys/pr-build 5.1.0-pr-53192-9 → 5.1.0-pr-53098-13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tsc.js +36 -54
- package/lib/tsserver.js +46 -54
- package/lib/tsserverlibrary.js +46 -55
- package/lib/typescript.js +45 -55
- package/lib/typingsInstaller.js +1 -1
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -3743,7 +3743,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
|
|
|
3743
3743
|
TypeFlags2[TypeFlags2["IncludesWildcard"] = 8388608 /* IndexedAccess */] = "IncludesWildcard";
|
|
3744
3744
|
TypeFlags2[TypeFlags2["IncludesEmptyObject"] = 16777216 /* Conditional */] = "IncludesEmptyObject";
|
|
3745
3745
|
TypeFlags2[TypeFlags2["IncludesInstantiable"] = 33554432 /* Substitution */] = "IncludesInstantiable";
|
|
3746
|
-
TypeFlags2[TypeFlags2["NotPrimitiveUnion"] =
|
|
3746
|
+
TypeFlags2[TypeFlags2["NotPrimitiveUnion"] = 36323363] = "NotPrimitiveUnion";
|
|
3747
3747
|
return TypeFlags2;
|
|
3748
3748
|
})(TypeFlags || {});
|
|
3749
3749
|
var ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => {
|
|
@@ -42675,6 +42675,7 @@ function createTypeChecker(host) {
|
|
|
42675
42675
|
var noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
|
|
42676
42676
|
var useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
|
|
42677
42677
|
var keyofStringsOnly = !!compilerOptions.keyofStringsOnly;
|
|
42678
|
+
var defaultIndexFlags = keyofStringsOnly ? 1 /* StringsOnly */ : 0 /* None */;
|
|
42678
42679
|
var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 8192 /* FreshLiteral */;
|
|
42679
42680
|
var exactOptionalPropertyTypes = compilerOptions.exactOptionalPropertyTypes;
|
|
42680
42681
|
var checkBinaryExpression = createCheckBinaryExpression();
|
|
@@ -53943,6 +53944,13 @@ function createTypeChecker(host) {
|
|
|
53943
53944
|
function isConflictingPrivateProperty(prop) {
|
|
53944
53945
|
return !prop.valueDeclaration && !!(getCheckFlags(prop) & 1024 /* ContainsPrivate */);
|
|
53945
53946
|
}
|
|
53947
|
+
function isGenericReducibleType(type) {
|
|
53948
|
+
return !!(type.flags & 1048576 /* Union */ && type.objectFlags & 16777216 /* ContainsIntersections */ && some(type.types, isGenericReducibleType) || type.flags & 2097152 /* Intersection */ && isReducibleIntersection(type));
|
|
53949
|
+
}
|
|
53950
|
+
function isReducibleIntersection(type) {
|
|
53951
|
+
const uniqueFilled = type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper));
|
|
53952
|
+
return getReducedType(uniqueFilled) !== uniqueFilled;
|
|
53953
|
+
}
|
|
53946
53954
|
function elaborateNeverIntersection(errorInfo, type) {
|
|
53947
53955
|
if (type.flags & 2097152 /* Intersection */ && getObjectFlags(type) & 33554432 /* IsNeverIntersection */) {
|
|
53948
53956
|
const neverProp = find(getPropertiesOfUnionOrIntersectionType(type), isDiscriminantWithNeverType);
|
|
@@ -55995,7 +56003,7 @@ function createTypeChecker(host) {
|
|
|
55995
56003
|
origin = createOriginUnionOrIntersectionType(1048576 /* Union */, reducedTypes);
|
|
55996
56004
|
}
|
|
55997
56005
|
}
|
|
55998
|
-
const objectFlags = (includes &
|
|
56006
|
+
const objectFlags = (includes & 36323363 /* NotPrimitiveUnion */ ? 0 : 32768 /* PrimitiveUnion */) | (includes & 2097152 /* Intersection */ ? 16777216 /* ContainsIntersections */ : 0);
|
|
55999
56007
|
return getUnionTypeFromSortedList(typeSet, objectFlags, aliasSymbol, aliasTypeArguments, origin);
|
|
56000
56008
|
}
|
|
56001
56009
|
function getUnionOrIntersectionTypePredicate(signatures, kind) {
|
|
@@ -56120,7 +56128,7 @@ function createTypeChecker(host) {
|
|
|
56120
56128
|
function eachUnionContains(unionTypes2, type) {
|
|
56121
56129
|
for (const u of unionTypes2) {
|
|
56122
56130
|
if (!containsType(u.types, type)) {
|
|
56123
|
-
const primitive = type.flags & 128 /* StringLiteral */ ? stringType : type.flags &
|
|
56131
|
+
const primitive = type.flags & 128 /* StringLiteral */ ? stringType : type.flags & 256 /* NumberLiteral */ ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 8192 /* UniqueESSymbol */ ? esSymbolType : void 0;
|
|
56124
56132
|
if (!primitive || !containsType(u.types, primitive)) {
|
|
56125
56133
|
return false;
|
|
56126
56134
|
}
|
|
@@ -56147,6 +56155,9 @@ function createTypeChecker(host) {
|
|
|
56147
56155
|
}
|
|
56148
56156
|
return false;
|
|
56149
56157
|
}
|
|
56158
|
+
function eachIsUnionContaining(types, flag) {
|
|
56159
|
+
return every(types, (t) => !!(t.flags & 1048576 /* Union */) && some(t.types, (tt) => !!(tt.flags & flag)));
|
|
56160
|
+
}
|
|
56150
56161
|
function removeFromEach(types, flag) {
|
|
56151
56162
|
for (let i = 0; i < types.length; i++) {
|
|
56152
56163
|
types[i] = filterType(types[i], (t) => !(t.flags & flag));
|
|
@@ -56235,11 +56246,11 @@ function createTypeChecker(host) {
|
|
|
56235
56246
|
if (includes & 1048576 /* Union */) {
|
|
56236
56247
|
if (intersectUnionsOfPrimitiveTypes(typeSet)) {
|
|
56237
56248
|
result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
|
|
56238
|
-
} else if (
|
|
56249
|
+
} else if (eachIsUnionContaining(typeSet, 32768 /* Undefined */)) {
|
|
56239
56250
|
const containedUndefinedType = some(typeSet, containsMissingType) ? missingType : undefinedType;
|
|
56240
56251
|
removeFromEach(typeSet, 32768 /* Undefined */);
|
|
56241
56252
|
result = getUnionType([getIntersectionType(typeSet), containedUndefinedType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
56242
|
-
} else if (
|
|
56253
|
+
} else if (eachIsUnionContaining(typeSet, 65536 /* Null */)) {
|
|
56243
56254
|
removeFromEach(typeSet, 65536 /* Null */);
|
|
56244
56255
|
result = getUnionType([getIntersectionType(typeSet), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
56245
56256
|
} else {
|
|
@@ -56309,10 +56320,10 @@ function createTypeChecker(host) {
|
|
|
56309
56320
|
}
|
|
56310
56321
|
return links.resolvedType;
|
|
56311
56322
|
}
|
|
56312
|
-
function createIndexType(type,
|
|
56323
|
+
function createIndexType(type, indexFlags) {
|
|
56313
56324
|
const result = createType(4194304 /* Index */);
|
|
56314
56325
|
result.type = type;
|
|
56315
|
-
result.
|
|
56326
|
+
result.indexFlags = indexFlags;
|
|
56316
56327
|
return result;
|
|
56317
56328
|
}
|
|
56318
56329
|
function createOriginIndexType(type) {
|
|
@@ -56320,31 +56331,23 @@ function createTypeChecker(host) {
|
|
|
56320
56331
|
result.type = type;
|
|
56321
56332
|
return result;
|
|
56322
56333
|
}
|
|
56323
|
-
function getIndexTypeForGenericType(type,
|
|
56324
|
-
return
|
|
56325
|
-
type,
|
|
56326
|
-
/*stringsOnly*/
|
|
56327
|
-
true
|
|
56328
|
-
)) : type.resolvedIndexType || (type.resolvedIndexType = createIndexType(
|
|
56329
|
-
type,
|
|
56330
|
-
/*stringsOnly*/
|
|
56331
|
-
false
|
|
56332
|
-
));
|
|
56334
|
+
function getIndexTypeForGenericType(type, indexFlags) {
|
|
56335
|
+
return indexFlags & 1 /* StringsOnly */ ? type.resolvedStringIndexType || (type.resolvedStringIndexType = createIndexType(type, 1 /* StringsOnly */)) : type.resolvedIndexType || (type.resolvedIndexType = createIndexType(type, 0 /* None */));
|
|
56333
56336
|
}
|
|
56334
|
-
function getIndexTypeForMappedType(type,
|
|
56337
|
+
function getIndexTypeForMappedType(type, indexFlags) {
|
|
56335
56338
|
const typeParameter = getTypeParameterFromMappedType(type);
|
|
56336
56339
|
const constraintType = getConstraintTypeFromMappedType(type);
|
|
56337
56340
|
const nameType = getNameTypeFromMappedType(type.target || type);
|
|
56338
|
-
if (!nameType && !
|
|
56341
|
+
if (!nameType && !(indexFlags & 2 /* NoIndexSignatures */)) {
|
|
56339
56342
|
return constraintType;
|
|
56340
56343
|
}
|
|
56341
56344
|
const keyTypes = [];
|
|
56342
56345
|
if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
|
|
56343
56346
|
if (!isGenericIndexType(constraintType)) {
|
|
56344
56347
|
const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
|
|
56345
|
-
forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */,
|
|
56348
|
+
forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */, !!(indexFlags & 1 /* StringsOnly */), addMemberForKeyType);
|
|
56346
56349
|
} else {
|
|
56347
|
-
return getIndexTypeForGenericType(type,
|
|
56350
|
+
return getIndexTypeForGenericType(type, indexFlags);
|
|
56348
56351
|
}
|
|
56349
56352
|
} else {
|
|
56350
56353
|
forEachType(getLowerBoundOfKeyType(constraintType), addMemberForKeyType);
|
|
@@ -56352,7 +56355,7 @@ function createTypeChecker(host) {
|
|
|
56352
56355
|
if (isGenericIndexType(constraintType)) {
|
|
56353
56356
|
forEachType(constraintType, addMemberForKeyType);
|
|
56354
56357
|
}
|
|
56355
|
-
const result =
|
|
56358
|
+
const result = indexFlags & 2 /* NoIndexSignatures */ ? filterType(getUnionType(keyTypes), (t) => !(t.flags & (1 /* Any */ | 4 /* String */))) : getUnionType(keyTypes);
|
|
56356
56359
|
if (result.flags & 1048576 /* Union */ && constraintType.flags & 1048576 /* Union */ && getTypeListId(result.types) === getTypeListId(constraintType.types)) {
|
|
56357
56360
|
return constraintType;
|
|
56358
56361
|
}
|
|
@@ -56405,19 +56408,15 @@ function createTypeChecker(host) {
|
|
|
56405
56408
|
origin
|
|
56406
56409
|
);
|
|
56407
56410
|
}
|
|
56408
|
-
function
|
|
56409
|
-
|
|
56410
|
-
return getReducedType(uniqueFilled) !== uniqueFilled;
|
|
56411
|
+
function shouldDeferIndexType(type, indexFlags = 0 /* None */) {
|
|
56412
|
+
return !!(type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericTupleType(type) || isGenericMappedType(type) && !hasDistributiveNameType(type) || type.flags & 1048576 /* Union */ && !(indexFlags & 4 /* NoReducibleCheck */) && isGenericReducibleType(type) || type.flags & 2097152 /* Intersection */ && maybeTypeOfKind(type, 465829888 /* Instantiable */) && some(type.types, isEmptyAnonymousObjectType));
|
|
56411
56413
|
}
|
|
56412
|
-
function
|
|
56413
|
-
return !!(type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericTupleType(type) || isGenericMappedType(type) && !hasDistributiveNameType(type) || type.flags & 1048576 /* Union */ && some(type.types, isPossiblyReducibleByInstantiation) || type.flags & 2097152 /* Intersection */ && maybeTypeOfKind(type, 465829888 /* Instantiable */) && some(type.types, isEmptyAnonymousObjectType));
|
|
56414
|
-
}
|
|
56415
|
-
function getIndexType(type, stringsOnly = keyofStringsOnly, noIndexSignatures) {
|
|
56414
|
+
function getIndexType(type, indexFlags = defaultIndexFlags) {
|
|
56416
56415
|
type = getReducedType(type);
|
|
56417
|
-
return shouldDeferIndexType(type) ? getIndexTypeForGenericType(type,
|
|
56416
|
+
return shouldDeferIndexType(type, indexFlags) ? getIndexTypeForGenericType(type, indexFlags) : type.flags & 1048576 /* Union */ ? getIntersectionType(map(type.types, (t) => getIndexType(t, indexFlags))) : type.flags & 2097152 /* Intersection */ ? getUnionType(map(type.types, (t) => getIndexType(t, indexFlags))) : getObjectFlags(type) & 32 /* Mapped */ ? getIndexTypeForMappedType(type, indexFlags) : type === wildcardType ? wildcardType : type.flags & 2 /* Unknown */ ? neverType : type.flags & (1 /* Any */ | 131072 /* Never */) ? keyofConstraintType : getLiteralTypeFromProperties(
|
|
56418
56417
|
type,
|
|
56419
|
-
(
|
|
56420
|
-
|
|
56418
|
+
(indexFlags & 2 /* NoIndexSignatures */ ? 128 /* StringLiteral */ : 402653316 /* StringLike */) | (indexFlags & 1 /* StringsOnly */ ? 0 : 296 /* NumberLike */ | 12288 /* ESSymbolLike */),
|
|
56419
|
+
indexFlags === defaultIndexFlags
|
|
56421
56420
|
);
|
|
56422
56421
|
}
|
|
56423
56422
|
function getExtractStringType(type) {
|
|
@@ -56957,12 +56956,13 @@ function createTypeChecker(host) {
|
|
|
56957
56956
|
if (objectType === wildcardType || indexType === wildcardType) {
|
|
56958
56957
|
return wildcardType;
|
|
56959
56958
|
}
|
|
56959
|
+
objectType = getReducedType(objectType);
|
|
56960
56960
|
if (isStringIndexSignatureOnlyType(objectType) && !(indexType.flags & 98304 /* Nullable */) && isTypeAssignableToKind(indexType, 4 /* String */ | 8 /* Number */)) {
|
|
56961
56961
|
indexType = stringType;
|
|
56962
56962
|
}
|
|
56963
56963
|
if (compilerOptions.noUncheckedIndexedAccess && accessFlags & 32 /* ExpressionPosition */)
|
|
56964
56964
|
accessFlags |= 1 /* IncludeUndefined */;
|
|
56965
|
-
if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 197 /* IndexedAccessType */ ? isGenericTupleType(objectType) && !indexTypeLessThan(indexType, objectType.target.fixedLength) : isGenericObjectType(objectType) && !(isTupleType(objectType) && indexTypeLessThan(indexType, objectType.target.fixedLength)))) {
|
|
56965
|
+
if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 197 /* IndexedAccessType */ ? isGenericTupleType(objectType) && !indexTypeLessThan(indexType, objectType.target.fixedLength) : isGenericObjectType(objectType) && !(isTupleType(objectType) && indexTypeLessThan(indexType, objectType.target.fixedLength)) || isGenericReducibleType(objectType))) {
|
|
56966
56966
|
if (objectType.flags & 3 /* AnyOrUnknown */) {
|
|
56967
56967
|
return objectType;
|
|
56968
56968
|
}
|
|
@@ -58148,9 +58148,6 @@ function createTypeChecker(host) {
|
|
|
58148
58148
|
}
|
|
58149
58149
|
return type;
|
|
58150
58150
|
}
|
|
58151
|
-
function getUniqueLiteralFilledInstantiation(type) {
|
|
58152
|
-
return type.flags & (402784252 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper));
|
|
58153
|
-
}
|
|
58154
58151
|
function getPermissiveInstantiation(type) {
|
|
58155
58152
|
return type.flags & (402784252 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.permissiveInstantiation || (type.permissiveInstantiation = instantiateType(type, permissiveMapper));
|
|
58156
58153
|
}
|
|
@@ -59779,11 +59776,6 @@ function createTypeChecker(host) {
|
|
|
59779
59776
|
if (containsType(targetTypes, source2)) {
|
|
59780
59777
|
return -1 /* True */;
|
|
59781
59778
|
}
|
|
59782
|
-
if (getObjectFlags(target2) & 32768 /* PrimitiveUnion */ && !(source2.flags & 1024 /* EnumLiteral */) && (source2.flags & (128 /* StringLiteral */ | 512 /* BooleanLiteral */ | 2048 /* BigIntLiteral */) || (relation === subtypeRelation || relation === strictSubtypeRelation) && source2.flags & 256 /* NumberLiteral */)) {
|
|
59783
|
-
const alternateForm = source2 === source2.regularType ? source2.freshType : source2.regularType;
|
|
59784
|
-
const primitive = source2.flags & 128 /* StringLiteral */ ? stringType : source2.flags & 256 /* NumberLiteral */ ? numberType : source2.flags & 2048 /* BigIntLiteral */ ? bigintType : void 0;
|
|
59785
|
-
return primitive && containsType(targetTypes, primitive) || alternateForm && containsType(targetTypes, alternateForm) ? -1 /* True */ : 0 /* False */;
|
|
59786
|
-
}
|
|
59787
59779
|
const match = getMatchingUnionConstituentForType(target2, source2);
|
|
59788
59780
|
if (match) {
|
|
59789
59781
|
const related = isRelatedTo(
|
|
@@ -60350,7 +60342,7 @@ function createTypeChecker(host) {
|
|
|
60350
60342
|
} else {
|
|
60351
60343
|
const constraint = getSimplifiedTypeOrConstraint(targetType);
|
|
60352
60344
|
if (constraint) {
|
|
60353
|
-
if (isRelatedTo(source2, getIndexType(constraint, target2.
|
|
60345
|
+
if (isRelatedTo(source2, getIndexType(constraint, target2.indexFlags | 4 /* NoReducibleCheck */), 2 /* Target */, reportErrors2) === -1 /* True */) {
|
|
60354
60346
|
return -1 /* True */;
|
|
60355
60347
|
}
|
|
60356
60348
|
} else if (isGenericMappedType(targetType)) {
|
|
@@ -60431,13 +60423,7 @@ function createTypeChecker(host) {
|
|
|
60431
60423
|
}
|
|
60432
60424
|
if (!isGenericMappedType(source2)) {
|
|
60433
60425
|
const targetKeys = keysRemapped ? getNameTypeFromMappedType(target2) : getConstraintTypeFromMappedType(target2);
|
|
60434
|
-
const sourceKeys = getIndexType(
|
|
60435
|
-
source2,
|
|
60436
|
-
/*stringsOnly*/
|
|
60437
|
-
void 0,
|
|
60438
|
-
/*noIndexSignatures*/
|
|
60439
|
-
true
|
|
60440
|
-
);
|
|
60426
|
+
const sourceKeys = getIndexType(source2, 2 /* NoIndexSignatures */);
|
|
60441
60427
|
const includeOptional = modifiers & 4 /* IncludeOptional */;
|
|
60442
60428
|
const filteredByApplicability = includeOptional ? intersectTypes(targetKeys, sourceKeys) : void 0;
|
|
60443
60429
|
if (includeOptional ? !(filteredByApplicability.flags & 131072 /* Never */) : isRelatedTo(targetKeys, sourceKeys, 3 /* Both */)) {
|
|
@@ -74670,11 +74656,7 @@ function createTypeChecker(host) {
|
|
|
74670
74656
|
}
|
|
74671
74657
|
const objectType = type.objectType;
|
|
74672
74658
|
const indexType = type.indexType;
|
|
74673
|
-
if (isTypeAssignableTo(indexType, getIndexType(
|
|
74674
|
-
objectType,
|
|
74675
|
-
/*stringsOnly*/
|
|
74676
|
-
false
|
|
74677
|
-
))) {
|
|
74659
|
+
if (isTypeAssignableTo(indexType, getIndexType(objectType, 0 /* None */))) {
|
|
74678
74660
|
if (accessNode.kind === 210 /* ElementAccessExpression */ && isAssignmentTarget(accessNode) && getObjectFlags(objectType) & 32 /* Mapped */ && getMappedTypeModifiers(objectType) & 1 /* IncludeReadonly */) {
|
|
74679
74661
|
error(accessNode, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
|
|
74680
74662
|
}
|
package/lib/tsserver.js
CHANGED
|
@@ -91,6 +91,7 @@ __export(server_exports, {
|
|
|
91
91
|
ImportKind: () => ImportKind,
|
|
92
92
|
ImportsNotUsedAsValues: () => ImportsNotUsedAsValues,
|
|
93
93
|
IndentStyle: () => IndentStyle,
|
|
94
|
+
IndexFlags: () => IndexFlags,
|
|
94
95
|
IndexKind: () => IndexKind,
|
|
95
96
|
InferenceFlags: () => InferenceFlags,
|
|
96
97
|
InferencePriority: () => InferencePriority,
|
|
@@ -6663,7 +6664,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
|
|
|
6663
6664
|
TypeFlags2[TypeFlags2["IncludesWildcard"] = 8388608 /* IndexedAccess */] = "IncludesWildcard";
|
|
6664
6665
|
TypeFlags2[TypeFlags2["IncludesEmptyObject"] = 16777216 /* Conditional */] = "IncludesEmptyObject";
|
|
6665
6666
|
TypeFlags2[TypeFlags2["IncludesInstantiable"] = 33554432 /* Substitution */] = "IncludesInstantiable";
|
|
6666
|
-
TypeFlags2[TypeFlags2["NotPrimitiveUnion"] =
|
|
6667
|
+
TypeFlags2[TypeFlags2["NotPrimitiveUnion"] = 36323363] = "NotPrimitiveUnion";
|
|
6667
6668
|
return TypeFlags2;
|
|
6668
6669
|
})(TypeFlags || {});
|
|
6669
6670
|
var ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => {
|
|
@@ -6747,6 +6748,13 @@ var AccessFlags = /* @__PURE__ */ ((AccessFlags2) => {
|
|
|
6747
6748
|
AccessFlags2[AccessFlags2["Persistent"] = 1 /* IncludeUndefined */] = "Persistent";
|
|
6748
6749
|
return AccessFlags2;
|
|
6749
6750
|
})(AccessFlags || {});
|
|
6751
|
+
var IndexFlags = /* @__PURE__ */ ((IndexFlags2) => {
|
|
6752
|
+
IndexFlags2[IndexFlags2["None"] = 0] = "None";
|
|
6753
|
+
IndexFlags2[IndexFlags2["StringsOnly"] = 1] = "StringsOnly";
|
|
6754
|
+
IndexFlags2[IndexFlags2["NoIndexSignatures"] = 2] = "NoIndexSignatures";
|
|
6755
|
+
IndexFlags2[IndexFlags2["NoReducibleCheck"] = 4] = "NoReducibleCheck";
|
|
6756
|
+
return IndexFlags2;
|
|
6757
|
+
})(IndexFlags || {});
|
|
6750
6758
|
var JsxReferenceKind = /* @__PURE__ */ ((JsxReferenceKind2) => {
|
|
6751
6759
|
JsxReferenceKind2[JsxReferenceKind2["Component"] = 0] = "Component";
|
|
6752
6760
|
JsxReferenceKind2[JsxReferenceKind2["Function"] = 1] = "Function";
|
|
@@ -47264,6 +47272,7 @@ function createTypeChecker(host) {
|
|
|
47264
47272
|
var noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
|
|
47265
47273
|
var useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
|
|
47266
47274
|
var keyofStringsOnly = !!compilerOptions.keyofStringsOnly;
|
|
47275
|
+
var defaultIndexFlags = keyofStringsOnly ? 1 /* StringsOnly */ : 0 /* None */;
|
|
47267
47276
|
var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 8192 /* FreshLiteral */;
|
|
47268
47277
|
var exactOptionalPropertyTypes = compilerOptions.exactOptionalPropertyTypes;
|
|
47269
47278
|
var checkBinaryExpression = createCheckBinaryExpression();
|
|
@@ -58532,6 +58541,13 @@ function createTypeChecker(host) {
|
|
|
58532
58541
|
function isConflictingPrivateProperty(prop) {
|
|
58533
58542
|
return !prop.valueDeclaration && !!(getCheckFlags(prop) & 1024 /* ContainsPrivate */);
|
|
58534
58543
|
}
|
|
58544
|
+
function isGenericReducibleType(type) {
|
|
58545
|
+
return !!(type.flags & 1048576 /* Union */ && type.objectFlags & 16777216 /* ContainsIntersections */ && some(type.types, isGenericReducibleType) || type.flags & 2097152 /* Intersection */ && isReducibleIntersection(type));
|
|
58546
|
+
}
|
|
58547
|
+
function isReducibleIntersection(type) {
|
|
58548
|
+
const uniqueFilled = type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper));
|
|
58549
|
+
return getReducedType(uniqueFilled) !== uniqueFilled;
|
|
58550
|
+
}
|
|
58535
58551
|
function elaborateNeverIntersection(errorInfo, type) {
|
|
58536
58552
|
if (type.flags & 2097152 /* Intersection */ && getObjectFlags(type) & 33554432 /* IsNeverIntersection */) {
|
|
58537
58553
|
const neverProp = find(getPropertiesOfUnionOrIntersectionType(type), isDiscriminantWithNeverType);
|
|
@@ -60584,7 +60600,7 @@ function createTypeChecker(host) {
|
|
|
60584
60600
|
origin = createOriginUnionOrIntersectionType(1048576 /* Union */, reducedTypes);
|
|
60585
60601
|
}
|
|
60586
60602
|
}
|
|
60587
|
-
const objectFlags = (includes &
|
|
60603
|
+
const objectFlags = (includes & 36323363 /* NotPrimitiveUnion */ ? 0 : 32768 /* PrimitiveUnion */) | (includes & 2097152 /* Intersection */ ? 16777216 /* ContainsIntersections */ : 0);
|
|
60588
60604
|
return getUnionTypeFromSortedList(typeSet, objectFlags, aliasSymbol, aliasTypeArguments, origin);
|
|
60589
60605
|
}
|
|
60590
60606
|
function getUnionOrIntersectionTypePredicate(signatures, kind) {
|
|
@@ -60709,7 +60725,7 @@ function createTypeChecker(host) {
|
|
|
60709
60725
|
function eachUnionContains(unionTypes2, type) {
|
|
60710
60726
|
for (const u of unionTypes2) {
|
|
60711
60727
|
if (!containsType(u.types, type)) {
|
|
60712
|
-
const primitive = type.flags & 128 /* StringLiteral */ ? stringType : type.flags &
|
|
60728
|
+
const primitive = type.flags & 128 /* StringLiteral */ ? stringType : type.flags & 256 /* NumberLiteral */ ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 8192 /* UniqueESSymbol */ ? esSymbolType : void 0;
|
|
60713
60729
|
if (!primitive || !containsType(u.types, primitive)) {
|
|
60714
60730
|
return false;
|
|
60715
60731
|
}
|
|
@@ -60736,6 +60752,9 @@ function createTypeChecker(host) {
|
|
|
60736
60752
|
}
|
|
60737
60753
|
return false;
|
|
60738
60754
|
}
|
|
60755
|
+
function eachIsUnionContaining(types, flag) {
|
|
60756
|
+
return every(types, (t) => !!(t.flags & 1048576 /* Union */) && some(t.types, (tt) => !!(tt.flags & flag)));
|
|
60757
|
+
}
|
|
60739
60758
|
function removeFromEach(types, flag) {
|
|
60740
60759
|
for (let i = 0; i < types.length; i++) {
|
|
60741
60760
|
types[i] = filterType(types[i], (t) => !(t.flags & flag));
|
|
@@ -60824,11 +60843,11 @@ function createTypeChecker(host) {
|
|
|
60824
60843
|
if (includes & 1048576 /* Union */) {
|
|
60825
60844
|
if (intersectUnionsOfPrimitiveTypes(typeSet)) {
|
|
60826
60845
|
result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
|
|
60827
|
-
} else if (
|
|
60846
|
+
} else if (eachIsUnionContaining(typeSet, 32768 /* Undefined */)) {
|
|
60828
60847
|
const containedUndefinedType = some(typeSet, containsMissingType) ? missingType : undefinedType;
|
|
60829
60848
|
removeFromEach(typeSet, 32768 /* Undefined */);
|
|
60830
60849
|
result = getUnionType([getIntersectionType(typeSet), containedUndefinedType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
60831
|
-
} else if (
|
|
60850
|
+
} else if (eachIsUnionContaining(typeSet, 65536 /* Null */)) {
|
|
60832
60851
|
removeFromEach(typeSet, 65536 /* Null */);
|
|
60833
60852
|
result = getUnionType([getIntersectionType(typeSet), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
60834
60853
|
} else {
|
|
@@ -60898,10 +60917,10 @@ function createTypeChecker(host) {
|
|
|
60898
60917
|
}
|
|
60899
60918
|
return links.resolvedType;
|
|
60900
60919
|
}
|
|
60901
|
-
function createIndexType(type,
|
|
60920
|
+
function createIndexType(type, indexFlags) {
|
|
60902
60921
|
const result = createType(4194304 /* Index */);
|
|
60903
60922
|
result.type = type;
|
|
60904
|
-
result.
|
|
60923
|
+
result.indexFlags = indexFlags;
|
|
60905
60924
|
return result;
|
|
60906
60925
|
}
|
|
60907
60926
|
function createOriginIndexType(type) {
|
|
@@ -60909,31 +60928,23 @@ function createTypeChecker(host) {
|
|
|
60909
60928
|
result.type = type;
|
|
60910
60929
|
return result;
|
|
60911
60930
|
}
|
|
60912
|
-
function getIndexTypeForGenericType(type,
|
|
60913
|
-
return
|
|
60914
|
-
type,
|
|
60915
|
-
/*stringsOnly*/
|
|
60916
|
-
true
|
|
60917
|
-
)) : type.resolvedIndexType || (type.resolvedIndexType = createIndexType(
|
|
60918
|
-
type,
|
|
60919
|
-
/*stringsOnly*/
|
|
60920
|
-
false
|
|
60921
|
-
));
|
|
60931
|
+
function getIndexTypeForGenericType(type, indexFlags) {
|
|
60932
|
+
return indexFlags & 1 /* StringsOnly */ ? type.resolvedStringIndexType || (type.resolvedStringIndexType = createIndexType(type, 1 /* StringsOnly */)) : type.resolvedIndexType || (type.resolvedIndexType = createIndexType(type, 0 /* None */));
|
|
60922
60933
|
}
|
|
60923
|
-
function getIndexTypeForMappedType(type,
|
|
60934
|
+
function getIndexTypeForMappedType(type, indexFlags) {
|
|
60924
60935
|
const typeParameter = getTypeParameterFromMappedType(type);
|
|
60925
60936
|
const constraintType = getConstraintTypeFromMappedType(type);
|
|
60926
60937
|
const nameType = getNameTypeFromMappedType(type.target || type);
|
|
60927
|
-
if (!nameType && !
|
|
60938
|
+
if (!nameType && !(indexFlags & 2 /* NoIndexSignatures */)) {
|
|
60928
60939
|
return constraintType;
|
|
60929
60940
|
}
|
|
60930
60941
|
const keyTypes = [];
|
|
60931
60942
|
if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
|
|
60932
60943
|
if (!isGenericIndexType(constraintType)) {
|
|
60933
60944
|
const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
|
|
60934
|
-
forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */,
|
|
60945
|
+
forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */, !!(indexFlags & 1 /* StringsOnly */), addMemberForKeyType);
|
|
60935
60946
|
} else {
|
|
60936
|
-
return getIndexTypeForGenericType(type,
|
|
60947
|
+
return getIndexTypeForGenericType(type, indexFlags);
|
|
60937
60948
|
}
|
|
60938
60949
|
} else {
|
|
60939
60950
|
forEachType(getLowerBoundOfKeyType(constraintType), addMemberForKeyType);
|
|
@@ -60941,7 +60952,7 @@ function createTypeChecker(host) {
|
|
|
60941
60952
|
if (isGenericIndexType(constraintType)) {
|
|
60942
60953
|
forEachType(constraintType, addMemberForKeyType);
|
|
60943
60954
|
}
|
|
60944
|
-
const result =
|
|
60955
|
+
const result = indexFlags & 2 /* NoIndexSignatures */ ? filterType(getUnionType(keyTypes), (t) => !(t.flags & (1 /* Any */ | 4 /* String */))) : getUnionType(keyTypes);
|
|
60945
60956
|
if (result.flags & 1048576 /* Union */ && constraintType.flags & 1048576 /* Union */ && getTypeListId(result.types) === getTypeListId(constraintType.types)) {
|
|
60946
60957
|
return constraintType;
|
|
60947
60958
|
}
|
|
@@ -60994,19 +61005,15 @@ function createTypeChecker(host) {
|
|
|
60994
61005
|
origin
|
|
60995
61006
|
);
|
|
60996
61007
|
}
|
|
60997
|
-
function
|
|
60998
|
-
|
|
60999
|
-
return getReducedType(uniqueFilled) !== uniqueFilled;
|
|
61008
|
+
function shouldDeferIndexType(type, indexFlags = 0 /* None */) {
|
|
61009
|
+
return !!(type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericTupleType(type) || isGenericMappedType(type) && !hasDistributiveNameType(type) || type.flags & 1048576 /* Union */ && !(indexFlags & 4 /* NoReducibleCheck */) && isGenericReducibleType(type) || type.flags & 2097152 /* Intersection */ && maybeTypeOfKind(type, 465829888 /* Instantiable */) && some(type.types, isEmptyAnonymousObjectType));
|
|
61000
61010
|
}
|
|
61001
|
-
function
|
|
61002
|
-
return !!(type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericTupleType(type) || isGenericMappedType(type) && !hasDistributiveNameType(type) || type.flags & 1048576 /* Union */ && some(type.types, isPossiblyReducibleByInstantiation) || type.flags & 2097152 /* Intersection */ && maybeTypeOfKind(type, 465829888 /* Instantiable */) && some(type.types, isEmptyAnonymousObjectType));
|
|
61003
|
-
}
|
|
61004
|
-
function getIndexType(type, stringsOnly = keyofStringsOnly, noIndexSignatures) {
|
|
61011
|
+
function getIndexType(type, indexFlags = defaultIndexFlags) {
|
|
61005
61012
|
type = getReducedType(type);
|
|
61006
|
-
return shouldDeferIndexType(type) ? getIndexTypeForGenericType(type,
|
|
61013
|
+
return shouldDeferIndexType(type, indexFlags) ? getIndexTypeForGenericType(type, indexFlags) : type.flags & 1048576 /* Union */ ? getIntersectionType(map(type.types, (t) => getIndexType(t, indexFlags))) : type.flags & 2097152 /* Intersection */ ? getUnionType(map(type.types, (t) => getIndexType(t, indexFlags))) : getObjectFlags(type) & 32 /* Mapped */ ? getIndexTypeForMappedType(type, indexFlags) : type === wildcardType ? wildcardType : type.flags & 2 /* Unknown */ ? neverType : type.flags & (1 /* Any */ | 131072 /* Never */) ? keyofConstraintType : getLiteralTypeFromProperties(
|
|
61007
61014
|
type,
|
|
61008
|
-
(
|
|
61009
|
-
|
|
61015
|
+
(indexFlags & 2 /* NoIndexSignatures */ ? 128 /* StringLiteral */ : 402653316 /* StringLike */) | (indexFlags & 1 /* StringsOnly */ ? 0 : 296 /* NumberLike */ | 12288 /* ESSymbolLike */),
|
|
61016
|
+
indexFlags === defaultIndexFlags
|
|
61010
61017
|
);
|
|
61011
61018
|
}
|
|
61012
61019
|
function getExtractStringType(type) {
|
|
@@ -61546,12 +61553,13 @@ function createTypeChecker(host) {
|
|
|
61546
61553
|
if (objectType === wildcardType || indexType === wildcardType) {
|
|
61547
61554
|
return wildcardType;
|
|
61548
61555
|
}
|
|
61556
|
+
objectType = getReducedType(objectType);
|
|
61549
61557
|
if (isStringIndexSignatureOnlyType(objectType) && !(indexType.flags & 98304 /* Nullable */) && isTypeAssignableToKind(indexType, 4 /* String */ | 8 /* Number */)) {
|
|
61550
61558
|
indexType = stringType;
|
|
61551
61559
|
}
|
|
61552
61560
|
if (compilerOptions.noUncheckedIndexedAccess && accessFlags & 32 /* ExpressionPosition */)
|
|
61553
61561
|
accessFlags |= 1 /* IncludeUndefined */;
|
|
61554
|
-
if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 197 /* IndexedAccessType */ ? isGenericTupleType(objectType) && !indexTypeLessThan(indexType, objectType.target.fixedLength) : isGenericObjectType(objectType) && !(isTupleType(objectType) && indexTypeLessThan(indexType, objectType.target.fixedLength)))) {
|
|
61562
|
+
if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 197 /* IndexedAccessType */ ? isGenericTupleType(objectType) && !indexTypeLessThan(indexType, objectType.target.fixedLength) : isGenericObjectType(objectType) && !(isTupleType(objectType) && indexTypeLessThan(indexType, objectType.target.fixedLength)) || isGenericReducibleType(objectType))) {
|
|
61555
61563
|
if (objectType.flags & 3 /* AnyOrUnknown */) {
|
|
61556
61564
|
return objectType;
|
|
61557
61565
|
}
|
|
@@ -62737,9 +62745,6 @@ function createTypeChecker(host) {
|
|
|
62737
62745
|
}
|
|
62738
62746
|
return type;
|
|
62739
62747
|
}
|
|
62740
|
-
function getUniqueLiteralFilledInstantiation(type) {
|
|
62741
|
-
return type.flags & (402784252 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper));
|
|
62742
|
-
}
|
|
62743
62748
|
function getPermissiveInstantiation(type) {
|
|
62744
62749
|
return type.flags & (402784252 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.permissiveInstantiation || (type.permissiveInstantiation = instantiateType(type, permissiveMapper));
|
|
62745
62750
|
}
|
|
@@ -64368,11 +64373,6 @@ function createTypeChecker(host) {
|
|
|
64368
64373
|
if (containsType(targetTypes, source2)) {
|
|
64369
64374
|
return -1 /* True */;
|
|
64370
64375
|
}
|
|
64371
|
-
if (getObjectFlags(target2) & 32768 /* PrimitiveUnion */ && !(source2.flags & 1024 /* EnumLiteral */) && (source2.flags & (128 /* StringLiteral */ | 512 /* BooleanLiteral */ | 2048 /* BigIntLiteral */) || (relation === subtypeRelation || relation === strictSubtypeRelation) && source2.flags & 256 /* NumberLiteral */)) {
|
|
64372
|
-
const alternateForm = source2 === source2.regularType ? source2.freshType : source2.regularType;
|
|
64373
|
-
const primitive = source2.flags & 128 /* StringLiteral */ ? stringType : source2.flags & 256 /* NumberLiteral */ ? numberType : source2.flags & 2048 /* BigIntLiteral */ ? bigintType : void 0;
|
|
64374
|
-
return primitive && containsType(targetTypes, primitive) || alternateForm && containsType(targetTypes, alternateForm) ? -1 /* True */ : 0 /* False */;
|
|
64375
|
-
}
|
|
64376
64376
|
const match = getMatchingUnionConstituentForType(target2, source2);
|
|
64377
64377
|
if (match) {
|
|
64378
64378
|
const related = isRelatedTo(
|
|
@@ -64939,7 +64939,7 @@ function createTypeChecker(host) {
|
|
|
64939
64939
|
} else {
|
|
64940
64940
|
const constraint = getSimplifiedTypeOrConstraint(targetType);
|
|
64941
64941
|
if (constraint) {
|
|
64942
|
-
if (isRelatedTo(source2, getIndexType(constraint, target2.
|
|
64942
|
+
if (isRelatedTo(source2, getIndexType(constraint, target2.indexFlags | 4 /* NoReducibleCheck */), 2 /* Target */, reportErrors2) === -1 /* True */) {
|
|
64943
64943
|
return -1 /* True */;
|
|
64944
64944
|
}
|
|
64945
64945
|
} else if (isGenericMappedType(targetType)) {
|
|
@@ -65020,13 +65020,7 @@ function createTypeChecker(host) {
|
|
|
65020
65020
|
}
|
|
65021
65021
|
if (!isGenericMappedType(source2)) {
|
|
65022
65022
|
const targetKeys = keysRemapped ? getNameTypeFromMappedType(target2) : getConstraintTypeFromMappedType(target2);
|
|
65023
|
-
const sourceKeys = getIndexType(
|
|
65024
|
-
source2,
|
|
65025
|
-
/*stringsOnly*/
|
|
65026
|
-
void 0,
|
|
65027
|
-
/*noIndexSignatures*/
|
|
65028
|
-
true
|
|
65029
|
-
);
|
|
65023
|
+
const sourceKeys = getIndexType(source2, 2 /* NoIndexSignatures */);
|
|
65030
65024
|
const includeOptional = modifiers & 4 /* IncludeOptional */;
|
|
65031
65025
|
const filteredByApplicability = includeOptional ? intersectTypes(targetKeys, sourceKeys) : void 0;
|
|
65032
65026
|
if (includeOptional ? !(filteredByApplicability.flags & 131072 /* Never */) : isRelatedTo(targetKeys, sourceKeys, 3 /* Both */)) {
|
|
@@ -79259,11 +79253,7 @@ function createTypeChecker(host) {
|
|
|
79259
79253
|
}
|
|
79260
79254
|
const objectType = type.objectType;
|
|
79261
79255
|
const indexType = type.indexType;
|
|
79262
|
-
if (isTypeAssignableTo(indexType, getIndexType(
|
|
79263
|
-
objectType,
|
|
79264
|
-
/*stringsOnly*/
|
|
79265
|
-
false
|
|
79266
|
-
))) {
|
|
79256
|
+
if (isTypeAssignableTo(indexType, getIndexType(objectType, 0 /* None */))) {
|
|
79267
79257
|
if (accessNode.kind === 210 /* ElementAccessExpression */ && isAssignmentTarget(accessNode) && getObjectFlags(objectType) & 32 /* Mapped */ && getMappedTypeModifiers(objectType) & 1 /* IncludeReadonly */) {
|
|
79268
79258
|
error(accessNode, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
|
|
79269
79259
|
}
|
|
@@ -168074,6 +168064,7 @@ __export(ts_exports3, {
|
|
|
168074
168064
|
ImportKind: () => ImportKind,
|
|
168075
168065
|
ImportsNotUsedAsValues: () => ImportsNotUsedAsValues,
|
|
168076
168066
|
IndentStyle: () => IndentStyle,
|
|
168067
|
+
IndexFlags: () => IndexFlags,
|
|
168077
168068
|
IndexKind: () => IndexKind,
|
|
168078
168069
|
InferenceFlags: () => InferenceFlags,
|
|
168079
168070
|
InferencePriority: () => InferencePriority,
|
|
@@ -182032,6 +182023,7 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
182032
182023
|
ImportKind,
|
|
182033
182024
|
ImportsNotUsedAsValues,
|
|
182034
182025
|
IndentStyle,
|
|
182026
|
+
IndexFlags,
|
|
182035
182027
|
IndexKind,
|
|
182036
182028
|
InferenceFlags,
|
|
182037
182029
|
InferencePriority,
|
package/lib/tsserverlibrary.js
CHANGED
|
@@ -3545,7 +3545,7 @@ ${lanes.join("\n")}
|
|
|
3545
3545
|
const name = DiagnosticCategory[d.category];
|
|
3546
3546
|
return lowerCase ? name.toLowerCase() : name;
|
|
3547
3547
|
}
|
|
3548
|
-
var SyntaxKind, NodeFlags, ModifierFlags, JsxFlags, RelationComparisonResult, GeneratedIdentifierFlags, TokenFlags, FlowFlags, CommentDirectiveType, OperationCanceledException, FileIncludeKind, FilePreprocessingDiagnosticsKind, EmitOnly, StructureIsReused, ExitStatus, MemberOverrideStatus, UnionReduction, ContextFlags, NodeBuilderFlags, TypeFormatFlags, SymbolFormatFlags, SymbolAccessibility, SyntheticSymbolKind, TypePredicateKind, TypeReferenceSerializationKind, SymbolFlags, EnumKind, CheckFlags, InternalSymbolName, NodeCheckFlags, TypeFlags, ObjectFlags, VarianceFlags, ElementFlags, AccessFlags, JsxReferenceKind, SignatureKind, SignatureFlags, IndexKind, TypeMapKind, InferencePriority, InferenceFlags, Ternary, AssignmentDeclarationKind, DiagnosticCategory, ModuleResolutionKind, ModuleDetectionKind, WatchFileKind, WatchDirectoryKind, PollingWatchKind, ModuleKind, JsxEmit, ImportsNotUsedAsValues, NewLineKind, ScriptKind, ScriptTarget, LanguageVariant, WatchDirectoryFlags, CharacterCodes, Extension, TransformFlags, SnippetKind, EmitFlags, InternalEmitFlags, ExternalEmitHelpers, EmitHint, OuterExpressionKinds, LexicalEnvironmentFlags, BundleFileSectionKind, ListFormat, PragmaKindFlags, commentPragmas;
|
|
3548
|
+
var SyntaxKind, NodeFlags, ModifierFlags, JsxFlags, RelationComparisonResult, GeneratedIdentifierFlags, TokenFlags, FlowFlags, CommentDirectiveType, OperationCanceledException, FileIncludeKind, FilePreprocessingDiagnosticsKind, EmitOnly, StructureIsReused, ExitStatus, MemberOverrideStatus, UnionReduction, ContextFlags, NodeBuilderFlags, TypeFormatFlags, SymbolFormatFlags, SymbolAccessibility, SyntheticSymbolKind, TypePredicateKind, TypeReferenceSerializationKind, SymbolFlags, EnumKind, CheckFlags, InternalSymbolName, NodeCheckFlags, TypeFlags, ObjectFlags, VarianceFlags, ElementFlags, AccessFlags, IndexFlags, JsxReferenceKind, SignatureKind, SignatureFlags, IndexKind, TypeMapKind, InferencePriority, InferenceFlags, Ternary, AssignmentDeclarationKind, DiagnosticCategory, ModuleResolutionKind, ModuleDetectionKind, WatchFileKind, WatchDirectoryKind, PollingWatchKind, ModuleKind, JsxEmit, ImportsNotUsedAsValues, NewLineKind, ScriptKind, ScriptTarget, LanguageVariant, WatchDirectoryFlags, CharacterCodes, Extension, TransformFlags, SnippetKind, EmitFlags, InternalEmitFlags, ExternalEmitHelpers, EmitHint, OuterExpressionKinds, LexicalEnvironmentFlags, BundleFileSectionKind, ListFormat, PragmaKindFlags, commentPragmas;
|
|
3549
3549
|
var init_types = __esm({
|
|
3550
3550
|
"src/compiler/types.ts"() {
|
|
3551
3551
|
"use strict";
|
|
@@ -4472,7 +4472,7 @@ ${lanes.join("\n")}
|
|
|
4472
4472
|
TypeFlags2[TypeFlags2["IncludesWildcard"] = 8388608 /* IndexedAccess */] = "IncludesWildcard";
|
|
4473
4473
|
TypeFlags2[TypeFlags2["IncludesEmptyObject"] = 16777216 /* Conditional */] = "IncludesEmptyObject";
|
|
4474
4474
|
TypeFlags2[TypeFlags2["IncludesInstantiable"] = 33554432 /* Substitution */] = "IncludesInstantiable";
|
|
4475
|
-
TypeFlags2[TypeFlags2["NotPrimitiveUnion"] =
|
|
4475
|
+
TypeFlags2[TypeFlags2["NotPrimitiveUnion"] = 36323363] = "NotPrimitiveUnion";
|
|
4476
4476
|
return TypeFlags2;
|
|
4477
4477
|
})(TypeFlags || {});
|
|
4478
4478
|
ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => {
|
|
@@ -4556,6 +4556,13 @@ ${lanes.join("\n")}
|
|
|
4556
4556
|
AccessFlags2[AccessFlags2["Persistent"] = 1 /* IncludeUndefined */] = "Persistent";
|
|
4557
4557
|
return AccessFlags2;
|
|
4558
4558
|
})(AccessFlags || {});
|
|
4559
|
+
IndexFlags = /* @__PURE__ */ ((IndexFlags2) => {
|
|
4560
|
+
IndexFlags2[IndexFlags2["None"] = 0] = "None";
|
|
4561
|
+
IndexFlags2[IndexFlags2["StringsOnly"] = 1] = "StringsOnly";
|
|
4562
|
+
IndexFlags2[IndexFlags2["NoIndexSignatures"] = 2] = "NoIndexSignatures";
|
|
4563
|
+
IndexFlags2[IndexFlags2["NoReducibleCheck"] = 4] = "NoReducibleCheck";
|
|
4564
|
+
return IndexFlags2;
|
|
4565
|
+
})(IndexFlags || {});
|
|
4559
4566
|
JsxReferenceKind = /* @__PURE__ */ ((JsxReferenceKind2) => {
|
|
4560
4567
|
JsxReferenceKind2[JsxReferenceKind2["Component"] = 0] = "Component";
|
|
4561
4568
|
JsxReferenceKind2[JsxReferenceKind2["Function"] = 1] = "Function";
|
|
@@ -45076,6 +45083,7 @@ ${lanes.join("\n")}
|
|
|
45076
45083
|
var noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
|
|
45077
45084
|
var useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
|
|
45078
45085
|
var keyofStringsOnly = !!compilerOptions.keyofStringsOnly;
|
|
45086
|
+
var defaultIndexFlags = keyofStringsOnly ? 1 /* StringsOnly */ : 0 /* None */;
|
|
45079
45087
|
var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 8192 /* FreshLiteral */;
|
|
45080
45088
|
var exactOptionalPropertyTypes = compilerOptions.exactOptionalPropertyTypes;
|
|
45081
45089
|
var checkBinaryExpression = createCheckBinaryExpression();
|
|
@@ -56344,6 +56352,13 @@ ${lanes.join("\n")}
|
|
|
56344
56352
|
function isConflictingPrivateProperty(prop) {
|
|
56345
56353
|
return !prop.valueDeclaration && !!(getCheckFlags(prop) & 1024 /* ContainsPrivate */);
|
|
56346
56354
|
}
|
|
56355
|
+
function isGenericReducibleType(type) {
|
|
56356
|
+
return !!(type.flags & 1048576 /* Union */ && type.objectFlags & 16777216 /* ContainsIntersections */ && some(type.types, isGenericReducibleType) || type.flags & 2097152 /* Intersection */ && isReducibleIntersection(type));
|
|
56357
|
+
}
|
|
56358
|
+
function isReducibleIntersection(type) {
|
|
56359
|
+
const uniqueFilled = type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper));
|
|
56360
|
+
return getReducedType(uniqueFilled) !== uniqueFilled;
|
|
56361
|
+
}
|
|
56347
56362
|
function elaborateNeverIntersection(errorInfo, type) {
|
|
56348
56363
|
if (type.flags & 2097152 /* Intersection */ && getObjectFlags(type) & 33554432 /* IsNeverIntersection */) {
|
|
56349
56364
|
const neverProp = find(getPropertiesOfUnionOrIntersectionType(type), isDiscriminantWithNeverType);
|
|
@@ -58396,7 +58411,7 @@ ${lanes.join("\n")}
|
|
|
58396
58411
|
origin = createOriginUnionOrIntersectionType(1048576 /* Union */, reducedTypes);
|
|
58397
58412
|
}
|
|
58398
58413
|
}
|
|
58399
|
-
const objectFlags = (includes &
|
|
58414
|
+
const objectFlags = (includes & 36323363 /* NotPrimitiveUnion */ ? 0 : 32768 /* PrimitiveUnion */) | (includes & 2097152 /* Intersection */ ? 16777216 /* ContainsIntersections */ : 0);
|
|
58400
58415
|
return getUnionTypeFromSortedList(typeSet, objectFlags, aliasSymbol, aliasTypeArguments, origin);
|
|
58401
58416
|
}
|
|
58402
58417
|
function getUnionOrIntersectionTypePredicate(signatures, kind) {
|
|
@@ -58521,7 +58536,7 @@ ${lanes.join("\n")}
|
|
|
58521
58536
|
function eachUnionContains(unionTypes2, type) {
|
|
58522
58537
|
for (const u of unionTypes2) {
|
|
58523
58538
|
if (!containsType(u.types, type)) {
|
|
58524
|
-
const primitive = type.flags & 128 /* StringLiteral */ ? stringType : type.flags &
|
|
58539
|
+
const primitive = type.flags & 128 /* StringLiteral */ ? stringType : type.flags & 256 /* NumberLiteral */ ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 8192 /* UniqueESSymbol */ ? esSymbolType : void 0;
|
|
58525
58540
|
if (!primitive || !containsType(u.types, primitive)) {
|
|
58526
58541
|
return false;
|
|
58527
58542
|
}
|
|
@@ -58548,6 +58563,9 @@ ${lanes.join("\n")}
|
|
|
58548
58563
|
}
|
|
58549
58564
|
return false;
|
|
58550
58565
|
}
|
|
58566
|
+
function eachIsUnionContaining(types, flag) {
|
|
58567
|
+
return every(types, (t) => !!(t.flags & 1048576 /* Union */) && some(t.types, (tt) => !!(tt.flags & flag)));
|
|
58568
|
+
}
|
|
58551
58569
|
function removeFromEach(types, flag) {
|
|
58552
58570
|
for (let i = 0; i < types.length; i++) {
|
|
58553
58571
|
types[i] = filterType(types[i], (t) => !(t.flags & flag));
|
|
@@ -58636,11 +58654,11 @@ ${lanes.join("\n")}
|
|
|
58636
58654
|
if (includes & 1048576 /* Union */) {
|
|
58637
58655
|
if (intersectUnionsOfPrimitiveTypes(typeSet)) {
|
|
58638
58656
|
result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
|
|
58639
|
-
} else if (
|
|
58657
|
+
} else if (eachIsUnionContaining(typeSet, 32768 /* Undefined */)) {
|
|
58640
58658
|
const containedUndefinedType = some(typeSet, containsMissingType) ? missingType : undefinedType;
|
|
58641
58659
|
removeFromEach(typeSet, 32768 /* Undefined */);
|
|
58642
58660
|
result = getUnionType([getIntersectionType(typeSet), containedUndefinedType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
58643
|
-
} else if (
|
|
58661
|
+
} else if (eachIsUnionContaining(typeSet, 65536 /* Null */)) {
|
|
58644
58662
|
removeFromEach(typeSet, 65536 /* Null */);
|
|
58645
58663
|
result = getUnionType([getIntersectionType(typeSet), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
58646
58664
|
} else {
|
|
@@ -58710,10 +58728,10 @@ ${lanes.join("\n")}
|
|
|
58710
58728
|
}
|
|
58711
58729
|
return links.resolvedType;
|
|
58712
58730
|
}
|
|
58713
|
-
function createIndexType(type,
|
|
58731
|
+
function createIndexType(type, indexFlags) {
|
|
58714
58732
|
const result = createType(4194304 /* Index */);
|
|
58715
58733
|
result.type = type;
|
|
58716
|
-
result.
|
|
58734
|
+
result.indexFlags = indexFlags;
|
|
58717
58735
|
return result;
|
|
58718
58736
|
}
|
|
58719
58737
|
function createOriginIndexType(type) {
|
|
@@ -58721,31 +58739,23 @@ ${lanes.join("\n")}
|
|
|
58721
58739
|
result.type = type;
|
|
58722
58740
|
return result;
|
|
58723
58741
|
}
|
|
58724
|
-
function getIndexTypeForGenericType(type,
|
|
58725
|
-
return
|
|
58726
|
-
type,
|
|
58727
|
-
/*stringsOnly*/
|
|
58728
|
-
true
|
|
58729
|
-
)) : type.resolvedIndexType || (type.resolvedIndexType = createIndexType(
|
|
58730
|
-
type,
|
|
58731
|
-
/*stringsOnly*/
|
|
58732
|
-
false
|
|
58733
|
-
));
|
|
58742
|
+
function getIndexTypeForGenericType(type, indexFlags) {
|
|
58743
|
+
return indexFlags & 1 /* StringsOnly */ ? type.resolvedStringIndexType || (type.resolvedStringIndexType = createIndexType(type, 1 /* StringsOnly */)) : type.resolvedIndexType || (type.resolvedIndexType = createIndexType(type, 0 /* None */));
|
|
58734
58744
|
}
|
|
58735
|
-
function getIndexTypeForMappedType(type,
|
|
58745
|
+
function getIndexTypeForMappedType(type, indexFlags) {
|
|
58736
58746
|
const typeParameter = getTypeParameterFromMappedType(type);
|
|
58737
58747
|
const constraintType = getConstraintTypeFromMappedType(type);
|
|
58738
58748
|
const nameType = getNameTypeFromMappedType(type.target || type);
|
|
58739
|
-
if (!nameType && !
|
|
58749
|
+
if (!nameType && !(indexFlags & 2 /* NoIndexSignatures */)) {
|
|
58740
58750
|
return constraintType;
|
|
58741
58751
|
}
|
|
58742
58752
|
const keyTypes = [];
|
|
58743
58753
|
if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
|
|
58744
58754
|
if (!isGenericIndexType(constraintType)) {
|
|
58745
58755
|
const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
|
|
58746
|
-
forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */,
|
|
58756
|
+
forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */, !!(indexFlags & 1 /* StringsOnly */), addMemberForKeyType);
|
|
58747
58757
|
} else {
|
|
58748
|
-
return getIndexTypeForGenericType(type,
|
|
58758
|
+
return getIndexTypeForGenericType(type, indexFlags);
|
|
58749
58759
|
}
|
|
58750
58760
|
} else {
|
|
58751
58761
|
forEachType(getLowerBoundOfKeyType(constraintType), addMemberForKeyType);
|
|
@@ -58753,7 +58763,7 @@ ${lanes.join("\n")}
|
|
|
58753
58763
|
if (isGenericIndexType(constraintType)) {
|
|
58754
58764
|
forEachType(constraintType, addMemberForKeyType);
|
|
58755
58765
|
}
|
|
58756
|
-
const result =
|
|
58766
|
+
const result = indexFlags & 2 /* NoIndexSignatures */ ? filterType(getUnionType(keyTypes), (t) => !(t.flags & (1 /* Any */ | 4 /* String */))) : getUnionType(keyTypes);
|
|
58757
58767
|
if (result.flags & 1048576 /* Union */ && constraintType.flags & 1048576 /* Union */ && getTypeListId(result.types) === getTypeListId(constraintType.types)) {
|
|
58758
58768
|
return constraintType;
|
|
58759
58769
|
}
|
|
@@ -58806,19 +58816,15 @@ ${lanes.join("\n")}
|
|
|
58806
58816
|
origin
|
|
58807
58817
|
);
|
|
58808
58818
|
}
|
|
58809
|
-
function
|
|
58810
|
-
|
|
58811
|
-
return getReducedType(uniqueFilled) !== uniqueFilled;
|
|
58819
|
+
function shouldDeferIndexType(type, indexFlags = 0 /* None */) {
|
|
58820
|
+
return !!(type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericTupleType(type) || isGenericMappedType(type) && !hasDistributiveNameType(type) || type.flags & 1048576 /* Union */ && !(indexFlags & 4 /* NoReducibleCheck */) && isGenericReducibleType(type) || type.flags & 2097152 /* Intersection */ && maybeTypeOfKind(type, 465829888 /* Instantiable */) && some(type.types, isEmptyAnonymousObjectType));
|
|
58812
58821
|
}
|
|
58813
|
-
function
|
|
58814
|
-
return !!(type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericTupleType(type) || isGenericMappedType(type) && !hasDistributiveNameType(type) || type.flags & 1048576 /* Union */ && some(type.types, isPossiblyReducibleByInstantiation) || type.flags & 2097152 /* Intersection */ && maybeTypeOfKind(type, 465829888 /* Instantiable */) && some(type.types, isEmptyAnonymousObjectType));
|
|
58815
|
-
}
|
|
58816
|
-
function getIndexType(type, stringsOnly = keyofStringsOnly, noIndexSignatures) {
|
|
58822
|
+
function getIndexType(type, indexFlags = defaultIndexFlags) {
|
|
58817
58823
|
type = getReducedType(type);
|
|
58818
|
-
return shouldDeferIndexType(type) ? getIndexTypeForGenericType(type,
|
|
58824
|
+
return shouldDeferIndexType(type, indexFlags) ? getIndexTypeForGenericType(type, indexFlags) : type.flags & 1048576 /* Union */ ? getIntersectionType(map(type.types, (t) => getIndexType(t, indexFlags))) : type.flags & 2097152 /* Intersection */ ? getUnionType(map(type.types, (t) => getIndexType(t, indexFlags))) : getObjectFlags(type) & 32 /* Mapped */ ? getIndexTypeForMappedType(type, indexFlags) : type === wildcardType ? wildcardType : type.flags & 2 /* Unknown */ ? neverType : type.flags & (1 /* Any */ | 131072 /* Never */) ? keyofConstraintType : getLiteralTypeFromProperties(
|
|
58819
58825
|
type,
|
|
58820
|
-
(
|
|
58821
|
-
|
|
58826
|
+
(indexFlags & 2 /* NoIndexSignatures */ ? 128 /* StringLiteral */ : 402653316 /* StringLike */) | (indexFlags & 1 /* StringsOnly */ ? 0 : 296 /* NumberLike */ | 12288 /* ESSymbolLike */),
|
|
58827
|
+
indexFlags === defaultIndexFlags
|
|
58822
58828
|
);
|
|
58823
58829
|
}
|
|
58824
58830
|
function getExtractStringType(type) {
|
|
@@ -59358,12 +59364,13 @@ ${lanes.join("\n")}
|
|
|
59358
59364
|
if (objectType === wildcardType || indexType === wildcardType) {
|
|
59359
59365
|
return wildcardType;
|
|
59360
59366
|
}
|
|
59367
|
+
objectType = getReducedType(objectType);
|
|
59361
59368
|
if (isStringIndexSignatureOnlyType(objectType) && !(indexType.flags & 98304 /* Nullable */) && isTypeAssignableToKind(indexType, 4 /* String */ | 8 /* Number */)) {
|
|
59362
59369
|
indexType = stringType;
|
|
59363
59370
|
}
|
|
59364
59371
|
if (compilerOptions.noUncheckedIndexedAccess && accessFlags & 32 /* ExpressionPosition */)
|
|
59365
59372
|
accessFlags |= 1 /* IncludeUndefined */;
|
|
59366
|
-
if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 197 /* IndexedAccessType */ ? isGenericTupleType(objectType) && !indexTypeLessThan(indexType, objectType.target.fixedLength) : isGenericObjectType(objectType) && !(isTupleType(objectType) && indexTypeLessThan(indexType, objectType.target.fixedLength)))) {
|
|
59373
|
+
if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 197 /* IndexedAccessType */ ? isGenericTupleType(objectType) && !indexTypeLessThan(indexType, objectType.target.fixedLength) : isGenericObjectType(objectType) && !(isTupleType(objectType) && indexTypeLessThan(indexType, objectType.target.fixedLength)) || isGenericReducibleType(objectType))) {
|
|
59367
59374
|
if (objectType.flags & 3 /* AnyOrUnknown */) {
|
|
59368
59375
|
return objectType;
|
|
59369
59376
|
}
|
|
@@ -60549,9 +60556,6 @@ ${lanes.join("\n")}
|
|
|
60549
60556
|
}
|
|
60550
60557
|
return type;
|
|
60551
60558
|
}
|
|
60552
|
-
function getUniqueLiteralFilledInstantiation(type) {
|
|
60553
|
-
return type.flags & (402784252 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper));
|
|
60554
|
-
}
|
|
60555
60559
|
function getPermissiveInstantiation(type) {
|
|
60556
60560
|
return type.flags & (402784252 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.permissiveInstantiation || (type.permissiveInstantiation = instantiateType(type, permissiveMapper));
|
|
60557
60561
|
}
|
|
@@ -62180,11 +62184,6 @@ ${lanes.join("\n")}
|
|
|
62180
62184
|
if (containsType(targetTypes, source2)) {
|
|
62181
62185
|
return -1 /* True */;
|
|
62182
62186
|
}
|
|
62183
|
-
if (getObjectFlags(target2) & 32768 /* PrimitiveUnion */ && !(source2.flags & 1024 /* EnumLiteral */) && (source2.flags & (128 /* StringLiteral */ | 512 /* BooleanLiteral */ | 2048 /* BigIntLiteral */) || (relation === subtypeRelation || relation === strictSubtypeRelation) && source2.flags & 256 /* NumberLiteral */)) {
|
|
62184
|
-
const alternateForm = source2 === source2.regularType ? source2.freshType : source2.regularType;
|
|
62185
|
-
const primitive = source2.flags & 128 /* StringLiteral */ ? stringType : source2.flags & 256 /* NumberLiteral */ ? numberType : source2.flags & 2048 /* BigIntLiteral */ ? bigintType : void 0;
|
|
62186
|
-
return primitive && containsType(targetTypes, primitive) || alternateForm && containsType(targetTypes, alternateForm) ? -1 /* True */ : 0 /* False */;
|
|
62187
|
-
}
|
|
62188
62187
|
const match = getMatchingUnionConstituentForType(target2, source2);
|
|
62189
62188
|
if (match) {
|
|
62190
62189
|
const related = isRelatedTo(
|
|
@@ -62751,7 +62750,7 @@ ${lanes.join("\n")}
|
|
|
62751
62750
|
} else {
|
|
62752
62751
|
const constraint = getSimplifiedTypeOrConstraint(targetType);
|
|
62753
62752
|
if (constraint) {
|
|
62754
|
-
if (isRelatedTo(source2, getIndexType(constraint, target2.
|
|
62753
|
+
if (isRelatedTo(source2, getIndexType(constraint, target2.indexFlags | 4 /* NoReducibleCheck */), 2 /* Target */, reportErrors2) === -1 /* True */) {
|
|
62755
62754
|
return -1 /* True */;
|
|
62756
62755
|
}
|
|
62757
62756
|
} else if (isGenericMappedType(targetType)) {
|
|
@@ -62832,13 +62831,7 @@ ${lanes.join("\n")}
|
|
|
62832
62831
|
}
|
|
62833
62832
|
if (!isGenericMappedType(source2)) {
|
|
62834
62833
|
const targetKeys = keysRemapped ? getNameTypeFromMappedType(target2) : getConstraintTypeFromMappedType(target2);
|
|
62835
|
-
const sourceKeys = getIndexType(
|
|
62836
|
-
source2,
|
|
62837
|
-
/*stringsOnly*/
|
|
62838
|
-
void 0,
|
|
62839
|
-
/*noIndexSignatures*/
|
|
62840
|
-
true
|
|
62841
|
-
);
|
|
62834
|
+
const sourceKeys = getIndexType(source2, 2 /* NoIndexSignatures */);
|
|
62842
62835
|
const includeOptional = modifiers & 4 /* IncludeOptional */;
|
|
62843
62836
|
const filteredByApplicability = includeOptional ? intersectTypes(targetKeys, sourceKeys) : void 0;
|
|
62844
62837
|
if (includeOptional ? !(filteredByApplicability.flags & 131072 /* Never */) : isRelatedTo(targetKeys, sourceKeys, 3 /* Both */)) {
|
|
@@ -77071,11 +77064,7 @@ ${lanes.join("\n")}
|
|
|
77071
77064
|
}
|
|
77072
77065
|
const objectType = type.objectType;
|
|
77073
77066
|
const indexType = type.indexType;
|
|
77074
|
-
if (isTypeAssignableTo(indexType, getIndexType(
|
|
77075
|
-
objectType,
|
|
77076
|
-
/*stringsOnly*/
|
|
77077
|
-
false
|
|
77078
|
-
))) {
|
|
77067
|
+
if (isTypeAssignableTo(indexType, getIndexType(objectType, 0 /* None */))) {
|
|
77079
77068
|
if (accessNode.kind === 210 /* ElementAccessExpression */ && isAssignmentTarget(accessNode) && getObjectFlags(objectType) & 32 /* Mapped */ && getMappedTypeModifiers(objectType) & 1 /* IncludeReadonly */) {
|
|
77080
77069
|
error(accessNode, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
|
|
77081
77070
|
}
|
|
@@ -178684,6 +178673,7 @@ ${e.message}`;
|
|
|
178684
178673
|
ImportKind: () => ImportKind,
|
|
178685
178674
|
ImportsNotUsedAsValues: () => ImportsNotUsedAsValues,
|
|
178686
178675
|
IndentStyle: () => IndentStyle,
|
|
178676
|
+
IndexFlags: () => IndexFlags,
|
|
178687
178677
|
IndexKind: () => IndexKind,
|
|
178688
178678
|
InferenceFlags: () => InferenceFlags,
|
|
178689
178679
|
InferencePriority: () => InferencePriority,
|
|
@@ -181040,6 +181030,7 @@ ${e.message}`;
|
|
|
181040
181030
|
ImportKind: () => ImportKind,
|
|
181041
181031
|
ImportsNotUsedAsValues: () => ImportsNotUsedAsValues,
|
|
181042
181032
|
IndentStyle: () => IndentStyle,
|
|
181033
|
+
IndexFlags: () => IndexFlags,
|
|
181043
181034
|
IndexKind: () => IndexKind,
|
|
181044
181035
|
InferenceFlags: () => InferenceFlags,
|
|
181045
181036
|
InferencePriority: () => InferencePriority,
|
package/lib/typescript.js
CHANGED
|
@@ -3545,7 +3545,7 @@ ${lanes.join("\n")}
|
|
|
3545
3545
|
const name = DiagnosticCategory[d.category];
|
|
3546
3546
|
return lowerCase ? name.toLowerCase() : name;
|
|
3547
3547
|
}
|
|
3548
|
-
var SyntaxKind, NodeFlags, ModifierFlags, JsxFlags, RelationComparisonResult, GeneratedIdentifierFlags, TokenFlags, FlowFlags, CommentDirectiveType, OperationCanceledException, FileIncludeKind, FilePreprocessingDiagnosticsKind, EmitOnly, StructureIsReused, ExitStatus, MemberOverrideStatus, UnionReduction, ContextFlags, NodeBuilderFlags, TypeFormatFlags, SymbolFormatFlags, SymbolAccessibility, SyntheticSymbolKind, TypePredicateKind, TypeReferenceSerializationKind, SymbolFlags, EnumKind, CheckFlags, InternalSymbolName, NodeCheckFlags, TypeFlags, ObjectFlags, VarianceFlags, ElementFlags, AccessFlags, JsxReferenceKind, SignatureKind, SignatureFlags, IndexKind, TypeMapKind, InferencePriority, InferenceFlags, Ternary, AssignmentDeclarationKind, DiagnosticCategory, ModuleResolutionKind, ModuleDetectionKind, WatchFileKind, WatchDirectoryKind, PollingWatchKind, ModuleKind, JsxEmit, ImportsNotUsedAsValues, NewLineKind, ScriptKind, ScriptTarget, LanguageVariant, WatchDirectoryFlags, CharacterCodes, Extension, TransformFlags, SnippetKind, EmitFlags, InternalEmitFlags, ExternalEmitHelpers, EmitHint, OuterExpressionKinds, LexicalEnvironmentFlags, BundleFileSectionKind, ListFormat, PragmaKindFlags, commentPragmas;
|
|
3548
|
+
var SyntaxKind, NodeFlags, ModifierFlags, JsxFlags, RelationComparisonResult, GeneratedIdentifierFlags, TokenFlags, FlowFlags, CommentDirectiveType, OperationCanceledException, FileIncludeKind, FilePreprocessingDiagnosticsKind, EmitOnly, StructureIsReused, ExitStatus, MemberOverrideStatus, UnionReduction, ContextFlags, NodeBuilderFlags, TypeFormatFlags, SymbolFormatFlags, SymbolAccessibility, SyntheticSymbolKind, TypePredicateKind, TypeReferenceSerializationKind, SymbolFlags, EnumKind, CheckFlags, InternalSymbolName, NodeCheckFlags, TypeFlags, ObjectFlags, VarianceFlags, ElementFlags, AccessFlags, IndexFlags, JsxReferenceKind, SignatureKind, SignatureFlags, IndexKind, TypeMapKind, InferencePriority, InferenceFlags, Ternary, AssignmentDeclarationKind, DiagnosticCategory, ModuleResolutionKind, ModuleDetectionKind, WatchFileKind, WatchDirectoryKind, PollingWatchKind, ModuleKind, JsxEmit, ImportsNotUsedAsValues, NewLineKind, ScriptKind, ScriptTarget, LanguageVariant, WatchDirectoryFlags, CharacterCodes, Extension, TransformFlags, SnippetKind, EmitFlags, InternalEmitFlags, ExternalEmitHelpers, EmitHint, OuterExpressionKinds, LexicalEnvironmentFlags, BundleFileSectionKind, ListFormat, PragmaKindFlags, commentPragmas;
|
|
3549
3549
|
var init_types = __esm({
|
|
3550
3550
|
"src/compiler/types.ts"() {
|
|
3551
3551
|
"use strict";
|
|
@@ -4472,7 +4472,7 @@ ${lanes.join("\n")}
|
|
|
4472
4472
|
TypeFlags2[TypeFlags2["IncludesWildcard"] = 8388608 /* IndexedAccess */] = "IncludesWildcard";
|
|
4473
4473
|
TypeFlags2[TypeFlags2["IncludesEmptyObject"] = 16777216 /* Conditional */] = "IncludesEmptyObject";
|
|
4474
4474
|
TypeFlags2[TypeFlags2["IncludesInstantiable"] = 33554432 /* Substitution */] = "IncludesInstantiable";
|
|
4475
|
-
TypeFlags2[TypeFlags2["NotPrimitiveUnion"] =
|
|
4475
|
+
TypeFlags2[TypeFlags2["NotPrimitiveUnion"] = 36323363] = "NotPrimitiveUnion";
|
|
4476
4476
|
return TypeFlags2;
|
|
4477
4477
|
})(TypeFlags || {});
|
|
4478
4478
|
ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => {
|
|
@@ -4556,6 +4556,13 @@ ${lanes.join("\n")}
|
|
|
4556
4556
|
AccessFlags2[AccessFlags2["Persistent"] = 1 /* IncludeUndefined */] = "Persistent";
|
|
4557
4557
|
return AccessFlags2;
|
|
4558
4558
|
})(AccessFlags || {});
|
|
4559
|
+
IndexFlags = /* @__PURE__ */ ((IndexFlags2) => {
|
|
4560
|
+
IndexFlags2[IndexFlags2["None"] = 0] = "None";
|
|
4561
|
+
IndexFlags2[IndexFlags2["StringsOnly"] = 1] = "StringsOnly";
|
|
4562
|
+
IndexFlags2[IndexFlags2["NoIndexSignatures"] = 2] = "NoIndexSignatures";
|
|
4563
|
+
IndexFlags2[IndexFlags2["NoReducibleCheck"] = 4] = "NoReducibleCheck";
|
|
4564
|
+
return IndexFlags2;
|
|
4565
|
+
})(IndexFlags || {});
|
|
4559
4566
|
JsxReferenceKind = /* @__PURE__ */ ((JsxReferenceKind2) => {
|
|
4560
4567
|
JsxReferenceKind2[JsxReferenceKind2["Component"] = 0] = "Component";
|
|
4561
4568
|
JsxReferenceKind2[JsxReferenceKind2["Function"] = 1] = "Function";
|
|
@@ -45076,6 +45083,7 @@ ${lanes.join("\n")}
|
|
|
45076
45083
|
var noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
|
|
45077
45084
|
var useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
|
|
45078
45085
|
var keyofStringsOnly = !!compilerOptions.keyofStringsOnly;
|
|
45086
|
+
var defaultIndexFlags = keyofStringsOnly ? 1 /* StringsOnly */ : 0 /* None */;
|
|
45079
45087
|
var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 8192 /* FreshLiteral */;
|
|
45080
45088
|
var exactOptionalPropertyTypes = compilerOptions.exactOptionalPropertyTypes;
|
|
45081
45089
|
var checkBinaryExpression = createCheckBinaryExpression();
|
|
@@ -56344,6 +56352,13 @@ ${lanes.join("\n")}
|
|
|
56344
56352
|
function isConflictingPrivateProperty(prop) {
|
|
56345
56353
|
return !prop.valueDeclaration && !!(getCheckFlags(prop) & 1024 /* ContainsPrivate */);
|
|
56346
56354
|
}
|
|
56355
|
+
function isGenericReducibleType(type) {
|
|
56356
|
+
return !!(type.flags & 1048576 /* Union */ && type.objectFlags & 16777216 /* ContainsIntersections */ && some(type.types, isGenericReducibleType) || type.flags & 2097152 /* Intersection */ && isReducibleIntersection(type));
|
|
56357
|
+
}
|
|
56358
|
+
function isReducibleIntersection(type) {
|
|
56359
|
+
const uniqueFilled = type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper));
|
|
56360
|
+
return getReducedType(uniqueFilled) !== uniqueFilled;
|
|
56361
|
+
}
|
|
56347
56362
|
function elaborateNeverIntersection(errorInfo, type) {
|
|
56348
56363
|
if (type.flags & 2097152 /* Intersection */ && getObjectFlags(type) & 33554432 /* IsNeverIntersection */) {
|
|
56349
56364
|
const neverProp = find(getPropertiesOfUnionOrIntersectionType(type), isDiscriminantWithNeverType);
|
|
@@ -58396,7 +58411,7 @@ ${lanes.join("\n")}
|
|
|
58396
58411
|
origin = createOriginUnionOrIntersectionType(1048576 /* Union */, reducedTypes);
|
|
58397
58412
|
}
|
|
58398
58413
|
}
|
|
58399
|
-
const objectFlags = (includes &
|
|
58414
|
+
const objectFlags = (includes & 36323363 /* NotPrimitiveUnion */ ? 0 : 32768 /* PrimitiveUnion */) | (includes & 2097152 /* Intersection */ ? 16777216 /* ContainsIntersections */ : 0);
|
|
58400
58415
|
return getUnionTypeFromSortedList(typeSet, objectFlags, aliasSymbol, aliasTypeArguments, origin);
|
|
58401
58416
|
}
|
|
58402
58417
|
function getUnionOrIntersectionTypePredicate(signatures, kind) {
|
|
@@ -58521,7 +58536,7 @@ ${lanes.join("\n")}
|
|
|
58521
58536
|
function eachUnionContains(unionTypes2, type) {
|
|
58522
58537
|
for (const u of unionTypes2) {
|
|
58523
58538
|
if (!containsType(u.types, type)) {
|
|
58524
|
-
const primitive = type.flags & 128 /* StringLiteral */ ? stringType : type.flags &
|
|
58539
|
+
const primitive = type.flags & 128 /* StringLiteral */ ? stringType : type.flags & 256 /* NumberLiteral */ ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 8192 /* UniqueESSymbol */ ? esSymbolType : void 0;
|
|
58525
58540
|
if (!primitive || !containsType(u.types, primitive)) {
|
|
58526
58541
|
return false;
|
|
58527
58542
|
}
|
|
@@ -58548,6 +58563,9 @@ ${lanes.join("\n")}
|
|
|
58548
58563
|
}
|
|
58549
58564
|
return false;
|
|
58550
58565
|
}
|
|
58566
|
+
function eachIsUnionContaining(types, flag) {
|
|
58567
|
+
return every(types, (t) => !!(t.flags & 1048576 /* Union */) && some(t.types, (tt) => !!(tt.flags & flag)));
|
|
58568
|
+
}
|
|
58551
58569
|
function removeFromEach(types, flag) {
|
|
58552
58570
|
for (let i = 0; i < types.length; i++) {
|
|
58553
58571
|
types[i] = filterType(types[i], (t) => !(t.flags & flag));
|
|
@@ -58636,11 +58654,11 @@ ${lanes.join("\n")}
|
|
|
58636
58654
|
if (includes & 1048576 /* Union */) {
|
|
58637
58655
|
if (intersectUnionsOfPrimitiveTypes(typeSet)) {
|
|
58638
58656
|
result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
|
|
58639
|
-
} else if (
|
|
58657
|
+
} else if (eachIsUnionContaining(typeSet, 32768 /* Undefined */)) {
|
|
58640
58658
|
const containedUndefinedType = some(typeSet, containsMissingType) ? missingType : undefinedType;
|
|
58641
58659
|
removeFromEach(typeSet, 32768 /* Undefined */);
|
|
58642
58660
|
result = getUnionType([getIntersectionType(typeSet), containedUndefinedType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
58643
|
-
} else if (
|
|
58661
|
+
} else if (eachIsUnionContaining(typeSet, 65536 /* Null */)) {
|
|
58644
58662
|
removeFromEach(typeSet, 65536 /* Null */);
|
|
58645
58663
|
result = getUnionType([getIntersectionType(typeSet), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
58646
58664
|
} else {
|
|
@@ -58710,10 +58728,10 @@ ${lanes.join("\n")}
|
|
|
58710
58728
|
}
|
|
58711
58729
|
return links.resolvedType;
|
|
58712
58730
|
}
|
|
58713
|
-
function createIndexType(type,
|
|
58731
|
+
function createIndexType(type, indexFlags) {
|
|
58714
58732
|
const result = createType(4194304 /* Index */);
|
|
58715
58733
|
result.type = type;
|
|
58716
|
-
result.
|
|
58734
|
+
result.indexFlags = indexFlags;
|
|
58717
58735
|
return result;
|
|
58718
58736
|
}
|
|
58719
58737
|
function createOriginIndexType(type) {
|
|
@@ -58721,31 +58739,23 @@ ${lanes.join("\n")}
|
|
|
58721
58739
|
result.type = type;
|
|
58722
58740
|
return result;
|
|
58723
58741
|
}
|
|
58724
|
-
function getIndexTypeForGenericType(type,
|
|
58725
|
-
return
|
|
58726
|
-
type,
|
|
58727
|
-
/*stringsOnly*/
|
|
58728
|
-
true
|
|
58729
|
-
)) : type.resolvedIndexType || (type.resolvedIndexType = createIndexType(
|
|
58730
|
-
type,
|
|
58731
|
-
/*stringsOnly*/
|
|
58732
|
-
false
|
|
58733
|
-
));
|
|
58742
|
+
function getIndexTypeForGenericType(type, indexFlags) {
|
|
58743
|
+
return indexFlags & 1 /* StringsOnly */ ? type.resolvedStringIndexType || (type.resolvedStringIndexType = createIndexType(type, 1 /* StringsOnly */)) : type.resolvedIndexType || (type.resolvedIndexType = createIndexType(type, 0 /* None */));
|
|
58734
58744
|
}
|
|
58735
|
-
function getIndexTypeForMappedType(type,
|
|
58745
|
+
function getIndexTypeForMappedType(type, indexFlags) {
|
|
58736
58746
|
const typeParameter = getTypeParameterFromMappedType(type);
|
|
58737
58747
|
const constraintType = getConstraintTypeFromMappedType(type);
|
|
58738
58748
|
const nameType = getNameTypeFromMappedType(type.target || type);
|
|
58739
|
-
if (!nameType && !
|
|
58749
|
+
if (!nameType && !(indexFlags & 2 /* NoIndexSignatures */)) {
|
|
58740
58750
|
return constraintType;
|
|
58741
58751
|
}
|
|
58742
58752
|
const keyTypes = [];
|
|
58743
58753
|
if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
|
|
58744
58754
|
if (!isGenericIndexType(constraintType)) {
|
|
58745
58755
|
const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
|
|
58746
|
-
forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */,
|
|
58756
|
+
forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */, !!(indexFlags & 1 /* StringsOnly */), addMemberForKeyType);
|
|
58747
58757
|
} else {
|
|
58748
|
-
return getIndexTypeForGenericType(type,
|
|
58758
|
+
return getIndexTypeForGenericType(type, indexFlags);
|
|
58749
58759
|
}
|
|
58750
58760
|
} else {
|
|
58751
58761
|
forEachType(getLowerBoundOfKeyType(constraintType), addMemberForKeyType);
|
|
@@ -58753,7 +58763,7 @@ ${lanes.join("\n")}
|
|
|
58753
58763
|
if (isGenericIndexType(constraintType)) {
|
|
58754
58764
|
forEachType(constraintType, addMemberForKeyType);
|
|
58755
58765
|
}
|
|
58756
|
-
const result =
|
|
58766
|
+
const result = indexFlags & 2 /* NoIndexSignatures */ ? filterType(getUnionType(keyTypes), (t) => !(t.flags & (1 /* Any */ | 4 /* String */))) : getUnionType(keyTypes);
|
|
58757
58767
|
if (result.flags & 1048576 /* Union */ && constraintType.flags & 1048576 /* Union */ && getTypeListId(result.types) === getTypeListId(constraintType.types)) {
|
|
58758
58768
|
return constraintType;
|
|
58759
58769
|
}
|
|
@@ -58806,19 +58816,15 @@ ${lanes.join("\n")}
|
|
|
58806
58816
|
origin
|
|
58807
58817
|
);
|
|
58808
58818
|
}
|
|
58809
|
-
function
|
|
58810
|
-
|
|
58811
|
-
return getReducedType(uniqueFilled) !== uniqueFilled;
|
|
58819
|
+
function shouldDeferIndexType(type, indexFlags = 0 /* None */) {
|
|
58820
|
+
return !!(type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericTupleType(type) || isGenericMappedType(type) && !hasDistributiveNameType(type) || type.flags & 1048576 /* Union */ && !(indexFlags & 4 /* NoReducibleCheck */) && isGenericReducibleType(type) || type.flags & 2097152 /* Intersection */ && maybeTypeOfKind(type, 465829888 /* Instantiable */) && some(type.types, isEmptyAnonymousObjectType));
|
|
58812
58821
|
}
|
|
58813
|
-
function
|
|
58814
|
-
return !!(type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericTupleType(type) || isGenericMappedType(type) && !hasDistributiveNameType(type) || type.flags & 1048576 /* Union */ && some(type.types, isPossiblyReducibleByInstantiation) || type.flags & 2097152 /* Intersection */ && maybeTypeOfKind(type, 465829888 /* Instantiable */) && some(type.types, isEmptyAnonymousObjectType));
|
|
58815
|
-
}
|
|
58816
|
-
function getIndexType(type, stringsOnly = keyofStringsOnly, noIndexSignatures) {
|
|
58822
|
+
function getIndexType(type, indexFlags = defaultIndexFlags) {
|
|
58817
58823
|
type = getReducedType(type);
|
|
58818
|
-
return shouldDeferIndexType(type) ? getIndexTypeForGenericType(type,
|
|
58824
|
+
return shouldDeferIndexType(type, indexFlags) ? getIndexTypeForGenericType(type, indexFlags) : type.flags & 1048576 /* Union */ ? getIntersectionType(map(type.types, (t) => getIndexType(t, indexFlags))) : type.flags & 2097152 /* Intersection */ ? getUnionType(map(type.types, (t) => getIndexType(t, indexFlags))) : getObjectFlags(type) & 32 /* Mapped */ ? getIndexTypeForMappedType(type, indexFlags) : type === wildcardType ? wildcardType : type.flags & 2 /* Unknown */ ? neverType : type.flags & (1 /* Any */ | 131072 /* Never */) ? keyofConstraintType : getLiteralTypeFromProperties(
|
|
58819
58825
|
type,
|
|
58820
|
-
(
|
|
58821
|
-
|
|
58826
|
+
(indexFlags & 2 /* NoIndexSignatures */ ? 128 /* StringLiteral */ : 402653316 /* StringLike */) | (indexFlags & 1 /* StringsOnly */ ? 0 : 296 /* NumberLike */ | 12288 /* ESSymbolLike */),
|
|
58827
|
+
indexFlags === defaultIndexFlags
|
|
58822
58828
|
);
|
|
58823
58829
|
}
|
|
58824
58830
|
function getExtractStringType(type) {
|
|
@@ -59358,12 +59364,13 @@ ${lanes.join("\n")}
|
|
|
59358
59364
|
if (objectType === wildcardType || indexType === wildcardType) {
|
|
59359
59365
|
return wildcardType;
|
|
59360
59366
|
}
|
|
59367
|
+
objectType = getReducedType(objectType);
|
|
59361
59368
|
if (isStringIndexSignatureOnlyType(objectType) && !(indexType.flags & 98304 /* Nullable */) && isTypeAssignableToKind(indexType, 4 /* String */ | 8 /* Number */)) {
|
|
59362
59369
|
indexType = stringType;
|
|
59363
59370
|
}
|
|
59364
59371
|
if (compilerOptions.noUncheckedIndexedAccess && accessFlags & 32 /* ExpressionPosition */)
|
|
59365
59372
|
accessFlags |= 1 /* IncludeUndefined */;
|
|
59366
|
-
if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 197 /* IndexedAccessType */ ? isGenericTupleType(objectType) && !indexTypeLessThan(indexType, objectType.target.fixedLength) : isGenericObjectType(objectType) && !(isTupleType(objectType) && indexTypeLessThan(indexType, objectType.target.fixedLength)))) {
|
|
59373
|
+
if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 197 /* IndexedAccessType */ ? isGenericTupleType(objectType) && !indexTypeLessThan(indexType, objectType.target.fixedLength) : isGenericObjectType(objectType) && !(isTupleType(objectType) && indexTypeLessThan(indexType, objectType.target.fixedLength)) || isGenericReducibleType(objectType))) {
|
|
59367
59374
|
if (objectType.flags & 3 /* AnyOrUnknown */) {
|
|
59368
59375
|
return objectType;
|
|
59369
59376
|
}
|
|
@@ -60549,9 +60556,6 @@ ${lanes.join("\n")}
|
|
|
60549
60556
|
}
|
|
60550
60557
|
return type;
|
|
60551
60558
|
}
|
|
60552
|
-
function getUniqueLiteralFilledInstantiation(type) {
|
|
60553
|
-
return type.flags & (402784252 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper));
|
|
60554
|
-
}
|
|
60555
60559
|
function getPermissiveInstantiation(type) {
|
|
60556
60560
|
return type.flags & (402784252 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.permissiveInstantiation || (type.permissiveInstantiation = instantiateType(type, permissiveMapper));
|
|
60557
60561
|
}
|
|
@@ -62180,11 +62184,6 @@ ${lanes.join("\n")}
|
|
|
62180
62184
|
if (containsType(targetTypes, source2)) {
|
|
62181
62185
|
return -1 /* True */;
|
|
62182
62186
|
}
|
|
62183
|
-
if (getObjectFlags(target2) & 32768 /* PrimitiveUnion */ && !(source2.flags & 1024 /* EnumLiteral */) && (source2.flags & (128 /* StringLiteral */ | 512 /* BooleanLiteral */ | 2048 /* BigIntLiteral */) || (relation === subtypeRelation || relation === strictSubtypeRelation) && source2.flags & 256 /* NumberLiteral */)) {
|
|
62184
|
-
const alternateForm = source2 === source2.regularType ? source2.freshType : source2.regularType;
|
|
62185
|
-
const primitive = source2.flags & 128 /* StringLiteral */ ? stringType : source2.flags & 256 /* NumberLiteral */ ? numberType : source2.flags & 2048 /* BigIntLiteral */ ? bigintType : void 0;
|
|
62186
|
-
return primitive && containsType(targetTypes, primitive) || alternateForm && containsType(targetTypes, alternateForm) ? -1 /* True */ : 0 /* False */;
|
|
62187
|
-
}
|
|
62188
62187
|
const match = getMatchingUnionConstituentForType(target2, source2);
|
|
62189
62188
|
if (match) {
|
|
62190
62189
|
const related = isRelatedTo(
|
|
@@ -62751,7 +62750,7 @@ ${lanes.join("\n")}
|
|
|
62751
62750
|
} else {
|
|
62752
62751
|
const constraint = getSimplifiedTypeOrConstraint(targetType);
|
|
62753
62752
|
if (constraint) {
|
|
62754
|
-
if (isRelatedTo(source2, getIndexType(constraint, target2.
|
|
62753
|
+
if (isRelatedTo(source2, getIndexType(constraint, target2.indexFlags | 4 /* NoReducibleCheck */), 2 /* Target */, reportErrors2) === -1 /* True */) {
|
|
62755
62754
|
return -1 /* True */;
|
|
62756
62755
|
}
|
|
62757
62756
|
} else if (isGenericMappedType(targetType)) {
|
|
@@ -62832,13 +62831,7 @@ ${lanes.join("\n")}
|
|
|
62832
62831
|
}
|
|
62833
62832
|
if (!isGenericMappedType(source2)) {
|
|
62834
62833
|
const targetKeys = keysRemapped ? getNameTypeFromMappedType(target2) : getConstraintTypeFromMappedType(target2);
|
|
62835
|
-
const sourceKeys = getIndexType(
|
|
62836
|
-
source2,
|
|
62837
|
-
/*stringsOnly*/
|
|
62838
|
-
void 0,
|
|
62839
|
-
/*noIndexSignatures*/
|
|
62840
|
-
true
|
|
62841
|
-
);
|
|
62834
|
+
const sourceKeys = getIndexType(source2, 2 /* NoIndexSignatures */);
|
|
62842
62835
|
const includeOptional = modifiers & 4 /* IncludeOptional */;
|
|
62843
62836
|
const filteredByApplicability = includeOptional ? intersectTypes(targetKeys, sourceKeys) : void 0;
|
|
62844
62837
|
if (includeOptional ? !(filteredByApplicability.flags & 131072 /* Never */) : isRelatedTo(targetKeys, sourceKeys, 3 /* Both */)) {
|
|
@@ -77071,11 +77064,7 @@ ${lanes.join("\n")}
|
|
|
77071
77064
|
}
|
|
77072
77065
|
const objectType = type.objectType;
|
|
77073
77066
|
const indexType = type.indexType;
|
|
77074
|
-
if (isTypeAssignableTo(indexType, getIndexType(
|
|
77075
|
-
objectType,
|
|
77076
|
-
/*stringsOnly*/
|
|
77077
|
-
false
|
|
77078
|
-
))) {
|
|
77067
|
+
if (isTypeAssignableTo(indexType, getIndexType(objectType, 0 /* None */))) {
|
|
77079
77068
|
if (accessNode.kind === 210 /* ElementAccessExpression */ && isAssignmentTarget(accessNode) && getObjectFlags(objectType) & 32 /* Mapped */ && getMappedTypeModifiers(objectType) & 1 /* IncludeReadonly */) {
|
|
77080
77069
|
error(accessNode, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
|
|
77081
77070
|
}
|
|
@@ -167852,6 +167841,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
167852
167841
|
ImportKind: () => ImportKind,
|
|
167853
167842
|
ImportsNotUsedAsValues: () => ImportsNotUsedAsValues,
|
|
167854
167843
|
IndentStyle: () => IndentStyle,
|
|
167844
|
+
IndexFlags: () => IndexFlags,
|
|
167855
167845
|
IndexKind: () => IndexKind,
|
|
167856
167846
|
InferenceFlags: () => InferenceFlags,
|
|
167857
167847
|
InferencePriority: () => InferencePriority,
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -3149,7 +3149,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
|
|
|
3149
3149
|
TypeFlags2[TypeFlags2["IncludesWildcard"] = 8388608 /* IndexedAccess */] = "IncludesWildcard";
|
|
3150
3150
|
TypeFlags2[TypeFlags2["IncludesEmptyObject"] = 16777216 /* Conditional */] = "IncludesEmptyObject";
|
|
3151
3151
|
TypeFlags2[TypeFlags2["IncludesInstantiable"] = 33554432 /* Substitution */] = "IncludesInstantiable";
|
|
3152
|
-
TypeFlags2[TypeFlags2["NotPrimitiveUnion"] =
|
|
3152
|
+
TypeFlags2[TypeFlags2["NotPrimitiveUnion"] = 36323363] = "NotPrimitiveUnion";
|
|
3153
3153
|
return TypeFlags2;
|
|
3154
3154
|
})(TypeFlags || {});
|
|
3155
3155
|
var ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => {
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@typescript-deploys/pr-build",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.1.0-pr-
|
|
5
|
+
"version": "5.1.0-pr-53098-13",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -113,5 +113,5 @@
|
|
|
113
113
|
"node": "14.21.1",
|
|
114
114
|
"npm": "8.19.3"
|
|
115
115
|
},
|
|
116
|
-
"gitHead": "
|
|
116
|
+
"gitHead": "cc7ab93ef68f6438bb50925a24a955193989e4d9"
|
|
117
117
|
}
|