@typescript-deploys/pr-build 5.1.0-pr-53996-2 → 5.1.0-pr-53907-15

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.1";
21
- var version = `${versionMajorMinor}.0-insiders.20230503`;
21
+ var version = `${versionMajorMinor}.0-insiders.20230505`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -7450,6 +7450,7 @@ var Diagnostics = {
7450
7450
  You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder: diag(8036, 1 /* Error */, "You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder_8036", "You cannot rename elements that are defined in another 'node_modules' folder."),
7451
7451
  Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files: diag(8037, 1 /* Error */, "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037", "Type satisfaction expressions can only be used in TypeScript files."),
7452
7452
  Decorators_may_not_appear_after_export_or_export_default_if_they_also_appear_before_export: diag(8038, 1 /* Error */, "Decorators_may_not_appear_after_export_or_export_default_if_they_also_appear_before_export_8038", "Decorators may not appear after 'export' or 'export default' if they also appear before 'export'."),
7453
+ A_JSDoc_template_tag_may_not_follow_a_typedef_callback_or_overload_tag: diag(8039, 1 /* Error */, "A_JSDoc_template_tag_may_not_follow_a_typedef_callback_or_overload_tag_8039", "A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag"),
7453
7454
  Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9005, 1 /* Error */, "Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_9005", "Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit."),
7454
7455
  Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9006, 1 /* Error */, "Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotati_9006", "Declaration emit for this file requires using private name '{0}' from module '{1}'. An explicit type annotation may unblock declaration emit."),
7455
7456
  JSX_attributes_must_only_be_assigned_a_non_empty_expression: diag(17e3, 1 /* Error */, "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", "JSX attributes must only be assigned a non-empty 'expression'."),
@@ -27168,8 +27169,13 @@ var Parser;
27168
27169
  return tokenIsIdentifierOrKeyword(token()) || token() === 19 /* OpenBraceToken */;
27169
27170
  case 14 /* JsxChildren */:
27170
27171
  return true;
27172
+ case 25 /* JSDocComment */:
27173
+ return true;
27174
+ case 26 /* Count */:
27175
+ return Debug.fail("ParsingContext.Count used as a context");
27176
+ default:
27177
+ Debug.assertNever(parsingContext2, "Non-exhaustive case in 'isListElement'.");
27171
27178
  }
27172
- return Debug.fail("Non-exhaustive case in 'isListElement'.");
27173
27179
  }
27174
27180
  function isValidHeritageClauseObjectLiteral() {
27175
27181
  Debug.assert(token() === 19 /* OpenBraceToken */);
@@ -27263,7 +27269,8 @@ var Parser;
27263
27269
  return false;
27264
27270
  }
