@typescript-deploys/pr-build 5.1.0-pr-54112-10 → 5.1.0-pr-53938-7
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 +45 -49
- package/lib/tsserver.js +54 -59
- package/lib/tsserverlibrary.js +54 -59
- package/lib/typescript.js +54 -59
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -43360,7 +43360,7 @@ function createTypeChecker(host) {
|
|
|
43360
43360
|
getGlobalIterableType: getGlobalAsyncIterableType,
|
|
43361
43361
|
getGlobalIterableIteratorType: getGlobalAsyncIterableIteratorType,
|
|
43362
43362
|
getGlobalGeneratorType: getGlobalAsyncGeneratorType,
|
|
43363
|
-
resolveIterationType: getAwaitedType,
|
|
43363
|
+
resolveIterationType: (type, errorNode) => getAwaitedType(type, errorNode, Diagnostics.Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member),
|
|
43364
43364
|
mustHaveANextMethodDiagnostic: Diagnostics.An_async_iterator_must_have_a_next_method,
|
|
43365
43365
|
mustBeAMethodDiagnostic: Diagnostics.The_0_property_of_an_async_iterator_must_be_a_method,
|
|
43366
43366
|
mustHaveAValueDiagnostic: Diagnostics.The_type_returned_by_the_0_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value_property
|
|
@@ -47865,32 +47865,34 @@ function createTypeChecker(host) {
|
|
|
47865
47865
|
const methodDeclaration = signatureToSignatureDeclarationHelper(signature, 172 /* MethodSignature */, context, { name: propertyName, questionToken: optionalToken });
|
|
47866
47866
|
typeElements.push(preserveCommentsOn(methodDeclaration));
|
|
47867
47867
|
}
|
|
47868
|
+
if (signatures.length || !optionalToken) {
|
|
47869
|
+
return;
|
|
47870
|
+
}
|
|
47871
|
+
}
|
|
47872
|
+
let propertyTypeNode;
|
|
47873
|
+
if (shouldUsePlaceholderForProperty(propertySymbol, context)) {
|
|
47874
|
+
propertyTypeNode = createElidedInformationPlaceholder(context);
|
|
47868
47875
|
} else {
|
|
47869
|
-
|
|
47870
|
-
|
|
47871
|
-
|
|
47872
|
-
} else {
|
|
47873
|
-
if (propertyIsReverseMapped) {
|
|
47874
|
-
context.reverseMappedStack || (context.reverseMappedStack = []);
|
|
47875
|
-
context.reverseMappedStack.push(propertySymbol);
|
|
47876
|
-
}
|
|
47877
|
-
propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
47878
|
-
if (propertyIsReverseMapped) {
|
|
47879
|
-
context.reverseMappedStack.pop();
|
|
47880
|
-
}
|
|
47876
|
+
if (propertyIsReverseMapped) {
|
|
47877
|
+
context.reverseMappedStack || (context.reverseMappedStack = []);
|
|
47878
|
+
context.reverseMappedStack.push(propertySymbol);
|
|
47881
47879
|
}
|
|
47882
|
-
|
|
47883
|
-
if (
|
|
47884
|
-
context.
|
|
47880
|
+
propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
47881
|
+
if (propertyIsReverseMapped) {
|
|
47882
|
+
context.reverseMappedStack.pop();
|
|
47885
47883
|
}
|
|
47886
|
-
const propertySignature = factory.createPropertySignature(
|
|
47887
|
-
modifiers,
|
|
47888
|
-
propertyName,
|
|
47889
|
-
optionalToken,
|
|
47890
|
-
propertyTypeNode
|
|
47891
|
-
);
|
|
47892
|
-
typeElements.push(preserveCommentsOn(propertySignature));
|
|
47893
47884
|
}
|
|
47885
|
+
const modifiers = isReadonlySymbol(propertySymbol) ? [factory.createToken(148 /* ReadonlyKeyword */)] : void 0;
|
|
47886
|
+
if (modifiers) {
|
|
47887
|
+
context.approximateLength += 9;
|
|
47888
|
+
}
|
|
47889
|
+
const propertySignature = factory.createPropertySignature(
|
|
47890
|
+
modifiers,
|
|
47891
|
+
propertyName,
|
|
47892
|
+
optionalToken,
|
|
47893
|
+
propertyTypeNode
|
|
47894
|
+
);
|
|
47895
|
+
typeElements.push(preserveCommentsOn(propertySignature));
|
|
47894
47896
|
function preserveCommentsOn(node) {
|
|
47895
47897
|
var _a2;
|
|
47896
47898
|
if (some(propertySymbol.declarations, (d) => d.kind === 354 /* JSDocPropertyTag */)) {
|
|
@@ -50885,7 +50887,7 @@ function createTypeChecker(host) {
|
|
|
50885
50887
|
} else {
|
|
50886
50888
|
const name = declaration.propertyName || declaration.name;
|
|
50887
50889
|
const indexType = getLiteralTypeFromPropertyName(name);
|
|
50888
|
-
const declaredType = getIndexedAccessType(parentType, indexType,
|
|
50890
|
+
const declaredType = getIndexedAccessType(parentType, indexType, 32 /* ExpressionPosition */, name);
|
|
50889
50891
|
type = getFlowTypeOfDestructuring(declaration, declaredType);
|
|
50890
50892
|
}
|
|
50891
50893
|
} else {
|
|
@@ -50896,7 +50898,7 @@ function createTypeChecker(host) {
|
|
|
50896
50898
|
type = everyType(baseConstraint, isTupleType) ? mapType(baseConstraint, (t) => sliceTupleType(t, index)) : createArrayType(elementType);
|
|
50897
50899
|
} else if (isArrayLikeType(parentType)) {
|
|
50898
50900
|
const indexType = getNumberLiteralType(index);
|
|
50899
|
-
const accessFlags =
|
|
50901
|
+
const accessFlags = 32 /* ExpressionPosition */ | (hasDefaultValue(declaration) ? 16 /* NoTupleBoundsCheck */ : 0);
|
|
50900
50902
|
const declaredType = getIndexedAccessTypeOrUndefined(parentType, indexType, accessFlags, declaration.name) || errorType;
|
|
50901
50903
|
type = getFlowTypeOfDestructuring(declaration, declaredType);
|
|
50902
50904
|
} else {
|
|
@@ -56765,12 +56767,12 @@ function createTypeChecker(host) {
|
|
|
56765
56767
|
const accessExpression = accessNode && accessNode.kind === 211 /* ElementAccessExpression */ ? accessNode : void 0;
|
|
56766
56768
|
const propName = accessNode && isPrivateIdentifier(accessNode) ? void 0 : getPropertyNameFromIndex(indexType, accessNode);
|
|
56767
56769
|
if (propName !== void 0) {
|
|
56768
|
-
if (accessFlags &
|
|
56770
|
+
if (accessFlags & 256 /* Contextual */) {
|
|
56769
56771
|
return getTypeOfPropertyOfContextualType(objectType, propName) || anyType;
|
|
56770
56772
|
}
|
|
56771
56773
|
const prop = getPropertyOfType(objectType, propName);
|
|
56772
56774
|
if (prop) {
|
|
56773
|
-
if (accessFlags &
|
|
56775
|
+
if (accessFlags & 64 /* ReportDeprecated */ && accessNode && prop.declarations && isDeprecatedSymbol(prop) && isUncalledFunctionReference(accessNode, prop)) {
|
|
56774
56776
|
const deprecatedNode = (accessExpression == null ? void 0 : accessExpression.argumentExpression) ?? (isIndexedAccessTypeNode(accessNode) ? accessNode.indexType : accessNode);
|
|
56775
56777
|
addDeprecatedSuggestion(deprecatedNode, prop.declarations, propName);
|
|
56776
56778
|
}
|
|
@@ -56780,7 +56782,7 @@ function createTypeChecker(host) {
|
|
|
56780
56782
|
error(accessExpression.argumentExpression, Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, symbolToString(prop));
|
|
56781
56783
|
return void 0;
|
|
56782
56784
|
}
|
|
56783
|
-
if (accessFlags &
|
|
56785
|
+
if (accessFlags & 8 /* CacheSymbol */) {
|
|
56784
56786
|
getNodeLinks(accessNode).resolvedSymbol = prop;
|
|
56785
56787
|
}
|
|
56786
56788
|
if (isThisPropertyAccessInConstructor(accessExpression, prop)) {
|
|
@@ -56792,7 +56794,7 @@ function createTypeChecker(host) {
|
|
|
56792
56794
|
}
|
|
56793
56795
|
if (everyType(objectType, isTupleType) && isNumericLiteralName(propName)) {
|
|
56794
56796
|
const index = +propName;
|
|
56795
|
-
if (accessNode && everyType(objectType, (t) => !t.target.hasRestElement) && !(accessFlags &
|
|
56797
|
+
if (accessNode && everyType(objectType, (t) => !t.target.hasRestElement) && !(accessFlags & 16 /* NoTupleBoundsCheck */)) {
|
|
56796
56798
|
const indexNode = getIndexNodeForAccessExpression(accessNode);
|
|
56797
56799
|
if (isTupleType(objectType)) {
|
|
56798
56800
|
if (index < 0) {
|
|
@@ -56825,7 +56827,7 @@ function createTypeChecker(host) {
|
|
|
56825
56827
|
}
|
|
56826
56828
|
const indexInfo = getApplicableIndexInfo(objectType, indexType) || getIndexInfoOfType(objectType, stringType);
|
|
56827
56829
|
if (indexInfo) {
|
|
56828
|
-
if (accessFlags &
|
|
56830
|
+
if (accessFlags & 2 /* NoIndexSignatures */ && indexInfo.keyType !== numberType) {
|
|
56829
56831
|
if (accessExpression) {
|
|
56830
56832
|
error(accessExpression, Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(originalObjectType));
|
|
56831
56833
|
}
|
|
@@ -56862,7 +56864,7 @@ function createTypeChecker(host) {
|
|
|
56862
56864
|
}
|
|
56863
56865
|
if (objectType.symbol === globalThisSymbol && propName !== void 0 && globalThisSymbol.exports.has(propName) && globalThisSymbol.exports.get(propName).flags & 418 /* BlockScoped */) {
|
|
56864
56866
|
error(accessExpression, Diagnostics.Property_0_does_not_exist_on_type_1, unescapeLeadingUnderscores(propName), typeToString(objectType));
|
|
56865
|
-
} else if (noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors && !(accessFlags &
|
|
56867
|
+
} else if (noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors && !(accessFlags & 128 /* SuppressNoImplicitAnyError */)) {
|
|
56866
56868
|
if (propName !== void 0 && typeHasStaticProperty(propName, objectType)) {
|
|
56867
56869
|
const typeName = typeToString(objectType);
|
|
56868
56870
|
error(accessExpression, Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_to_access_the_static_member_2_instead, propName, typeName, typeName + "[" + getTextOfNode(accessExpression.argumentExpression) + "]");
|
|
@@ -57098,13 +57100,13 @@ function createTypeChecker(host) {
|
|
|
57098
57100
|
if (isStringIndexSignatureOnlyType(objectType) && !(indexType.flags & 98304 /* Nullable */) && isTypeAssignableToKind(indexType, 4 /* String */ | 8 /* Number */)) {
|
|
57099
57101
|
indexType = stringType;
|
|
57100
57102
|
}
|
|
57101
|
-
if (compilerOptions.noUncheckedIndexedAccess && accessFlags &
|
|
57103
|
+
if (compilerOptions.noUncheckedIndexedAccess && accessFlags & 32 /* ExpressionPosition */)
|
|
57102
57104
|
accessFlags |= 1 /* IncludeUndefined */;
|
|
57103
|
-
if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 198 /* IndexedAccessType */ ? isGenericTupleType(objectType) && !indexTypeLessThan(indexType, objectType.target.fixedLength) : isGenericObjectType(objectType) && !(isTupleType(objectType) && indexTypeLessThan(indexType, objectType.target.fixedLength)) ||
|
|
57105
|
+
if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 198 /* IndexedAccessType */ ? isGenericTupleType(objectType) && !indexTypeLessThan(indexType, objectType.target.fixedLength) : isGenericObjectType(objectType) && !(isTupleType(objectType) && indexTypeLessThan(indexType, objectType.target.fixedLength)) || isGenericReducibleType(objectType))) {
|
|
57104
57106
|
if (objectType.flags & 3 /* AnyOrUnknown */) {
|
|
57105
57107
|
return objectType;
|
|
57106
57108
|
}
|
|
57107
|
-
const persistentAccessFlags = accessFlags &
|
|
57109
|
+
const persistentAccessFlags = accessFlags & 1 /* Persistent */;
|
|
57108
57110
|
const id = objectType.id + "," + indexType.id + "," + persistentAccessFlags + getAliasId(aliasSymbol, aliasTypeArguments);
|
|
57109
57111
|
let type = indexedAccessTypes.get(id);
|
|
57110
57112
|
if (!type) {
|
|
@@ -57117,7 +57119,7 @@ function createTypeChecker(host) {
|
|
|
57117
57119
|
const propTypes = [];
|
|
57118
57120
|
let wasMissingProp = false;
|
|
57119
57121
|
for (const t of indexType.types) {
|
|
57120
|
-
const propType = getPropertyTypeForIndexType(objectType, apparentObjectType, t, indexType, accessNode, accessFlags | (wasMissingProp ?
|
|
57122
|
+
const propType = getPropertyTypeForIndexType(objectType, apparentObjectType, t, indexType, accessNode, accessFlags | (wasMissingProp ? 128 /* SuppressNoImplicitAnyError */ : 0));
|
|
57121
57123
|
if (propType) {
|
|
57122
57124
|
propTypes.push(propType);
|
|
57123
57125
|
} else if (!accessNode) {
|
|
@@ -57129,9 +57131,9 @@ function createTypeChecker(host) {
|
|
|
57129
57131
|
if (wasMissingProp) {
|
|
57130
57132
|
return void 0;
|
|
57131
57133
|
}
|
|
57132
|
-
return accessFlags &
|
|
57134
|
+
return accessFlags & 4 /* Writing */ ? getIntersectionType(propTypes, aliasSymbol, aliasTypeArguments) : getUnionType(propTypes, 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
57133
57135
|
}
|
|
57134
|
-
return getPropertyTypeForIndexType(objectType, apparentObjectType, indexType, indexType, accessNode, accessFlags |
|
|
57136
|
+
return getPropertyTypeForIndexType(objectType, apparentObjectType, indexType, indexType, accessNode, accessFlags | 8 /* CacheSymbol */ | 64 /* ReportDeprecated */);
|
|
57135
57137
|
}
|
|
57136
57138
|
function getTypeFromIndexedAccessTypeNode(node) {
|
|
57137
57139
|
const links = getNodeLinks(node);
|
|
@@ -60554,7 +60556,7 @@ function createTypeChecker(host) {
|
|
|
60554
60556
|
const baseObjectType = getBaseConstraintOfType(objectType) || objectType;
|
|
60555
60557
|
const baseIndexType = getBaseConstraintOfType(indexType) || indexType;
|
|
60556
60558
|
if (!isGenericObjectType(baseObjectType) && !isGenericIndexType(baseIndexType)) {
|
|
60557
|
-
const accessFlags =
|
|
60559
|
+
const accessFlags = 4 /* Writing */ | (baseObjectType !== objectType ? 2 /* NoIndexSignatures */ : 0);
|
|
60558
60560
|
const constraint = getIndexedAccessTypeOrUndefined(baseObjectType, baseIndexType, accessFlags);
|
|
60559
60561
|
if (constraint) {
|
|
60560
60562
|
if (reportErrors2 && originalErrorInfo) {
|
|
@@ -63080,12 +63082,6 @@ function createTypeChecker(host) {
|
|
|
63080
63082
|
}
|
|
63081
63083
|
}
|
|
63082
63084
|
}
|
|
63083
|
-
if (target.flags & 8388608 /* IndexedAccess */ && isGenericReducibleType(target.objectType)) {
|
|
63084
|
-
const instantiated = getIndexedAccessType(target.objectType, target.indexType, 2 /* ResolveReducibleTypes */);
|
|
63085
|
-
if (instantiated && instantiated !== target) {
|
|
63086
|
-
inferFromTypes(source, instantiated);
|
|
63087
|
-
}
|
|
63088
|
-
}
|
|
63089
63085
|
}
|
|
63090
63086
|
if (getObjectFlags(source) & 4 /* Reference */ && getObjectFlags(target) & 4 /* Reference */ && (source.target === target.target || isArrayType(source) && isArrayType(target)) && !(source.node && target.node)) {
|
|
63091
63087
|
inferFromTypeArguments(getTypeArguments(source), getTypeArguments(target), getVariances(source.target));
|
|
@@ -66611,7 +66607,7 @@ function createTypeChecker(host) {
|
|
|
66611
66607
|
return getEffectiveFirstArgumentForJsxSignature(signature, callTarget);
|
|
66612
66608
|
}
|
|
66613
66609
|
const restIndex = signature.parameters.length - 1;
|
|
66614
|
-
return signatureHasRestParameter(signature) && argIndex >= restIndex ? getIndexedAccessType(getTypeOfSymbol(signature.parameters[restIndex]), getNumberLiteralType(argIndex - restIndex),
|
|
66610
|
+
return signatureHasRestParameter(signature) && argIndex >= restIndex ? getIndexedAccessType(getTypeOfSymbol(signature.parameters[restIndex]), getNumberLiteralType(argIndex - restIndex), 256 /* Contextual */) : getTypeAtPosition(signature, argIndex);
|
|
66615
66611
|
}
|
|
66616
66612
|
function getContextualTypeForDecorator(decorator) {
|
|
66617
66613
|
const signature = getDecoratorCallSignature(decorator);
|
|
@@ -69292,7 +69288,7 @@ function createTypeChecker(host) {
|
|
|
69292
69288
|
return errorType;
|
|
69293
69289
|
}
|
|
69294
69290
|
const effectiveIndexType = isForInVariableForNumericPropertyNames(indexExpression) ? numberType : indexType;
|
|
69295
|
-
const accessFlags = isAssignmentTarget(node) ?
|
|
69291
|
+
const accessFlags = isAssignmentTarget(node) ? 4 /* Writing */ | (isGenericObjectType(objectType) && !isThisTypeParameter(objectType) ? 2 /* NoIndexSignatures */ : 0) : 32 /* ExpressionPosition */;
|
|
69296
69292
|
const indexedAccessType = getIndexedAccessTypeOrUndefined(objectType, effectiveIndexType, accessFlags, node) || errorType;
|
|
69297
69293
|
return checkIndexedAccessIndexType(getFlowTypeOfAccessExpression(node, getNodeLinks(node).resolvedSymbol, indexedAccessType, indexExpression, checkMode), node);
|
|
69298
69294
|
}
|
|
@@ -69572,7 +69568,7 @@ function createTypeChecker(host) {
|
|
|
69572
69568
|
flags.push(4 /* Rest */);
|
|
69573
69569
|
}
|
|
69574
69570
|
} else {
|
|
69575
|
-
const contextualType = isTupleType(restType) ? getContextualTypeForElementExpression(restType, i - index, argCount - index) || unknownType : getIndexedAccessType(restType, getNumberLiteralType(i - index),
|
|
69571
|
+
const contextualType = isTupleType(restType) ? getContextualTypeForElementExpression(restType, i - index, argCount - index) || unknownType : getIndexedAccessType(restType, getNumberLiteralType(i - index), 256 /* Contextual */);
|
|
69576
69572
|
const argType = checkExpressionWithContextualType(arg, contextualType, context, checkMode);
|
|
69577
69573
|
const hasPrimitiveContextualType = inConstContext || maybeTypeOfKind(contextualType, 402784252 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
|
|
69578
69574
|
types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType));
|
|
@@ -72957,7 +72953,7 @@ function createTypeChecker(host) {
|
|
|
72957
72953
|
);
|
|
72958
72954
|
}
|
|
72959
72955
|
}
|
|
72960
|
-
const elementType = getIndexedAccessType(objectLiteralType, exprType,
|
|
72956
|
+
const elementType = getIndexedAccessType(objectLiteralType, exprType, 32 /* ExpressionPosition */, name);
|
|
72961
72957
|
const type = getFlowTypeOfDestructuring(property, elementType);
|
|
72962
72958
|
return checkDestructuringAssignment(property.kind === 303 /* ShorthandPropertyAssignment */ ? property : property.initializer, type);
|
|
72963
72959
|
} else if (property.kind === 304 /* SpreadAssignment */) {
|
|
@@ -73006,7 +73002,7 @@ function createTypeChecker(host) {
|
|
|
73006
73002
|
if (element.kind !== 229 /* SpreadElement */) {
|
|
73007
73003
|
const indexType = getNumberLiteralType(elementIndex);
|
|
73008
73004
|
if (isArrayLikeType(sourceType)) {
|
|
73009
|
-
const accessFlags =
|
|
73005
|
+
const accessFlags = 32 /* ExpressionPosition */ | (hasDefaultValue(element) ? 16 /* NoTupleBoundsCheck */ : 0);
|
|
73010
73006
|
const elementType2 = getIndexedAccessTypeOrUndefined(sourceType, indexType, accessFlags, createSyntheticExpression(element, indexType)) || errorType;
|
|
73011
73007
|
const assignedType = hasDefaultValue(element) ? getTypeWithFacts(elementType2, 524288 /* NEUndefined */) : elementType2;
|
|
73012
73008
|
const type = getFlowTypeOfDestructuring(element, assignedType);
|
package/lib/tsserver.js
CHANGED
|
@@ -6735,16 +6735,15 @@ var ElementFlags = /* @__PURE__ */ ((ElementFlags2) => {
|
|
|
6735
6735
|
var AccessFlags = /* @__PURE__ */ ((AccessFlags2) => {
|
|
6736
6736
|
AccessFlags2[AccessFlags2["None"] = 0] = "None";
|
|
6737
6737
|
AccessFlags2[AccessFlags2["IncludeUndefined"] = 1] = "IncludeUndefined";
|
|
6738
|
-
AccessFlags2[AccessFlags2["
|
|
6739
|
-
AccessFlags2[AccessFlags2["
|
|
6740
|
-
AccessFlags2[AccessFlags2["
|
|
6741
|
-
AccessFlags2[AccessFlags2["
|
|
6742
|
-
AccessFlags2[AccessFlags2["
|
|
6743
|
-
AccessFlags2[AccessFlags2["
|
|
6744
|
-
AccessFlags2[AccessFlags2["
|
|
6745
|
-
AccessFlags2[AccessFlags2["
|
|
6746
|
-
AccessFlags2[AccessFlags2["
|
|
6747
|
-
AccessFlags2[AccessFlags2["Persistent"] = 3] = "Persistent";
|
|
6738
|
+
AccessFlags2[AccessFlags2["NoIndexSignatures"] = 2] = "NoIndexSignatures";
|
|
6739
|
+
AccessFlags2[AccessFlags2["Writing"] = 4] = "Writing";
|
|
6740
|
+
AccessFlags2[AccessFlags2["CacheSymbol"] = 8] = "CacheSymbol";
|
|
6741
|
+
AccessFlags2[AccessFlags2["NoTupleBoundsCheck"] = 16] = "NoTupleBoundsCheck";
|
|
6742
|
+
AccessFlags2[AccessFlags2["ExpressionPosition"] = 32] = "ExpressionPosition";
|
|
6743
|
+
AccessFlags2[AccessFlags2["ReportDeprecated"] = 64] = "ReportDeprecated";
|
|
6744
|
+
AccessFlags2[AccessFlags2["SuppressNoImplicitAnyError"] = 128] = "SuppressNoImplicitAnyError";
|
|
6745
|
+
AccessFlags2[AccessFlags2["Contextual"] = 256] = "Contextual";
|
|
6746
|
+
AccessFlags2[AccessFlags2["Persistent"] = 1 /* IncludeUndefined */] = "Persistent";
|
|
6748
6747
|
return AccessFlags2;
|
|
6749
6748
|
})(AccessFlags || {});
|
|
6750
6749
|
var IndexFlags = /* @__PURE__ */ ((IndexFlags2) => {
|
|
@@ -48011,7 +48010,7 @@ function createTypeChecker(host) {
|
|
|
48011
48010
|
getGlobalIterableType: getGlobalAsyncIterableType,
|
|
48012
48011
|
getGlobalIterableIteratorType: getGlobalAsyncIterableIteratorType,
|
|
48013
48012
|
getGlobalGeneratorType: getGlobalAsyncGeneratorType,
|
|
48014
|
-
resolveIterationType: getAwaitedType,
|
|
48013
|
+
resolveIterationType: (type, errorNode) => getAwaitedType(type, errorNode, Diagnostics.Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member),
|
|
48015
48014
|
mustHaveANextMethodDiagnostic: Diagnostics.An_async_iterator_must_have_a_next_method,
|
|
48016
48015
|
mustBeAMethodDiagnostic: Diagnostics.The_0_property_of_an_async_iterator_must_be_a_method,
|
|
48017
48016
|
mustHaveAValueDiagnostic: Diagnostics.The_type_returned_by_the_0_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value_property
|
|
@@ -52516,32 +52515,34 @@ function createTypeChecker(host) {
|
|
|
52516
52515
|
const methodDeclaration = signatureToSignatureDeclarationHelper(signature, 172 /* MethodSignature */, context, { name: propertyName, questionToken: optionalToken });
|
|
52517
52516
|
typeElements.push(preserveCommentsOn(methodDeclaration));
|
|
52518
52517
|
}
|
|
52518
|
+
if (signatures.length || !optionalToken) {
|
|
52519
|
+
return;
|
|
52520
|
+
}
|
|
52521
|
+
}
|
|
52522
|
+
let propertyTypeNode;
|
|
52523
|
+
if (shouldUsePlaceholderForProperty(propertySymbol, context)) {
|
|
52524
|
+
propertyTypeNode = createElidedInformationPlaceholder(context);
|
|
52519
52525
|
} else {
|
|
52520
|
-
|
|
52521
|
-
|
|
52522
|
-
|
|
52523
|
-
} else {
|
|
52524
|
-
if (propertyIsReverseMapped) {
|
|
52525
|
-
context.reverseMappedStack || (context.reverseMappedStack = []);
|
|
52526
|
-
context.reverseMappedStack.push(propertySymbol);
|
|
52527
|
-
}
|
|
52528
|
-
propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
52529
|
-
if (propertyIsReverseMapped) {
|
|
52530
|
-
context.reverseMappedStack.pop();
|
|
52531
|
-
}
|
|
52526
|
+
if (propertyIsReverseMapped) {
|
|
52527
|
+
context.reverseMappedStack || (context.reverseMappedStack = []);
|
|
52528
|
+
context.reverseMappedStack.push(propertySymbol);
|
|
52532
52529
|
}
|
|
52533
|
-
|
|
52534
|
-
if (
|
|
52535
|
-
context.
|
|
52530
|
+
propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
52531
|
+
if (propertyIsReverseMapped) {
|
|
52532
|
+
context.reverseMappedStack.pop();
|
|
52536
52533
|
}
|
|
52537
|
-
const propertySignature = factory.createPropertySignature(
|
|
52538
|
-
modifiers,
|
|
52539
|
-
propertyName,
|
|
52540
|
-
optionalToken,
|
|
52541
|
-
propertyTypeNode
|
|
52542
|
-
);
|
|
52543
|
-
typeElements.push(preserveCommentsOn(propertySignature));
|
|
52544
52534
|
}
|
|
52535
|
+
const modifiers = isReadonlySymbol(propertySymbol) ? [factory.createToken(148 /* ReadonlyKeyword */)] : void 0;
|
|
52536
|
+
if (modifiers) {
|
|
52537
|
+
context.approximateLength += 9;
|
|
52538
|
+
}
|
|
52539
|
+
const propertySignature = factory.createPropertySignature(
|
|
52540
|
+
modifiers,
|
|
52541
|
+
propertyName,
|
|
52542
|
+
optionalToken,
|
|
52543
|
+
propertyTypeNode
|
|
52544
|
+
);
|
|
52545
|
+
typeElements.push(preserveCommentsOn(propertySignature));
|
|
52545
52546
|
function preserveCommentsOn(node) {
|
|
52546
52547
|
var _a2;
|
|
52547
52548
|
if (some(propertySymbol.declarations, (d) => d.kind === 354 /* JSDocPropertyTag */)) {
|
|
@@ -55536,7 +55537,7 @@ function createTypeChecker(host) {
|
|
|
55536
55537
|
} else {
|
|
55537
55538
|
const name = declaration.propertyName || declaration.name;
|
|
55538
55539
|
const indexType = getLiteralTypeFromPropertyName(name);
|
|
55539
|
-
const declaredType = getIndexedAccessType(parentType, indexType,
|
|
55540
|
+
const declaredType = getIndexedAccessType(parentType, indexType, 32 /* ExpressionPosition */, name);
|
|
55540
55541
|
type = getFlowTypeOfDestructuring(declaration, declaredType);
|
|
55541
55542
|
}
|
|
55542
55543
|
} else {
|
|
@@ -55547,7 +55548,7 @@ function createTypeChecker(host) {
|
|
|
55547
55548
|
type = everyType(baseConstraint, isTupleType) ? mapType(baseConstraint, (t) => sliceTupleType(t, index)) : createArrayType(elementType);
|
|
55548
55549
|
} else if (isArrayLikeType(parentType)) {
|
|
55549
55550
|
const indexType = getNumberLiteralType(index);
|
|
55550
|
-
const accessFlags =
|
|
55551
|
+
const accessFlags = 32 /* ExpressionPosition */ | (hasDefaultValue(declaration) ? 16 /* NoTupleBoundsCheck */ : 0);
|
|
55551
55552
|
const declaredType = getIndexedAccessTypeOrUndefined(parentType, indexType, accessFlags, declaration.name) || errorType;
|
|
55552
55553
|
type = getFlowTypeOfDestructuring(declaration, declaredType);
|
|
55553
55554
|
} else {
|
|
@@ -61416,12 +61417,12 @@ function createTypeChecker(host) {
|
|
|
61416
61417
|
const accessExpression = accessNode && accessNode.kind === 211 /* ElementAccessExpression */ ? accessNode : void 0;
|
|
61417
61418
|
const propName = accessNode && isPrivateIdentifier(accessNode) ? void 0 : getPropertyNameFromIndex(indexType, accessNode);
|
|
61418
61419
|
if (propName !== void 0) {
|
|
61419
|
-
if (accessFlags &
|
|
61420
|
+
if (accessFlags & 256 /* Contextual */) {
|
|
61420
61421
|
return getTypeOfPropertyOfContextualType(objectType, propName) || anyType;
|
|
61421
61422
|
}
|
|
61422
61423
|
const prop = getPropertyOfType(objectType, propName);
|
|
61423
61424
|
if (prop) {
|
|
61424
|
-
if (accessFlags &
|
|
61425
|
+
if (accessFlags & 64 /* ReportDeprecated */ && accessNode && prop.declarations && isDeprecatedSymbol(prop) && isUncalledFunctionReference(accessNode, prop)) {
|
|
61425
61426
|
const deprecatedNode = (accessExpression == null ? void 0 : accessExpression.argumentExpression) ?? (isIndexedAccessTypeNode(accessNode) ? accessNode.indexType : accessNode);
|
|
61426
61427
|
addDeprecatedSuggestion(deprecatedNode, prop.declarations, propName);
|
|
61427
61428
|
}
|
|
@@ -61431,7 +61432,7 @@ function createTypeChecker(host) {
|
|
|
61431
61432
|
error(accessExpression.argumentExpression, Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, symbolToString(prop));
|
|
61432
61433
|
return void 0;
|
|
61433
61434
|
}
|
|
61434
|
-
if (accessFlags &
|
|
61435
|
+
if (accessFlags & 8 /* CacheSymbol */) {
|
|
61435
61436
|
getNodeLinks(accessNode).resolvedSymbol = prop;
|
|
61436
61437
|
}
|
|
61437
61438
|
if (isThisPropertyAccessInConstructor(accessExpression, prop)) {
|
|
@@ -61443,7 +61444,7 @@ function createTypeChecker(host) {
|
|
|
61443
61444
|
}
|
|
61444
61445
|
if (everyType(objectType, isTupleType) && isNumericLiteralName(propName)) {
|
|
61445
61446
|
const index = +propName;
|
|
61446
|
-
if (accessNode && everyType(objectType, (t) => !t.target.hasRestElement) && !(accessFlags &
|
|
61447
|
+
if (accessNode && everyType(objectType, (t) => !t.target.hasRestElement) && !(accessFlags & 16 /* NoTupleBoundsCheck */)) {
|
|
61447
61448
|
const indexNode = getIndexNodeForAccessExpression(accessNode);
|
|
61448
61449
|
if (isTupleType(objectType)) {
|
|
61449
61450
|
if (index < 0) {
|
|
@@ -61476,7 +61477,7 @@ function createTypeChecker(host) {
|
|
|
61476
61477
|
}
|
|
61477
61478
|
const indexInfo = getApplicableIndexInfo(objectType, indexType) || getIndexInfoOfType(objectType, stringType);
|
|
61478
61479
|
if (indexInfo) {
|
|
61479
|
-
if (accessFlags &
|
|
61480
|
+
if (accessFlags & 2 /* NoIndexSignatures */ && indexInfo.keyType !== numberType) {
|
|
61480
61481
|
if (accessExpression) {
|
|
61481
61482
|
error(accessExpression, Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(originalObjectType));
|
|
61482
61483
|
}
|
|
@@ -61513,7 +61514,7 @@ function createTypeChecker(host) {
|
|
|
61513
61514
|
}
|
|
61514
61515
|
if (objectType.symbol === globalThisSymbol && propName !== void 0 && globalThisSymbol.exports.has(propName) && globalThisSymbol.exports.get(propName).flags & 418 /* BlockScoped */) {
|
|
61515
61516
|
error(accessExpression, Diagnostics.Property_0_does_not_exist_on_type_1, unescapeLeadingUnderscores(propName), typeToString(objectType));
|
|
61516
|
-
} else if (noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors && !(accessFlags &
|
|
61517
|
+
} else if (noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors && !(accessFlags & 128 /* SuppressNoImplicitAnyError */)) {
|
|
61517
61518
|
if (propName !== void 0 && typeHasStaticProperty(propName, objectType)) {
|
|
61518
61519
|
const typeName = typeToString(objectType);
|
|
61519
61520
|
error(accessExpression, Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_to_access_the_static_member_2_instead, propName, typeName, typeName + "[" + getTextOfNode(accessExpression.argumentExpression) + "]");
|
|
@@ -61749,13 +61750,13 @@ function createTypeChecker(host) {
|
|
|
61749
61750
|
if (isStringIndexSignatureOnlyType(objectType) && !(indexType.flags & 98304 /* Nullable */) && isTypeAssignableToKind(indexType, 4 /* String */ | 8 /* Number */)) {
|
|
61750
61751
|
indexType = stringType;
|
|
61751
61752
|
}
|
|
61752
|
-
if (compilerOptions.noUncheckedIndexedAccess && accessFlags &
|
|
61753
|
+
if (compilerOptions.noUncheckedIndexedAccess && accessFlags & 32 /* ExpressionPosition */)
|
|
61753
61754
|
accessFlags |= 1 /* IncludeUndefined */;
|
|
61754
|
-
if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 198 /* IndexedAccessType */ ? isGenericTupleType(objectType) && !indexTypeLessThan(indexType, objectType.target.fixedLength) : isGenericObjectType(objectType) && !(isTupleType(objectType) && indexTypeLessThan(indexType, objectType.target.fixedLength)) ||
|
|
61755
|
+
if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 198 /* IndexedAccessType */ ? isGenericTupleType(objectType) && !indexTypeLessThan(indexType, objectType.target.fixedLength) : isGenericObjectType(objectType) && !(isTupleType(objectType) && indexTypeLessThan(indexType, objectType.target.fixedLength)) || isGenericReducibleType(objectType))) {
|
|
61755
61756
|
if (objectType.flags & 3 /* AnyOrUnknown */) {
|
|
61756
61757
|
return objectType;
|
|
61757
61758
|
}
|
|
61758
|
-
const persistentAccessFlags = accessFlags &
|
|
61759
|
+
const persistentAccessFlags = accessFlags & 1 /* Persistent */;
|
|
61759
61760
|
const id = objectType.id + "," + indexType.id + "," + persistentAccessFlags + getAliasId(aliasSymbol, aliasTypeArguments);
|
|
61760
61761
|
let type = indexedAccessTypes.get(id);
|
|
61761
61762
|
if (!type) {
|
|
@@ -61768,7 +61769,7 @@ function createTypeChecker(host) {
|
|
|
61768
61769
|
const propTypes = [];
|
|
61769
61770
|
let wasMissingProp = false;
|
|
61770
61771
|
for (const t of indexType.types) {
|
|
61771
|
-
const propType = getPropertyTypeForIndexType(objectType, apparentObjectType, t, indexType, accessNode, accessFlags | (wasMissingProp ?
|
|
61772
|
+
const propType = getPropertyTypeForIndexType(objectType, apparentObjectType, t, indexType, accessNode, accessFlags | (wasMissingProp ? 128 /* SuppressNoImplicitAnyError */ : 0));
|
|
61772
61773
|
if (propType) {
|
|
61773
61774
|
propTypes.push(propType);
|
|
61774
61775
|
} else if (!accessNode) {
|
|
@@ -61780,9 +61781,9 @@ function createTypeChecker(host) {
|
|
|
61780
61781
|
if (wasMissingProp) {
|
|
61781
61782
|
return void 0;
|
|
61782
61783
|
}
|
|
61783
|
-
return accessFlags &
|
|
61784
|
+
return accessFlags & 4 /* Writing */ ? getIntersectionType(propTypes, aliasSymbol, aliasTypeArguments) : getUnionType(propTypes, 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
61784
61785
|
}
|
|
61785
|
-
return getPropertyTypeForIndexType(objectType, apparentObjectType, indexType, indexType, accessNode, accessFlags |
|
|
61786
|
+
return getPropertyTypeForIndexType(objectType, apparentObjectType, indexType, indexType, accessNode, accessFlags | 8 /* CacheSymbol */ | 64 /* ReportDeprecated */);
|
|
61786
61787
|
}
|
|
61787
61788
|
function getTypeFromIndexedAccessTypeNode(node) {
|
|
61788
61789
|
const links = getNodeLinks(node);
|
|
@@ -65205,7 +65206,7 @@ function createTypeChecker(host) {
|
|
|
65205
65206
|
const baseObjectType = getBaseConstraintOfType(objectType) || objectType;
|
|
65206
65207
|
const baseIndexType = getBaseConstraintOfType(indexType) || indexType;
|
|
65207
65208
|
if (!isGenericObjectType(baseObjectType) && !isGenericIndexType(baseIndexType)) {
|
|
65208
|
-
const accessFlags =
|
|
65209
|
+
const accessFlags = 4 /* Writing */ | (baseObjectType !== objectType ? 2 /* NoIndexSignatures */ : 0);
|
|
65209
65210
|
const constraint = getIndexedAccessTypeOrUndefined(baseObjectType, baseIndexType, accessFlags);
|
|
65210
65211
|
if (constraint) {
|
|
65211
65212
|
if (reportErrors2 && originalErrorInfo) {
|
|
@@ -67731,12 +67732,6 @@ function createTypeChecker(host) {
|
|
|
67731
67732
|
}
|
|
67732
67733
|
}
|
|
67733
67734
|
}
|
|
67734
|
-
if (target.flags & 8388608 /* IndexedAccess */ && isGenericReducibleType(target.objectType)) {
|
|
67735
|
-
const instantiated = getIndexedAccessType(target.objectType, target.indexType, 2 /* ResolveReducibleTypes */);
|
|
67736
|
-
if (instantiated && instantiated !== target) {
|
|
67737
|
-
inferFromTypes(source, instantiated);
|
|
67738
|
-
}
|
|
67739
|
-
}
|
|
67740
67735
|
}
|
|
67741
67736
|
if (getObjectFlags(source) & 4 /* Reference */ && getObjectFlags(target) & 4 /* Reference */ && (source.target === target.target || isArrayType(source) && isArrayType(target)) && !(source.node && target.node)) {
|
|
67742
67737
|
inferFromTypeArguments(getTypeArguments(source), getTypeArguments(target), getVariances(source.target));
|
|
@@ -71262,7 +71257,7 @@ function createTypeChecker(host) {
|
|
|
71262
71257
|
return getEffectiveFirstArgumentForJsxSignature(signature, callTarget);
|
|
71263
71258
|
}
|
|
71264
71259
|
const restIndex = signature.parameters.length - 1;
|
|
71265
|
-
return signatureHasRestParameter(signature) && argIndex >= restIndex ? getIndexedAccessType(getTypeOfSymbol(signature.parameters[restIndex]), getNumberLiteralType(argIndex - restIndex),
|
|
71260
|
+
return signatureHasRestParameter(signature) && argIndex >= restIndex ? getIndexedAccessType(getTypeOfSymbol(signature.parameters[restIndex]), getNumberLiteralType(argIndex - restIndex), 256 /* Contextual */) : getTypeAtPosition(signature, argIndex);
|
|
71266
71261
|
}
|
|
71267
71262
|
function getContextualTypeForDecorator(decorator) {
|
|
71268
71263
|
const signature = getDecoratorCallSignature(decorator);
|
|
@@ -73943,7 +73938,7 @@ function createTypeChecker(host) {
|
|
|
73943
73938
|
return errorType;
|
|
73944
73939
|
}
|
|
73945
73940
|
const effectiveIndexType = isForInVariableForNumericPropertyNames(indexExpression) ? numberType : indexType;
|
|
73946
|
-
const accessFlags = isAssignmentTarget(node) ?
|
|
73941
|
+
const accessFlags = isAssignmentTarget(node) ? 4 /* Writing */ | (isGenericObjectType(objectType) && !isThisTypeParameter(objectType) ? 2 /* NoIndexSignatures */ : 0) : 32 /* ExpressionPosition */;
|
|
73947
73942
|
const indexedAccessType = getIndexedAccessTypeOrUndefined(objectType, effectiveIndexType, accessFlags, node) || errorType;
|
|
73948
73943
|
return checkIndexedAccessIndexType(getFlowTypeOfAccessExpression(node, getNodeLinks(node).resolvedSymbol, indexedAccessType, indexExpression, checkMode), node);
|
|
73949
73944
|
}
|
|
@@ -74223,7 +74218,7 @@ function createTypeChecker(host) {
|
|
|
74223
74218
|
flags.push(4 /* Rest */);
|
|
74224
74219
|
}
|
|
74225
74220
|
} else {
|
|
74226
|
-
const contextualType = isTupleType(restType) ? getContextualTypeForElementExpression(restType, i - index, argCount - index) || unknownType : getIndexedAccessType(restType, getNumberLiteralType(i - index),
|
|
74221
|
+
const contextualType = isTupleType(restType) ? getContextualTypeForElementExpression(restType, i - index, argCount - index) || unknownType : getIndexedAccessType(restType, getNumberLiteralType(i - index), 256 /* Contextual */);
|
|
74227
74222
|
const argType = checkExpressionWithContextualType(arg, contextualType, context, checkMode);
|
|
74228
74223
|
const hasPrimitiveContextualType = inConstContext || maybeTypeOfKind(contextualType, 402784252 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
|
|
74229
74224
|
types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType));
|
|
@@ -77608,7 +77603,7 @@ function createTypeChecker(host) {
|
|
|
77608
77603
|
);
|
|
77609
77604
|
}
|
|
77610
77605
|
}
|
|
77611
|
-
const elementType = getIndexedAccessType(objectLiteralType, exprType,
|
|
77606
|
+
const elementType = getIndexedAccessType(objectLiteralType, exprType, 32 /* ExpressionPosition */, name);
|
|
77612
77607
|
const type = getFlowTypeOfDestructuring(property, elementType);
|
|
77613
77608
|
return checkDestructuringAssignment(property.kind === 303 /* ShorthandPropertyAssignment */ ? property : property.initializer, type);
|
|
77614
77609
|
} else if (property.kind === 304 /* SpreadAssignment */) {
|
|
@@ -77657,7 +77652,7 @@ function createTypeChecker(host) {
|
|
|
77657
77652
|
if (element.kind !== 229 /* SpreadElement */) {
|
|
77658
77653
|
const indexType = getNumberLiteralType(elementIndex);
|
|
77659
77654
|
if (isArrayLikeType(sourceType)) {
|
|
77660
|
-
const accessFlags =
|
|
77655
|
+
const accessFlags = 32 /* ExpressionPosition */ | (hasDefaultValue(element) ? 16 /* NoTupleBoundsCheck */ : 0);
|
|
77661
77656
|
const elementType2 = getIndexedAccessTypeOrUndefined(sourceType, indexType, accessFlags, createSyntheticExpression(element, indexType)) || errorType;
|
|
77662
77657
|
const assignedType = hasDefaultValue(element) ? getTypeWithFacts(elementType2, 524288 /* NEUndefined */) : elementType2;
|
|
77663
77658
|
const type = getFlowTypeOfDestructuring(element, assignedType);
|
package/lib/tsserverlibrary.js
CHANGED
|
@@ -4525,16 +4525,15 @@ ${lanes.join("\n")}
|
|
|
4525
4525
|
AccessFlags = /* @__PURE__ */ ((AccessFlags2) => {
|
|
4526
4526
|
AccessFlags2[AccessFlags2["None"] = 0] = "None";
|
|
4527
4527
|
AccessFlags2[AccessFlags2["IncludeUndefined"] = 1] = "IncludeUndefined";
|
|
4528
|
-
AccessFlags2[AccessFlags2["
|
|
4529
|
-
AccessFlags2[AccessFlags2["
|
|
4530
|
-
AccessFlags2[AccessFlags2["
|
|
4531
|
-
AccessFlags2[AccessFlags2["
|
|
4532
|
-
AccessFlags2[AccessFlags2["
|
|
4533
|
-
AccessFlags2[AccessFlags2["
|
|
4534
|
-
AccessFlags2[AccessFlags2["
|
|
4535
|
-
AccessFlags2[AccessFlags2["
|
|
4536
|
-
AccessFlags2[AccessFlags2["
|
|
4537
|
-
AccessFlags2[AccessFlags2["Persistent"] = 3] = "Persistent";
|
|
4528
|
+
AccessFlags2[AccessFlags2["NoIndexSignatures"] = 2] = "NoIndexSignatures";
|
|
4529
|
+
AccessFlags2[AccessFlags2["Writing"] = 4] = "Writing";
|
|
4530
|
+
AccessFlags2[AccessFlags2["CacheSymbol"] = 8] = "CacheSymbol";
|
|
4531
|
+
AccessFlags2[AccessFlags2["NoTupleBoundsCheck"] = 16] = "NoTupleBoundsCheck";
|
|
4532
|
+
AccessFlags2[AccessFlags2["ExpressionPosition"] = 32] = "ExpressionPosition";
|
|
4533
|
+
AccessFlags2[AccessFlags2["ReportDeprecated"] = 64] = "ReportDeprecated";
|
|
4534
|
+
AccessFlags2[AccessFlags2["SuppressNoImplicitAnyError"] = 128] = "SuppressNoImplicitAnyError";
|
|
4535
|
+
AccessFlags2[AccessFlags2["Contextual"] = 256] = "Contextual";
|
|
4536
|
+
AccessFlags2[AccessFlags2["Persistent"] = 1 /* IncludeUndefined */] = "Persistent";
|
|
4538
4537
|
return AccessFlags2;
|
|
4539
4538
|
})(AccessFlags || {});
|
|
4540
4539
|
IndexFlags = /* @__PURE__ */ ((IndexFlags2) => {
|
|
@@ -45803,7 +45802,7 @@ ${lanes.join("\n")}
|
|
|
45803
45802
|
getGlobalIterableType: getGlobalAsyncIterableType,
|
|
45804
45803
|
getGlobalIterableIteratorType: getGlobalAsyncIterableIteratorType,
|
|
45805
45804
|
getGlobalGeneratorType: getGlobalAsyncGeneratorType,
|
|
45806
|
-
resolveIterationType: getAwaitedType,
|
|
45805
|
+
resolveIterationType: (type, errorNode) => getAwaitedType(type, errorNode, Diagnostics.Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member),
|
|
45807
45806
|
mustHaveANextMethodDiagnostic: Diagnostics.An_async_iterator_must_have_a_next_method,
|
|
45808
45807
|
mustBeAMethodDiagnostic: Diagnostics.The_0_property_of_an_async_iterator_must_be_a_method,
|
|
45809
45808
|
mustHaveAValueDiagnostic: Diagnostics.The_type_returned_by_the_0_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value_property
|
|
@@ -50308,32 +50307,34 @@ ${lanes.join("\n")}
|
|
|
50308
50307
|
const methodDeclaration = signatureToSignatureDeclarationHelper(signature, 172 /* MethodSignature */, context, { name: propertyName, questionToken: optionalToken });
|
|
50309
50308
|
typeElements.push(preserveCommentsOn(methodDeclaration));
|
|
50310
50309
|
}
|
|
50310
|
+
if (signatures.length || !optionalToken) {
|
|
50311
|
+
return;
|
|
50312
|
+
}
|
|
50313
|
+
}
|
|
50314
|
+
let propertyTypeNode;
|
|
50315
|
+
if (shouldUsePlaceholderForProperty(propertySymbol, context)) {
|
|
50316
|
+
propertyTypeNode = createElidedInformationPlaceholder(context);
|
|
50311
50317
|
} else {
|
|
50312
|
-
|
|
50313
|
-
|
|
50314
|
-
|
|
50315
|
-
} else {
|
|
50316
|
-
if (propertyIsReverseMapped) {
|
|
50317
|
-
context.reverseMappedStack || (context.reverseMappedStack = []);
|
|
50318
|
-
context.reverseMappedStack.push(propertySymbol);
|
|
50319
|
-
}
|
|
50320
|
-
propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
50321
|
-
if (propertyIsReverseMapped) {
|
|
50322
|
-
context.reverseMappedStack.pop();
|
|
50323
|
-
}
|
|
50318
|
+
if (propertyIsReverseMapped) {
|
|
50319
|
+
context.reverseMappedStack || (context.reverseMappedStack = []);
|
|
50320
|
+
context.reverseMappedStack.push(propertySymbol);
|
|
50324
50321
|
}
|
|
50325
|
-
|
|
50326
|
-
if (
|
|
50327
|
-
context.
|
|
50322
|
+
propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
50323
|
+
if (propertyIsReverseMapped) {
|
|
50324
|
+
context.reverseMappedStack.pop();
|
|
50328
50325
|
}
|
|
50329
|
-
const propertySignature = factory.createPropertySignature(
|
|
50330
|
-
modifiers,
|
|
50331
|
-
propertyName,
|
|
50332
|
-
optionalToken,
|
|
50333
|
-
propertyTypeNode
|
|
50334
|
-
);
|
|
50335
|
-
typeElements.push(preserveCommentsOn(propertySignature));
|
|
50336
50326
|
}
|
|
50327
|
+
const modifiers = isReadonlySymbol(propertySymbol) ? [factory.createToken(148 /* ReadonlyKeyword */)] : void 0;
|
|
50328
|
+
if (modifiers) {
|
|
50329
|
+
context.approximateLength += 9;
|
|
50330
|
+
}
|
|
50331
|
+
const propertySignature = factory.createPropertySignature(
|
|
50332
|
+
modifiers,
|
|
50333
|
+
propertyName,
|
|
50334
|
+
optionalToken,
|
|
50335
|
+
propertyTypeNode
|
|
50336
|
+
);
|
|
50337
|
+
typeElements.push(preserveCommentsOn(propertySignature));
|
|
50337
50338
|
function preserveCommentsOn(node) {
|
|
50338
50339
|
var _a2;
|
|
50339
50340
|
if (some(propertySymbol.declarations, (d) => d.kind === 354 /* JSDocPropertyTag */)) {
|
|
@@ -53328,7 +53329,7 @@ ${lanes.join("\n")}
|
|
|
53328
53329
|
} else {
|
|
53329
53330
|
const name = declaration.propertyName || declaration.name;
|
|
53330
53331
|
const indexType = getLiteralTypeFromPropertyName(name);
|
|
53331
|
-
const declaredType = getIndexedAccessType(parentType, indexType,
|
|
53332
|
+
const declaredType = getIndexedAccessType(parentType, indexType, 32 /* ExpressionPosition */, name);
|
|
53332
53333
|
type = getFlowTypeOfDestructuring(declaration, declaredType);
|
|
53333
53334
|
}
|
|
53334
53335
|
} else {
|
|
@@ -53339,7 +53340,7 @@ ${lanes.join("\n")}
|
|
|
53339
53340
|
type = everyType(baseConstraint, isTupleType) ? mapType(baseConstraint, (t) => sliceTupleType(t, index)) : createArrayType(elementType);
|
|
53340
53341
|
} else if (isArrayLikeType(parentType)) {
|
|
53341
53342
|
const indexType = getNumberLiteralType(index);
|
|
53342
|
-
const accessFlags =
|
|
53343
|
+
const accessFlags = 32 /* ExpressionPosition */ | (hasDefaultValue(declaration) ? 16 /* NoTupleBoundsCheck */ : 0);
|
|
53343
53344
|
const declaredType = getIndexedAccessTypeOrUndefined(parentType, indexType, accessFlags, declaration.name) || errorType;
|
|
53344
53345
|
type = getFlowTypeOfDestructuring(declaration, declaredType);
|
|
53345
53346
|
} else {
|
|
@@ -59208,12 +59209,12 @@ ${lanes.join("\n")}
|
|
|
59208
59209
|
const accessExpression = accessNode && accessNode.kind === 211 /* ElementAccessExpression */ ? accessNode : void 0;
|
|
59209
59210
|
const propName = accessNode && isPrivateIdentifier(accessNode) ? void 0 : getPropertyNameFromIndex(indexType, accessNode);
|
|
59210
59211
|
if (propName !== void 0) {
|
|
59211
|
-
if (accessFlags &
|
|
59212
|
+
if (accessFlags & 256 /* Contextual */) {
|
|
59212
59213
|
return getTypeOfPropertyOfContextualType(objectType, propName) || anyType;
|
|
59213
59214
|
}
|
|
59214
59215
|
const prop = getPropertyOfType(objectType, propName);
|
|
59215
59216
|
if (prop) {
|
|
59216
|
-
if (accessFlags &
|
|
59217
|
+
if (accessFlags & 64 /* ReportDeprecated */ && accessNode && prop.declarations && isDeprecatedSymbol(prop) && isUncalledFunctionReference(accessNode, prop)) {
|
|
59217
59218
|
const deprecatedNode = (accessExpression == null ? void 0 : accessExpression.argumentExpression) ?? (isIndexedAccessTypeNode(accessNode) ? accessNode.indexType : accessNode);
|
|
59218
59219
|
addDeprecatedSuggestion(deprecatedNode, prop.declarations, propName);
|
|
59219
59220
|
}
|
|
@@ -59223,7 +59224,7 @@ ${lanes.join("\n")}
|
|
|
59223
59224
|
error(accessExpression.argumentExpression, Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, symbolToString(prop));
|
|
59224
59225
|
return void 0;
|
|
59225
59226
|
}
|
|
59226
|
-
if (accessFlags &
|
|
59227
|
+
if (accessFlags & 8 /* CacheSymbol */) {
|
|
59227
59228
|
getNodeLinks(accessNode).resolvedSymbol = prop;
|
|
59228
59229
|
}
|
|
59229
59230
|
if (isThisPropertyAccessInConstructor(accessExpression, prop)) {
|
|
@@ -59235,7 +59236,7 @@ ${lanes.join("\n")}
|
|
|
59235
59236
|
}
|
|
59236
59237
|
if (everyType(objectType, isTupleType) && isNumericLiteralName(propName)) {
|
|
59237
59238
|
const index = +propName;
|
|
59238
|
-
if (accessNode && everyType(objectType, (t) => !t.target.hasRestElement) && !(accessFlags &
|
|
59239
|
+
if (accessNode && everyType(objectType, (t) => !t.target.hasRestElement) && !(accessFlags & 16 /* NoTupleBoundsCheck */)) {
|
|
59239
59240
|
const indexNode = getIndexNodeForAccessExpression(accessNode);
|
|
59240
59241
|
if (isTupleType(objectType)) {
|
|
59241
59242
|
if (index < 0) {
|
|
@@ -59268,7 +59269,7 @@ ${lanes.join("\n")}
|
|
|
59268
59269
|
}
|
|
59269
59270
|
const indexInfo = getApplicableIndexInfo(objectType, indexType) || getIndexInfoOfType(objectType, stringType);
|
|
59270
59271
|
if (indexInfo) {
|
|
59271
|
-
if (accessFlags &
|
|
59272
|
+
if (accessFlags & 2 /* NoIndexSignatures */ && indexInfo.keyType !== numberType) {
|
|
59272
59273
|
if (accessExpression) {
|
|
59273
59274
|
error(accessExpression, Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(originalObjectType));
|
|
59274
59275
|
}
|
|
@@ -59305,7 +59306,7 @@ ${lanes.join("\n")}
|
|
|
59305
59306
|
}
|
|
59306
59307
|
if (objectType.symbol === globalThisSymbol && propName !== void 0 && globalThisSymbol.exports.has(propName) && globalThisSymbol.exports.get(propName).flags & 418 /* BlockScoped */) {
|
|
59307
59308
|
error(accessExpression, Diagnostics.Property_0_does_not_exist_on_type_1, unescapeLeadingUnderscores(propName), typeToString(objectType));
|
|
59308
|
-
} else if (noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors && !(accessFlags &
|
|
59309
|
+
} else if (noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors && !(accessFlags & 128 /* SuppressNoImplicitAnyError */)) {
|
|
59309
59310
|
if (propName !== void 0 && typeHasStaticProperty(propName, objectType)) {
|
|
59310
59311
|
const typeName = typeToString(objectType);
|
|
59311
59312
|
error(accessExpression, Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_to_access_the_static_member_2_instead, propName, typeName, typeName + "[" + getTextOfNode(accessExpression.argumentExpression) + "]");
|
|
@@ -59541,13 +59542,13 @@ ${lanes.join("\n")}
|
|
|
59541
59542
|
if (isStringIndexSignatureOnlyType(objectType) && !(indexType.flags & 98304 /* Nullable */) && isTypeAssignableToKind(indexType, 4 /* String */ | 8 /* Number */)) {
|
|
59542
59543
|
indexType = stringType;
|
|
59543
59544
|
}
|
|
59544
|
-
if (compilerOptions.noUncheckedIndexedAccess && accessFlags &
|
|
59545
|
+
if (compilerOptions.noUncheckedIndexedAccess && accessFlags & 32 /* ExpressionPosition */)
|
|
59545
59546
|
accessFlags |= 1 /* IncludeUndefined */;
|
|
59546
|
-
if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 198 /* IndexedAccessType */ ? isGenericTupleType(objectType) && !indexTypeLessThan(indexType, objectType.target.fixedLength) : isGenericObjectType(objectType) && !(isTupleType(objectType) && indexTypeLessThan(indexType, objectType.target.fixedLength)) ||
|
|
59547
|
+
if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 198 /* IndexedAccessType */ ? isGenericTupleType(objectType) && !indexTypeLessThan(indexType, objectType.target.fixedLength) : isGenericObjectType(objectType) && !(isTupleType(objectType) && indexTypeLessThan(indexType, objectType.target.fixedLength)) || isGenericReducibleType(objectType))) {
|
|
59547
59548
|
if (objectType.flags & 3 /* AnyOrUnknown */) {
|
|
59548
59549
|
return objectType;
|
|
59549
59550
|
}
|
|
59550
|
-
const persistentAccessFlags = accessFlags &
|
|
59551
|
+
const persistentAccessFlags = accessFlags & 1 /* Persistent */;
|
|
59551
59552
|
const id = objectType.id + "," + indexType.id + "," + persistentAccessFlags + getAliasId(aliasSymbol, aliasTypeArguments);
|
|
59552
59553
|
let type = indexedAccessTypes.get(id);
|
|
59553
59554
|
if (!type) {
|
|
@@ -59560,7 +59561,7 @@ ${lanes.join("\n")}
|
|
|
59560
59561
|
const propTypes = [];
|
|
59561
59562
|
let wasMissingProp = false;
|
|
59562
59563
|
for (const t of indexType.types) {
|
|
59563
|
-
const propType = getPropertyTypeForIndexType(objectType, apparentObjectType, t, indexType, accessNode, accessFlags | (wasMissingProp ?
|
|
59564
|
+
const propType = getPropertyTypeForIndexType(objectType, apparentObjectType, t, indexType, accessNode, accessFlags | (wasMissingProp ? 128 /* SuppressNoImplicitAnyError */ : 0));
|
|
59564
59565
|
if (propType) {
|
|
59565
59566
|
propTypes.push(propType);
|
|
59566
59567
|
} else if (!accessNode) {
|
|
@@ -59572,9 +59573,9 @@ ${lanes.join("\n")}
|
|
|
59572
59573
|
if (wasMissingProp) {
|
|
59573
59574
|
return void 0;
|
|
59574
59575
|
}
|
|
59575
|
-
return accessFlags &
|
|
59576
|
+
return accessFlags & 4 /* Writing */ ? getIntersectionType(propTypes, aliasSymbol, aliasTypeArguments) : getUnionType(propTypes, 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
59576
59577
|
}
|
|
59577
|
-
return getPropertyTypeForIndexType(objectType, apparentObjectType, indexType, indexType, accessNode, accessFlags |
|
|
59578
|
+
return getPropertyTypeForIndexType(objectType, apparentObjectType, indexType, indexType, accessNode, accessFlags | 8 /* CacheSymbol */ | 64 /* ReportDeprecated */);
|
|
59578
59579
|
}
|
|
59579
59580
|
function getTypeFromIndexedAccessTypeNode(node) {
|
|
59580
59581
|
const links = getNodeLinks(node);
|
|
@@ -62997,7 +62998,7 @@ ${lanes.join("\n")}
|
|
|
62997
62998
|
const baseObjectType = getBaseConstraintOfType(objectType) || objectType;
|
|
62998
62999
|
const baseIndexType = getBaseConstraintOfType(indexType) || indexType;
|
|
62999
63000
|
if (!isGenericObjectType(baseObjectType) && !isGenericIndexType(baseIndexType)) {
|
|
63000
|
-
const accessFlags =
|
|
63001
|
+
const accessFlags = 4 /* Writing */ | (baseObjectType !== objectType ? 2 /* NoIndexSignatures */ : 0);
|
|
63001
63002
|
const constraint = getIndexedAccessTypeOrUndefined(baseObjectType, baseIndexType, accessFlags);
|
|
63002
63003
|
if (constraint) {
|
|
63003
63004
|
if (reportErrors2 && originalErrorInfo) {
|
|
@@ -65523,12 +65524,6 @@ ${lanes.join("\n")}
|
|
|
65523
65524
|
}
|
|
65524
65525
|
}
|
|
65525
65526
|
}
|
|
65526
|
-
if (target.flags & 8388608 /* IndexedAccess */ && isGenericReducibleType(target.objectType)) {
|
|
65527
|
-
const instantiated = getIndexedAccessType(target.objectType, target.indexType, 2 /* ResolveReducibleTypes */);
|
|
65528
|
-
if (instantiated && instantiated !== target) {
|
|
65529
|
-
inferFromTypes(source, instantiated);
|
|
65530
|
-
}
|
|
65531
|
-
}
|
|
65532
65527
|
}
|
|
65533
65528
|
if (getObjectFlags(source) & 4 /* Reference */ && getObjectFlags(target) & 4 /* Reference */ && (source.target === target.target || isArrayType(source) && isArrayType(target)) && !(source.node && target.node)) {
|
|
65534
65529
|
inferFromTypeArguments(getTypeArguments(source), getTypeArguments(target), getVariances(source.target));
|
|
@@ -69054,7 +69049,7 @@ ${lanes.join("\n")}
|
|
|
69054
69049
|
return getEffectiveFirstArgumentForJsxSignature(signature, callTarget);
|
|
69055
69050
|
}
|
|
69056
69051
|
const restIndex = signature.parameters.length - 1;
|
|
69057
|
-
return signatureHasRestParameter(signature) && argIndex >= restIndex ? getIndexedAccessType(getTypeOfSymbol(signature.parameters[restIndex]), getNumberLiteralType(argIndex - restIndex),
|
|
69052
|
+
return signatureHasRestParameter(signature) && argIndex >= restIndex ? getIndexedAccessType(getTypeOfSymbol(signature.parameters[restIndex]), getNumberLiteralType(argIndex - restIndex), 256 /* Contextual */) : getTypeAtPosition(signature, argIndex);
|
|
69058
69053
|
}
|
|
69059
69054
|
function getContextualTypeForDecorator(decorator) {
|
|
69060
69055
|
const signature = getDecoratorCallSignature(decorator);
|
|
@@ -71735,7 +71730,7 @@ ${lanes.join("\n")}
|
|
|
71735
71730
|
return errorType;
|
|
71736
71731
|
}
|
|
71737
71732
|
const effectiveIndexType = isForInVariableForNumericPropertyNames(indexExpression) ? numberType : indexType;
|
|
71738
|
-
const accessFlags = isAssignmentTarget(node) ?
|
|
71733
|
+
const accessFlags = isAssignmentTarget(node) ? 4 /* Writing */ | (isGenericObjectType(objectType) && !isThisTypeParameter(objectType) ? 2 /* NoIndexSignatures */ : 0) : 32 /* ExpressionPosition */;
|
|
71739
71734
|
const indexedAccessType = getIndexedAccessTypeOrUndefined(objectType, effectiveIndexType, accessFlags, node) || errorType;
|
|
71740
71735
|
return checkIndexedAccessIndexType(getFlowTypeOfAccessExpression(node, getNodeLinks(node).resolvedSymbol, indexedAccessType, indexExpression, checkMode), node);
|
|
71741
71736
|
}
|
|
@@ -72015,7 +72010,7 @@ ${lanes.join("\n")}
|
|
|
72015
72010
|
flags.push(4 /* Rest */);
|
|
72016
72011
|
}
|
|
72017
72012
|
} else {
|
|
72018
|
-
const contextualType = isTupleType(restType) ? getContextualTypeForElementExpression(restType, i - index, argCount - index) || unknownType : getIndexedAccessType(restType, getNumberLiteralType(i - index),
|
|
72013
|
+
const contextualType = isTupleType(restType) ? getContextualTypeForElementExpression(restType, i - index, argCount - index) || unknownType : getIndexedAccessType(restType, getNumberLiteralType(i - index), 256 /* Contextual */);
|
|
72019
72014
|
const argType = checkExpressionWithContextualType(arg, contextualType, context, checkMode);
|
|
72020
72015
|
const hasPrimitiveContextualType = inConstContext || maybeTypeOfKind(contextualType, 402784252 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
|
|
72021
72016
|
types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType));
|
|
@@ -75400,7 +75395,7 @@ ${lanes.join("\n")}
|
|
|
75400
75395
|
);
|
|
75401
75396
|
}
|
|
75402
75397
|
}
|
|
75403
|
-
const elementType = getIndexedAccessType(objectLiteralType, exprType,
|
|
75398
|
+
const elementType = getIndexedAccessType(objectLiteralType, exprType, 32 /* ExpressionPosition */, name);
|
|
75404
75399
|
const type = getFlowTypeOfDestructuring(property, elementType);
|
|
75405
75400
|
return checkDestructuringAssignment(property.kind === 303 /* ShorthandPropertyAssignment */ ? property : property.initializer, type);
|
|
75406
75401
|
} else if (property.kind === 304 /* SpreadAssignment */) {
|
|
@@ -75449,7 +75444,7 @@ ${lanes.join("\n")}
|
|
|
75449
75444
|
if (element.kind !== 229 /* SpreadElement */) {
|
|
75450
75445
|
const indexType = getNumberLiteralType(elementIndex);
|
|
75451
75446
|
if (isArrayLikeType(sourceType)) {
|
|
75452
|
-
const accessFlags =
|
|
75447
|
+
const accessFlags = 32 /* ExpressionPosition */ | (hasDefaultValue(element) ? 16 /* NoTupleBoundsCheck */ : 0);
|
|
75453
75448
|
const elementType2 = getIndexedAccessTypeOrUndefined(sourceType, indexType, accessFlags, createSyntheticExpression(element, indexType)) || errorType;
|
|
75454
75449
|
const assignedType = hasDefaultValue(element) ? getTypeWithFacts(elementType2, 524288 /* NEUndefined */) : elementType2;
|
|
75455
75450
|
const type = getFlowTypeOfDestructuring(element, assignedType);
|
package/lib/typescript.js
CHANGED
|
@@ -4525,16 +4525,15 @@ ${lanes.join("\n")}
|
|
|
4525
4525
|
AccessFlags = /* @__PURE__ */ ((AccessFlags2) => {
|
|
4526
4526
|
AccessFlags2[AccessFlags2["None"] = 0] = "None";
|
|
4527
4527
|
AccessFlags2[AccessFlags2["IncludeUndefined"] = 1] = "IncludeUndefined";
|
|
4528
|
-
AccessFlags2[AccessFlags2["
|
|
4529
|
-
AccessFlags2[AccessFlags2["
|
|
4530
|
-
AccessFlags2[AccessFlags2["
|
|
4531
|
-
AccessFlags2[AccessFlags2["
|
|
4532
|
-
AccessFlags2[AccessFlags2["
|
|
4533
|
-
AccessFlags2[AccessFlags2["
|
|
4534
|
-
AccessFlags2[AccessFlags2["
|
|
4535
|
-
AccessFlags2[AccessFlags2["
|
|
4536
|
-
AccessFlags2[AccessFlags2["
|
|
4537
|
-
AccessFlags2[AccessFlags2["Persistent"] = 3] = "Persistent";
|
|
4528
|
+
AccessFlags2[AccessFlags2["NoIndexSignatures"] = 2] = "NoIndexSignatures";
|
|
4529
|
+
AccessFlags2[AccessFlags2["Writing"] = 4] = "Writing";
|
|
4530
|
+
AccessFlags2[AccessFlags2["CacheSymbol"] = 8] = "CacheSymbol";
|
|
4531
|
+
AccessFlags2[AccessFlags2["NoTupleBoundsCheck"] = 16] = "NoTupleBoundsCheck";
|
|
4532
|
+
AccessFlags2[AccessFlags2["ExpressionPosition"] = 32] = "ExpressionPosition";
|
|
4533
|
+
AccessFlags2[AccessFlags2["ReportDeprecated"] = 64] = "ReportDeprecated";
|
|
4534
|
+
AccessFlags2[AccessFlags2["SuppressNoImplicitAnyError"] = 128] = "SuppressNoImplicitAnyError";
|
|
4535
|
+
AccessFlags2[AccessFlags2["Contextual"] = 256] = "Contextual";
|
|
4536
|
+
AccessFlags2[AccessFlags2["Persistent"] = 1 /* IncludeUndefined */] = "Persistent";
|
|
4538
4537
|
return AccessFlags2;
|
|
4539
4538
|
})(AccessFlags || {});
|
|
4540
4539
|
IndexFlags = /* @__PURE__ */ ((IndexFlags2) => {
|
|
@@ -45803,7 +45802,7 @@ ${lanes.join("\n")}
|
|
|
45803
45802
|
getGlobalIterableType: getGlobalAsyncIterableType,
|
|
45804
45803
|
getGlobalIterableIteratorType: getGlobalAsyncIterableIteratorType,
|
|
45805
45804
|
getGlobalGeneratorType: getGlobalAsyncGeneratorType,
|
|
45806
|
-
resolveIterationType: getAwaitedType,
|
|
45805
|
+
resolveIterationType: (type, errorNode) => getAwaitedType(type, errorNode, Diagnostics.Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member),
|
|
45807
45806
|
mustHaveANextMethodDiagnostic: Diagnostics.An_async_iterator_must_have_a_next_method,
|
|
45808
45807
|
mustBeAMethodDiagnostic: Diagnostics.The_0_property_of_an_async_iterator_must_be_a_method,
|
|
45809
45808
|
mustHaveAValueDiagnostic: Diagnostics.The_type_returned_by_the_0_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value_property
|
|
@@ -50308,32 +50307,34 @@ ${lanes.join("\n")}
|
|
|
50308
50307
|
const methodDeclaration = signatureToSignatureDeclarationHelper(signature, 172 /* MethodSignature */, context, { name: propertyName, questionToken: optionalToken });
|
|
50309
50308
|
typeElements.push(preserveCommentsOn(methodDeclaration));
|
|
50310
50309
|
}
|
|
50310
|
+
if (signatures.length || !optionalToken) {
|
|
50311
|
+
return;
|
|
50312
|
+
}
|
|
50313
|
+
}
|
|
50314
|
+
let propertyTypeNode;
|
|
50315
|
+
if (shouldUsePlaceholderForProperty(propertySymbol, context)) {
|
|
50316
|
+
propertyTypeNode = createElidedInformationPlaceholder(context);
|
|
50311
50317
|
} else {
|
|
50312
|
-
|
|
50313
|
-
|
|
50314
|
-
|
|
50315
|
-
} else {
|
|
50316
|
-
if (propertyIsReverseMapped) {
|
|
50317
|
-
context.reverseMappedStack || (context.reverseMappedStack = []);
|
|
50318
|
-
context.reverseMappedStack.push(propertySymbol);
|
|
50319
|
-
}
|
|
50320
|
-
propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
50321
|
-
if (propertyIsReverseMapped) {
|
|
50322
|
-
context.reverseMappedStack.pop();
|
|
50323
|
-
}
|
|
50318
|
+
if (propertyIsReverseMapped) {
|
|
50319
|
+
context.reverseMappedStack || (context.reverseMappedStack = []);
|
|
50320
|
+
context.reverseMappedStack.push(propertySymbol);
|
|
50324
50321
|
}
|
|
50325
|
-
|
|
50326
|
-
if (
|
|
50327
|
-
context.
|
|
50322
|
+
propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
50323
|
+
if (propertyIsReverseMapped) {
|
|
50324
|
+
context.reverseMappedStack.pop();
|
|
50328
50325
|
}
|
|
50329
|
-
const propertySignature = factory.createPropertySignature(
|
|
50330
|
-
modifiers,
|
|
50331
|
-
propertyName,
|
|
50332
|
-
optionalToken,
|
|
50333
|
-
propertyTypeNode
|
|
50334
|
-
);
|
|
50335
|
-
typeElements.push(preserveCommentsOn(propertySignature));
|
|
50336
50326
|
}
|
|
50327
|
+
const modifiers = isReadonlySymbol(propertySymbol) ? [factory.createToken(148 /* ReadonlyKeyword */)] : void 0;
|
|
50328
|
+
if (modifiers) {
|
|
50329
|
+
context.approximateLength += 9;
|
|
50330
|
+
}
|
|
50331
|
+
const propertySignature = factory.createPropertySignature(
|
|
50332
|
+
modifiers,
|
|
50333
|
+
propertyName,
|
|
50334
|
+
optionalToken,
|
|
50335
|
+
propertyTypeNode
|
|
50336
|
+
);
|
|
50337
|
+
typeElements.push(preserveCommentsOn(propertySignature));
|
|
50337
50338
|
function preserveCommentsOn(node) {
|
|
50338
50339
|
var _a2;
|
|
50339
50340
|
if (some(propertySymbol.declarations, (d) => d.kind === 354 /* JSDocPropertyTag */)) {
|
|
@@ -53328,7 +53329,7 @@ ${lanes.join("\n")}
|
|
|
53328
53329
|
} else {
|
|
53329
53330
|
const name = declaration.propertyName || declaration.name;
|
|
53330
53331
|
const indexType = getLiteralTypeFromPropertyName(name);
|
|
53331
|
-
const declaredType = getIndexedAccessType(parentType, indexType,
|
|
53332
|
+
const declaredType = getIndexedAccessType(parentType, indexType, 32 /* ExpressionPosition */, name);
|
|
53332
53333
|
type = getFlowTypeOfDestructuring(declaration, declaredType);
|
|
53333
53334
|
}
|
|
53334
53335
|
} else {
|
|
@@ -53339,7 +53340,7 @@ ${lanes.join("\n")}
|
|
|
53339
53340
|
type = everyType(baseConstraint, isTupleType) ? mapType(baseConstraint, (t) => sliceTupleType(t, index)) : createArrayType(elementType);
|
|
53340
53341
|
} else if (isArrayLikeType(parentType)) {
|
|
53341
53342
|
const indexType = getNumberLiteralType(index);
|
|
53342
|
-
const accessFlags =
|
|
53343
|
+
const accessFlags = 32 /* ExpressionPosition */ | (hasDefaultValue(declaration) ? 16 /* NoTupleBoundsCheck */ : 0);
|
|
53343
53344
|
const declaredType = getIndexedAccessTypeOrUndefined(parentType, indexType, accessFlags, declaration.name) || errorType;
|
|
53344
53345
|
type = getFlowTypeOfDestructuring(declaration, declaredType);
|
|
53345
53346
|
} else {
|
|
@@ -59208,12 +59209,12 @@ ${lanes.join("\n")}
|
|
|
59208
59209
|
const accessExpression = accessNode && accessNode.kind === 211 /* ElementAccessExpression */ ? accessNode : void 0;
|
|
59209
59210
|
const propName = accessNode && isPrivateIdentifier(accessNode) ? void 0 : getPropertyNameFromIndex(indexType, accessNode);
|
|
59210
59211
|
if (propName !== void 0) {
|
|
59211
|
-
if (accessFlags &
|
|
59212
|
+
if (accessFlags & 256 /* Contextual */) {
|
|
59212
59213
|
return getTypeOfPropertyOfContextualType(objectType, propName) || anyType;
|
|
59213
59214
|
}
|
|
59214
59215
|
const prop = getPropertyOfType(objectType, propName);
|
|
59215
59216
|
if (prop) {
|
|
59216
|
-
if (accessFlags &
|
|
59217
|
+
if (accessFlags & 64 /* ReportDeprecated */ && accessNode && prop.declarations && isDeprecatedSymbol(prop) && isUncalledFunctionReference(accessNode, prop)) {
|
|
59217
59218
|
const deprecatedNode = (accessExpression == null ? void 0 : accessExpression.argumentExpression) ?? (isIndexedAccessTypeNode(accessNode) ? accessNode.indexType : accessNode);
|
|
59218
59219
|
addDeprecatedSuggestion(deprecatedNode, prop.declarations, propName);
|
|
59219
59220
|
}
|
|
@@ -59223,7 +59224,7 @@ ${lanes.join("\n")}
|
|
|
59223
59224
|
error(accessExpression.argumentExpression, Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, symbolToString(prop));
|
|
59224
59225
|
return void 0;
|
|
59225
59226
|
}
|
|
59226
|
-
if (accessFlags &
|
|
59227
|
+
if (accessFlags & 8 /* CacheSymbol */) {
|
|
59227
59228
|
getNodeLinks(accessNode).resolvedSymbol = prop;
|
|
59228
59229
|
}
|
|
59229
59230
|
if (isThisPropertyAccessInConstructor(accessExpression, prop)) {
|
|
@@ -59235,7 +59236,7 @@ ${lanes.join("\n")}
|
|
|
59235
59236
|
}
|
|
59236
59237
|
if (everyType(objectType, isTupleType) && isNumericLiteralName(propName)) {
|
|
59237
59238
|
const index = +propName;
|
|
59238
|
-
if (accessNode && everyType(objectType, (t) => !t.target.hasRestElement) && !(accessFlags &
|
|
59239
|
+
if (accessNode && everyType(objectType, (t) => !t.target.hasRestElement) && !(accessFlags & 16 /* NoTupleBoundsCheck */)) {
|
|
59239
59240
|
const indexNode = getIndexNodeForAccessExpression(accessNode);
|
|
59240
59241
|
if (isTupleType(objectType)) {
|
|
59241
59242
|
if (index < 0) {
|
|
@@ -59268,7 +59269,7 @@ ${lanes.join("\n")}
|
|
|
59268
59269
|
}
|
|
59269
59270
|
const indexInfo = getApplicableIndexInfo(objectType, indexType) || getIndexInfoOfType(objectType, stringType);
|
|
59270
59271
|
if (indexInfo) {
|
|
59271
|
-
if (accessFlags &
|
|
59272
|
+
if (accessFlags & 2 /* NoIndexSignatures */ && indexInfo.keyType !== numberType) {
|
|
59272
59273
|
if (accessExpression) {
|
|
59273
59274
|
error(accessExpression, Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(originalObjectType));
|
|
59274
59275
|
}
|
|
@@ -59305,7 +59306,7 @@ ${lanes.join("\n")}
|
|
|
59305
59306
|
}
|
|
59306
59307
|
if (objectType.symbol === globalThisSymbol && propName !== void 0 && globalThisSymbol.exports.has(propName) && globalThisSymbol.exports.get(propName).flags & 418 /* BlockScoped */) {
|
|
59307
59308
|
error(accessExpression, Diagnostics.Property_0_does_not_exist_on_type_1, unescapeLeadingUnderscores(propName), typeToString(objectType));
|
|
59308
|
-
} else if (noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors && !(accessFlags &
|
|
59309
|
+
} else if (noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors && !(accessFlags & 128 /* SuppressNoImplicitAnyError */)) {
|
|
59309
59310
|
if (propName !== void 0 && typeHasStaticProperty(propName, objectType)) {
|
|
59310
59311
|
const typeName = typeToString(objectType);
|
|
59311
59312
|
error(accessExpression, Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_to_access_the_static_member_2_instead, propName, typeName, typeName + "[" + getTextOfNode(accessExpression.argumentExpression) + "]");
|
|
@@ -59541,13 +59542,13 @@ ${lanes.join("\n")}
|
|
|
59541
59542
|
if (isStringIndexSignatureOnlyType(objectType) && !(indexType.flags & 98304 /* Nullable */) && isTypeAssignableToKind(indexType, 4 /* String */ | 8 /* Number */)) {
|
|
59542
59543
|
indexType = stringType;
|
|
59543
59544
|
}
|
|
59544
|
-
if (compilerOptions.noUncheckedIndexedAccess && accessFlags &
|
|
59545
|
+
if (compilerOptions.noUncheckedIndexedAccess && accessFlags & 32 /* ExpressionPosition */)
|
|
59545
59546
|
accessFlags |= 1 /* IncludeUndefined */;
|
|
59546
|
-
if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 198 /* IndexedAccessType */ ? isGenericTupleType(objectType) && !indexTypeLessThan(indexType, objectType.target.fixedLength) : isGenericObjectType(objectType) && !(isTupleType(objectType) && indexTypeLessThan(indexType, objectType.target.fixedLength)) ||
|
|
59547
|
+
if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 198 /* IndexedAccessType */ ? isGenericTupleType(objectType) && !indexTypeLessThan(indexType, objectType.target.fixedLength) : isGenericObjectType(objectType) && !(isTupleType(objectType) && indexTypeLessThan(indexType, objectType.target.fixedLength)) || isGenericReducibleType(objectType))) {
|
|
59547
59548
|
if (objectType.flags & 3 /* AnyOrUnknown */) {
|
|
59548
59549
|
return objectType;
|
|
59549
59550
|
}
|
|
59550
|
-
const persistentAccessFlags = accessFlags &
|
|
59551
|
+
const persistentAccessFlags = accessFlags & 1 /* Persistent */;
|
|
59551
59552
|
const id = objectType.id + "," + indexType.id + "," + persistentAccessFlags + getAliasId(aliasSymbol, aliasTypeArguments);
|
|
59552
59553
|
let type = indexedAccessTypes.get(id);
|
|
59553
59554
|
if (!type) {
|
|
@@ -59560,7 +59561,7 @@ ${lanes.join("\n")}
|
|
|
59560
59561
|
const propTypes = [];
|
|
59561
59562
|
let wasMissingProp = false;
|
|
59562
59563
|
for (const t of indexType.types) {
|
|
59563
|
-
const propType = getPropertyTypeForIndexType(objectType, apparentObjectType, t, indexType, accessNode, accessFlags | (wasMissingProp ?
|
|
59564
|
+
const propType = getPropertyTypeForIndexType(objectType, apparentObjectType, t, indexType, accessNode, accessFlags | (wasMissingProp ? 128 /* SuppressNoImplicitAnyError */ : 0));
|
|
59564
59565
|
if (propType) {
|
|
59565
59566
|
propTypes.push(propType);
|
|
59566
59567
|
} else if (!accessNode) {
|
|
@@ -59572,9 +59573,9 @@ ${lanes.join("\n")}
|
|
|
59572
59573
|
if (wasMissingProp) {
|
|
59573
59574
|
return void 0;
|
|
59574
59575
|
}
|
|
59575
|
-
return accessFlags &
|
|
59576
|
+
return accessFlags & 4 /* Writing */ ? getIntersectionType(propTypes, aliasSymbol, aliasTypeArguments) : getUnionType(propTypes, 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
59576
59577
|
}
|
|
59577
|
-
return getPropertyTypeForIndexType(objectType, apparentObjectType, indexType, indexType, accessNode, accessFlags |
|
|
59578
|
+
return getPropertyTypeForIndexType(objectType, apparentObjectType, indexType, indexType, accessNode, accessFlags | 8 /* CacheSymbol */ | 64 /* ReportDeprecated */);
|
|
59578
59579
|
}
|
|
59579
59580
|
function getTypeFromIndexedAccessTypeNode(node) {
|
|
59580
59581
|
const links = getNodeLinks(node);
|
|
@@ -62997,7 +62998,7 @@ ${lanes.join("\n")}
|
|
|
62997
62998
|
const baseObjectType = getBaseConstraintOfType(objectType) || objectType;
|
|
62998
62999
|
const baseIndexType = getBaseConstraintOfType(indexType) || indexType;
|
|
62999
63000
|
if (!isGenericObjectType(baseObjectType) && !isGenericIndexType(baseIndexType)) {
|
|
63000
|
-
const accessFlags =
|
|
63001
|
+
const accessFlags = 4 /* Writing */ | (baseObjectType !== objectType ? 2 /* NoIndexSignatures */ : 0);
|
|
63001
63002
|
const constraint = getIndexedAccessTypeOrUndefined(baseObjectType, baseIndexType, accessFlags);
|
|
63002
63003
|
if (constraint) {
|
|
63003
63004
|
if (reportErrors2 && originalErrorInfo) {
|
|
@@ -65523,12 +65524,6 @@ ${lanes.join("\n")}
|
|
|
65523
65524
|
}
|
|
65524
65525
|
}
|
|
65525
65526
|
}
|
|
65526
|
-
if (target.flags & 8388608 /* IndexedAccess */ && isGenericReducibleType(target.objectType)) {
|
|
65527
|
-
const instantiated = getIndexedAccessType(target.objectType, target.indexType, 2 /* ResolveReducibleTypes */);
|
|
65528
|
-
if (instantiated && instantiated !== target) {
|
|
65529
|
-
inferFromTypes(source, instantiated);
|
|
65530
|
-
}
|
|
65531
|
-
}
|
|
65532
65527
|
}
|
|
65533
65528
|
if (getObjectFlags(source) & 4 /* Reference */ && getObjectFlags(target) & 4 /* Reference */ && (source.target === target.target || isArrayType(source) && isArrayType(target)) && !(source.node && target.node)) {
|
|
65534
65529
|
inferFromTypeArguments(getTypeArguments(source), getTypeArguments(target), getVariances(source.target));
|
|
@@ -69054,7 +69049,7 @@ ${lanes.join("\n")}
|
|
|
69054
69049
|
return getEffectiveFirstArgumentForJsxSignature(signature, callTarget);
|
|
69055
69050
|
}
|
|
69056
69051
|
const restIndex = signature.parameters.length - 1;
|
|
69057
|
-
return signatureHasRestParameter(signature) && argIndex >= restIndex ? getIndexedAccessType(getTypeOfSymbol(signature.parameters[restIndex]), getNumberLiteralType(argIndex - restIndex),
|
|
69052
|
+
return signatureHasRestParameter(signature) && argIndex >= restIndex ? getIndexedAccessType(getTypeOfSymbol(signature.parameters[restIndex]), getNumberLiteralType(argIndex - restIndex), 256 /* Contextual */) : getTypeAtPosition(signature, argIndex);
|
|
69058
69053
|
}
|
|
69059
69054
|
function getContextualTypeForDecorator(decorator) {
|
|
69060
69055
|
const signature = getDecoratorCallSignature(decorator);
|
|
@@ -71735,7 +71730,7 @@ ${lanes.join("\n")}
|
|
|
71735
71730
|
return errorType;
|
|
71736
71731
|
}
|
|
71737
71732
|
const effectiveIndexType = isForInVariableForNumericPropertyNames(indexExpression) ? numberType : indexType;
|
|
71738
|
-
const accessFlags = isAssignmentTarget(node) ?
|
|
71733
|
+
const accessFlags = isAssignmentTarget(node) ? 4 /* Writing */ | (isGenericObjectType(objectType) && !isThisTypeParameter(objectType) ? 2 /* NoIndexSignatures */ : 0) : 32 /* ExpressionPosition */;
|
|
71739
71734
|
const indexedAccessType = getIndexedAccessTypeOrUndefined(objectType, effectiveIndexType, accessFlags, node) || errorType;
|
|
71740
71735
|
return checkIndexedAccessIndexType(getFlowTypeOfAccessExpression(node, getNodeLinks(node).resolvedSymbol, indexedAccessType, indexExpression, checkMode), node);
|
|
71741
71736
|
}
|
|
@@ -72015,7 +72010,7 @@ ${lanes.join("\n")}
|
|
|
72015
72010
|
flags.push(4 /* Rest */);
|
|
72016
72011
|
}
|
|
72017
72012
|
} else {
|
|
72018
|
-
const contextualType = isTupleType(restType) ? getContextualTypeForElementExpression(restType, i - index, argCount - index) || unknownType : getIndexedAccessType(restType, getNumberLiteralType(i - index),
|
|
72013
|
+
const contextualType = isTupleType(restType) ? getContextualTypeForElementExpression(restType, i - index, argCount - index) || unknownType : getIndexedAccessType(restType, getNumberLiteralType(i - index), 256 /* Contextual */);
|
|
72019
72014
|
const argType = checkExpressionWithContextualType(arg, contextualType, context, checkMode);
|
|
72020
72015
|
const hasPrimitiveContextualType = inConstContext || maybeTypeOfKind(contextualType, 402784252 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
|
|
72021
72016
|
types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType));
|
|
@@ -75400,7 +75395,7 @@ ${lanes.join("\n")}
|
|
|
75400
75395
|
);
|
|
75401
75396
|
}
|
|
75402
75397
|
}
|
|
75403
|
-
const elementType = getIndexedAccessType(objectLiteralType, exprType,
|
|
75398
|
+
const elementType = getIndexedAccessType(objectLiteralType, exprType, 32 /* ExpressionPosition */, name);
|
|
75404
75399
|
const type = getFlowTypeOfDestructuring(property, elementType);
|
|
75405
75400
|
return checkDestructuringAssignment(property.kind === 303 /* ShorthandPropertyAssignment */ ? property : property.initializer, type);
|
|
75406
75401
|
} else if (property.kind === 304 /* SpreadAssignment */) {
|
|
@@ -75449,7 +75444,7 @@ ${lanes.join("\n")}
|
|
|
75449
75444
|
if (element.kind !== 229 /* SpreadElement */) {
|
|
75450
75445
|
const indexType = getNumberLiteralType(elementIndex);
|
|
75451
75446
|
if (isArrayLikeType(sourceType)) {
|
|
75452
|
-
const accessFlags =
|
|
75447
|
+
const accessFlags = 32 /* ExpressionPosition */ | (hasDefaultValue(element) ? 16 /* NoTupleBoundsCheck */ : 0);
|
|
75453
75448
|
const elementType2 = getIndexedAccessTypeOrUndefined(sourceType, indexType, accessFlags, createSyntheticExpression(element, indexType)) || errorType;
|
|
75454
75449
|
const assignedType = hasDefaultValue(element) ? getTypeWithFacts(elementType2, 524288 /* NEUndefined */) : elementType2;
|
|
75455
75450
|
const type = getFlowTypeOfDestructuring(element, assignedType);
|
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-53938-7",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -116,5 +116,5 @@
|
|
|
116
116
|
"node": "14.21.1",
|
|
117
117
|
"npm": "8.19.3"
|
|
118
118
|
},
|
|
119
|
-
"gitHead": "
|
|
119
|
+
"gitHead": "18024d904f733c6b313a433dc6b724af240d5b0a"
|
|
120
120
|
}
|