@typescript-deploys/pr-build 5.2.0-pr-52095-16 → 5.2.0-pr-55152-2

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 CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.2";
21
- var version = `${versionMajorMinor}.0-insiders.20230725`;
21
+ var version = `${versionMajorMinor}.0-insiders.20230726`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -5764,6 +5764,7 @@ var Diagnostics = {
5764
5764
  Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method: diag(1062, 1 /* Error */, "Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method_1062", "Type is referenced directly or indirectly in the fulfillment callback of its own 'then' method."),
5765
5765
  An_export_assignment_cannot_be_used_in_a_namespace: diag(1063, 1 /* Error */, "An_export_assignment_cannot_be_used_in_a_namespace_1063", "An export assignment cannot be used in a namespace."),
5766
5766
  The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_write_Promise_0: diag(1064, 1 /* Error */, "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_wri_1064", "The return type of an async function or method must be the global Promise<T> type. Did you mean to write 'Promise<{0}>'?"),
5767
+ The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type: diag(1065, 1 /* Error */, "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_1065", "The return type of an async function or method must be the global Promise<T> type."),
5767
5768
  In_ambient_enum_declarations_member_initializer_must_be_constant_expression: diag(1066, 1 /* Error */, "In_ambient_enum_declarations_member_initializer_must_be_constant_expression_1066", "In ambient enum declarations member initializer must be constant expression."),
5768
5769
  Unexpected_token_A_constructor_method_accessor_or_property_was_expected: diag(1068, 1 /* Error */, "Unexpected_token_A_constructor_method_accessor_or_property_was_expected_1068", "Unexpected token. A constructor, method, accessor, or property was expected."),
5769
5770
  Unexpected_token_A_type_parameter_name_was_expected_without_curly_braces: diag(1069, 1 /* Error */, "Unexpected_token_A_type_parameter_name_was_expected_without_curly_braces_1069", "Unexpected token. A type parameter name was expected without curly braces."),
@@ -59802,6 +59803,7 @@ function createTypeChecker(host) {
59802
59803
  let overrideNextErrorInfo = 0;
59803
59804
  let lastSkippedInfo;
59804
59805
  let incompatibleStack;
59806
+ let skipParentCounter = 0;
59805
59807
  Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking");
59806
59808
  const result = isRelatedTo(
59807
59809
  source,
@@ -59977,7 +59979,15 @@ function createTypeChecker(host) {
59977
59979
  reportIncompatibleStack();
59978
59980
  if (message.elidedInCompatabilityPyramid)
59979
59981
  return;
59980
- errorInfo = chainDiagnosticMessages(errorInfo, message, ...args);
59982
+ if (skipParentCounter === 0) {
59983
+ errorInfo = chainDiagnosticMessages(errorInfo, message, ...args);
59984
+ } else {
59985
+ skipParentCounter--;
59986
+ }
59987
+ }
59988
+ function reportParentSkippedError(message, ...args) {
59989
+ reportError(message, ...args);
59990
+ skipParentCounter++;
59981
59991
  }
59982
59992
  function associateRelatedInfo(info) {
59983
59993
  Debug.assert(!!errorInfo);
@@ -60314,14 +60324,14 @@ function createTypeChecker(host) {
60314
60324
  }
60315
60325
  }
60316
60326
  if (suggestion !== void 0) {
60317
- reportError(
60327
+ reportParentSkippedError(
60318
60328
  Diagnostics.Object_literal_may_only_specify_known_properties_but_0_does_not_exist_in_type_1_Did_you_mean_to_write_2,
60319
60329
  symbolToString(prop),
60320
60330
  typeToString(errorTarget),
60321
60331
  suggestion
60322
60332
  );
60323
60333
  } else {
60324
- reportError(
60334
+ reportParentSkippedError(
60325
60335
  Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1,
60326
60336
  symbolToString(prop),
60327
60337
  typeToString(errorTarget)
@@ -61158,26 +61168,6 @@ function createTypeChecker(host) {
61158
61168
  )) {
61159
61169
  return result2;
61160
61170
  }
61161
- if (sourceFlags & 8388608 /* IndexedAccess */) {
61162
- const indexType = source2.indexType;
61163
- if (indexType.flags & 4194304 /* Index */) {
61164
- const unresolvedIndexConstraint = getBaseConstraintOfType(indexType.type);
61165
- const indexConstraint = unresolvedIndexConstraint && unresolvedIndexConstraint !== noConstraintType ? getIndexType(unresolvedIndexConstraint) : keyofConstraintType;
61166
- const constraint2 = getIndexedAccessType(source2.objectType, indexConstraint);
61167
- if (result2 = isRelatedTo(
61168
- constraint2,
61169
- target2,
61170
- 1 /* Source */,
61171
- /*reportErrors*/
61172
- false,
61173
- /*headMessage*/
61174
- void 0,
61175
- intersectionState
61176
- )) {
61177
- return result2;
61178
- }
61179
- }
61180
- }
61181
61171
  if (isMappedTypeGenericIndexedAccess(source2)) {
61182
61172
  const indexConstraint = getConstraintOfType(source2.indexType);
61183
61173
  if (indexConstraint) {
@@ -67272,75 +67262,41 @@ function createTypeChecker(host) {
67272
67262
  return mapType(
67273
67263
  type,
67274
67264
  (t) => {
67275
- if (!(t.flags & 3670016 /* StructuredType */)) {
67276
- return void 0;
67277
- }
67278
- if (t.flags & 2097152 /* Intersection */) {
67279
- const intersection = t;
67280
- let applicableIndexedMappedTypeSubstitions;
67281
- let concretePropertyTypes;
67282
- let applicableIndexInfoCandidates;
67283
- for (const t2 of intersection.types) {
67284
- if (isGenericMappedType(t2) && !t2.declaration.nameType) {
67285
- applicableIndexedMappedTypeSubstitions = append(applicableIndexedMappedTypeSubstitions, getTypeOfApplicableIndexedMappedTypeSubstitutionOfContextualType(t2));
67286
- continue;
67287
- }
67288
- const typeOfConcreteProperty = getTypeOfConcretePropertyOfContextualType(t2);
67289
- if (typeOfConcreteProperty) {
67290
- concretePropertyTypes = append(concretePropertyTypes, typeOfConcreteProperty);
67291
- continue;
67292
- }
67293
- applicableIndexInfoCandidates = append(applicableIndexInfoCandidates, t2);
67294
- }
67295
- if (concretePropertyTypes) {
67296
- return getIntersectionType(concatenate(concretePropertyTypes, applicableIndexedMappedTypeSubstitions));
67265
+ var _a;
67266
+ if (isGenericMappedType(t) && !t.declaration.nameType) {
67267
+ const constraint = getConstraintTypeFromMappedType(t);
67268
+ const constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
67269
+ const propertyNameType = nameType || getStringLiteralType(unescapeLeadingUnderscores(name));
67270
+ if (isTypeAssignableTo(propertyNameType, constraintOfConstraint)) {
67271
+ return substituteIndexedMappedType(t, propertyNameType);
67272
+ }
67273
+ } else if (t.flags & 3670016 /* StructuredType */) {
67274
+ const prop = getPropertyOfType(t, name);
67275
+ if (prop) {
67276
+ return isCircularMappedProperty(prop) ? void 0 : getTypeOfSymbol(prop);
67297
67277
  }
67298
- const types = concatenate(mapDefined(applicableIndexInfoCandidates, getTypeOfApplicableIndexInfoOfContextualType), applicableIndexedMappedTypeSubstitions);
67299
- if (types.length > 0) {
67300
- return getIntersectionType(types);
67278
+ if (isTupleType(t) && isNumericLiteralName(name) && +name >= 0) {
67279
+ const restType = getElementTypeOfSliceOfTupleType(
67280
+ t,
67281
+ t.target.fixedLength,
67282
+ /*endSkipCount*/
67283
+ 0,
67284
+ /*writing*/
67285
+ false,
67286
+ /*noReductions*/
67287
+ true
67288
+ );
67289
+ if (restType) {
67290
+ return restType;
67291
+ }
67301
67292
  }
67302
- return void 0;
67293
+ return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(unescapeLeadingUnderscores(name)))) == null ? void 0 : _a.type;
67303
67294
  }
67304
- return isGenericMappedType(t) && !t.declaration.nameType ? getTypeOfApplicableIndexedMappedTypeSubstitutionOfContextualType(t) : getTypeOfConcretePropertyOfContextualType(t) || getTypeOfApplicableIndexInfoOfContextualType(t);
67295
+ return void 0;
67305
67296
  },
67306
67297
  /*noReductions*/
67307
67298
  true
67308
67299
  );
67309
- function getTypeOfApplicableIndexedMappedTypeSubstitutionOfContextualType(t) {
67310
- const constraint = getConstraintTypeFromMappedType(t);
67311
- const constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
67312
- const propertyNameType = nameType || getStringLiteralType(unescapeLeadingUnderscores(name));
67313
- if (isTypeAssignableTo(propertyNameType, constraintOfConstraint)) {
67314
- return substituteIndexedMappedType(t, propertyNameType);
67315
- }
67316
- return void 0;
67317
- }
67318
- function getTypeOfConcretePropertyOfContextualType(t) {
67319
- const prop = getPropertyOfType(t, name);
67320
- if (prop) {
67321
- return isCircularMappedProperty(prop) ? void 0 : getTypeOfSymbol(prop);
67322
- }
67323
- if (isTupleType(t) && isNumericLiteralName(name) && +name >= 0) {
67324
- const restType = getElementTypeOfSliceOfTupleType(
67325
- t,
67326
- t.target.fixedLength,
67327
- /*endSkipCount*/
67328
- 0,
67329
- /*writing*/
67330
- false,
67331
- /*noReductions*/
67332
- true
67333
- );
67334
- if (restType) {
67335
- return restType;
67336
- }
67337
- }
67338
- return void 0;
67339
- }
67340
- function getTypeOfApplicableIndexInfoOfContextualType(t) {
67341
- var _a;
67342
- return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(unescapeLeadingUnderscores(name)))) == null ? void 0 : _a.type;
67343
- }
67344
67300
  }
67345
67301
  function getContextualTypeForObjectLiteralMethod(node, contextFlags) {
67346
67302
  Debug.assert(isObjectLiteralMethod(node));
@@ -75020,7 +74976,18 @@ function createTypeChecker(host) {
75020
74976
  addLazyDiagnostic(checkSignatureDeclarationDiagnostics);
75021
74977
  function checkSignatureDeclarationDiagnostics() {
75022
74978
  checkCollisionWithArgumentsInGeneratedCode(node);
75023
- const returnTypeNode = getEffectiveReturnTypeNode(node);
74979
+ let returnTypeNode = getEffectiveReturnTypeNode(node);
74980
+ let returnTypeErrorLocation = returnTypeNode;
74981
+ if (isInJSFile(node)) {
74982
+ const typeTag = getJSDocTypeTag(node);
74983
+ if (typeTag && typeTag.typeExpression && isTypeReferenceNode(typeTag.typeExpression.type)) {
74984
+ const signature = getSingleCallSignature(getTypeFromTypeNode(typeTag.typeExpression));
74985
+ if (signature && signature.declaration) {
74986
+ returnTypeNode = getEffectiveReturnTypeNode(signature.declaration);
74987
+ returnTypeErrorLocation = typeTag.typeExpression.type;
74988
+ }
74989
+ }
74990
+ }
75024
74991
  if (noImplicitAny && !returnTypeNode) {
75025
74992
  switch (node.kind) {
75026
74993
  case 180 /* ConstructSignature */:
@@ -75031,21 +74998,21 @@ function createTypeChecker(host) {
75031
74998
  break;
75032
74999
  }
75033
75000
  }
75034
- if (returnTypeNode) {
75001
+ if (returnTypeNode && returnTypeErrorLocation) {
75035
75002
  const functionFlags2 = getFunctionFlags(node);
75036
75003
  if ((functionFlags2 & (4 /* Invalid */ | 1 /* Generator */)) === 1 /* Generator */) {
75037
75004
  const returnType = getTypeFromTypeNode(returnTypeNode);
75038
75005
  if (returnType === voidType) {
75039
- error(returnTypeNode, Diagnostics.A_generator_cannot_have_a_void_type_annotation);
75006
+ error(returnTypeErrorLocation, Diagnostics.A_generator_cannot_have_a_void_type_annotation);
75040
75007
  } else {
75041
75008
  const generatorYieldType = getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || anyType;
75042
75009
  const generatorReturnType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || generatorYieldType;
75043
75010
  const generatorNextType = getIterationTypeOfGeneratorFunctionReturnType(2 /* Next */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || unknownType;
75044
75011
  const generatorInstantiation = createGeneratorReturnType(generatorYieldType, generatorReturnType, generatorNextType, !!(functionFlags2 & 2 /* Async */));
75045
- checkTypeAssignableTo(generatorInstantiation, returnType, returnTypeNode);
75012
+ checkTypeAssignableTo(generatorInstantiation, returnType, returnTypeErrorLocation);
75046
75013
  }
75047
75014
  } else if ((functionFlags2 & 3 /* AsyncGenerator */) === 2 /* Async */) {
75048
- checkAsyncFunctionReturnType(node, returnTypeNode);
75015
+ checkAsyncFunctionReturnType(node, returnTypeNode, returnTypeErrorLocation);
75049
75016
  }
75050
75017
  }
75051
75018
  if (node.kind !== 181 /* IndexSignature */ && node.kind !== 324 /* JSDocFunctionType */) {
@@ -76127,7 +76094,7 @@ function createTypeChecker(host) {
76127
76094
  }
76128
76095
  return typeAsAwaitable.awaitedTypeOfType = type;
76129
76096
  }
76130
- function checkAsyncFunctionReturnType(node, returnTypeNode) {
76097
+ function checkAsyncFunctionReturnType(node, returnTypeNode, returnTypeErrorLocation) {
76131
76098
  const returnType = getTypeFromTypeNode(returnTypeNode);
76132
76099
  if (languageVersion >= 2 /* ES2015 */) {
76133
76100
  if (isErrorType(returnType)) {
@@ -76138,7 +76105,7 @@ function createTypeChecker(host) {
76138
76105
  true
76139
76106
  );
76140
76107
  if (globalPromiseType !== emptyGenericType && !isReferenceToType(returnType, globalPromiseType)) {
76141
- error(returnTypeNode, Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_write_Promise_0, typeToString(getAwaitedTypeNoAlias(returnType) || voidType));
76108
+ reportErrorForInvalidReturnType(Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_write_Promise_0, returnTypeNode, returnTypeErrorLocation, typeToString(getAwaitedTypeNoAlias(returnType) || voidType));
76142
76109
  return;
76143
76110
  }
76144
76111
  } else {
@@ -76148,7 +76115,7 @@ function createTypeChecker(host) {
76148
76115
  }
76149
76116
  const promiseConstructorName = getEntityNameFromTypeNode(returnTypeNode);
76150
76117
  if (promiseConstructorName === void 0) {
76151
- error(returnTypeNode, Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, typeToString(returnType));
76118
+ reportErrorForInvalidReturnType(Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, returnTypeNode, returnTypeErrorLocation, typeToString(returnType));
76152
76119
  return;
76153
76120
  }
76154
76121
  const promiseConstructorSymbol = resolveEntityName(
@@ -76163,9 +76130,9 @@ function createTypeChecker(host) {
76163
76130
  /*reportErrors*/
76164
76131
  false
76165
76132
  )) {
76166
- error(returnTypeNode, Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option);
76133
+ error(returnTypeErrorLocation, Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option);
76167
76134
  } else {
76168
- error(returnTypeNode, Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, entityNameToString(promiseConstructorName));
76135
+ reportErrorForInvalidReturnType(Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, returnTypeNode, returnTypeErrorLocation, entityNameToString(promiseConstructorName));
76169
76136
  }
76170
76137
  return;
76171
76138
  }
@@ -76174,15 +76141,16 @@ function createTypeChecker(host) {
76174
76141
  true
76175
76142
  );
76176
76143
  if (globalPromiseConstructorLikeType === emptyObjectType) {
76177
- error(returnTypeNode, Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, entityNameToString(promiseConstructorName));
76144
+ reportErrorForInvalidReturnType(Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, returnTypeNode, returnTypeErrorLocation, entityNameToString(promiseConstructorName));
76178
76145
  return;
76179
76146
  }
76180
- if (!checkTypeAssignableTo(
76181
- promiseConstructorType,
76182
- globalPromiseConstructorLikeType,
76183
- returnTypeNode,
76184
- Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value
76185
- )) {
76147
+ const headMessage = Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value;
76148
+ const errorInfo = () => returnTypeNode === returnTypeErrorLocation ? void 0 : chainDiagnosticMessages(
76149
+ /*details*/
76150
+ void 0,
76151
+ Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type
76152
+ );
76153
+ if (!checkTypeAssignableTo(promiseConstructorType, globalPromiseConstructorLikeType, returnTypeErrorLocation, headMessage, errorInfo)) {
76186
76154
  return;
76187
76155
  }
76188
76156
  const rootName = promiseConstructorName && getFirstIdentifier(promiseConstructorName);
@@ -76204,6 +76172,14 @@ function createTypeChecker(host) {
76204
76172
  node,
76205
76173
  Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member
76206
76174
  );
76175
+ function reportErrorForInvalidReturnType(message, returnTypeNode2, returnTypeErrorLocation2, typeName) {
76176
+ if (returnTypeNode2 === returnTypeErrorLocation2) {
76177
+ error(returnTypeErrorLocation2, message, typeName);
76178
+ } else {
76179
+ const diag2 = error(returnTypeErrorLocation2, Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type);
76180
+ addRelatedInfo(diag2, createDiagnosticForNode(returnTypeNode2, message, typeName));
76181
+ }
76182
+ }
76207
76183
  }
76208
76184
  function checkDecorator(node) {
76209
76185
  const signature = getResolvedSignature(node);
package/lib/tsserver.js CHANGED
@@ -2329,7 +2329,7 @@ module.exports = __toCommonJS(server_exports);
2329
2329
 
2330
2330
  // src/compiler/corePublic.ts
2331
2331
  var versionMajorMinor = "5.2";
2332
- var version = `${versionMajorMinor}.0-insiders.20230725`;
2332
+ var version = `${versionMajorMinor}.0-insiders.20230726`;
2333
2333
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2334
2334
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2335
2335
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -9287,6 +9287,7 @@ var Diagnostics = {
9287
9287
  Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method: diag(1062, 1 /* Error */, "Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method_1062", "Type is referenced directly or indirectly in the fulfillment callback of its own 'then' method."),
9288
9288
  An_export_assignment_cannot_be_used_in_a_namespace: diag(1063, 1 /* Error */, "An_export_assignment_cannot_be_used_in_a_namespace_1063", "An export assignment cannot be used in a namespace."),
9289
9289
  The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_write_Promise_0: diag(1064, 1 /* Error */, "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_wri_1064", "The return type of an async function or method must be the global Promise<T> type. Did you mean to write 'Promise<{0}>'?"),
9290
+ The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type: diag(1065, 1 /* Error */, "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_1065", "The return type of an async function or method must be the global Promise<T> type."),
9290
9291
  In_ambient_enum_declarations_member_initializer_must_be_constant_expression: diag(1066, 1 /* Error */, "In_ambient_enum_declarations_member_initializer_must_be_constant_expression_1066", "In ambient enum declarations member initializer must be constant expression."),
9291
9292
  Unexpected_token_A_constructor_method_accessor_or_property_was_expected: diag(1068, 1 /* Error */, "Unexpected_token_A_constructor_method_accessor_or_property_was_expected_1068", "Unexpected token. A constructor, method, accessor, or property was expected."),
9292
9293
  Unexpected_token_A_type_parameter_name_was_expected_without_curly_braces: diag(1069, 1 /* Error */, "Unexpected_token_A_type_parameter_name_was_expected_without_curly_braces_1069", "Unexpected token. A type parameter name was expected without curly braces."),
@@ -64511,6 +64512,7 @@ function createTypeChecker(host) {
64511
64512
  let overrideNextErrorInfo = 0;
64512
64513
  let lastSkippedInfo;
64513
64514
  let incompatibleStack;
64515
+ let skipParentCounter = 0;
64514
64516
  Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking");
64515
64517
  const result = isRelatedTo(
64516
64518
  source,
@@ -64686,7 +64688,15 @@ function createTypeChecker(host) {
64686
64688
  reportIncompatibleStack();
64687
64689
  if (message.elidedInCompatabilityPyramid)
64688
64690
  return;
64689
- errorInfo = chainDiagnosticMessages(errorInfo, message, ...args);
64691
+ if (skipParentCounter === 0) {
64692
+ errorInfo = chainDiagnosticMessages(errorInfo, message, ...args);
64693
+ } else {
64694
+ skipParentCounter--;
64695
+ }
64696
+ }
64697
+ function reportParentSkippedError(message, ...args) {
64698
+ reportError(message, ...args);
64699
+ skipParentCounter++;
64690
64700
  }
64691
64701
  function associateRelatedInfo(info) {
64692
64702
  Debug.assert(!!errorInfo);
@@ -65023,14 +65033,14 @@ function createTypeChecker(host) {
65023
65033
  }
65024
65034
  }
65025
65035
  if (suggestion !== void 0) {
65026
- reportError(
65036
+ reportParentSkippedError(
65027
65037
  Diagnostics.Object_literal_may_only_specify_known_properties_but_0_does_not_exist_in_type_1_Did_you_mean_to_write_2,
65028
65038
  symbolToString(prop),
65029
65039
  typeToString(errorTarget),
65030
65040
  suggestion
65031
65041
  );
65032
65042
  } else {
65033
- reportError(
65043
+ reportParentSkippedError(
65034
65044
  Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1,
65035
65045
  symbolToString(prop),
65036
65046
  typeToString(errorTarget)
@@ -65867,26 +65877,6 @@ function createTypeChecker(host) {
65867
65877
  )) {
65868
65878
  return result2;
65869
65879
  }
65870
- if (sourceFlags & 8388608 /* IndexedAccess */) {
65871
- const indexType = source2.indexType;
65872
- if (indexType.flags & 4194304 /* Index */) {
65873
- const unresolvedIndexConstraint = getBaseConstraintOfType(indexType.type);
65874
- const indexConstraint = unresolvedIndexConstraint && unresolvedIndexConstraint !== noConstraintType ? getIndexType(unresolvedIndexConstraint) : keyofConstraintType;
65875
- const constraint2 = getIndexedAccessType(source2.objectType, indexConstraint);
65876
- if (result2 = isRelatedTo(
65877
- constraint2,
65878
- target2,
65879
- 1 /* Source */,
65880
- /*reportErrors*/
65881
- false,
65882
- /*headMessage*/
65883
- void 0,
65884
- intersectionState
65885
- )) {
65886
- return result2;
65887
- }
65888
- }
65889
- }
65890
65880
  if (isMappedTypeGenericIndexedAccess(source2)) {
65891
65881
  const indexConstraint = getConstraintOfType(source2.indexType);
65892
65882
  if (indexConstraint) {
@@ -71981,75 +71971,41 @@ function createTypeChecker(host) {
71981
71971
  return mapType(
71982
71972
  type,
71983
71973
  (t) => {
71984
- if (!(t.flags & 3670016 /* StructuredType */)) {
71985
- return void 0;
71986
- }
71987
- if (t.flags & 2097152 /* Intersection */) {
71988
- const intersection = t;
71989
- let applicableIndexedMappedTypeSubstitions;
71990
- let concretePropertyTypes;
71991
- let applicableIndexInfoCandidates;
71992
- for (const t2 of intersection.types) {
71993
- if (isGenericMappedType(t2) && !t2.declaration.nameType) {
71994
- applicableIndexedMappedTypeSubstitions = append(applicableIndexedMappedTypeSubstitions, getTypeOfApplicableIndexedMappedTypeSubstitutionOfContextualType(t2));
71995
- continue;
71996
- }
71997
- const typeOfConcreteProperty = getTypeOfConcretePropertyOfContextualType(t2);
71998
- if (typeOfConcreteProperty) {
71999
- concretePropertyTypes = append(concretePropertyTypes, typeOfConcreteProperty);
72000
- continue;
72001
- }
72002
- applicableIndexInfoCandidates = append(applicableIndexInfoCandidates, t2);
72003
- }
72004
- if (concretePropertyTypes) {
72005
- return getIntersectionType(concatenate(concretePropertyTypes, applicableIndexedMappedTypeSubstitions));
71974
+ var _a;
71975
+ if (isGenericMappedType(t) && !t.declaration.nameType) {
71976
+ const constraint = getConstraintTypeFromMappedType(t);
71977
+ const constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
71978
+ const propertyNameType = nameType || getStringLiteralType(unescapeLeadingUnderscores(name));
71979
+ if (isTypeAssignableTo(propertyNameType, constraintOfConstraint)) {
71980
+ return substituteIndexedMappedType(t, propertyNameType);
71981
+ }
71982
+ } else if (t.flags & 3670016 /* StructuredType */) {
71983
+ const prop = getPropertyOfType(t, name);
71984
+ if (prop) {
71985
+ return isCircularMappedProperty(prop) ? void 0 : getTypeOfSymbol(prop);
72006
71986
  }
72007
- const types = concatenate(mapDefined(applicableIndexInfoCandidates, getTypeOfApplicableIndexInfoOfContextualType), applicableIndexedMappedTypeSubstitions);
72008
- if (types.length > 0) {
72009
- return getIntersectionType(types);
71987
+ if (isTupleType(t) && isNumericLiteralName(name) && +name >= 0) {
71988
+ const restType = getElementTypeOfSliceOfTupleType(
71989
+ t,
71990
+ t.target.fixedLength,
71991
+ /*endSkipCount*/
71992
+ 0,
71993
+ /*writing*/
71994
+ false,
71995
+ /*noReductions*/
71996
+ true
71997
+ );
71998
+ if (restType) {
71999
+ return restType;
72000
+ }
72010
72001
  }
72011
- return void 0;
72002
+ return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(unescapeLeadingUnderscores(name)))) == null ? void 0 : _a.type;
72012
72003
  }
72013
- return isGenericMappedType(t) && !t.declaration.nameType ? getTypeOfApplicableIndexedMappedTypeSubstitutionOfContextualType(t) : getTypeOfConcretePropertyOfContextualType(t) || getTypeOfApplicableIndexInfoOfContextualType(t);
72004
+ return void 0;
72014
72005
  },
72015
72006
  /*noReductions*/
72016
72007
  true
72017
72008
  );
72018
- function getTypeOfApplicableIndexedMappedTypeSubstitutionOfContextualType(t) {
72019
- const constraint = getConstraintTypeFromMappedType(t);
72020
- const constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
72021
- const propertyNameType = nameType || getStringLiteralType(unescapeLeadingUnderscores(name));
72022
- if (isTypeAssignableTo(propertyNameType, constraintOfConstraint)) {
72023
- return substituteIndexedMappedType(t, propertyNameType);
72024
- }
72025
- return void 0;
72026
- }
72027
- function getTypeOfConcretePropertyOfContextualType(t) {
72028
- const prop = getPropertyOfType(t, name);
72029
- if (prop) {
72030
- return isCircularMappedProperty(prop) ? void 0 : getTypeOfSymbol(prop);
72031
- }
72032
- if (isTupleType(t) && isNumericLiteralName(name) && +name >= 0) {
72033
- const restType = getElementTypeOfSliceOfTupleType(
72034
- t,
72035
- t.target.fixedLength,
72036
- /*endSkipCount*/
72037
- 0,
72038
- /*writing*/
72039
- false,
72040
- /*noReductions*/
72041
- true
72042
- );
72043
- if (restType) {
72044
- return restType;
72045
- }
72046
- }
72047
- return void 0;
72048
- }
72049
- function getTypeOfApplicableIndexInfoOfContextualType(t) {
72050
- var _a;
72051
- return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(unescapeLeadingUnderscores(name)))) == null ? void 0 : _a.type;
72052
- }
72053
72009
  }
72054
72010
  function getContextualTypeForObjectLiteralMethod(node, contextFlags) {
72055
72011
  Debug.assert(isObjectLiteralMethod(node));
@@ -79729,7 +79685,18 @@ function createTypeChecker(host) {
79729
79685
  addLazyDiagnostic(checkSignatureDeclarationDiagnostics);
79730
79686
  function checkSignatureDeclarationDiagnostics() {
79731
79687
  checkCollisionWithArgumentsInGeneratedCode(node);
79732
- const returnTypeNode = getEffectiveReturnTypeNode(node);
79688
+ let returnTypeNode = getEffectiveReturnTypeNode(node);
79689
+ let returnTypeErrorLocation = returnTypeNode;
79690
+ if (isInJSFile(node)) {
79691
+ const typeTag = getJSDocTypeTag(node);
79692
+ if (typeTag && typeTag.typeExpression && isTypeReferenceNode(typeTag.typeExpression.type)) {
79693
+ const signature = getSingleCallSignature(getTypeFromTypeNode(typeTag.typeExpression));
79694
+ if (signature && signature.declaration) {
79695
+ returnTypeNode = getEffectiveReturnTypeNode(signature.declaration);
79696
+ returnTypeErrorLocation = typeTag.typeExpression.type;
79697
+ }
79698
+ }
79699
+ }
79733
79700
  if (noImplicitAny && !returnTypeNode) {
79734
79701
  switch (node.kind) {
79735
79702
  case 180 /* ConstructSignature */:
@@ -79740,21 +79707,21 @@ function createTypeChecker(host) {
79740
79707
  break;
79741
79708
  }
79742
79709
  }
79743
- if (returnTypeNode) {
79710
+ if (returnTypeNode && returnTypeErrorLocation) {
79744
79711
  const functionFlags2 = getFunctionFlags(node);
79745
79712
  if ((functionFlags2 & (4 /* Invalid */ | 1 /* Generator */)) === 1 /* Generator */) {
79746
79713
  const returnType = getTypeFromTypeNode(returnTypeNode);
79747
79714
  if (returnType === voidType) {
79748
- error2(returnTypeNode, Diagnostics.A_generator_cannot_have_a_void_type_annotation);
79715
+ error2(returnTypeErrorLocation, Diagnostics.A_generator_cannot_have_a_void_type_annotation);
79749
79716
  } else {
79750
79717
  const generatorYieldType = getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || anyType;
79751
79718
  const generatorReturnType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || generatorYieldType;
79752
79719
  const generatorNextType = getIterationTypeOfGeneratorFunctionReturnType(2 /* Next */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || unknownType;
79753
79720
  const generatorInstantiation = createGeneratorReturnType(generatorYieldType, generatorReturnType, generatorNextType, !!(functionFlags2 & 2 /* Async */));
79754
- checkTypeAssignableTo(generatorInstantiation, returnType, returnTypeNode);
79721
+ checkTypeAssignableTo(generatorInstantiation, returnType, returnTypeErrorLocation);
79755
79722
  }
79756
79723
  } else if ((functionFlags2 & 3 /* AsyncGenerator */) === 2 /* Async */) {
79757
- checkAsyncFunctionReturnType(node, returnTypeNode);
79724
+ checkAsyncFunctionReturnType(node, returnTypeNode, returnTypeErrorLocation);
79758
79725
  }
79759
79726
  }
79760
79727
  if (node.kind !== 181 /* IndexSignature */ && node.kind !== 324 /* JSDocFunctionType */) {
@@ -80836,7 +80803,7 @@ function createTypeChecker(host) {
80836
80803
  }
80837
80804
  return typeAsAwaitable.awaitedTypeOfType = type;
80838
80805
  }
80839
- function checkAsyncFunctionReturnType(node, returnTypeNode) {
80806
+ function checkAsyncFunctionReturnType(node, returnTypeNode, returnTypeErrorLocation) {
80840
80807
  const returnType = getTypeFromTypeNode(returnTypeNode);
80841
80808
  if (languageVersion >= 2 /* ES2015 */) {
80842
80809
  if (isErrorType(returnType)) {
@@ -80847,7 +80814,7 @@ function createTypeChecker(host) {
80847
80814
  true
80848
80815
  );
80849
80816
  if (globalPromiseType !== emptyGenericType && !isReferenceToType2(returnType, globalPromiseType)) {
80850
- error2(returnTypeNode, Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_write_Promise_0, typeToString(getAwaitedTypeNoAlias(returnType) || voidType));
80817
+ reportErrorForInvalidReturnType(Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_write_Promise_0, returnTypeNode, returnTypeErrorLocation, typeToString(getAwaitedTypeNoAlias(returnType) || voidType));
80851
80818
  return;
80852
80819
  }
80853
80820
  } else {
@@ -80857,7 +80824,7 @@ function createTypeChecker(host) {
80857
80824
  }
80858
80825
  const promiseConstructorName = getEntityNameFromTypeNode(returnTypeNode);
80859
80826
  if (promiseConstructorName === void 0) {
80860
- error2(returnTypeNode, Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, typeToString(returnType));
80827
+ reportErrorForInvalidReturnType(Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, returnTypeNode, returnTypeErrorLocation, typeToString(returnType));
80861
80828
  return;
80862
80829
  }
80863
80830
  const promiseConstructorSymbol = resolveEntityName(
@@ -80872,9 +80839,9 @@ function createTypeChecker(host) {
80872
80839
  /*reportErrors*/
80873
80840
  false
80874
80841
  )) {
80875
- error2(returnTypeNode, Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option);
80842
+ error2(returnTypeErrorLocation, Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option);
80876
80843
  } else {
80877
- error2(returnTypeNode, Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, entityNameToString(promiseConstructorName));
80844
+ reportErrorForInvalidReturnType(Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, returnTypeNode, returnTypeErrorLocation, entityNameToString(promiseConstructorName));
80878
80845
  }
80879
80846
  return;
80880
80847
  }
@@ -80883,15 +80850,16 @@ function createTypeChecker(host) {
80883
80850
  true
80884
80851
  );
80885
80852
  if (globalPromiseConstructorLikeType === emptyObjectType) {
80886
- error2(returnTypeNode, Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, entityNameToString(promiseConstructorName));
80853
+ reportErrorForInvalidReturnType(Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, returnTypeNode, returnTypeErrorLocation, entityNameToString(promiseConstructorName));
80887
80854
  return;
80888
80855
  }
80889
- if (!checkTypeAssignableTo(
80890
- promiseConstructorType,
80891
- globalPromiseConstructorLikeType,
80892
- returnTypeNode,
80893
- Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value
80894
- )) {
80856
+ const headMessage = Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value;
80857
+ const errorInfo = () => returnTypeNode === returnTypeErrorLocation ? void 0 : chainDiagnosticMessages(
80858
+ /*details*/
80859
+ void 0,
80860
+ Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type
80861
+ );
80862
+ if (!checkTypeAssignableTo(promiseConstructorType, globalPromiseConstructorLikeType, returnTypeErrorLocation, headMessage, errorInfo)) {
80895
80863
  return;
80896
80864
  }
80897
80865
  const rootName = promiseConstructorName && getFirstIdentifier(promiseConstructorName);
@@ -80913,6 +80881,14 @@ function createTypeChecker(host) {
80913
80881
  node,
80914
80882
  Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member
80915
80883
  );
80884
+ function reportErrorForInvalidReturnType(message, returnTypeNode2, returnTypeErrorLocation2, typeName) {
80885
+ if (returnTypeNode2 === returnTypeErrorLocation2) {
80886
+ error2(returnTypeErrorLocation2, message, typeName);
80887
+ } else {
80888
+ const diag2 = error2(returnTypeErrorLocation2, Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type);
80889
+ addRelatedInfo(diag2, createDiagnosticForNode(returnTypeNode2, message, typeName));
80890
+ }
80891
+ }
80916
80892
  }
80917
80893
  function checkDecorator(node) {
80918
80894
  const signature = getResolvedSignature(node);
@@ -35,7 +35,7 @@ var ts = (() => {
35
35
  "src/compiler/corePublic.ts"() {
36
36
  "use strict";
37
37
  versionMajorMinor = "5.2";
38
- version = `${versionMajorMinor}.0-insiders.20230725`;
38
+ version = `${versionMajorMinor}.0-insiders.20230726`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -7068,6 +7068,7 @@ ${lanes.join("\n")}
7068
7068
  Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method: diag(1062, 1 /* Error */, "Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method_1062", "Type is referenced directly or indirectly in the fulfillment callback of its own 'then' method."),
7069
7069
  An_export_assignment_cannot_be_used_in_a_namespace: diag(1063, 1 /* Error */, "An_export_assignment_cannot_be_used_in_a_namespace_1063", "An export assignment cannot be used in a namespace."),
7070
7070
  The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_write_Promise_0: diag(1064, 1 /* Error */, "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_wri_1064", "The return type of an async function or method must be the global Promise<T> type. Did you mean to write 'Promise<{0}>'?"),
7071
+ The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type: diag(1065, 1 /* Error */, "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_1065", "The return type of an async function or method must be the global Promise<T> type."),
7071
7072
  In_ambient_enum_declarations_member_initializer_must_be_constant_expression: diag(1066, 1 /* Error */, "In_ambient_enum_declarations_member_initializer_must_be_constant_expression_1066", "In ambient enum declarations member initializer must be constant expression."),
7072
7073
  Unexpected_token_A_constructor_method_accessor_or_property_was_expected: diag(1068, 1 /* Error */, "Unexpected_token_A_constructor_method_accessor_or_property_was_expected_1068", "Unexpected token. A constructor, method, accessor, or property was expected."),
7073
7074
  Unexpected_token_A_type_parameter_name_was_expected_without_curly_braces: diag(1069, 1 /* Error */, "Unexpected_token_A_type_parameter_name_was_expected_without_curly_braces_1069", "Unexpected token. A type parameter name was expected without curly braces."),
@@ -62276,6 +62277,7 @@ ${lanes.join("\n")}
62276
62277
  let overrideNextErrorInfo = 0;
62277
62278
  let lastSkippedInfo;
62278
62279
  let incompatibleStack;
62280
+ let skipParentCounter = 0;
62279
62281
  Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking");
62280
62282
  const result = isRelatedTo(
62281
62283
  source,
@@ -62451,7 +62453,15 @@ ${lanes.join("\n")}
62451
62453
  reportIncompatibleStack();
62452
62454
  if (message.elidedInCompatabilityPyramid)
62453
62455
  return;
62454
- errorInfo = chainDiagnosticMessages(errorInfo, message, ...args);
62456
+ if (skipParentCounter === 0) {
62457
+ errorInfo = chainDiagnosticMessages(errorInfo, message, ...args);
62458
+ } else {
62459
+ skipParentCounter--;
62460
+ }
62461
+ }
62462
+ function reportParentSkippedError(message, ...args) {
62463
+ reportError(message, ...args);
62464
+ skipParentCounter++;
62455
62465
  }
62456
62466
  function associateRelatedInfo(info) {
62457
62467
  Debug.assert(!!errorInfo);
@@ -62788,14 +62798,14 @@ ${lanes.join("\n")}
62788
62798
  }
62789
62799
  }
62790
62800
  if (suggestion !== void 0) {
62791
- reportError(
62801
+ reportParentSkippedError(
62792
62802
  Diagnostics.Object_literal_may_only_specify_known_properties_but_0_does_not_exist_in_type_1_Did_you_mean_to_write_2,
62793
62803
  symbolToString(prop),
62794
62804
  typeToString(errorTarget),
62795
62805
  suggestion
62796
62806
  );
62797
62807
  } else {
62798
- reportError(
62808
+ reportParentSkippedError(
62799
62809
  Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1,
62800
62810
  symbolToString(prop),
62801
62811
  typeToString(errorTarget)
@@ -63632,26 +63642,6 @@ ${lanes.join("\n")}
63632
63642
  )) {
63633
63643
  return result2;
63634
63644
  }
63635
- if (sourceFlags & 8388608 /* IndexedAccess */) {
63636
- const indexType = source2.indexType;
63637
- if (indexType.flags & 4194304 /* Index */) {
63638
- const unresolvedIndexConstraint = getBaseConstraintOfType(indexType.type);
63639
- const indexConstraint = unresolvedIndexConstraint && unresolvedIndexConstraint !== noConstraintType ? getIndexType(unresolvedIndexConstraint) : keyofConstraintType;
63640
- const constraint2 = getIndexedAccessType(source2.objectType, indexConstraint);
63641
- if (result2 = isRelatedTo(
63642
- constraint2,
63643
- target2,
63644
- 1 /* Source */,
63645
- /*reportErrors*/
63646
- false,
63647
- /*headMessage*/
63648
- void 0,
63649
- intersectionState
63650
- )) {
63651
- return result2;
63652
- }
63653
- }
63654
- }
63655
63645
  if (isMappedTypeGenericIndexedAccess(source2)) {
63656
63646
  const indexConstraint = getConstraintOfType(source2.indexType);
63657
63647
  if (indexConstraint) {
@@ -69746,75 +69736,41 @@ ${lanes.join("\n")}
69746
69736
  return mapType(
69747
69737
  type,
69748
69738
  (t) => {
69749
- if (!(t.flags & 3670016 /* StructuredType */)) {
69750
- return void 0;
69751
- }
69752
- if (t.flags & 2097152 /* Intersection */) {
69753
- const intersection = t;
69754
- let applicableIndexedMappedTypeSubstitions;
69755
- let concretePropertyTypes;
69756
- let applicableIndexInfoCandidates;
69757
- for (const t2 of intersection.types) {
69758
- if (isGenericMappedType(t2) && !t2.declaration.nameType) {
69759
- applicableIndexedMappedTypeSubstitions = append(applicableIndexedMappedTypeSubstitions, getTypeOfApplicableIndexedMappedTypeSubstitutionOfContextualType(t2));
69760
- continue;
69761
- }
69762
- const typeOfConcreteProperty = getTypeOfConcretePropertyOfContextualType(t2);
69763
- if (typeOfConcreteProperty) {
69764
- concretePropertyTypes = append(concretePropertyTypes, typeOfConcreteProperty);
69765
- continue;
69766
- }
69767
- applicableIndexInfoCandidates = append(applicableIndexInfoCandidates, t2);
69768
- }
69769
- if (concretePropertyTypes) {
69770
- return getIntersectionType(concatenate(concretePropertyTypes, applicableIndexedMappedTypeSubstitions));
69739
+ var _a;
69740
+ if (isGenericMappedType(t) && !t.declaration.nameType) {
69741
+ const constraint = getConstraintTypeFromMappedType(t);
69742
+ const constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
69743
+ const propertyNameType = nameType || getStringLiteralType(unescapeLeadingUnderscores(name));
69744
+ if (isTypeAssignableTo(propertyNameType, constraintOfConstraint)) {
69745
+ return substituteIndexedMappedType(t, propertyNameType);
69746
+ }
69747
+ } else if (t.flags & 3670016 /* StructuredType */) {
69748
+ const prop = getPropertyOfType(t, name);
69749
+ if (prop) {
69750
+ return isCircularMappedProperty(prop) ? void 0 : getTypeOfSymbol(prop);
69771
69751
  }
69772
- const types = concatenate(mapDefined(applicableIndexInfoCandidates, getTypeOfApplicableIndexInfoOfContextualType), applicableIndexedMappedTypeSubstitions);
69773
- if (types.length > 0) {
69774
- return getIntersectionType(types);
69752
+ if (isTupleType(t) && isNumericLiteralName(name) && +name >= 0) {
69753
+ const restType = getElementTypeOfSliceOfTupleType(
69754
+ t,
69755
+ t.target.fixedLength,
69756
+ /*endSkipCount*/
69757
+ 0,
69758
+ /*writing*/
69759
+ false,
69760
+ /*noReductions*/
69761
+ true
69762
+ );
69763
+ if (restType) {
69764
+ return restType;
69765
+ }
69775
69766
  }
69776
- return void 0;
69767
+ return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(unescapeLeadingUnderscores(name)))) == null ? void 0 : _a.type;
69777
69768
  }
69778
- return isGenericMappedType(t) && !t.declaration.nameType ? getTypeOfApplicableIndexedMappedTypeSubstitutionOfContextualType(t) : getTypeOfConcretePropertyOfContextualType(t) || getTypeOfApplicableIndexInfoOfContextualType(t);
69769
+ return void 0;
69779
69770
  },
69780
69771
  /*noReductions*/
69781
69772
  true
69782
69773
  );
69783
- function getTypeOfApplicableIndexedMappedTypeSubstitutionOfContextualType(t) {
69784
- const constraint = getConstraintTypeFromMappedType(t);
69785
- const constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
69786
- const propertyNameType = nameType || getStringLiteralType(unescapeLeadingUnderscores(name));
69787
- if (isTypeAssignableTo(propertyNameType, constraintOfConstraint)) {
69788
- return substituteIndexedMappedType(t, propertyNameType);
69789
- }
69790
- return void 0;
69791
- }
69792
- function getTypeOfConcretePropertyOfContextualType(t) {
69793
- const prop = getPropertyOfType(t, name);
69794
- if (prop) {
69795
- return isCircularMappedProperty(prop) ? void 0 : getTypeOfSymbol(prop);
69796
- }
69797
- if (isTupleType(t) && isNumericLiteralName(name) && +name >= 0) {
69798
- const restType = getElementTypeOfSliceOfTupleType(
69799
- t,
69800
- t.target.fixedLength,
69801
- /*endSkipCount*/
69802
- 0,
69803
- /*writing*/
69804
- false,
69805
- /*noReductions*/
69806
- true
69807
- );
69808
- if (restType) {
69809
- return restType;
69810
- }
69811
- }
69812
- return void 0;
69813
- }
69814
- function getTypeOfApplicableIndexInfoOfContextualType(t) {
69815
- var _a;
69816
- return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(unescapeLeadingUnderscores(name)))) == null ? void 0 : _a.type;
69817
- }
69818
69774
  }
69819
69775
  function getContextualTypeForObjectLiteralMethod(node, contextFlags) {
69820
69776
  Debug.assert(isObjectLiteralMethod(node));
@@ -77494,7 +77450,18 @@ ${lanes.join("\n")}
77494
77450
  addLazyDiagnostic(checkSignatureDeclarationDiagnostics);
77495
77451
  function checkSignatureDeclarationDiagnostics() {
77496
77452
  checkCollisionWithArgumentsInGeneratedCode(node);
77497
- const returnTypeNode = getEffectiveReturnTypeNode(node);
77453
+ let returnTypeNode = getEffectiveReturnTypeNode(node);
77454
+ let returnTypeErrorLocation = returnTypeNode;
77455
+ if (isInJSFile(node)) {
77456
+ const typeTag = getJSDocTypeTag(node);
77457
+ if (typeTag && typeTag.typeExpression && isTypeReferenceNode(typeTag.typeExpression.type)) {
77458
+ const signature = getSingleCallSignature(getTypeFromTypeNode(typeTag.typeExpression));
77459
+ if (signature && signature.declaration) {
77460
+ returnTypeNode = getEffectiveReturnTypeNode(signature.declaration);
77461
+ returnTypeErrorLocation = typeTag.typeExpression.type;
77462
+ }
77463
+ }
77464
+ }
77498
77465
  if (noImplicitAny && !returnTypeNode) {
77499
77466
  switch (node.kind) {
77500
77467
  case 180 /* ConstructSignature */:
@@ -77505,21 +77472,21 @@ ${lanes.join("\n")}
77505
77472
  break;
77506
77473
  }
77507
77474
  }
77508
- if (returnTypeNode) {
77475
+ if (returnTypeNode && returnTypeErrorLocation) {
77509
77476
  const functionFlags2 = getFunctionFlags(node);
77510
77477
  if ((functionFlags2 & (4 /* Invalid */ | 1 /* Generator */)) === 1 /* Generator */) {
77511
77478
  const returnType = getTypeFromTypeNode(returnTypeNode);
77512
77479
  if (returnType === voidType) {
77513
- error2(returnTypeNode, Diagnostics.A_generator_cannot_have_a_void_type_annotation);
77480
+ error2(returnTypeErrorLocation, Diagnostics.A_generator_cannot_have_a_void_type_annotation);
77514
77481
  } else {
77515
77482
  const generatorYieldType = getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || anyType;
77516
77483
  const generatorReturnType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || generatorYieldType;
77517
77484
  const generatorNextType = getIterationTypeOfGeneratorFunctionReturnType(2 /* Next */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || unknownType;
77518
77485
  const generatorInstantiation = createGeneratorReturnType(generatorYieldType, generatorReturnType, generatorNextType, !!(functionFlags2 & 2 /* Async */));
77519
- checkTypeAssignableTo(generatorInstantiation, returnType, returnTypeNode);
77486
+ checkTypeAssignableTo(generatorInstantiation, returnType, returnTypeErrorLocation);
77520
77487
  }
77521
77488
  } else if ((functionFlags2 & 3 /* AsyncGenerator */) === 2 /* Async */) {
77522
- checkAsyncFunctionReturnType(node, returnTypeNode);
77489
+ checkAsyncFunctionReturnType(node, returnTypeNode, returnTypeErrorLocation);
77523
77490
  }
77524
77491
  }
77525
77492
  if (node.kind !== 181 /* IndexSignature */ && node.kind !== 324 /* JSDocFunctionType */) {
@@ -78601,7 +78568,7 @@ ${lanes.join("\n")}
78601
78568
  }
78602
78569
  return typeAsAwaitable.awaitedTypeOfType = type;
78603
78570
  }
78604
- function checkAsyncFunctionReturnType(node, returnTypeNode) {
78571
+ function checkAsyncFunctionReturnType(node, returnTypeNode, returnTypeErrorLocation) {
78605
78572
  const returnType = getTypeFromTypeNode(returnTypeNode);
78606
78573
  if (languageVersion >= 2 /* ES2015 */) {
78607
78574
  if (isErrorType(returnType)) {
@@ -78612,7 +78579,7 @@ ${lanes.join("\n")}
78612
78579
  true
78613
78580
  );
78614
78581
  if (globalPromiseType !== emptyGenericType && !isReferenceToType2(returnType, globalPromiseType)) {
78615
- error2(returnTypeNode, Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_write_Promise_0, typeToString(getAwaitedTypeNoAlias(returnType) || voidType));
78582
+ reportErrorForInvalidReturnType(Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_write_Promise_0, returnTypeNode, returnTypeErrorLocation, typeToString(getAwaitedTypeNoAlias(returnType) || voidType));
78616
78583
  return;
78617
78584
  }
78618
78585
  } else {
@@ -78622,7 +78589,7 @@ ${lanes.join("\n")}
78622
78589
  }
78623
78590
  const promiseConstructorName = getEntityNameFromTypeNode(returnTypeNode);
78624
78591
  if (promiseConstructorName === void 0) {
78625
- error2(returnTypeNode, Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, typeToString(returnType));
78592
+ reportErrorForInvalidReturnType(Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, returnTypeNode, returnTypeErrorLocation, typeToString(returnType));
78626
78593
  return;
78627
78594
  }
78628
78595
  const promiseConstructorSymbol = resolveEntityName(
@@ -78637,9 +78604,9 @@ ${lanes.join("\n")}
78637
78604
  /*reportErrors*/
78638
78605
  false
78639
78606
  )) {
78640
- error2(returnTypeNode, Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option);
78607
+ error2(returnTypeErrorLocation, Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option);
78641
78608
  } else {
78642
- error2(returnTypeNode, Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, entityNameToString(promiseConstructorName));
78609
+ reportErrorForInvalidReturnType(Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, returnTypeNode, returnTypeErrorLocation, entityNameToString(promiseConstructorName));
78643
78610
  }
78644
78611
  return;
78645
78612
  }
@@ -78648,15 +78615,16 @@ ${lanes.join("\n")}
78648
78615
  true
78649
78616
  );
78650
78617
  if (globalPromiseConstructorLikeType === emptyObjectType) {
78651
- error2(returnTypeNode, Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, entityNameToString(promiseConstructorName));
78618
+ reportErrorForInvalidReturnType(Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, returnTypeNode, returnTypeErrorLocation, entityNameToString(promiseConstructorName));
78652
78619
  return;
78653
78620
  }
78654
- if (!checkTypeAssignableTo(
78655
- promiseConstructorType,
78656
- globalPromiseConstructorLikeType,
78657
- returnTypeNode,
78658
- Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value
78659
- )) {
78621
+ const headMessage = Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value;
78622
+ const errorInfo = () => returnTypeNode === returnTypeErrorLocation ? void 0 : chainDiagnosticMessages(
78623
+ /*details*/
78624
+ void 0,
78625
+ Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type
78626
+ );
78627
+ if (!checkTypeAssignableTo(promiseConstructorType, globalPromiseConstructorLikeType, returnTypeErrorLocation, headMessage, errorInfo)) {
78660
78628
  return;
78661
78629
  }
78662
78630
  const rootName = promiseConstructorName && getFirstIdentifier(promiseConstructorName);
@@ -78678,6 +78646,14 @@ ${lanes.join("\n")}
78678
78646
  node,
78679
78647
  Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member
78680
78648
  );
78649
+ function reportErrorForInvalidReturnType(message, returnTypeNode2, returnTypeErrorLocation2, typeName) {
78650
+ if (returnTypeNode2 === returnTypeErrorLocation2) {
78651
+ error2(returnTypeErrorLocation2, message, typeName);
78652
+ } else {
78653
+ const diag2 = error2(returnTypeErrorLocation2, Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type);
78654
+ addRelatedInfo(diag2, createDiagnosticForNode(returnTypeNode2, message, typeName));
78655
+ }
78656
+ }
78681
78657
  }
78682
78658
  function checkDecorator(node) {
78683
78659
  const signature = getResolvedSignature(node);
package/lib/typescript.js CHANGED
@@ -35,7 +35,7 @@ var ts = (() => {
35
35
  "src/compiler/corePublic.ts"() {
36
36
  "use strict";
37
37
  versionMajorMinor = "5.2";
38
- version = `${versionMajorMinor}.0-insiders.20230725`;
38
+ version = `${versionMajorMinor}.0-insiders.20230726`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -7068,6 +7068,7 @@ ${lanes.join("\n")}
7068
7068
  Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method: diag(1062, 1 /* Error */, "Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method_1062", "Type is referenced directly or indirectly in the fulfillment callback of its own 'then' method."),
7069
7069
  An_export_assignment_cannot_be_used_in_a_namespace: diag(1063, 1 /* Error */, "An_export_assignment_cannot_be_used_in_a_namespace_1063", "An export assignment cannot be used in a namespace."),
7070
7070
  The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_write_Promise_0: diag(1064, 1 /* Error */, "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_wri_1064", "The return type of an async function or method must be the global Promise<T> type. Did you mean to write 'Promise<{0}>'?"),
7071
+ The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type: diag(1065, 1 /* Error */, "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_1065", "The return type of an async function or method must be the global Promise<T> type."),
7071
7072
  In_ambient_enum_declarations_member_initializer_must_be_constant_expression: diag(1066, 1 /* Error */, "In_ambient_enum_declarations_member_initializer_must_be_constant_expression_1066", "In ambient enum declarations member initializer must be constant expression."),
7072
7073
  Unexpected_token_A_constructor_method_accessor_or_property_was_expected: diag(1068, 1 /* Error */, "Unexpected_token_A_constructor_method_accessor_or_property_was_expected_1068", "Unexpected token. A constructor, method, accessor, or property was expected."),
7073
7074
  Unexpected_token_A_type_parameter_name_was_expected_without_curly_braces: diag(1069, 1 /* Error */, "Unexpected_token_A_type_parameter_name_was_expected_without_curly_braces_1069", "Unexpected token. A type parameter name was expected without curly braces."),
@@ -62276,6 +62277,7 @@ ${lanes.join("\n")}
62276
62277
  let overrideNextErrorInfo = 0;
62277
62278
  let lastSkippedInfo;
62278
62279
  let incompatibleStack;
62280
+ let skipParentCounter = 0;
62279
62281
  Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking");
62280
62282
  const result = isRelatedTo(
62281
62283
  source,
@@ -62451,7 +62453,15 @@ ${lanes.join("\n")}
62451
62453
  reportIncompatibleStack();
62452
62454
  if (message.elidedInCompatabilityPyramid)
62453
62455
  return;
62454
- errorInfo = chainDiagnosticMessages(errorInfo, message, ...args);
62456
+ if (skipParentCounter === 0) {
62457
+ errorInfo = chainDiagnosticMessages(errorInfo, message, ...args);
62458
+ } else {
62459
+ skipParentCounter--;
62460
+ }
62461
+ }
62462
+ function reportParentSkippedError(message, ...args) {
62463
+ reportError(message, ...args);
62464
+ skipParentCounter++;
62455
62465
  }
62456
62466
  function associateRelatedInfo(info) {
62457
62467
  Debug.assert(!!errorInfo);
@@ -62788,14 +62798,14 @@ ${lanes.join("\n")}
62788
62798
  }
62789
62799
  }
62790
62800
  if (suggestion !== void 0) {
62791
- reportError(
62801
+ reportParentSkippedError(
62792
62802
  Diagnostics.Object_literal_may_only_specify_known_properties_but_0_does_not_exist_in_type_1_Did_you_mean_to_write_2,
62793
62803
  symbolToString(prop),
62794
62804
  typeToString(errorTarget),
62795
62805
  suggestion
62796
62806
  );
62797
62807
  } else {
62798
- reportError(
62808
+ reportParentSkippedError(
62799
62809
  Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1,
62800
62810
  symbolToString(prop),
62801
62811
  typeToString(errorTarget)
@@ -63632,26 +63642,6 @@ ${lanes.join("\n")}
63632
63642
  )) {
63633
63643
  return result2;
63634
63644
  }
63635
- if (sourceFlags & 8388608 /* IndexedAccess */) {
63636
- const indexType = source2.indexType;
63637
- if (indexType.flags & 4194304 /* Index */) {
63638
- const unresolvedIndexConstraint = getBaseConstraintOfType(indexType.type);
63639
- const indexConstraint = unresolvedIndexConstraint && unresolvedIndexConstraint !== noConstraintType ? getIndexType(unresolvedIndexConstraint) : keyofConstraintType;
63640
- const constraint2 = getIndexedAccessType(source2.objectType, indexConstraint);
63641
- if (result2 = isRelatedTo(
63642
- constraint2,
63643
- target2,
63644
- 1 /* Source */,
63645
- /*reportErrors*/
63646
- false,
63647
- /*headMessage*/
63648
- void 0,
63649
- intersectionState
63650
- )) {
63651
- return result2;
63652
- }
63653
- }
63654
- }
63655
63645
  if (isMappedTypeGenericIndexedAccess(source2)) {
63656
63646
  const indexConstraint = getConstraintOfType(source2.indexType);
63657
63647
  if (indexConstraint) {
@@ -69746,75 +69736,41 @@ ${lanes.join("\n")}
69746
69736
  return mapType(
69747
69737
  type,
69748
69738
  (t) => {
69749
- if (!(t.flags & 3670016 /* StructuredType */)) {
69750
- return void 0;
69751
- }
69752
- if (t.flags & 2097152 /* Intersection */) {
69753
- const intersection = t;
69754
- let applicableIndexedMappedTypeSubstitions;
69755
- let concretePropertyTypes;
69756
- let applicableIndexInfoCandidates;
69757
- for (const t2 of intersection.types) {
69758
- if (isGenericMappedType(t2) && !t2.declaration.nameType) {
69759
- applicableIndexedMappedTypeSubstitions = append(applicableIndexedMappedTypeSubstitions, getTypeOfApplicableIndexedMappedTypeSubstitutionOfContextualType(t2));
69760
- continue;
69761
- }
69762
- const typeOfConcreteProperty = getTypeOfConcretePropertyOfContextualType(t2);
69763
- if (typeOfConcreteProperty) {
69764
- concretePropertyTypes = append(concretePropertyTypes, typeOfConcreteProperty);
69765
- continue;
69766
- }
69767
- applicableIndexInfoCandidates = append(applicableIndexInfoCandidates, t2);
69768
- }
69769
- if (concretePropertyTypes) {
69770
- return getIntersectionType(concatenate(concretePropertyTypes, applicableIndexedMappedTypeSubstitions));
69739
+ var _a;
69740
+ if (isGenericMappedType(t) && !t.declaration.nameType) {
69741
+ const constraint = getConstraintTypeFromMappedType(t);
69742
+ const constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
69743
+ const propertyNameType = nameType || getStringLiteralType(unescapeLeadingUnderscores(name));
69744
+ if (isTypeAssignableTo(propertyNameType, constraintOfConstraint)) {
69745
+ return substituteIndexedMappedType(t, propertyNameType);
69746
+ }
69747
+ } else if (t.flags & 3670016 /* StructuredType */) {
69748
+ const prop = getPropertyOfType(t, name);
69749
+ if (prop) {
69750
+ return isCircularMappedProperty(prop) ? void 0 : getTypeOfSymbol(prop);
69771
69751
  }
69772
- const types = concatenate(mapDefined(applicableIndexInfoCandidates, getTypeOfApplicableIndexInfoOfContextualType), applicableIndexedMappedTypeSubstitions);
69773
- if (types.length > 0) {
69774
- return getIntersectionType(types);
69752
+ if (isTupleType(t) && isNumericLiteralName(name) && +name >= 0) {
69753
+ const restType = getElementTypeOfSliceOfTupleType(
69754
+ t,
69755
+ t.target.fixedLength,
69756
+ /*endSkipCount*/
69757
+ 0,
69758
+ /*writing*/
69759
+ false,
69760
+ /*noReductions*/
69761
+ true
69762
+ );
69763
+ if (restType) {
69764
+ return restType;
69765
+ }
69775
69766
  }
69776
- return void 0;
69767
+ return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(unescapeLeadingUnderscores(name)))) == null ? void 0 : _a.type;
69777
69768
  }
69778
- return isGenericMappedType(t) && !t.declaration.nameType ? getTypeOfApplicableIndexedMappedTypeSubstitutionOfContextualType(t) : getTypeOfConcretePropertyOfContextualType(t) || getTypeOfApplicableIndexInfoOfContextualType(t);
69769
+ return void 0;
69779
69770
  },
69780
69771
  /*noReductions*/
69781
69772
  true
69782
69773
  );
69783
- function getTypeOfApplicableIndexedMappedTypeSubstitutionOfContextualType(t) {
69784
- const constraint = getConstraintTypeFromMappedType(t);
69785
- const constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
69786
- const propertyNameType = nameType || getStringLiteralType(unescapeLeadingUnderscores(name));
69787
- if (isTypeAssignableTo(propertyNameType, constraintOfConstraint)) {
69788
- return substituteIndexedMappedType(t, propertyNameType);
69789
- }
69790
- return void 0;
69791
- }
69792
- function getTypeOfConcretePropertyOfContextualType(t) {
69793
- const prop = getPropertyOfType(t, name);
69794
- if (prop) {
69795
- return isCircularMappedProperty(prop) ? void 0 : getTypeOfSymbol(prop);
69796
- }
69797
- if (isTupleType(t) && isNumericLiteralName(name) && +name >= 0) {
69798
- const restType = getElementTypeOfSliceOfTupleType(
69799
- t,
69800
- t.target.fixedLength,
69801
- /*endSkipCount*/
69802
- 0,
69803
- /*writing*/
69804
- false,
69805
- /*noReductions*/
69806
- true
69807
- );
69808
- if (restType) {
69809
- return restType;
69810
- }
69811
- }
69812
- return void 0;
69813
- }
69814
- function getTypeOfApplicableIndexInfoOfContextualType(t) {
69815
- var _a;
69816
- return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(unescapeLeadingUnderscores(name)))) == null ? void 0 : _a.type;
69817
- }
69818
69774
  }
69819
69775
  function getContextualTypeForObjectLiteralMethod(node, contextFlags) {
69820
69776
  Debug.assert(isObjectLiteralMethod(node));
@@ -77494,7 +77450,18 @@ ${lanes.join("\n")}
77494
77450
  addLazyDiagnostic(checkSignatureDeclarationDiagnostics);
77495
77451
  function checkSignatureDeclarationDiagnostics() {
77496
77452
  checkCollisionWithArgumentsInGeneratedCode(node);
77497
- const returnTypeNode = getEffectiveReturnTypeNode(node);
77453
+ let returnTypeNode = getEffectiveReturnTypeNode(node);
77454
+ let returnTypeErrorLocation = returnTypeNode;
77455
+ if (isInJSFile(node)) {
77456
+ const typeTag = getJSDocTypeTag(node);
77457
+ if (typeTag && typeTag.typeExpression && isTypeReferenceNode(typeTag.typeExpression.type)) {
77458
+ const signature = getSingleCallSignature(getTypeFromTypeNode(typeTag.typeExpression));
77459
+ if (signature && signature.declaration) {
77460
+ returnTypeNode = getEffectiveReturnTypeNode(signature.declaration);
77461
+ returnTypeErrorLocation = typeTag.typeExpression.type;
77462
+ }
77463
+ }
77464
+ }
77498
77465
  if (noImplicitAny && !returnTypeNode) {
77499
77466
  switch (node.kind) {
77500
77467
  case 180 /* ConstructSignature */:
@@ -77505,21 +77472,21 @@ ${lanes.join("\n")}
77505
77472
  break;
77506
77473
  }
77507
77474
  }
77508
- if (returnTypeNode) {
77475
+ if (returnTypeNode && returnTypeErrorLocation) {
77509
77476
  const functionFlags2 = getFunctionFlags(node);
77510
77477
  if ((functionFlags2 & (4 /* Invalid */ | 1 /* Generator */)) === 1 /* Generator */) {
77511
77478
  const returnType = getTypeFromTypeNode(returnTypeNode);
77512
77479
  if (returnType === voidType) {
77513
- error2(returnTypeNode, Diagnostics.A_generator_cannot_have_a_void_type_annotation);
77480
+ error2(returnTypeErrorLocation, Diagnostics.A_generator_cannot_have_a_void_type_annotation);
77514
77481
  } else {
77515
77482
  const generatorYieldType = getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || anyType;
77516
77483
  const generatorReturnType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || generatorYieldType;
77517
77484
  const generatorNextType = getIterationTypeOfGeneratorFunctionReturnType(2 /* Next */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || unknownType;
77518
77485
  const generatorInstantiation = createGeneratorReturnType(generatorYieldType, generatorReturnType, generatorNextType, !!(functionFlags2 & 2 /* Async */));
77519
- checkTypeAssignableTo(generatorInstantiation, returnType, returnTypeNode);
77486
+ checkTypeAssignableTo(generatorInstantiation, returnType, returnTypeErrorLocation);
77520
77487
  }
77521
77488
  } else if ((functionFlags2 & 3 /* AsyncGenerator */) === 2 /* Async */) {
77522
- checkAsyncFunctionReturnType(node, returnTypeNode);
77489
+ checkAsyncFunctionReturnType(node, returnTypeNode, returnTypeErrorLocation);
77523
77490
  }
77524
77491
  }
77525
77492
  if (node.kind !== 181 /* IndexSignature */ && node.kind !== 324 /* JSDocFunctionType */) {
@@ -78601,7 +78568,7 @@ ${lanes.join("\n")}
78601
78568
  }
78602
78569
  return typeAsAwaitable.awaitedTypeOfType = type;
78603
78570
  }
78604
- function checkAsyncFunctionReturnType(node, returnTypeNode) {
78571
+ function checkAsyncFunctionReturnType(node, returnTypeNode, returnTypeErrorLocation) {
78605
78572
  const returnType = getTypeFromTypeNode(returnTypeNode);
78606
78573
  if (languageVersion >= 2 /* ES2015 */) {
78607
78574
  if (isErrorType(returnType)) {
@@ -78612,7 +78579,7 @@ ${lanes.join("\n")}
78612
78579
  true
78613
78580
  );
78614
78581
  if (globalPromiseType !== emptyGenericType && !isReferenceToType2(returnType, globalPromiseType)) {
78615
- error2(returnTypeNode, Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_write_Promise_0, typeToString(getAwaitedTypeNoAlias(returnType) || voidType));
78582
+ reportErrorForInvalidReturnType(Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_write_Promise_0, returnTypeNode, returnTypeErrorLocation, typeToString(getAwaitedTypeNoAlias(returnType) || voidType));
78616
78583
  return;
78617
78584
  }
78618
78585
  } else {
@@ -78622,7 +78589,7 @@ ${lanes.join("\n")}
78622
78589
  }
78623
78590
  const promiseConstructorName = getEntityNameFromTypeNode(returnTypeNode);
78624
78591
  if (promiseConstructorName === void 0) {
78625
- error2(returnTypeNode, Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, typeToString(returnType));
78592
+ reportErrorForInvalidReturnType(Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, returnTypeNode, returnTypeErrorLocation, typeToString(returnType));
78626
78593
  return;
78627
78594
  }
78628
78595
  const promiseConstructorSymbol = resolveEntityName(
@@ -78637,9 +78604,9 @@ ${lanes.join("\n")}
78637
78604
  /*reportErrors*/
78638
78605
  false
78639
78606
  )) {
78640
- error2(returnTypeNode, Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option);
78607
+ error2(returnTypeErrorLocation, Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option);
78641
78608
  } else {
78642
- error2(returnTypeNode, Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, entityNameToString(promiseConstructorName));
78609
+ reportErrorForInvalidReturnType(Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, returnTypeNode, returnTypeErrorLocation, entityNameToString(promiseConstructorName));
78643
78610
  }
78644
78611
  return;
78645
78612
  }
@@ -78648,15 +78615,16 @@ ${lanes.join("\n")}
78648
78615
  true
78649
78616
  );
78650
78617
  if (globalPromiseConstructorLikeType === emptyObjectType) {
78651
- error2(returnTypeNode, Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, entityNameToString(promiseConstructorName));
78618
+ reportErrorForInvalidReturnType(Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, returnTypeNode, returnTypeErrorLocation, entityNameToString(promiseConstructorName));
78652
78619
  return;
78653
78620
  }
78654
- if (!checkTypeAssignableTo(
78655
- promiseConstructorType,
78656
- globalPromiseConstructorLikeType,
78657
- returnTypeNode,
78658
- Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value
78659
- )) {
78621
+ const headMessage = Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value;
78622
+ const errorInfo = () => returnTypeNode === returnTypeErrorLocation ? void 0 : chainDiagnosticMessages(
78623
+ /*details*/
78624
+ void 0,
78625
+ Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type
78626
+ );
78627
+ if (!checkTypeAssignableTo(promiseConstructorType, globalPromiseConstructorLikeType, returnTypeErrorLocation, headMessage, errorInfo)) {
78660
78628
  return;
78661
78629
  }
78662
78630
  const rootName = promiseConstructorName && getFirstIdentifier(promiseConstructorName);
@@ -78678,6 +78646,14 @@ ${lanes.join("\n")}
78678
78646
  node,
78679
78647
  Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member
78680
78648
  );
78649
+ function reportErrorForInvalidReturnType(message, returnTypeNode2, returnTypeErrorLocation2, typeName) {
78650
+ if (returnTypeNode2 === returnTypeErrorLocation2) {
78651
+ error2(returnTypeErrorLocation2, message, typeName);
78652
+ } else {
78653
+ const diag2 = error2(returnTypeErrorLocation2, Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type);
78654
+ addRelatedInfo(diag2, createDiagnosticForNode(returnTypeNode2, message, typeName));
78655
+ }
78656
+ }
78681
78657
  }
78682
78658
  function checkDecorator(node) {
78683
78659
  const signature = getResolvedSignature(node);
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
54
54
 
55
55
  // src/compiler/corePublic.ts
56
56
  var versionMajorMinor = "5.2";
57
- var version = `${versionMajorMinor}.0-insiders.20230725`;
57
+ var version = `${versionMajorMinor}.0-insiders.20230726`;
58
58
 
59
59
  // src/compiler/core.ts
60
60
  var emptyArray = [];
@@ -5138,6 +5138,7 @@ var Diagnostics = {
5138
5138
  Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method: diag(1062, 1 /* Error */, "Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method_1062", "Type is referenced directly or indirectly in the fulfillment callback of its own 'then' method."),
5139
5139
  An_export_assignment_cannot_be_used_in_a_namespace: diag(1063, 1 /* Error */, "An_export_assignment_cannot_be_used_in_a_namespace_1063", "An export assignment cannot be used in a namespace."),
5140
5140
  The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_write_Promise_0: diag(1064, 1 /* Error */, "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_wri_1064", "The return type of an async function or method must be the global Promise<T> type. Did you mean to write 'Promise<{0}>'?"),
5141
+ The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type: diag(1065, 1 /* Error */, "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_1065", "The return type of an async function or method must be the global Promise<T> type."),
5141
5142
  In_ambient_enum_declarations_member_initializer_must_be_constant_expression: diag(1066, 1 /* Error */, "In_ambient_enum_declarations_member_initializer_must_be_constant_expression_1066", "In ambient enum declarations member initializer must be constant expression."),
5142
5143
  Unexpected_token_A_constructor_method_accessor_or_property_was_expected: diag(1068, 1 /* Error */, "Unexpected_token_A_constructor_method_accessor_or_property_was_expected_1068", "Unexpected token. A constructor, method, accessor, or property was expected."),
5143
5144
  Unexpected_token_A_type_parameter_name_was_expected_without_curly_braces: diag(1069, 1 /* Error */, "Unexpected_token_A_type_parameter_name_was_expected_without_curly_braces_1069", "Unexpected token. A type parameter name was expected without curly braces."),
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.2.0-pr-52095-16",
5
+ "version": "5.2.0-pr-55152-2",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -114,5 +114,5 @@
114
114
  "node": "20.1.0",
115
115
  "npm": "8.19.4"
116
116
  },
117
- "gitHead": "50adcbc61a52891e41529278e8225593f95a63ff"
117
+ "gitHead": "4e746373c1770c712d9801932e5188ab7bc6447e"
118
118
  }