typescript 5.1.0-dev.20230501 → 5.1.0-dev.20230506

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.
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
54
54
 
55
55
  // src/compiler/corePublic.ts
56
56
  var versionMajorMinor = "5.1";
57
- var version = `${versionMajorMinor}.0-dev.20230501`;
57
+ var version = `${versionMajorMinor}.0-dev.20230506`;
58
58
 
59
59
  // src/compiler/core.ts
60
60
  var emptyArray = [];
@@ -6824,6 +6824,7 @@ var Diagnostics = {
6824
6824
  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."),
6825
6825
  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."),
6826
6826
  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'."),
6827
+ 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"),
6827
6828
  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."),
6828
6829
  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."),
6829
6830
  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'."),
@@ -19204,8 +19205,13 @@ var Parser;
19204
19205
  return tokenIsIdentifierOrKeyword(token()) || token() === 19 /* OpenBraceToken */;
19205
19206
  case 14 /* JsxChildren */:
19206
19207
  return true;
19208
+ case 25 /* JSDocComment */:
19209
+ return true;
19210
+ case 26 /* Count */:
19211
+ return Debug.fail("ParsingContext.Count used as a context");
19212
+ default:
19213
+ Debug.assertNever(parsingContext2, "Non-exhaustive case in 'isListElement'.");
19207
19214
  }
19208
- return Debug.fail("Non-exhaustive case in 'isListElement'.");
19209
19215
  }
19210
19216
  function isValidHeritageClauseObjectLiteral() {
19211
19217
  Debug.assert(token() === 19 /* OpenBraceToken */);
@@ -19299,7 +19305,8 @@ var Parser;
19299
19305
  return false;
19300
19306
  }