27265
27271
  function isInSomeParsingContext() {
27266
- for (let kind = 0; kind < 25 /* Count */; kind++) {
27272
+ Debug.assert(parsingContext, "Missing parsing context");
27273
+ for (let kind = 0; kind < 26 /* Count */; kind++) {
27267
27274
  if (parsingContext & 1 << kind) {
27268
27275
  if (isListElement(
27269
27276
  kind,
@@ -27522,7 +27529,9 @@ var Parser;
27522
27529
  return parseErrorAtCurrentToken(Diagnostics.Identifier_expected);
27523
27530
  case 24 /* AssertEntries */:
27524
27531
  return parseErrorAtCurrentToken(Diagnostics.Identifier_or_string_literal_expected);
27525
- case 25 /* Count */:
27532
+ case 25 /* JSDocComment */:
27533
+ return parseErrorAtCurrentToken(Diagnostics.Identifier_expected);
27534
+ case 26 /* Count */:
27526
27535
  return Debug.fail("ParsingContext.Count used as a context");
27527
27536
  default:
27528
27537
  Debug.assertNever(context);
@@ -31654,7 +31663,8 @@ var Parser;
31654
31663
  ParsingContext2[ParsingContext2["HeritageClauses"] = 22] = "HeritageClauses";
31655
31664
  ParsingContext2[ParsingContext2["ImportOrExportSpecifiers"] = 23] = "ImportOrExportSpecifiers";
31656
31665
  ParsingContext2[ParsingContext2["AssertEntries"] = 24] = "AssertEntries";
31657
- ParsingContext2[ParsingContext2["Count"] = 25] = "Count";
31666
+ ParsingContext2[ParsingContext2["JSDocComment"] = 25] = "JSDocComment";
31667
+ ParsingContext2[ParsingContext2["Count"] = 26] = "Count";
31658
31668
  })(ParsingContext || (ParsingContext = {}));
31659
31669
  let Tristate;
31660
31670
  ((Tristate2) => {
@@ -31776,6 +31786,8 @@ var Parser;
31776
31786
  PropertyLikeParse2[PropertyLikeParse2["CallbackParameter"] = 4] = "CallbackParameter";
31777
31787
  })(PropertyLikeParse || (PropertyLikeParse = {}));
31778
31788
  function parseJSDocCommentWorker(start = 0, length2) {
31789
+ const saveParsingContext = parsingContext;
31790
+ parsingContext |= 1 << 25 /* JSDocComment */;
31779
31791
  const content = sourceText;
31780
31792
  const end = length2 === void 0 ? content.length : start + length2;
31781
31793
  length2 = end - start;
@@ -31792,7 +31804,10 @@ var Parser;
31792
31804
  let commentsPos;
31793
31805
  let comments = [];
31794
31806
  const parts = [];
31795
- return scanner.scanRange(start + 3, length2 - 5, () => {
31807
+ const result = scanner.scanRange(start + 3, length2 - 5, doJSDocScan);
31808
+ parsingContext = saveParsingContext;
31809
+ return result;
31810
+ function doJSDocScan() {
31796
31811
  let state = 1 /* SawAsterisk */;
31797
31812
  let margin;
31798
31813
  let indent2 = start - (content.lastIndexOf("\n", start) + 1) + 4;
@@ -31888,7 +31903,7 @@ var Parser;
31888
31903
  Debug.assertIsDefined(commentsPos, "having parsed tags implies that the end of the comment span should be set");
31889
31904
  const tagsArray = tags && createNodeArray(tags, tagsPos, tagsEnd);
31890
31905
  return finishNode(factory2.createJSDocComment(parts.length ? createNodeArray(parts, start, commentsPos) : trimmedComments.length ? trimmedComments : void 0, tagsArray), start, end);
31891
- });
31906
+ }
31892
31907
  function removeLeadingNewlines(comments2) {
31893
31908
  while (comments2.length && (comments2[0] === "\n" || comments2[0] === "\r")) {
31894
31909
  comments2.shift();
@@ -32247,8 +32262,8 @@ var Parser;
32247
32262
  typeExpression = nestedTypeLiteral;
32248
32263
  isNameFirst = true;
32249
32264
  }
32250
- const result = target === 1 /* Property */ ? factory2.createJSDocPropertyTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment) : factory2.createJSDocParameterTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment);
32251
- return finishNode(result, start2);
32265
+ const result2 = target === 1 /* Property */ ? factory2.createJSDocPropertyTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment) : factory2.createJSDocParameterTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment);
32266
+ return finishNode(result2, start2);
32252
32267
  }
32253
32268
  function parseNestedTypeLiteral(typeExpression, name, target, indent2) {
32254
32269
  if (typeExpression && isObjectOrObjectArrayTypeReference(typeExpression.type)) {
@@ -32258,6 +32273,8 @@ var Parser;
32258
32273
  while (child = tryParse(() => parseChildParameterOrPropertyTag(target, indent2, name))) {
32259
32274
  if (child.kind === 347 /* JSDocParameterTag */ || child.kind === 354 /* JSDocPropertyTag */) {
32260
32275
  children = append(children, child);
32276
+ } else if (child.kind === 351 /* JSDocTemplateTag */) {
32277
+ parseErrorAtRange(child.tagName, Diagnostics.A_JSDoc_template_tag_may_not_follow_a_typedef_callback_or_overload_tag);
32261
32278
  }
32262
32279
  }
32263
32280
  if (children) {
@@ -32396,6 +32413,9 @@ var Parser;
32396
32413
  let jsDocPropertyTags;
32397
32414
  let hasChildren = false;
32398
32415
  while (child = tryParse(() => parseChildPropertyTag(indent2))) {
32416
+ if (child.kind === 351 /* JSDocTemplateTag */) {
32417
+ break;
32418
+ }
32399
32419
  hasChildren = true;
32400
32420
  if (child.kind === 350 /* JSDocTypeTag */) {
32401
32421
  if (childTypeTag) {
@@ -32455,6 +32475,10 @@ var Parser;
32455
32475
  let child;
32456
32476
  let parameters;
32457
32477
  while (child = tryParse(() => parseChildParameterOrPropertyTag(4 /* CallbackParameter */, indent2))) {
32478
+ if (child.kind === 351 /* JSDocTemplateTag */) {
32479
+ parseErrorAtRange(child.tagName, Diagnostics.A_JSDoc_template_tag_may_not_follow_a_typedef_callback_or_overload_tag);
32480
+ break;
32481
+ }
32458
32482
  parameters = append(parameters, child);
32459
32483
  }
32460
32484
  return createNodeArray(parameters || [], pos);
@@ -32549,7 +32573,7 @@ var Parser;
32549
32573
  const start2 = scanner.getTokenFullStart();
32550
32574
  nextTokenJSDoc();
32551
32575
  const tagName = parseJSDocIdentifierName();
32552
- skipWhitespace();
32576
+ const indentText = skipWhitespaceOrAsterisk();
32553
32577
  let t;
32554
32578
  switch (tagName.escapedText) {
32555
32579
  case "type":
@@ -32563,6 +32587,8 @@ var Parser;
32563
32587
  case "param":
32564
32588
  t = 2 /* Parameter */ | 4 /* CallbackParameter */;
32565
32589
  break;
32590
+ case "template":
32591
+ return parseTemplateTag(start2, tagName, indent2, indentText);
32566
32592
  default:
32567
32593
  return false;
32568
32594
  }
@@ -32650,9 +32676,9 @@ var Parser;
32650
32676
  const end2 = scanner.getTokenEnd();
32651
32677
  const originalKeywordKind = token();
32652
32678
  const text = internIdentifier(scanner.getTokenValue());
32653
- const result = finishNode(factoryCreateIdentifier(text, originalKeywordKind), start2, end2);
32679
+ const result2 = finishNode(factoryCreateIdentifier(text, originalKeywordKind), start2, end2);
32654
32680
  nextTokenJSDoc();
32655
- return result;
32681
+ return result2;
32656
32682
  }
32657
32683
  }
32658
32684
  })(JSDocParser = Parser2.JSDocParser || (Parser2.JSDocParser = {}));
@@ -42861,24 +42887,13 @@ function createTypeChecker(host) {
42861
42887
  getTypeOfPropertyOfContextualType,
42862
42888
  getFullyQualifiedName,
42863
42889
  getResolvedSignature: (node, candidatesOutArray, argumentCount) => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 0 /* Normal */),
42864
- getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray, checkMode = 32 /* IsForStringLiteralArgumentCompletions */) => {
42865
- if (checkMode & 32 /* IsForStringLiteralArgumentCompletions */) {
42866
- return runWithInferenceBlockedFromSourceNode(editingArgument, () => getResolvedSignatureWorker(
42867
- call,
42868
- candidatesOutArray,
42869
- /*argumentCount*/
42870
- void 0,
42871
- checkMode & ~32 /* IsForStringLiteralArgumentCompletions */
42872
- ));
42873
- }
42874
- return runWithoutResolvedSignatureCaching(editingArgument, () => getResolvedSignatureWorker(
42875
- call,
42876
- candidatesOutArray,
42877
- /*argumentCount*/
42878
- void 0,
42879
- checkMode & ~32 /* IsForStringLiteralArgumentCompletions */
42880
- ));
42881
- },
42890
+ getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray) => runWithInferenceBlockedFromSourceNode(editingArgument, () => getResolvedSignatureWorker(
42891
+ call,
42892
+ candidatesOutArray,
42893
+ /*argumentCount*/
42894
+ void 0,
42895
+ 32 /* IsForStringLiteralArgumentCompletions */
42896
+ )),
42882
42897
  getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */)),