19301
19307
  function isInSomeParsingContext() {
19302
- for (let kind = 0; kind < 25 /* Count */; kind++) {
19308
+ Debug.assert(parsingContext, "Missing parsing context");
19309
+ for (let kind = 0; kind < 26 /* Count */; kind++) {
19303
19310
  if (parsingContext & 1 << kind) {
19304
19311
  if (isListElement(
19305
19312
  kind,
@@ -19558,7 +19565,9 @@ var Parser;
19558
19565
  return parseErrorAtCurrentToken(Diagnostics.Identifier_expected);
19559
19566
  case 24 /* AssertEntries */:
19560
19567
  return parseErrorAtCurrentToken(Diagnostics.Identifier_or_string_literal_expected);
19561
- case 25 /* Count */:
19568
+ case 25 /* JSDocComment */:
19569
+ return parseErrorAtCurrentToken(Diagnostics.Identifier_expected);
19570
+ case 26 /* Count */:
19562
19571
  return Debug.fail("ParsingContext.Count used as a context");
19563
19572
  default:
19564
19573
  Debug.assertNever(context);
@@ -23690,7 +23699,8 @@ var Parser;
23690
23699
  ParsingContext2[ParsingContext2["HeritageClauses"] = 22] = "HeritageClauses";
23691
23700
  ParsingContext2[ParsingContext2["ImportOrExportSpecifiers"] = 23] = "ImportOrExportSpecifiers";
23692
23701
  ParsingContext2[ParsingContext2["AssertEntries"] = 24] = "AssertEntries";
23693
- ParsingContext2[ParsingContext2["Count"] = 25] = "Count";
23702
+ ParsingContext2[ParsingContext2["JSDocComment"] = 25] = "JSDocComment";
23703
+ ParsingContext2[ParsingContext2["Count"] = 26] = "Count";
23694
23704
  })(ParsingContext || (ParsingContext = {}));
23695
23705
  let Tristate;
23696
23706
  ((Tristate2) => {
@@ -23812,6 +23822,8 @@ var Parser;
23812
23822
  PropertyLikeParse2[PropertyLikeParse2["CallbackParameter"] = 4] = "CallbackParameter";
23813
23823
  })(PropertyLikeParse || (PropertyLikeParse = {}));
23814
23824
  function parseJSDocCommentWorker(start = 0, length2) {
23825
+ const saveParsingContext = parsingContext;
23826
+ parsingContext |= 1 << 25 /* JSDocComment */;
23815
23827
  const content = sourceText;
23816
23828
  const end = length2 === void 0 ? content.length : start + length2;
23817
23829
  length2 = end - start;
@@ -23828,7 +23840,10 @@ var Parser;
23828
23840
  let commentsPos;
23829
23841
  let comments = [];
23830
23842
  const parts = [];
23831
- return scanner.scanRange(start + 3, length2 - 5, () => {
23843
+ const result = scanner.scanRange(start + 3, length2 - 5, doJSDocScan);
23844
+ parsingContext = saveParsingContext;
23845
+ return result;
23846
+ function doJSDocScan() {
23832
23847
  let state = 1 /* SawAsterisk */;
23833
23848
  let margin;
23834
23849
  let indent2 = start - (content.lastIndexOf("\n", start) + 1) + 4;
@@ -23924,7 +23939,7 @@ var Parser;
23924
23939
  Debug.assertIsDefined(commentsPos, "having parsed tags implies that the end of the comment span should be set");
23925
23940
  const tagsArray = tags && createNodeArray(tags, tagsPos, tagsEnd);
23926
23941
  return finishNode(factory2.createJSDocComment(parts.length ? createNodeArray(parts, start, commentsPos) : trimmedComments.length ? trimmedComments : void 0, tagsArray), start, end);
23927
- });
23942
+ }
23928
23943
  function removeLeadingNewlines(comments2) {
23929
23944
  while (comments2.length && (comments2[0] === "\n" || comments2[0] === "\r")) {
23930
23945
  comments2.shift();
@@ -24283,8 +24298,8 @@ var Parser;
24283
24298
  typeExpression = nestedTypeLiteral;
24284
24299
  isNameFirst = true;
24285
24300
  }
24286
- const result = target === 1 /* Property */ ? factory2.createJSDocPropertyTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment) : factory2.createJSDocParameterTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment);
24287
- return finishNode(result, start2);
24301
+ const result2 = target === 1 /* Property */ ? factory2.createJSDocPropertyTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment) : factory2.createJSDocParameterTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment);
24302
+ return finishNode(result2, start2);
24288
24303
  }
24289
24304
  function parseNestedTypeLiteral(typeExpression, name, target, indent2) {
24290
24305
  if (typeExpression && isObjectOrObjectArrayTypeReference(typeExpression.type)) {
@@ -24294,6 +24309,8 @@ var Parser;
24294
24309
  while (child = tryParse(() => parseChildParameterOrPropertyTag(target, indent2, name))) {
24295
24310
  if (child.kind === 347 /* JSDocParameterTag */ || child.kind === 354 /* JSDocPropertyTag */) {
24296
24311
  children = append(children, child);
24312
+ } else if (child.kind === 351 /* JSDocTemplateTag */) {
24313
+ parseErrorAtRange(child.tagName, Diagnostics.A_JSDoc_template_tag_may_not_follow_a_typedef_callback_or_overload_tag);
24297
24314
  }
24298
24315
  }
24299
24316
  if (children) {
@@ -24432,6 +24449,9 @@ var Parser;
24432
24449
  let jsDocPropertyTags;
24433
24450
  let hasChildren = false;
24434
24451
  while (child = tryParse(() => parseChildPropertyTag(indent2))) {
24452
+ if (child.kind === 351 /* JSDocTemplateTag */) {
24453
+ break;
24454
+ }
24435
24455
  hasChildren = true;
24436
24456
  if (child.kind === 350 /* JSDocTypeTag */) {
24437
24457
  if (childTypeTag) {
@@ -24491,6 +24511,10 @@ var Parser;
24491
24511
  let child;
24492
24512
  let parameters;
24493
24513
  while (child = tryParse(() => parseChildParameterOrPropertyTag(4 /* CallbackParameter */, indent2))) {
24514
+ if (child.kind === 351 /* JSDocTemplateTag */) {
24515
+ parseErrorAtRange(child.tagName, Diagnostics.A_JSDoc_template_tag_may_not_follow_a_typedef_callback_or_overload_tag);
24516
+ break;
24517
+ }
24494
24518
  parameters = append(parameters, child);
24495
24519
  }
24496
24520
  return createNodeArray(parameters || [], pos);
@@ -24585,7 +24609,7 @@ var Parser;
24585
24609
  const start2 = scanner.getTokenFullStart();
24586
24610
  nextTokenJSDoc();
24587
24611
  const tagName = parseJSDocIdentifierName();
24588
- skipWhitespace();
24612
+ const indentText = skipWhitespaceOrAsterisk();
24589
24613
  let t;
24590
24614
  switch (tagName.escapedText) {
24591
24615
  case "type":
@@ -24599,6 +24623,8 @@ var Parser;
24599
24623
  case "param":
24600
24624
  t = 2 /* Parameter */ | 4 /* CallbackParameter */;
24601
24625
  break;
24626
+ case "template":
24627
+ return parseTemplateTag(start2, tagName, indent2, indentText);
24602
24628
  default:
24603
24629
  return false;
24604
24630
  }
@@ -24686,9 +24712,9 @@ var Parser;
24686
24712
  const end2 = scanner.getTokenEnd();
24687
24713
  const originalKeywordKind = token();
24688
24714
  const text = internIdentifier(scanner.getTokenValue());
24689
- const result = finishNode(factoryCreateIdentifier(text, originalKeywordKind), start2, end2);
24715
+ const result2 = finishNode(factoryCreateIdentifier(text, originalKeywordKind), start2, end2);
24690
24716
  nextTokenJSDoc();
24691
- return result;
24717
+ return result2;
24692
24718
  }
24693
24719
  }
24694
24720
  })(JSDocParser = Parser2.JSDocParser || (Parser2.JSDocParser = {}));
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "typescript",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "5.1.0-dev.20230501",
5
+ "version": "5.1.0-dev.20230506",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -115,5 +115,5 @@
115
115
  "node": "14.21.1",
116
116
  "npm": "8.19.3"
117
117
  },
118
- "gitHead": "289bd5ac83cdb4730134d031e6a224473a325a64"
118
+ "gitHead": "04d4580f4eedc036b014ef4329cffe9979da3af9"
119
119
  }