42883
42898
  getExpandedParameters,
42884
42899
  hasEffectiveRestParameter,
@@ -63621,7 +63636,7 @@ function createTypeChecker(host) {
63621
63636
  const constraint = getConstraintOfTypeParameter(inference.typeParameter);
63622
63637
  if (constraint) {
63623
63638
  const instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
63624
- if (!inferredType || inferredType === wildcardType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
63639
+ if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
63625
63640
  inference.inferredType = fallbackType && context.compareTypes(fallbackType, getTypeWithThisArgument(instantiatedConstraint, fallbackType)) ? fallbackType : instantiatedConstraint;
63626
63641
  }
63627
63642
  }
@@ -66977,6 +66992,7 @@ function createTypeChecker(host) {
66977
66992
  case 9 /* NumericLiteral */:
66978
66993
  case 10 /* BigIntLiteral */:
66979
66994
  case 15 /* NoSubstitutionTemplateLiteral */:
66995
+ case 227 /* TemplateExpression */:
66980
66996
  case 112 /* TrueKeyword */:
66981
66997
  case 97 /* FalseKeyword */:
66982
66998
  case 106 /* NullKeyword */:
@@ -69527,7 +69543,7 @@ function createTypeChecker(host) {
69527
69543
  }
69528
69544
  for (let i = 0; i < argCount; i++) {
69529
69545
  const arg = args[i];
69530
- if (arg.kind !== 231 /* OmittedExpression */) {
69546
+ if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode & 32 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) {
69531
69547
  const paramType = getTypeAtPosition(signature, i);
69532
69548
  if (couldContainTypeVariables(paramType)) {
69533
69549
  const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
@@ -70139,6 +70155,7 @@ function createTypeChecker(host) {
70139
70155
  const args = getEffectiveCallArguments(node);
70140
70156
  const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
70141
70157
  let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
70158
+ argCheckMode |= checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
70142
70159
  let candidatesForArgumentError;
70143
70160
  let candidateForArgumentArityError;
70144
70161
  let candidateForTypeArgumentError;
@@ -70362,7 +70379,7 @@ function createTypeChecker(host) {
70362
70379
  continue;
70363
70380
  }
70364
70381
  if (argCheckMode) {
70365
- argCheckMode = 0 /* Normal */;
70382
+ argCheckMode = checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
70366
70383
  if (inferenceContext) {
70367
70384
  const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
70368
70385
  checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
@@ -72370,6 +72387,10 @@ function createTypeChecker(host) {
72370
72387
  forEachReturnStatement(func.body, (returnStatement) => {
72371
72388
  const expr = returnStatement.expression;
72372
72389
  if (expr) {
72390
+ if (expr.kind === 212 /* CallExpression */ && expr.expression.kind === 80 /* Identifier */ && checkExpressionCached(expr.expression).symbol === func.symbol) {
72391
+ hasReturnOfTypeNever = true;
72392
+ return;
72393
+ }
72373
72394
  let type = checkExpressionCached(expr, checkMode && checkMode & ~8 /* SkipGenericFunctions */);
72374
72395
  if (functionFlags & 2 /* Async */) {
72375
72396
  type = unwrapAwaitedType(checkAwaitedType(
@@ -73769,11 +73790,15 @@ function createTypeChecker(host) {
73769
73790
  texts.push(span.literal.text);
73770
73791
  types.push(isTypeAssignableTo(type, templateConstraintType) ? type : stringType);
73771
73792
  }
73772
- return isConstContext(node) || isTemplateLiteralContext(node) || someType(getContextualType(
73793
+ if (isConstContext(node) || isTemplateLiteralContext(node) || someType(getContextualType(
73773
73794
  node,
73774
73795
  /*contextFlags*/
73775
73796
  void 0
73776
- ) || unknownType, isTemplateLiteralContextualType) ? getTemplateLiteralType(texts, types) : stringType;
73797
+ ) || unknownType, isTemplateLiteralContextualType)) {
73798
+ return getTemplateLiteralType(texts, types);
73799
+ }
73800
+ const evaluated = node.parent.kind !== 214 /* TaggedTemplateExpression */ && evaluateTemplateExpression(node);
73801
+ return evaluated ? getFreshTypeOfLiteralType(getStringLiteralType(evaluated)) : stringType;
73777
73802
  }
73778
73803
  function isTemplateLiteralContextualType(type) {
73779
73804
  return !!(type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */) || type.flags & 58982400 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316 /* StringLike */));
@@ -74200,7 +74225,7 @@ function createTypeChecker(host) {
74200
74225
  return nullWideningType;
74201
74226
  case 15 /* NoSubstitutionTemplateLiteral */:
74202
74227
  case 11 /* StringLiteral */:
74203
- return hasSkipDirectInferenceFlag(node) ? wildcardType : getFreshTypeOfLiteralType(getStringLiteralType(node.text));
74228
+ return hasSkipDirectInferenceFlag(node) ? anyType : getFreshTypeOfLiteralType(getStringLiteralType(node.text));
74204
74229
  case 9 /* NumericLiteral */:
74205
74230
  checkGrammarNumericLiteral(node);
74206
74231
  return getFreshTypeOfLiteralType(getNumberLiteralType(+node.text));
@@ -78751,11 +78776,11 @@ function createTypeChecker(host) {
78751
78776
  );
78752
78777
  if (symbol) {
78753
78778
  if (symbol.flags & 8 /* EnumMember */) {
78754
- return evaluateEnumMember(expr, symbol, location);
78779
+ return location ? evaluateEnumMember(expr, symbol, location) : getEnumMemberValue(symbol.valueDeclaration);
78755
78780
  }
78756
78781
  if (isConstVariable(symbol)) {
78757
78782
  const declaration = symbol.valueDeclaration;
78758
- if (declaration && !declaration.type && declaration.initializer && declaration !== location && isBlockScopedNameDeclaredBeforeUse(declaration, location)) {
78783
+ if (declaration && !declaration.type && declaration.initializer && (!location || declaration !== location && isBlockScopedNameDeclaredBeforeUse(declaration, location))) {
78759
78784
  return evaluate(declaration.initializer, declaration);
78760
78785
  }
78761
78786
  }
@@ -78775,7 +78800,7 @@ function createTypeChecker(host) {
78775
78800
  const name = escapeLeadingUnderscores(expr.argumentExpression.text);
78776
78801
  const member = rootSymbol.exports.get(name);
78777
78802
  if (member) {
78778
- return evaluateEnumMember(expr, member, location);
78803
+ return location ? evaluateEnumMember(expr, member, location) : getEnumMemberValue(member.valueDeclaration);
78779
78804
  }
78780
78805
  }
78781
78806
  }
package/lib/tsserver.js CHANGED
@@ -2303,7 +2303,7 @@ module.exports = __toCommonJS(server_exports);
2303
2303
 
2304
2304
  // src/compiler/corePublic.ts
2305
2305
  var versionMajorMinor = "5.1";
2306
- var version = `${versionMajorMinor}.0-insiders.20230503`;
2306
+ var version = `${versionMajorMinor}.0-insiders.20230505`;
2307
2307
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2308
2308
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2309
2309
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -10957,6 +10957,7 @@ var Diagnostics = {
10957
10957
  You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder: diag(8036, 1 /* Error */, "You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder_8036", "You cannot rename elements that are defined in another 'node_modules' folder."),
10958
10958
  Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files: diag(8037, 1 /* Error */, "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037", "Type satisfaction expressions can only be used in TypeScript files."),
10959
10959
  Decorators_may_not_appear_after_export_or_export_default_if_they_also_appear_before_export: diag(8038, 1 /* Error */, "Decorators_may_not_appear_after_export_or_export_default_if_they_also_appear_before_export_8038", "Decorators may not appear after 'export' or 'export default' if they also appear before 'export'."),
10960
+ A_JSDoc_template_tag_may_not_follow_a_typedef_callback_or_overload_tag: diag(8039, 1 /* Error */, "A_JSDoc_template_tag_may_not_follow_a_typedef_callback_or_overload_tag_8039", "A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag"),
10960
10961
  Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9005, 1 /* Error */, "Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_9005", "Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit."),
10961
10962
  Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9006, 1 /* Error */, "Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotati_9006", "Declaration emit for this file requires using private name '{0}' from module '{1}'. An explicit type annotation may unblock declaration emit."),
10962
10963
  JSX_attributes_must_only_be_assigned_a_non_empty_expression: diag(17e3, 1 /* Error */, "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", "JSX attributes must only be assigned a non-empty 'expression'."),
@@ -31552,8 +31553,13 @@ var Parser;
31552
31553
  return tokenIsIdentifierOrKeyword(token()) || token() === 19 /* OpenBraceToken */;
31553
31554
  case 14 /* JsxChildren */:
31554
31555
  return true;
31556
+ case 25 /* JSDocComment */:
31557
+ return true;
31558
+ case 26 /* Count */:
31559
+ return Debug.fail("ParsingContext.Count used as a context");
31560
+ default:
31561
+ Debug.assertNever(parsingContext2, "Non-exhaustive case in 'isListElement'.");
31555
31562
  }
31556
- return Debug.fail("Non-exhaustive case in 'isListElement'.");
31557
31563
  }
31558
31564
  function isValidHeritageClauseObjectLiteral() {
31559
31565
  Debug.assert(token() === 19 /* OpenBraceToken */);
@@ -31647,7 +31653,8 @@ var Parser;
31647
31653
  return false;
31648
31654
  }
31649
31655
  function isInSomeParsingContext() {
31650
- for (let kind = 0; kind < 25 /* Count */; kind++) {
31656
+ Debug.assert(parsingContext, "Missing parsing context");
31657
+ for (let kind = 0; kind < 26 /* Count */; kind++) {
31651
31658
  if (parsingContext & 1 << kind) {
31652
31659
  if (isListElement2(
31653
31660
  kind,
@@ -31906,7 +31913,9 @@ var Parser;
31906
31913
  return parseErrorAtCurrentToken(Diagnostics.Identifier_expected);
31907
31914
  case 24 /* AssertEntries */:
31908
31915
  return parseErrorAtCurrentToken(Diagnostics.Identifier_or_string_literal_expected);
31909
- case 25 /* Count */:
31916
+ case 25 /* JSDocComment */:
31917
+ return parseErrorAtCurrentToken(Diagnostics.Identifier_expected);
31918
+ case 26 /* Count */:
31910
31919
  return Debug.fail("ParsingContext.Count used as a context");
31911
31920
  default:
31912
31921
  Debug.assertNever(context);
@@ -36038,7 +36047,8 @@ var Parser;
36038
36047
  ParsingContext2[ParsingContext2["HeritageClauses"] = 22] = "HeritageClauses";
36039
36048
  ParsingContext2[ParsingContext2["ImportOrExportSpecifiers"] = 23] = "ImportOrExportSpecifiers";
36040
36049
  ParsingContext2[ParsingContext2["AssertEntries"] = 24] = "AssertEntries";
36041
- ParsingContext2[ParsingContext2["Count"] = 25] = "Count";
36050
+ ParsingContext2[ParsingContext2["JSDocComment"] = 25] = "JSDocComment";
36051
+ ParsingContext2[ParsingContext2["Count"] = 26] = "Count";
36042
36052
  })(ParsingContext || (ParsingContext = {}));
36043
36053
  let Tristate;
36044
36054
  ((Tristate2) => {
@@ -36160,6 +36170,8 @@ var Parser;
36160
36170
  PropertyLikeParse2[PropertyLikeParse2["CallbackParameter"] = 4] = "CallbackParameter";
36161
36171
  })(PropertyLikeParse || (PropertyLikeParse = {}));
36162
36172
  function parseJSDocCommentWorker(start2 = 0, length2) {
36173
+ const saveParsingContext = parsingContext;
36174
+ parsingContext |= 1 << 25 /* JSDocComment */;
36163
36175
  const content = sourceText;
36164
36176
  const end = length2 === void 0 ? content.length : start2 + length2;
36165
36177
  length2 = end - start2;
@@ -36176,7 +36188,10 @@ var Parser;
36176
36188
  let commentsPos;
36177
36189
  let comments = [];
36178
36190
  const parts = [];
36179
- return scanner2.scanRange(start2 + 3, length2 - 5, () => {
36191
+ const result = scanner2.scanRange(start2 + 3, length2 - 5, doJSDocScan);
36192
+ parsingContext = saveParsingContext;
36193
+ return result;
36194
+ function doJSDocScan() {
36180
36195
  let state = 1 /* SawAsterisk */;
36181
36196
  let margin;
36182
36197
  let indent3 = start2 - (content.lastIndexOf("\n", start2) + 1) + 4;
@@ -36272,7 +36287,7 @@ var Parser;
36272
36287
  Debug.assertIsDefined(commentsPos, "having parsed tags implies that the end of the comment span should be set");
36273
36288
  const tagsArray = tags && createNodeArray(tags, tagsPos, tagsEnd);
36274
36289
  return finishNode(factory2.createJSDocComment(parts.length ? createNodeArray(parts, start2, commentsPos) : trimmedComments.length ? trimmedComments : void 0, tagsArray), start2, end);
36275
- });
36290
+ }
36276
36291
  function removeLeadingNewlines(comments2) {
36277
36292
  while (comments2.length && (comments2[0] === "\n" || comments2[0] === "\r")) {
36278
36293
  comments2.shift();
@@ -36631,8 +36646,8 @@ var Parser;
36631
36646
  typeExpression = nestedTypeLiteral;
36632
36647
  isNameFirst = true;
36633
36648
  }
36634
- const result = target === 1 /* Property */ ? factory2.createJSDocPropertyTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment) : factory2.createJSDocParameterTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment);
36635
- return finishNode(result, start3);
36649
+ const result2 = target === 1 /* Property */ ? factory2.createJSDocPropertyTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment) : factory2.createJSDocParameterTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment);
36650
+ return finishNode(result2, start3);
36636
36651
  }
36637
36652
  function parseNestedTypeLiteral(typeExpression, name, target, indent3) {
36638
36653
  if (typeExpression && isObjectOrObjectArrayTypeReference(typeExpression.type)) {
@@ -36642,6 +36657,8 @@ var Parser;
36642
36657
  while (child = tryParse(() => parseChildParameterOrPropertyTag(target, indent3, name))) {
36643
36658
  if (child.kind === 347 /* JSDocParameterTag */ || child.kind === 354 /* JSDocPropertyTag */) {
36644
36659
  children = append(children, child);
36660
+ } else if (child.kind === 351 /* JSDocTemplateTag */) {
36661
+ parseErrorAtRange(child.tagName, Diagnostics.A_JSDoc_template_tag_may_not_follow_a_typedef_callback_or_overload_tag);
36645
36662
  }
36646
36663
  }
36647
36664
  if (children) {
@@ -36780,6 +36797,9 @@ var Parser;
36780
36797
  let jsDocPropertyTags;
36781
36798
  let hasChildren = false;
36782
36799
  while (child = tryParse(() => parseChildPropertyTag(indent3))) {
36800
+ if (child.kind === 351 /* JSDocTemplateTag */) {
36801
+ break;
36802
+ }
36783
36803
  hasChildren = true;
36784
36804
  if (child.kind === 350 /* JSDocTypeTag */) {
36785
36805
  if (childTypeTag) {
@@ -36839,6 +36859,10 @@ var Parser;
36839
36859
  let child;
36840
36860
  let parameters;
36841
36861
  while (child = tryParse(() => parseChildParameterOrPropertyTag(4 /* CallbackParameter */, indent3))) {
36862
+ if (child.kind === 351 /* JSDocTemplateTag */) {
36863
+ parseErrorAtRange(child.tagName, Diagnostics.A_JSDoc_template_tag_may_not_follow_a_typedef_callback_or_overload_tag);
36864
+ break;
36865
+ }
36842
36866
  parameters = append(parameters, child);
36843
36867
  }
36844
36868
  return createNodeArray(parameters || [], pos);
@@ -36933,7 +36957,7 @@ var Parser;
36933
36957
  const start3 = scanner2.getTokenFullStart();
36934
36958
  nextTokenJSDoc();
36935
36959
  const tagName = parseJSDocIdentifierName();
36936
- skipWhitespace();
36960
+ const indentText = skipWhitespaceOrAsterisk();
36937
36961
  let t;
36938
36962
  switch (tagName.escapedText) {
36939
36963
  case "type":
@@ -36947,6 +36971,8 @@ var Parser;
36947
36971
  case "param":
36948
36972
  t = 2 /* Parameter */ | 4 /* CallbackParameter */;
36949
36973
  break;
36974
+ case "template":
36975
+ return parseTemplateTag(start3, tagName, indent3, indentText);
36950
36976
  default:
36951
36977
  return false;
36952
36978
  }
@@ -37034,9 +37060,9 @@ var Parser;
37034
37060
  const end2 = scanner2.getTokenEnd();
37035
37061
  const originalKeywordKind = token();
37036
37062
  const text = internIdentifier(scanner2.getTokenValue());
37037
- const result = finishNode(factoryCreateIdentifier(text, originalKeywordKind), start3, end2);
37063
+ const result2 = finishNode(factoryCreateIdentifier(text, originalKeywordKind), start3, end2);
37038
37064
  nextTokenJSDoc();
37039
- return result;
37065
+ return result2;
37040
37066
  }
37041
37067
  }
37042
37068
  })(JSDocParser = Parser2.JSDocParser || (Parser2.JSDocParser = {}));
@@ -47511,24 +47537,13 @@ function createTypeChecker(host) {
47511
47537
  getTypeOfPropertyOfContextualType,
47512
47538
  getFullyQualifiedName,
47513
47539
  getResolvedSignature: (node, candidatesOutArray, argumentCount) => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 0 /* Normal */),
47514
- getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray, checkMode = 32 /* IsForStringLiteralArgumentCompletions */) => {
47515
- if (checkMode & 32 /* IsForStringLiteralArgumentCompletions */) {
47516
- return runWithInferenceBlockedFromSourceNode(editingArgument, () => getResolvedSignatureWorker(
47517
- call,
47518
- candidatesOutArray,
47519
- /*argumentCount*/
47520
- void 0,
47521
- checkMode & ~32 /* IsForStringLiteralArgumentCompletions */
47522
- ));
47523
- }
47524
- return runWithoutResolvedSignatureCaching(editingArgument, () => getResolvedSignatureWorker(
47525
- call,
47526
- candidatesOutArray,
47527
- /*argumentCount*/
47528
- void 0,
47529
- checkMode & ~32 /* IsForStringLiteralArgumentCompletions */
47530
- ));
47531
- },
47540
+ getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray) => runWithInferenceBlockedFromSourceNode(editingArgument, () => getResolvedSignatureWorker(
47541
+ call,
47542
+ candidatesOutArray,
47543
+ /*argumentCount*/
47544
+ void 0,
47545
+ 32 /* IsForStringLiteralArgumentCompletions */
47546
+ )),
47532
47547
  getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */)),
47533
47548
  getExpandedParameters,
47534
47549
  hasEffectiveRestParameter,
@@ -68271,7 +68286,7 @@ function createTypeChecker(host) {
68271
68286
  const constraint = getConstraintOfTypeParameter(inference.typeParameter);
68272
68287
  if (constraint) {
68273
68288
  const instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
68274
- if (!inferredType || inferredType === wildcardType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
68289
+ if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
68275
68290
  inference.inferredType = fallbackType && context.compareTypes(fallbackType, getTypeWithThisArgument(instantiatedConstraint, fallbackType)) ? fallbackType : instantiatedConstraint;
68276
68291
  }
68277
68292
  }
@@ -71627,6 +71642,7 @@ function createTypeChecker(host) {
71627
71642
  case 9 /* NumericLiteral */:
71628
71643
  case 10 /* BigIntLiteral */:
71629
71644
  case 15 /* NoSubstitutionTemplateLiteral */:
71645
+ case 227 /* TemplateExpression */:
71630
71646
  case 112 /* TrueKeyword */:
71631
71647
  case 97 /* FalseKeyword */:
71632
71648
  case 106 /* NullKeyword */:
@@ -74177,7 +74193,7 @@ function createTypeChecker(host) {
74177
74193
  }
74178
74194
  for (let i = 0; i < argCount; i++) {
74179
74195
  const arg = args[i];
74180
- if (arg.kind !== 231 /* OmittedExpression */) {
74196
+ if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode & 32 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) {
74181
74197
  const paramType = getTypeAtPosition(signature, i);
74182
74198
  if (couldContainTypeVariables(paramType)) {
74183
74199
  const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
@@ -74789,6 +74805,7 @@ function createTypeChecker(host) {
74789
74805
  const args = getEffectiveCallArguments(node);
74790
74806
  const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
74791
74807
  let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
74808
+ argCheckMode |= checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
74792
74809
  let candidatesForArgumentError;
74793
74810
  let candidateForArgumentArityError;
74794
74811
  let candidateForTypeArgumentError;
@@ -75012,7 +75029,7 @@ function createTypeChecker(host) {
75012
75029
  continue;
75013
75030
  }
75014
75031
  if (argCheckMode) {
75015
- argCheckMode = 0 /* Normal */;
75032
+ argCheckMode = checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
75016
75033
  if (inferenceContext) {
75017
75034
  const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
75018
75035
  checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
@@ -77020,6 +77037,10 @@ function createTypeChecker(host) {
77020
77037
  forEachReturnStatement(func.body, (returnStatement) => {
77021
77038
  const expr = returnStatement.expression;
77022
77039
  if (expr) {
77040
+ if (expr.kind === 212 /* CallExpression */ && expr.expression.kind === 80 /* Identifier */ && checkExpressionCached(expr.expression).symbol === func.symbol) {
77041
+ hasReturnOfTypeNever = true;
77042
+ return;
77043
+ }
77023
77044
  let type = checkExpressionCached(expr, checkMode && checkMode & ~8 /* SkipGenericFunctions */);
77024
77045
  if (functionFlags & 2 /* Async */) {
77025
77046
  type = unwrapAwaitedType(checkAwaitedType(
@@ -78419,11 +78440,15 @@ function createTypeChecker(host) {
78419
78440
  texts.push(span.literal.text);
78420
78441
  types.push(isTypeAssignableTo(type, templateConstraintType) ? type : stringType);
78421
78442
  }
78422
- return isConstContext(node) || isTemplateLiteralContext(node) || someType(getContextualType2(
78443
+ if (isConstContext(node) || isTemplateLiteralContext(node) || someType(getContextualType2(
78423
78444
  node,
78424
78445
  /*contextFlags*/
78425
78446
  void 0
78426
- ) || unknownType, isTemplateLiteralContextualType) ? getTemplateLiteralType(texts, types) : stringType;
78447
+ ) || unknownType, isTemplateLiteralContextualType)) {
78448
+ return getTemplateLiteralType(texts, types);
78449
+ }
78450
+ const evaluated = node.parent.kind !== 214 /* TaggedTemplateExpression */ && evaluateTemplateExpression(node);
78451
+ return evaluated ? getFreshTypeOfLiteralType(getStringLiteralType(evaluated)) : stringType;
78427
78452
  }
78428
78453
  function isTemplateLiteralContextualType(type) {
78429
78454
  return !!(type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */) || type.flags & 58982400 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316 /* StringLike */));
@@ -78850,7 +78875,7 @@ function createTypeChecker(host) {
78850
78875
  return nullWideningType;
78851
78876
  case 15 /* NoSubstitutionTemplateLiteral */:
78852
78877
  case 11 /* StringLiteral */:
78853
- return hasSkipDirectInferenceFlag(node) ? wildcardType : getFreshTypeOfLiteralType(getStringLiteralType(node.text));
78878
+ return hasSkipDirectInferenceFlag(node) ? anyType : getFreshTypeOfLiteralType(getStringLiteralType(node.text));
78854
78879
  case 9 /* NumericLiteral */:
78855
78880
  checkGrammarNumericLiteral(node);
78856
78881
  return getFreshTypeOfLiteralType(getNumberLiteralType(+node.text));
@@ -83401,11 +83426,11 @@ function createTypeChecker(host) {
83401
83426
  );
83402
83427
  if (symbol) {
83403
83428
  if (symbol.flags & 8 /* EnumMember */) {
83404
- return evaluateEnumMember(expr, symbol, location);
83429
+ return location ? evaluateEnumMember(expr, symbol, location) : getEnumMemberValue(symbol.valueDeclaration);
83405
83430
  }
83406
83431
  if (isConstVariable(symbol)) {
83407
83432
  const declaration = symbol.valueDeclaration;
83408
- if (declaration && !declaration.type && declaration.initializer && declaration !== location && isBlockScopedNameDeclaredBeforeUse(declaration, location)) {
83433
+ if (declaration && !declaration.type && declaration.initializer && (!location || declaration !== location && isBlockScopedNameDeclaredBeforeUse(declaration, location))) {
83409
83434
  return evaluate(declaration.initializer, declaration);
83410
83435
  }
83411
83436
  }
@@ -83425,7 +83450,7 @@ function createTypeChecker(host) {
83425
83450
  const name = escapeLeadingUnderscores(expr.argumentExpression.text);
83426
83451
  const member = rootSymbol.exports.get(name);
83427
83452
  if (member) {
83428
- return evaluateEnumMember(expr, member, location);
83453
+ return location ? evaluateEnumMember(expr, member, location) : getEnumMemberValue(member.valueDeclaration);
83429
83454
  }
83430
83455
  }
83431
83456
  }
@@ -158578,7 +158603,7 @@ function getStringLiteralCompletionEntries(sourceFile, node, position, typeCheck
158578
158603
  case 290 /* JsxAttribute */:
158579
158604
  if (!isRequireCallArgument(node) && !isImportCall(parent2)) {
158580
158605
  const argumentInfo = ts_SignatureHelp_exports.getArgumentInfoForCompletions(parent2.kind === 290 /* JsxAttribute */ ? parent2.parent : node, position, sourceFile);
158581
- return argumentInfo && (getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker, 0 /* Normal */)) || fromContextualType();
158606
+ return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType();
158582
158607
  }
158583
158608
  case 271 /* ImportDeclaration */:
158584
158609
  case 277 /* ExportDeclaration */:
@@ -158647,12 +158672,12 @@ function walkUpParentheses(node) {
158647
158672
  function getAlreadyUsedTypesInStringLiteralUnion(union, current) {
158648
158673
  return mapDefined(union.types, (type) => type !== current && isLiteralTypeNode(type) && isStringLiteral(type.literal) ? type.literal.text : void 0);
158649
158674
  }
158650
- function getStringLiteralCompletionsFromSignature(call, arg, argumentInfo, checker, checkMode = 32 /* IsForStringLiteralArgumentCompletions */) {
158675
+ function getStringLiteralCompletionsFromSignature(call, arg, argumentInfo, checker) {
158651
158676
  let isNewIdentifier = false;
158652
158677
  const uniques = /* @__PURE__ */ new Map();
158653
158678
  const candidates = [];
158654
158679
  const editingArgument = isJsxOpeningLikeElement(call) ? Debug.checkDefined(findAncestor(arg.parent, isJsxAttribute)) : arg;
158655
- checker.getResolvedSignatureForStringLiteralCompletions(call, editingArgument, candidates, checkMode);
158680
+ checker.getResolvedSignatureForStringLiteralCompletions(call, editingArgument, candidates);
158656
158681
  const types = flatMap(candidates, (candidate) => {
158657
158682
  if (!signatureHasRestParameter(candidate) && argumentInfo.argumentCount > candidate.parameters.length)
158658
158683
  return;
@@ -165047,7 +165072,7 @@ function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, so
165047
165072
  displayParts.push(spacePart());
165048
165073
  displayParts.push(operatorPart(64 /* EqualsToken */));
165049
165074
  displayParts.push(spacePart());
165050
- addRange(displayParts, typeToDisplayParts(typeChecker, isConstTypeReference(location.parent) ? typeChecker.getTypeAtLocation(location.parent) : typeChecker.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration, 8388608 /* InTypeAlias */));
165075
+ addRange(displayParts, typeToDisplayParts(typeChecker, location.parent && isConstTypeReference(location.parent) ? typeChecker.getTypeAtLocation(location.parent) : typeChecker.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration, 8388608 /* InTypeAlias */));
165051
165076
  }
165052
165077
  if (symbolFlags & 384 /* Enum */) {
165053
165078
  prefixNextMeaning();