typescript 5.5.0-dev.20240326 → 5.5.0-dev.20240327

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/typescript.js CHANGED
@@ -1466,6 +1466,7 @@ __export(typescript_exports, {
1466
1466
  isJSDocEnumTag: () => isJSDocEnumTag,
1467
1467
  isJSDocFunctionType: () => isJSDocFunctionType,
1468
1468
  isJSDocImplementsTag: () => isJSDocImplementsTag,
1469
+ isJSDocImportTag: () => isJSDocImportTag,
1469
1470
  isJSDocIndexSignature: () => isJSDocIndexSignature,
1470
1471
  isJSDocLikeText: () => isJSDocLikeText,
1471
1472
  isJSDocLink: () => isJSDocLink,
@@ -2326,7 +2327,7 @@ module.exports = __toCommonJS(typescript_exports);
2326
2327
 
2327
2328
  // src/compiler/corePublic.ts
2328
2329
  var versionMajorMinor = "5.5";
2329
- var version = `${versionMajorMinor}.0-dev.20240326`;
2330
+ var version = `${versionMajorMinor}.0-dev.20240327`;
2330
2331
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2331
2332
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2332
2333
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -6071,12 +6072,13 @@ var SyntaxKind = /* @__PURE__ */ ((SyntaxKind5) => {
6071
6072
  SyntaxKind5[SyntaxKind5["JSDocPropertyTag"] = 348] = "JSDocPropertyTag";
6072
6073
  SyntaxKind5[SyntaxKind5["JSDocThrowsTag"] = 349] = "JSDocThrowsTag";
6073
6074
  SyntaxKind5[SyntaxKind5["JSDocSatisfiesTag"] = 350] = "JSDocSatisfiesTag";
6074
- SyntaxKind5[SyntaxKind5["SyntaxList"] = 351] = "SyntaxList";
6075
- SyntaxKind5[SyntaxKind5["NotEmittedStatement"] = 352] = "NotEmittedStatement";
6076
- SyntaxKind5[SyntaxKind5["PartiallyEmittedExpression"] = 353] = "PartiallyEmittedExpression";
6077
- SyntaxKind5[SyntaxKind5["CommaListExpression"] = 354] = "CommaListExpression";
6078
- SyntaxKind5[SyntaxKind5["SyntheticReferenceExpression"] = 355] = "SyntheticReferenceExpression";
6079
- SyntaxKind5[SyntaxKind5["Count"] = 356] = "Count";
6075
+ SyntaxKind5[SyntaxKind5["JSDocImportTag"] = 351] = "JSDocImportTag";
6076
+ SyntaxKind5[SyntaxKind5["SyntaxList"] = 352] = "SyntaxList";
6077
+ SyntaxKind5[SyntaxKind5["NotEmittedStatement"] = 353] = "NotEmittedStatement";
6078
+ SyntaxKind5[SyntaxKind5["PartiallyEmittedExpression"] = 354] = "PartiallyEmittedExpression";
6079
+ SyntaxKind5[SyntaxKind5["CommaListExpression"] = 355] = "CommaListExpression";
6080
+ SyntaxKind5[SyntaxKind5["SyntheticReferenceExpression"] = 356] = "SyntheticReferenceExpression";
6081
+ SyntaxKind5[SyntaxKind5["Count"] = 357] = "Count";
6080
6082
  SyntaxKind5[SyntaxKind5["FirstAssignment"] = 64 /* EqualsToken */] = "FirstAssignment";
6081
6083
  SyntaxKind5[SyntaxKind5["LastAssignment"] = 79 /* CaretEqualsToken */] = "LastAssignment";
6082
6084
  SyntaxKind5[SyntaxKind5["FirstCompoundAssignment"] = 65 /* PlusEqualsToken */] = "FirstCompoundAssignment";
@@ -6105,9 +6107,9 @@ var SyntaxKind = /* @__PURE__ */ ((SyntaxKind5) => {
6105
6107
  SyntaxKind5[SyntaxKind5["LastStatement"] = 259 /* DebuggerStatement */] = "LastStatement";
6106
6108
  SyntaxKind5[SyntaxKind5["FirstNode"] = 166 /* QualifiedName */] = "FirstNode";
6107
6109
  SyntaxKind5[SyntaxKind5["FirstJSDocNode"] = 309 /* JSDocTypeExpression */] = "FirstJSDocNode";
6108
- SyntaxKind5[SyntaxKind5["LastJSDocNode"] = 350 /* JSDocSatisfiesTag */] = "LastJSDocNode";
6110
+ SyntaxKind5[SyntaxKind5["LastJSDocNode"] = 351 /* JSDocImportTag */] = "LastJSDocNode";
6109
6111
  SyntaxKind5[SyntaxKind5["FirstJSDocTagNode"] = 327 /* JSDocTag */] = "FirstJSDocTagNode";
6110
- SyntaxKind5[SyntaxKind5["LastJSDocTagNode"] = 350 /* JSDocSatisfiesTag */] = "LastJSDocTagNode";
6112
+ SyntaxKind5[SyntaxKind5["LastJSDocTagNode"] = 351 /* JSDocImportTag */] = "LastJSDocTagNode";
6111
6113
  SyntaxKind5[SyntaxKind5["FirstContextualKeyword"] = 128 /* AbstractKeyword */] = "FirstContextualKeyword";
6112
6114
  SyntaxKind5[SyntaxKind5["LastContextualKeyword"] = 165 /* OfKeyword */] = "LastContextualKeyword";
6113
6115
  return SyntaxKind5;
@@ -12042,7 +12044,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12042
12044
  var tokenValue;
12043
12045
  var tokenFlags;
12044
12046
  var commentDirectives;
12045
- var inJSDocType = 0;
12047
+ var skipJsDocLeadingAsterisks = 0;
12046
12048
  var scriptKind = 0 /* Unknown */;
12047
12049
  var jsDocParsingMode = 0 /* ParseAll */;
12048
12050
  setText(text, start, length2);
@@ -12093,7 +12095,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12093
12095
  setOnError,
12094
12096
  resetTokenState,
12095
12097
  setTextPos: resetTokenState,
12096
- setInJSDocType,
12098
+ setSkipJsDocLeadingAsterisks,
12097
12099
  tryScan,
12098
12100
  lookAhead,
12099
12101
  scanRange
@@ -12809,7 +12811,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12809
12811
  return pos += 2, token = 43 /* AsteriskAsteriskToken */;
12810
12812
  }
12811
12813
  pos++;
12812
- if (inJSDocType && !asteriskSeen && tokenFlags & 1 /* PrecedingLineBreak */) {
12814
+ if (skipJsDocLeadingAsterisks && !asteriskSeen && tokenFlags & 1 /* PrecedingLineBreak */) {
12813
12815
  asteriskSeen = true;
12814
12816
  continue;
12815
12817
  }
@@ -13587,8 +13589,8 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13587
13589
  tokenValue = void 0;
13588
13590
  tokenFlags = 0 /* None */;
13589
13591
  }
13590
- function setInJSDocType(inType) {
13591
- inJSDocType += inType ? 1 : -1;
13592
+ function setSkipJsDocLeadingAsterisks(skip) {
13593
+ skipJsDocLeadingAsterisks += skip ? 1 : -1;
13592
13594
  }
13593
13595
  }
13594
13596
  function codePointAt(s, i) {
@@ -14791,8 +14793,8 @@ function isExpressionKind(kind) {
14791
14793
  case 230 /* SpreadElement */:
14792
14794
  case 234 /* AsExpression */:
14793
14795
  case 232 /* OmittedExpression */:
14794
- case 354 /* CommaListExpression */:
14795
- case 353 /* PartiallyEmittedExpression */:
14796
+ case 355 /* CommaListExpression */:
14797
+ case 354 /* PartiallyEmittedExpression */:
14796
14798
  case 238 /* SatisfiesExpression */:
14797
14799
  return true;
14798
14800
  default:
@@ -14977,7 +14979,7 @@ function isDeclarationStatementKind(kind) {
14977
14979
  return kind === 262 /* FunctionDeclaration */ || kind === 282 /* MissingDeclaration */ || kind === 263 /* ClassDeclaration */ || kind === 264 /* InterfaceDeclaration */ || kind === 265 /* TypeAliasDeclaration */ || kind === 266 /* EnumDeclaration */ || kind === 267 /* ModuleDeclaration */ || kind === 272 /* ImportDeclaration */ || kind === 271 /* ImportEqualsDeclaration */ || kind === 278 /* ExportDeclaration */ || kind === 277 /* ExportAssignment */ || kind === 270 /* NamespaceExportDeclaration */;
14978
14980
  }
14979
14981
  function isStatementKindButNotDeclarationKind(kind) {
14980
- return kind === 252 /* BreakStatement */ || kind === 251 /* ContinueStatement */ || kind === 259 /* DebuggerStatement */ || kind === 246 /* DoStatement */ || kind === 244 /* ExpressionStatement */ || kind === 242 /* EmptyStatement */ || kind === 249 /* ForInStatement */ || kind === 250 /* ForOfStatement */ || kind === 248 /* ForStatement */ || kind === 245 /* IfStatement */ || kind === 256 /* LabeledStatement */ || kind === 253 /* ReturnStatement */ || kind === 255 /* SwitchStatement */ || kind === 257 /* ThrowStatement */ || kind === 258 /* TryStatement */ || kind === 243 /* VariableStatement */ || kind === 247 /* WhileStatement */ || kind === 254 /* WithStatement */ || kind === 352 /* NotEmittedStatement */;
14982
+ return kind === 252 /* BreakStatement */ || kind === 251 /* ContinueStatement */ || kind === 259 /* DebuggerStatement */ || kind === 246 /* DoStatement */ || kind === 244 /* ExpressionStatement */ || kind === 242 /* EmptyStatement */ || kind === 249 /* ForInStatement */ || kind === 250 /* ForOfStatement */ || kind === 248 /* ForStatement */ || kind === 245 /* IfStatement */ || kind === 256 /* LabeledStatement */ || kind === 253 /* ReturnStatement */ || kind === 255 /* SwitchStatement */ || kind === 257 /* ThrowStatement */ || kind === 258 /* TryStatement */ || kind === 243 /* VariableStatement */ || kind === 247 /* WhileStatement */ || kind === 254 /* WithStatement */ || kind === 353 /* NotEmittedStatement */;
14981
14983
  }
14982
14984
  function isDeclaration(node) {
14983
14985
  if (node.kind === 168 /* TypeParameter */) {
@@ -15038,13 +15040,13 @@ function isCaseOrDefaultClause(node) {
15038
15040
  return kind === 296 /* CaseClause */ || kind === 297 /* DefaultClause */;
15039
15041
  }
15040
15042
  function isJSDocNode(node) {
15041
- return node.kind >= 309 /* FirstJSDocNode */ && node.kind <= 350 /* LastJSDocNode */;
15043
+ return node.kind >= 309 /* FirstJSDocNode */ && node.kind <= 351 /* LastJSDocNode */;
15042
15044
  }
15043
15045
  function isJSDocCommentContainingNode(node) {
15044
15046
  return node.kind === 320 /* JSDoc */ || node.kind === 319 /* JSDocNamepathType */ || node.kind === 321 /* JSDocText */ || isJSDocLinkLike(node) || isJSDocTag(node) || isJSDocTypeLiteral(node) || isJSDocSignature(node);
15045
15047
  }
15046
15048
  function isJSDocTag(node) {
15047
- return node.kind >= 327 /* FirstJSDocTagNode */ && node.kind <= 350 /* LastJSDocTagNode */;
15049
+ return node.kind >= 327 /* FirstJSDocTagNode */ && node.kind <= 351 /* LastJSDocTagNode */;
15048
15050
  }
15049
15051
  function isSetAccessor(node) {
15050
15052
  return node.kind === 178 /* SetAccessor */;
@@ -15542,7 +15544,7 @@ function getTokenPosOfNode(node, sourceFile, includeJsDoc) {
15542
15544
  if (includeJsDoc && hasJSDocNodes(node)) {
15543
15545
  return getTokenPosOfNode(node.jsDoc[0], sourceFile);
15544
15546
  }
15545
- if (node.kind === 351 /* SyntaxList */ && node._children.length > 0) {
15547
+ if (node.kind === 352 /* SyntaxList */ && node._children.length > 0) {
15546
15548
  return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc);
15547
15549
  }
15548
15550
  return skipTrivia(
@@ -17578,6 +17580,7 @@ function tryGetModuleSpecifierFromDeclaration(node) {
17578
17580
  ))) == null ? void 0 : _a.arguments[0];
17579
17581
  case 272 /* ImportDeclaration */:
17580
17582
  case 278 /* ExportDeclaration */:
17583
+ case 351 /* JSDocImportTag */:
17581
17584
  return tryCast(node.moduleSpecifier, isStringLiteralLike);
17582
17585
  case 271 /* ImportEqualsDeclaration */:
17583
17586
  return tryCast((_b = tryCast(node.moduleReference, isExternalModuleReference)) == null ? void 0 : _b.expression, isStringLiteralLike);
@@ -17602,6 +17605,7 @@ function tryGetImportFromModuleSpecifier(node) {
17602
17605
  switch (node.parent.kind) {
17603
17606
  case 272 /* ImportDeclaration */:
17604
17607
  case 278 /* ExportDeclaration */:
17608
+ case 351 /* JSDocImportTag */:
17605
17609
  return node.parent;
17606
17610
  case 283 /* ExternalModuleReference */:
17607
17611
  return node.parent.parent;
@@ -17622,6 +17626,7 @@ function getExternalModuleName(node) {
17622
17626
  switch (node.kind) {
17623
17627
  case 272 /* ImportDeclaration */:
17624
17628
  case 278 /* ExportDeclaration */:
17629
+ case 351 /* JSDocImportTag */:
17625
17630
  return node.moduleSpecifier;
17626
17631
  case 271 /* ImportEqualsDeclaration */:
17627
17632
  return node.moduleReference.kind === 283 /* ExternalModuleReference */ ? node.moduleReference.expression : void 0;
@@ -17648,7 +17653,7 @@ function getNamespaceDeclarationNode(node) {
17648
17653
  }
17649
17654
  }
17650
17655
  function isDefaultImport(node) {
17651
- return node.kind === 272 /* ImportDeclaration */ && !!node.importClause && !!node.importClause.name;
17656
+ return (node.kind === 272 /* ImportDeclaration */ || node.kind === 351 /* JSDocImportTag */) && !!node.importClause && !!node.importClause.name;
17652
17657
  }
17653
17658
  function forEachImportClauseDeclaration(node, action) {
17654
17659
  if (node.name) {
@@ -18538,7 +18543,7 @@ var OperatorPrecedence = /* @__PURE__ */ ((OperatorPrecedence2) => {
18538
18543
  })(OperatorPrecedence || {});
18539
18544
  function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) {
18540
18545
  switch (nodeKind) {
18541
- case 354 /* CommaListExpression */:
18546
+ case 355 /* CommaListExpression */:
18542
18547
  return 0 /* Comma */;
18543
18548
  case 230 /* SpreadElement */:
18544
18549
  return 1 /* Spread */;
@@ -20235,7 +20240,7 @@ function getLeftmostExpression(node, stopAtCallExpressions) {
20235
20240
  case 212 /* ElementAccessExpression */:
20236
20241
  case 211 /* PropertyAccessExpression */:
20237
20242
  case 235 /* NonNullExpression */:
20238
- case 353 /* PartiallyEmittedExpression */:
20243
+ case 354 /* PartiallyEmittedExpression */:
20239
20244
  case 238 /* SatisfiesExpression */:
20240
20245
  node = node.expression;
20241
20246
  continue;
@@ -21677,7 +21682,7 @@ function getContainingNodeArray(node) {
21677
21682
  return parent2.types;
21678
21683
  case 189 /* TupleType */:
21679
21684
  case 209 /* ArrayLiteralExpression */:
21680
- case 354 /* CommaListExpression */:
21685
+ case 355 /* CommaListExpression */:
21681
21686
  case 275 /* NamedImports */:
21682
21687
  case 279 /* NamedExports */:
21683
21688
  return parent2.elements;
@@ -22804,7 +22809,7 @@ function createNodeFactory(flags, baseFactory2) {
22804
22809
  updateImportEqualsDeclaration,
22805
22810
  createImportDeclaration,
22806
22811
  updateImportDeclaration,
22807
- createImportClause,
22812
+ createImportClause: createImportClause2,
22808
22813
  updateImportClause,
22809
22814
  createAssertClause,
22810
22815
  updateAssertClause,
@@ -22898,6 +22903,8 @@ function createNodeFactory(flags, baseFactory2) {
22898
22903
  updateJSDocImplementsTag,
22899
22904
  createJSDocSeeTag,
22900
22905
  updateJSDocSeeTag,
22906
+ createJSDocImportTag,
22907
+ updateJSDocImportTag,
22901
22908
  createJSDocNameReference,
22902
22909
  updateJSDocNameReference,
22903
22910
  createJSDocMemberName,
@@ -25237,7 +25244,7 @@ function createNodeFactory(flags, baseFactory2) {
25237
25244
  function updateImportDeclaration(node, modifiers, importClause, moduleSpecifier, attributes) {
25238
25245
  return node.modifiers !== modifiers || node.importClause !== importClause || node.moduleSpecifier !== moduleSpecifier || node.attributes !== attributes ? update(createImportDeclaration(modifiers, importClause, moduleSpecifier, attributes), node) : node;
25239
25246
  }
25240
- function createImportClause(isTypeOnly, name, namedBindings) {
25247
+ function createImportClause2(isTypeOnly, name, namedBindings) {
25241
25248
  const node = createBaseDeclaration(273 /* ImportClause */);
25242
25249
  node.isTypeOnly = isTypeOnly;
25243
25250
  node.name = name;
@@ -25250,7 +25257,7 @@ function createNodeFactory(flags, baseFactory2) {
25250
25257
  return node;
25251
25258
  }
25252
25259
  function updateImportClause(node, isTypeOnly, name, namedBindings) {
25253
- return node.isTypeOnly !== isTypeOnly || node.name !== name || node.namedBindings !== namedBindings ? update(createImportClause(isTypeOnly, name, namedBindings), node) : node;
25260
+ return node.isTypeOnly !== isTypeOnly || node.name !== name || node.namedBindings !== namedBindings ? update(createImportClause2(isTypeOnly, name, namedBindings), node) : node;
25254
25261
  }
25255
25262
  function createAssertClause(elements, multiLine) {
25256
25263
  const node = createBaseNode(300 /* AssertClause */);
@@ -25670,6 +25677,17 @@ function createNodeFactory(flags, baseFactory2) {
25670
25677
  function updateJSDocEnumTag(node, tagName = getDefaultTagName(node), typeExpression, comment) {
25671
25678
  return node.tagName !== tagName || node.typeExpression !== typeExpression || node.comment !== comment ? update(createJSDocEnumTag(tagName, typeExpression, comment), node) : node;
25672
25679
  }
25680
+ function createJSDocImportTag(tagName, importClause, moduleSpecifier, attributes, comment) {
25681
+ const node = createBaseJSDocTag(351 /* JSDocImportTag */, tagName ?? createIdentifier("import"), comment);
25682
+ node.importClause = importClause;
25683
+ node.moduleSpecifier = moduleSpecifier;
25684
+ node.attributes = attributes;
25685
+ node.comment = comment;
25686
+ return node;
25687
+ }
25688
+ function updateJSDocImportTag(node, tagName, importClause, moduleSpecifier, attributes, comment) {
25689
+ return node.tagName !== tagName || node.comment !== comment || node.importClause !== importClause || node.moduleSpecifier !== moduleSpecifier || node.attributes !== attributes ? update(createJSDocImportTag(tagName, importClause, moduleSpecifier, attributes, comment), node) : node;
25690
+ }
25673
25691
  function createJSDocText(text) {
25674
25692
  const node = createBaseNode(321 /* JSDocText */);
25675
25693
  node.text = text;
@@ -26067,18 +26085,18 @@ function createNodeFactory(flags, baseFactory2) {
26067
26085
  return node;
26068
26086
  }
26069
26087
  function createSyntaxList3(children) {
26070
- const node = createBaseNode(351 /* SyntaxList */);
26088
+ const node = createBaseNode(352 /* SyntaxList */);
26071
26089
  node._children = children;
26072
26090
  return node;
26073
26091
  }
26074
26092
  function createNotEmittedStatement(original) {
26075
- const node = createBaseNode(352 /* NotEmittedStatement */);
26093
+ const node = createBaseNode(353 /* NotEmittedStatement */);
26076
26094
  node.original = original;
26077
26095
  setTextRange(node, original);
26078
26096
  return node;
26079
26097
  }
26080
26098
  function createPartiallyEmittedExpression(expression, original) {
26081
- const node = createBaseNode(353 /* PartiallyEmittedExpression */);
26099
+ const node = createBaseNode(354 /* PartiallyEmittedExpression */);
26082
26100
  node.expression = expression;
26083
26101
  node.original = original;
26084
26102
  node.transformFlags |= propagateChildFlags(node.expression) | 1 /* ContainsTypeScript */;
@@ -26100,7 +26118,7 @@ function createNodeFactory(flags, baseFactory2) {
26100
26118
  return node;
26101
26119
  }
26102
26120
  function createCommaListExpression(elements) {
26103
- const node = createBaseNode(354 /* CommaListExpression */);
26121
+ const node = createBaseNode(355 /* CommaListExpression */);
26104
26122
  node.elements = createNodeArray(sameFlatMap(elements, flattenCommaElements));
26105
26123
  node.transformFlags |= propagateChildrenFlags(node.elements);
26106
26124
  return node;
@@ -26109,7 +26127,7 @@ function createNodeFactory(flags, baseFactory2) {
26109
26127
  return node.elements !== elements ? update(createCommaListExpression(elements), node) : node;
26110
26128
  }
26111
26129
  function createSyntheticReferenceExpression(expression, thisArg) {
26112
- const node = createBaseNode(355 /* SyntheticReferenceExpression */);
26130
+ const node = createBaseNode(356 /* SyntheticReferenceExpression */);
26113
26131
  node.expression = expression;
26114
26132
  node.thisArg = thisArg;
26115
26133
  node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.thisArg);
@@ -26355,7 +26373,7 @@ function createNodeFactory(flags, baseFactory2) {
26355
26373
  return updateSatisfiesExpression(outerExpression, expression, outerExpression.type);
26356
26374
  case 235 /* NonNullExpression */:
26357
26375
  return updateNonNullExpression(outerExpression, expression);
26358
- case 353 /* PartiallyEmittedExpression */:
26376
+ case 354 /* PartiallyEmittedExpression */:
26359
26377
  return updatePartiallyEmittedExpression(outerExpression, expression);
26360
26378
  }
26361
26379
  }
@@ -26765,6 +26783,8 @@ function getDefaultTagNameForKind(kind) {
26765
26783
  return "augments";
26766
26784
  case 329 /* JSDocImplementsTag */:
26767
26785
  return "implements";
26786
+ case 351 /* JSDocImportTag */:
26787
+ return "import";
26768
26788
  default:
26769
26789
  return Debug.fail(`Unsupported kind: ${Debug.formatSyntaxKind(kind)}`);
26770
26790
  }
@@ -26905,7 +26925,7 @@ function getTransformFlagsSubtreeExclusions(kind) {
26905
26925
  case 216 /* TypeAssertionExpression */:
26906
26926
  case 238 /* SatisfiesExpression */:
26907
26927
  case 234 /* AsExpression */:
26908
- case 353 /* PartiallyEmittedExpression */:
26928
+ case 354 /* PartiallyEmittedExpression */:
26909
26929
  case 217 /* ParenthesizedExpression */:
26910
26930
  case 108 /* SuperKeyword */:
26911
26931
  return -2147483648 /* OuterExpressionExcludes */;
@@ -28617,10 +28637,10 @@ function isSyntheticExpression(node) {
28617
28637
  return node.kind === 237 /* SyntheticExpression */;
28618
28638
  }
28619
28639
  function isPartiallyEmittedExpression(node) {
28620
- return node.kind === 353 /* PartiallyEmittedExpression */;
28640
+ return node.kind === 354 /* PartiallyEmittedExpression */;
28621
28641
  }
28622
28642
  function isCommaListExpression(node) {
28623
- return node.kind === 354 /* CommaListExpression */;
28643
+ return node.kind === 355 /* CommaListExpression */;
28624
28644
  }
28625
28645
  function isTemplateSpan(node) {
28626
28646
  return node.kind === 239 /* TemplateSpan */;
@@ -28770,10 +28790,10 @@ function isMissingDeclaration(node) {
28770
28790
  return node.kind === 282 /* MissingDeclaration */;
28771
28791
  }
28772
28792
  function isNotEmittedStatement(node) {
28773
- return node.kind === 352 /* NotEmittedStatement */;
28793
+ return node.kind === 353 /* NotEmittedStatement */;
28774
28794
  }
28775
28795
  function isSyntheticReference(node) {
28776
- return node.kind === 355 /* SyntheticReferenceExpression */;
28796
+ return node.kind === 356 /* SyntheticReferenceExpression */;
28777
28797
  }
28778
28798
  function isExternalModuleReference(node) {
28779
28799
  return node.kind === 283 /* ExternalModuleReference */;
@@ -28967,8 +28987,11 @@ function isJSDocSatisfiesTag(node) {
28967
28987
  function isJSDocThrowsTag(node) {
28968
28988
  return node.kind === 349 /* JSDocThrowsTag */;
28969
28989
  }
28990
+ function isJSDocImportTag(node) {
28991
+ return node.kind === 351 /* JSDocImportTag */;
28992
+ }
28970
28993
  function isSyntaxList(n) {
28971
- return n.kind === 351 /* SyntaxList */;
28994
+ return n.kind === 352 /* SyntaxList */;
28972
28995
  }
28973
28996
 
28974
28997
  // src/compiler/factory/utilities.ts
@@ -29363,7 +29386,7 @@ function isOuterExpression(node, kinds = 15 /* All */) {
29363
29386
  return (kinds & 2 /* TypeAssertions */) !== 0;
29364
29387
  case 235 /* NonNullExpression */:
29365
29388
  return (kinds & 4 /* NonNullAssertions */) !== 0;
29366
- case 353 /* PartiallyEmittedExpression */:
29389
+ case 354 /* PartiallyEmittedExpression */:
29367
29390
  return (kinds & 8 /* PartiallyEmittedExpressions */) !== 0;
29368
29391
  }
29369
29392
  return false;
@@ -30454,7 +30477,7 @@ var forEachChildTable = {
30454
30477
  [282 /* MissingDeclaration */]: function forEachChildInMissingDeclaration(node, cbNode, cbNodes) {
30455
30478
  return visitNodes(cbNode, cbNodes, node.modifiers);
30456
30479
  },
30457
- [354 /* CommaListExpression */]: function forEachChildInCommaListExpression(node, cbNode, cbNodes) {
30480
+ [355 /* CommaListExpression */]: function forEachChildInCommaListExpression(node, cbNode, cbNodes) {
30458
30481
  return visitNodes(cbNode, cbNodes, node.elements);
30459
30482
  },
30460
30483
  [284 /* JsxElement */]: function forEachChildInJsxElement(node, cbNode, cbNodes) {
@@ -30549,7 +30572,8 @@ var forEachChildTable = {
30549
30572
  [336 /* JSDocReadonlyTag */]: forEachChildInJSDocTag,
30550
30573
  [331 /* JSDocDeprecatedTag */]: forEachChildInJSDocTag,
30551
30574
  [337 /* JSDocOverrideTag */]: forEachChildInJSDocTag,
30552
- [353 /* PartiallyEmittedExpression */]: forEachChildInPartiallyEmittedExpression
30575
+ [351 /* JSDocImportTag */]: forEachChildInJSDocImportTag,
30576
+ [354 /* PartiallyEmittedExpression */]: forEachChildInPartiallyEmittedExpression
30553
30577
  };
30554
30578
  function forEachChildInCallOrConstructSignature(node, cbNode, cbNodes) {
30555
30579
  return visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode2(cbNode, node.type);
@@ -30600,6 +30624,9 @@ function forEachChildInJSDocLinkCodeOrPlain(node, cbNode, _cbNodes) {
30600
30624
  function forEachChildInJSDocTag(node, cbNode, cbNodes) {
30601
30625
  return visitNode2(cbNode, node.tagName) || (typeof node.comment === "string" ? void 0 : visitNodes(cbNode, cbNodes, node.comment));
30602
30626
  }
30627
+ function forEachChildInJSDocImportTag(node, cbNode, cbNodes) {
30628
+ return visitNode2(cbNode, node.tagName) || visitNode2(cbNode, node.importClause) || visitNode2(cbNode, node.moduleSpecifier) || visitNode2(cbNode, node.attributes) || (typeof node.comment === "string" ? void 0 : visitNodes(cbNode, cbNodes, node.comment));
30629
+ }
30603
30630
  function forEachChildInPartiallyEmittedExpression(node, cbNode, _cbNodes) {
30604
30631
  return visitNode2(cbNode, node.expression);
30605
30632
  }
@@ -32607,7 +32634,7 @@ var Parser;
32607
32634
  );
32608
32635
  }
32609
32636
  function parseJSDocType() {
32610
- scanner2.setInJSDocType(true);
32637
+ scanner2.setSkipJsDocLeadingAsterisks(true);
32611
32638
  const pos = getNodePos();
32612
32639
  if (parseOptional(144 /* ModuleKeyword */)) {
32613
32640
  const moduleTag = factory2.createJSDocNamepathType(
@@ -32626,12 +32653,12 @@ var Parser;
32626
32653
  nextTokenJSDoc();
32627
32654
  }
32628
32655
  }
32629
- scanner2.setInJSDocType(false);
32656
+ scanner2.setSkipJsDocLeadingAsterisks(false);
32630
32657
  return finishNode(moduleTag, pos);
32631
32658
  }
32632
32659
  const hasDotDotDot = parseOptional(26 /* DotDotDotToken */);
32633
32660
  let type = parseTypeOrTypePredicate();
32634
- scanner2.setInJSDocType(false);
32661
+ scanner2.setSkipJsDocLeadingAsterisks(false);
32635
32662
  if (hasDotDotDot) {
32636
32663
  type = finishNode(factory2.createJSDocVariadicType(type), pos);
32637
32664
  }
@@ -36194,22 +36221,28 @@ var Parser;
36194
36221
  if (identifier && !tokenAfterImportedIdentifierDefinitelyProducesImportDeclaration()) {
36195
36222
  return parseImportEqualsDeclaration(pos, hasJSDoc, modifiers, identifier, isTypeOnly);
36196
36223
  }
36224
+ const importClause = tryParseImportClause(identifier, afterImportPos, isTypeOnly);
36225
+ const moduleSpecifier = parseModuleSpecifier();
36226
+ const attributes = tryParseImportAttributes();
36227
+ parseSemicolon();
36228
+ const node = factory2.createImportDeclaration(modifiers, importClause, moduleSpecifier, attributes);
36229
+ return withJSDoc(finishNode(node, pos), hasJSDoc);
36230
+ }
36231
+ function tryParseImportClause(identifier, pos, isTypeOnly, skipJsDocLeadingAsterisks = false) {
36197
36232
  let importClause;
36198
36233
  if (identifier || // import id
36199
36234
  token() === 42 /* AsteriskToken */ || // import *
36200
36235
  token() === 19 /* OpenBraceToken */) {
36201
- importClause = parseImportClause(identifier, afterImportPos, isTypeOnly);
36236
+ importClause = parseImportClause(identifier, pos, isTypeOnly, skipJsDocLeadingAsterisks);
36202
36237
  parseExpected(161 /* FromKeyword */);
36203
36238
  }
36204
- const moduleSpecifier = parseModuleSpecifier();
36239
+ return importClause;
36240
+ }
36241
+ function tryParseImportAttributes() {
36205
36242
  const currentToken2 = token();
36206
- let attributes;
36207
36243
  if ((currentToken2 === 118 /* WithKeyword */ || currentToken2 === 132 /* AssertKeyword */) && !scanner2.hasPrecedingLineBreak()) {
36208
- attributes = parseImportAttributes(currentToken2);
36244
+ return parseImportAttributes(currentToken2);
36209
36245
  }
36210
- parseSemicolon();
36211
- const node = factory2.createImportDeclaration(modifiers, importClause, moduleSpecifier, attributes);
36212
- return withJSDoc(finishNode(node, pos), hasJSDoc);
36213
36246
  }
36214
36247
  function parseImportAttribute() {
36215
36248
  const pos = getNodePos();
@@ -36276,10 +36309,14 @@ var Parser;
36276
36309
  const finished = withJSDoc(finishNode(node, pos), hasJSDoc);
36277
36310
  return finished;
36278
36311
  }
36279
- function parseImportClause(identifier, pos, isTypeOnly) {
36312
+ function parseImportClause(identifier, pos, isTypeOnly, skipJsDocLeadingAsterisks) {
36280
36313
  let namedBindings;
36281
36314
  if (!identifier || parseOptional(28 /* CommaToken */)) {
36315
+ if (skipJsDocLeadingAsterisks)
36316
+ scanner2.setSkipJsDocLeadingAsterisks(true);
36282
36317
  namedBindings = token() === 42 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(275 /* NamedImports */);
36318
+ if (skipJsDocLeadingAsterisks)
36319
+ scanner2.setSkipJsDocLeadingAsterisks(false);
36283
36320
  }
36284
36321
  return finishNode(factory2.createImportClause(isTypeOnly, identifier, namedBindings), pos);
36285
36322
  }
@@ -36850,6 +36887,9 @@ var Parser;
36850
36887
  case "throws":
36851
36888
  tag = parseThrowsTag(start2, tagName, margin, indentText);
36852
36889
  break;
36890
+ case "import":
36891
+ tag = parseImportTag(start2, tagName, margin, indentText);
36892
+ break;
36853
36893
  default:
36854
36894
  tag = parseUnknownTag(start2, tagName, margin, indentText);
36855
36895
  break;
@@ -37169,13 +37209,32 @@ var Parser;
37169
37209
  const comments2 = margin !== void 0 && indentText !== void 0 ? parseTrailingTagComments(start2, getNodePos(), margin, indentText) : void 0;
37170
37210
  return finishNode(factory2.createJSDocSatisfiesTag(tagName, typeExpression, comments2), start2);
37171
37211
  }
37212
+ function parseImportTag(start2, tagName, margin, indentText) {
37213
+ const afterImportTagPos = scanner2.getTokenFullStart();
37214
+ let identifier;
37215
+ if (isIdentifier2()) {
37216
+ identifier = parseIdentifier();
37217
+ }
37218
+ const importClause = tryParseImportClause(
37219
+ identifier,
37220
+ afterImportTagPos,
37221
+ /*isTypeOnly*/
37222
+ true,
37223
+ /*skipJsDocLeadingAsterisks*/
37224
+ true
37225
+ );
37226
+ const moduleSpecifier = parseModuleSpecifier();
37227
+ const attributes = tryParseImportAttributes();
37228
+ const comments2 = margin !== void 0 && indentText !== void 0 ? parseTrailingTagComments(start2, getNodePos(), margin, indentText) : void 0;
37229
+ return finishNode(factory2.createJSDocImportTag(tagName, importClause, moduleSpecifier, attributes, comments2), start2);
37230
+ }
37172
37231
  function parseExpressionWithTypeArgumentsForAugments() {
37173
37232
  const usedBrace = parseOptional(19 /* OpenBraceToken */);
37174
37233
  const pos = getNodePos();
37175
37234
  const expression = parsePropertyAccessEntityNameExpression();
37176
- scanner2.setInJSDocType(true);
37235
+ scanner2.setSkipJsDocLeadingAsterisks(true);
37177
37236
  const typeArguments = tryParseTypeArguments();
37178
- scanner2.setInJSDocType(false);
37237
+ scanner2.setSkipJsDocLeadingAsterisks(false);
37179
37238
  const node = factory2.createExpressionWithTypeArguments(expression, typeArguments);
37180
37239
  const res = finishNode(node, pos);
37181
37240
  if (usedBrace) {
@@ -44109,6 +44168,7 @@ function createBinder() {
44109
44168
  var lastContainer;
44110
44169
  var delayedTypeAliases;
44111
44170
  var seenThisKeyword;
44171
+ var jsDocImports;
44112
44172
  var currentFlow;
44113
44173
  var currentBreakTarget;
44114
44174
  var currentContinueTarget;
@@ -44156,6 +44216,7 @@ function createBinder() {
44156
44216
  file.symbolCount = symbolCount;
44157
44217
  file.classifiableNames = classifiableNames;
44158
44218
  delayedBindJSDocTypedefTag();
44219
+ bindJSDocImports();
44159
44220
  }
44160
44221
  file = void 0;
44161
44222
  options = void 0;
@@ -44166,6 +44227,7 @@ function createBinder() {
44166
44227
  blockScopeContainer = void 0;
44167
44228
  lastContainer = void 0;
44168
44229
  delayedTypeAliases = void 0;
44230
+ jsDocImports = void 0;
44169
44231
  seenThisKeyword = false;
44170
44232
  currentFlow = void 0;
44171
44233
  currentBreakTarget = void 0;
@@ -44600,6 +44662,9 @@ function createBinder() {
44600
44662
  case 340 /* JSDocEnumTag */:
44601
44663
  bindJSDocTypeAlias(node);
44602
44664
  break;
44665
+ case 351 /* JSDocImportTag */:
44666
+ bindJSDocImportTag(node);
44667
+ break;
44603
44668
  case 307 /* SourceFile */: {
44604
44669
  bindEachFunctionsFirst(node.statements);
44605
44670
  bind(node.endOfFileToken);
@@ -45332,6 +45397,12 @@ function createBinder() {
45332
45397
  addDeclarationToSymbol(host.symbol, host, 32 /* Class */);
45333
45398
  }
45334
45399
  }
45400
+ function bindJSDocImportTag(node) {
45401
+ bind(node.tagName);
45402
+ if (typeof node.comment !== "string") {
45403
+ bindEach(node.comment);
45404
+ }
45405
+ }
45335
45406
  function bindOptionalExpression(node, trueTarget, falseTarget) {
45336
45407
  doWithConditionalBranches(bind, node, trueTarget, falseTarget);
45337
45408
  if (!isOptionalChain(node) || isOutermostOptionalChain(node)) {
@@ -45648,6 +45719,31 @@ function createBinder() {
45648
45719
  parent2 = saveParent;
45649
45720
  currentFlow = saveCurrentFlow;
45650
45721
  }
45722
+ function bindJSDocImports() {
45723
+ if (jsDocImports === void 0) {
45724
+ return;
45725
+ }
45726
+ const saveContainer = container;
45727
+ const saveLastContainer = lastContainer;
45728
+ const saveBlockScopeContainer = blockScopeContainer;
45729
+ const saveParent = parent2;
45730
+ const saveCurrentFlow = currentFlow;
45731
+ for (const jsDocImportTag of jsDocImports) {
45732
+ const host = getJSDocHost(jsDocImportTag);
45733
+ const enclosingContainer = host ? getEnclosingContainer(host) : void 0;
45734
+ const enclosingBlockScopeContainer = host ? getEnclosingBlockScopeContainer(host) : void 0;
45735
+ container = enclosingContainer || file;
45736
+ blockScopeContainer = enclosingBlockScopeContainer || file;
45737
+ currentFlow = initFlowNode({ flags: 2 /* Start */ });
45738
+ parent2 = jsDocImportTag;
45739
+ bind(jsDocImportTag.importClause);
45740
+ }
45741
+ container = saveContainer;
45742
+ lastContainer = saveLastContainer;
45743
+ blockScopeContainer = saveBlockScopeContainer;
45744
+ parent2 = saveParent;
45745
+ currentFlow = saveCurrentFlow;
45746
+ }
45651
45747
  function checkContextualIdentifier(node) {
45652
45748
  if (!file.parseDiagnostics.length && !(node.flags & 33554432 /* Ambient */) && !(node.flags & 16777216 /* JSDoc */) && !isIdentifierName(node)) {
45653
45749
  const originalKeywordKind = identifierToKeywordKind(node);
@@ -46072,6 +46168,8 @@ function createBinder() {
46072
46168
  return (delayedTypeAliases || (delayedTypeAliases = [])).push(node);
46073
46169
  case 339 /* JSDocOverloadTag */:
46074
46170
  return bind(node.typeExpression);
46171
+ case 351 /* JSDocImportTag */:
46172
+ return (jsDocImports || (jsDocImports = [])).push(node);
46075
46173
  }
46076
46174
  }
46077
46175
  function bindPropertyWorker(node) {
@@ -49800,6 +49898,7 @@ function createTypeChecker(host) {
49800
49898
  case 346 /* JSDocTypedefTag */:
49801
49899
  case 338 /* JSDocCallbackTag */:
49802
49900
  case 340 /* JSDocEnumTag */:
49901
+ case 351 /* JSDocImportTag */:
49803
49902
  const root = getJSDocRoot(location);
49804
49903
  if (root) {
49805
49904
  location = root.parent;
@@ -51292,7 +51391,7 @@ function createTypeChecker(host) {
51292
51391
  return ambientModule;
51293
51392
  }
51294
51393
  const currentSourceFile = getSourceFileOfNode(location);
51295
- const contextSpecifier = isStringLiteralLike(location) ? location : ((_a = isModuleDeclaration(location) ? location : location.parent && isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : void 0) == null ? void 0 : _a.name) || ((_b = isLiteralImportTypeNode(location) ? location : void 0) == null ? void 0 : _b.argument.literal) || (isVariableDeclaration(location) && location.initializer && isRequireCall(
51394
+ const contextSpecifier = isStringLiteralLike(location) ? location : ((_a = isModuleDeclaration(location) ? location : location.parent && isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : void 0) == null ? void 0 : _a.name) || ((_b = isLiteralImportTypeNode(location) ? location : void 0) == null ? void 0 : _b.argument.literal) || (isInJSFile(location) && isJSDocImportTag(location) ? location.moduleSpecifier : void 0) || (isVariableDeclaration(location) && location.initializer && isRequireCall(
51296
51395
  location.initializer,
51297
51396
  /*requireStringLiteralLikeArgument*/
51298
51397
  true
@@ -55668,19 +55767,20 @@ function createTypeChecker(host) {
55668
55767
  case 273 /* ImportClause */: {
55669
55768
  const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
55670
55769
  const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.moduleSpecifier;
55770
+ const attributes = isImportDeclaration(node.parent) ? node.parent.attributes : void 0;
55771
+ const isTypeOnly = isJSDocImportTag(node.parent);
55671
55772
  addResult(
55672
55773
  factory.createImportDeclaration(
55673
55774
  /*modifiers*/
55674
55775
  void 0,
55675
55776
  factory.createImportClause(
55676
- /*isTypeOnly*/
55677
- false,
55777
+ isTypeOnly,
55678
55778
  factory.createIdentifier(localName),
55679
55779
  /*namedBindings*/
55680
55780
  void 0
55681
55781
  ),
55682
55782
  specifier2,
55683
- node.parent.attributes
55783
+ attributes
55684
55784
  ),
55685
55785
  0 /* None */
55686
55786
  );
@@ -55689,13 +55789,13 @@ function createTypeChecker(host) {
55689
55789
  case 274 /* NamespaceImport */: {
55690
55790
  const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
55691
55791
  const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.moduleSpecifier;
55792
+ const isTypeOnly = isJSDocImportTag(node.parent.parent);
55692
55793
  addResult(
55693
55794
  factory.createImportDeclaration(
55694
55795
  /*modifiers*/
55695
55796
  void 0,
55696
55797
  factory.createImportClause(
55697
- /*isTypeOnly*/
55698
- false,
55798
+ isTypeOnly,
55699
55799
  /*name*/
55700
55800
  void 0,
55701
55801
  factory.createNamespaceImport(factory.createIdentifier(localName))
@@ -55723,13 +55823,13 @@ function createTypeChecker(host) {
55723
55823
  case 276 /* ImportSpecifier */: {
55724
55824
  const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
55725
55825
  const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.parent.moduleSpecifier;
55826
+ const isTypeOnly = isJSDocImportTag(node.parent.parent.parent);
55726
55827
  addResult(
55727
55828
  factory.createImportDeclaration(
55728
55829
  /*modifiers*/
55729
55830
  void 0,
55730
55831
  factory.createImportClause(
55731
- /*isTypeOnly*/
55732
- false,
55832
+ isTypeOnly,
55733
55833
  /*name*/
55734
55834
  void 0,
55735
55835
  factory.createNamedImports([
@@ -58409,7 +58509,7 @@ function createTypeChecker(host) {
58409
58509
  if (!lateSymbol)
58410
58510
  lateSymbols.set(memberName, lateSymbol = createSymbol(0 /* None */, memberName, 4096 /* Late */));
58411
58511
  const earlySymbol = earlySymbols && earlySymbols.get(memberName);
58412
- if (!(parent2.flags & 32 /* Class */) && (lateSymbol.flags & getExcludedSymbolFlags(symbolFlags) || earlySymbol)) {
58512
+ if (!(parent2.flags & 32 /* Class */) && lateSymbol.flags & getExcludedSymbolFlags(symbolFlags)) {
58413
58513
  const declarations = earlySymbol ? concatenate(earlySymbol.declarations, lateSymbol.declarations) : lateSymbol.declarations;
58414
58514
  const name = !(type.flags & 8192 /* UniqueESSymbol */) && unescapeLeadingUnderscores(memberName) || declarationNameToString(declName);
58415
58515
  forEach(declarations, (declaration) => error2(getNameOfDeclaration(declaration) || declaration, Diagnostics.Property_0_was_also_declared_here, name));
@@ -69935,13 +70035,20 @@ function createTypeChecker(host) {
69935
70035
  return getFlowCacheKey(node.expression, declaredType, initialType, flowContainer);
69936
70036
  case 166 /* QualifiedName */:
69937
70037
  const left = getFlowCacheKey(node.left, declaredType, initialType, flowContainer);
69938
- return left && left + "." + node.right.escapedText;
70038
+ return left && `${left}.${node.right.escapedText}`;
69939
70039
  case 211 /* PropertyAccessExpression */:
69940
70040
  case 212 /* ElementAccessExpression */:
69941
70041
  const propName = getAccessedPropertyName(node);
69942
70042
  if (propName !== void 0) {
69943
70043
  const key = getFlowCacheKey(node.expression, declaredType, initialType, flowContainer);
69944
- return key && key + "." + propName;
70044
+ return key && `${key}.${propName}`;
70045
+ }
70046
+ if (isElementAccessExpression(node) && isIdentifier(node.argumentExpression)) {
70047
+ const symbol = getResolvedSymbol(node.argumentExpression);
70048
+ if (isConstantVariable(symbol) || isParameterOrMutableLocalVariable(symbol) && !isSymbolAssigned(symbol)) {
70049
+ const key = getFlowCacheKey(node.expression, declaredType, initialType, flowContainer);
70050
+ return key && `${key}.@${getSymbolId(symbol)}`;
70051
+ }
69945
70052
  }
69946
70053
  break;
69947
70054
  case 206 /* ObjectBindingPattern */:
@@ -69978,8 +70085,19 @@ function createTypeChecker(host) {
69978
70085
  case 211 /* PropertyAccessExpression */:
69979
70086
  case 212 /* ElementAccessExpression */:
69980
70087
  const sourcePropertyName = getAccessedPropertyName(source);
69981
- const targetPropertyName = isAccessExpression(target) ? getAccessedPropertyName(target) : void 0;
69982
- return sourcePropertyName !== void 0 && targetPropertyName !== void 0 && targetPropertyName === sourcePropertyName && isMatchingReference(source.expression, target.expression);
70088
+ if (sourcePropertyName !== void 0) {
70089
+ const targetPropertyName = isAccessExpression(target) ? getAccessedPropertyName(target) : void 0;
70090
+ if (targetPropertyName !== void 0) {
70091
+ return targetPropertyName === sourcePropertyName && isMatchingReference(source.expression, target.expression);
70092
+ }
70093
+ }
70094
+ if (isElementAccessExpression(source) && isElementAccessExpression(target) && isIdentifier(source.argumentExpression) && isIdentifier(target.argumentExpression)) {
70095
+ const symbol = getResolvedSymbol(source.argumentExpression);
70096
+ if (symbol === getResolvedSymbol(target.argumentExpression) && (isConstantVariable(symbol) || isParameterOrMutableLocalVariable(symbol) && !isSymbolAssigned(symbol))) {
70097
+ return isMatchingReference(source.expression, target.expression);
70098
+ }
70099
+ }
70100
+ break;
69983
70101
  case 166 /* QualifiedName */:
69984
70102
  return isAccessExpression(target) && source.right.escapedText === getAccessedPropertyName(target) && isMatchingReference(source.left, target.expression);
69985
70103
  case 226 /* BinaryExpression */:
@@ -82610,6 +82728,9 @@ function createTypeChecker(host) {
82610
82728
  error2(node.tagName, Diagnostics.An_arrow_function_cannot_have_a_this_parameter);
82611
82729
  }
82612
82730
  }
82731
+ function checkJSDocImportTag(node) {
82732
+ checkImportAttributes(node);
82733
+ }
82613
82734
  function checkJSDocImplementsTag(node) {
82614
82735
  const classLike = getEffectiveJSDocHost(node);
82615
82736
  if (!classLike || !isClassDeclaration(classLike) && !isClassExpression(classLike)) {
@@ -85877,7 +85998,8 @@ function createTypeChecker(host) {
85877
85998
  const message = isImportAttributes2 ? moduleKind === 199 /* NodeNext */ ? Diagnostics.Import_attributes_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls : Diagnostics.Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve : moduleKind === 199 /* NodeNext */ ? Diagnostics.Import_assertions_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls : Diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve;
85878
85999
  return grammarErrorOnNode(node, message);
85879
86000
  }
85880
- if (isImportDeclaration(declaration) ? (_a = declaration.importClause) == null ? void 0 : _a.isTypeOnly : declaration.isTypeOnly) {
86001
+ const isTypeOnly = isJSDocImportTag(declaration) || (isImportDeclaration(declaration) ? (_a = declaration.importClause) == null ? void 0 : _a.isTypeOnly : declaration.isTypeOnly);
86002
+ if (isTypeOnly) {
85881
86003
  return grammarErrorOnNode(node, isImportAttributes2 ? Diagnostics.Import_attributes_cannot_be_used_with_type_only_imports_or_exports : Diagnostics.Import_assertions_cannot_be_used_with_type_only_imports_or_exports);
85882
86004
  }
85883
86005
  if (override) {
@@ -86328,6 +86450,8 @@ function createTypeChecker(host) {
86328
86450
  return checkJSDocSatisfiesTag(node);
86329
86451
  case 343 /* JSDocThisTag */:
86330
86452
  return checkJSDocThisTag(node);
86453
+ case 351 /* JSDocImportTag */:
86454
+ return checkJSDocImportTag(node);
86331
86455
  case 199 /* IndexedAccessType */:
86332
86456
  return checkIndexedAccessType(node);
86333
86457
  case 200 /* MappedType */:
@@ -87131,7 +87255,7 @@ function createTypeChecker(host) {
87131
87255
  return void 0;
87132
87256
  case 11 /* StringLiteral */:
87133
87257
  case 15 /* NoSubstitutionTemplateLiteral */:
87134
- if (isExternalModuleImportEqualsDeclaration(node.parent.parent) && getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node || (node.parent.kind === 272 /* ImportDeclaration */ || node.parent.kind === 278 /* ExportDeclaration */) && node.parent.moduleSpecifier === node || (isInJSFile(node) && isRequireCall(
87258
+ if (isExternalModuleImportEqualsDeclaration(node.parent.parent) && getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node || (node.parent.kind === 272 /* ImportDeclaration */ || node.parent.kind === 278 /* ExportDeclaration */) && node.parent.moduleSpecifier === node || isInJSFile(node) && isJSDocImportTag(node.parent) && node.parent.moduleSpecifier === node || (isInJSFile(node) && isRequireCall(
87135
87259
  node.parent,
87136
87260
  /*requireStringLiteralLikeArgument*/
87137
87261
  false
@@ -91272,13 +91396,13 @@ var visitEachChildTable = {
91272
91396
  );
91273
91397
  },
91274
91398
  // Transformation nodes
91275
- [353 /* PartiallyEmittedExpression */]: function visitEachChildOfPartiallyEmittedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
91399
+ [354 /* PartiallyEmittedExpression */]: function visitEachChildOfPartiallyEmittedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
91276
91400
  return context.factory.updatePartiallyEmittedExpression(
91277
91401
  node,
91278
91402
  Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression))
91279
91403
  );
91280
91404
  },
91281
- [354 /* CommaListExpression */]: function visitEachChildOfCommaListExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) {
91405
+ [355 /* CommaListExpression */]: function visitEachChildOfCommaListExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) {
91282
91406
  return context.factory.updateCommaListExpression(
91283
91407
  node,
91284
91408
  nodesVisitor(node.elements, visitor, isExpression)
@@ -95122,7 +95246,7 @@ function transformClassFields(context) {
95122
95246
  /*discarded*/
95123
95247
  true
95124
95248
  );
95125
- case 354 /* CommaListExpression */:
95249
+ case 355 /* CommaListExpression */:
95126
95250
  return visitCommaListExpression(
95127
95251
  node,
95128
95252
  /*discarded*/
@@ -98215,7 +98339,7 @@ function transformESDecorators(context) {
98215
98339
  return visitForStatement(node);
98216
98340
  case 244 /* ExpressionStatement */:
98217
98341
  return visitExpressionStatement(node);
98218
- case 354 /* CommaListExpression */:
98342
+ case 355 /* CommaListExpression */:
98219
98343
  return visitCommaListExpression(
98220
98344
  node,
98221
98345
  /*discarded*/
@@ -98227,7 +98351,7 @@ function transformESDecorators(context) {
98227
98351
  /*discarded*/
98228
98352
  false
98229
98353
  );
98230
- case 353 /* PartiallyEmittedExpression */:
98354
+ case 354 /* PartiallyEmittedExpression */:
98231
98355
  return visitPartiallyEmittedExpression(
98232
98356
  node,
98233
98357
  /*discarded*/
@@ -98313,7 +98437,7 @@ function transformESDecorators(context) {
98313
98437
  /*discarded*/
98314
98438
  true
98315
98439
  );
98316
- case 354 /* CommaListExpression */:
98440
+ case 355 /* CommaListExpression */:
98317
98441
  return visitCommaListExpression(
98318
98442
  node,
98319
98443
  /*discarded*/
@@ -100904,7 +101028,7 @@ function transformES2018(context) {
100904
101028
  return visitObjectLiteralExpression(node);
100905
101029
  case 226 /* BinaryExpression */:
100906
101030
  return visitBinaryExpression(node, expressionResultIsUnused2);
100907
- case 354 /* CommaListExpression */:
101031
+ case 355 /* CommaListExpression */:
100908
101032
  return visitCommaListExpression(node, expressionResultIsUnused2);
100909
101033
  case 299 /* CatchClause */:
100910
101034
  return visitCatchClause(node);
@@ -104127,7 +104251,7 @@ function transformES2015(context) {
104127
104251
  return visitParenthesizedExpression(node, expressionResultIsUnused2);
104128
104252
  case 226 /* BinaryExpression */:
104129
104253
  return visitBinaryExpression(node, expressionResultIsUnused2);
104130
- case 354 /* CommaListExpression */:
104254
+ case 355 /* CommaListExpression */:
104131
104255
  return visitCommaListExpression(node, expressionResultIsUnused2);
104132
104256
  case 15 /* NoSubstitutionTemplateLiteral */:
104133
104257
  case 16 /* TemplateHead */:
@@ -107422,7 +107546,7 @@ function transformGenerators(context) {
107422
107546
  switch (node.kind) {
107423
107547
  case 226 /* BinaryExpression */:
107424
107548
  return visitBinaryExpression(node);
107425
- case 354 /* CommaListExpression */:
107549
+ case 355 /* CommaListExpression */:
107426
107550
  return visitCommaListExpression(node);
107427
107551
  case 227 /* ConditionalExpression */:
107428
107552
  return visitConditionalExpression(node);
@@ -109812,7 +109936,7 @@ function transformModule(context) {
109812
109936
  return visitExpressionStatement(node);
109813
109937
  case 217 /* ParenthesizedExpression */:
109814
109938
  return visitParenthesizedExpression(node, valueIsDiscarded);
109815
- case 353 /* PartiallyEmittedExpression */:
109939
+ case 354 /* PartiallyEmittedExpression */:
109816
109940
  return visitPartiallyEmittedExpression(node, valueIsDiscarded);
109817
109941
  case 213 /* CallExpression */:
109818
109942
  if (isImportCall(node) && currentSourceFile.impliedNodeFormat === void 0) {
@@ -112205,7 +112329,7 @@ function transformSystemModule(context) {
112205
112329
  return visitExpressionStatement(node);
112206
112330
  case 217 /* ParenthesizedExpression */:
112207
112331
  return visitParenthesizedExpression(node, valueIsDiscarded);
112208
- case 353 /* PartiallyEmittedExpression */:
112332
+ case 354 /* PartiallyEmittedExpression */:
112209
112333
  return visitPartiallyEmittedExpression(node, valueIsDiscarded);
112210
112334
  case 226 /* BinaryExpression */:
112211
112335
  if (isDestructuringAssignment(node)) {
@@ -114218,6 +114342,8 @@ function transformDeclarations(context) {
114218
114342
  }
114219
114343
  if (isDeclaration(input) && isDeclarationAndNotVisible(input))
114220
114344
  return;
114345
+ if (isJSDocImportTag(input))
114346
+ return;
114221
114347
  if (isFunctionLike(input) && resolver.isImplementationOfOverload(input))
114222
114348
  return;
114223
114349
  let previousEnclosingDeclaration;
@@ -114865,7 +114991,7 @@ function noEmitNotification(hint, node, callback) {
114865
114991
  }
114866
114992
  function transformNodes(resolver, host, factory2, options, nodes, transformers, allowDtsFiles) {
114867
114993
  var _a, _b;
114868
- const enabledSyntaxKindFeatures = new Array(356 /* Count */);
114994
+ const enabledSyntaxKindFeatures = new Array(357 /* Count */);
114869
114995
  let lexicalEnvironmentVariableDeclarations;
114870
114996
  let lexicalEnvironmentFunctionDeclarations;
114871
114997
  let lexicalEnvironmentStatements;
@@ -116444,7 +116570,9 @@ function createPrinter(printerOptions = {}, handlers = {}) {
116444
116570
  return emitJSDocTypedefTag(node);
116445
116571
  case 347 /* JSDocSeeTag */:
116446
116572
  return emitJSDocSeeTag(node);
116447
- case 352 /* NotEmittedStatement */:
116573
+ case 351 /* JSDocImportTag */:
116574
+ return emitJSDocImportTag(node);
116575
+ case 353 /* NotEmittedStatement */:
116448
116576
  return;
116449
116577
  }
116450
116578
  if (isExpression(node)) {
@@ -116545,15 +116673,15 @@ function createPrinter(printerOptions = {}, handlers = {}) {
116545
116673
  return emitJsxSelfClosingElement(node);
116546
116674
  case 288 /* JsxFragment */:
116547
116675
  return emitJsxFragment(node);
116548
- case 351 /* SyntaxList */:
116676
+ case 352 /* SyntaxList */:
116549
116677
  return Debug.fail("SyntaxList should not be printed");
116550
- case 352 /* NotEmittedStatement */:
116678
+ case 353 /* NotEmittedStatement */:
116551
116679
  return;
116552
- case 353 /* PartiallyEmittedExpression */:
116680
+ case 354 /* PartiallyEmittedExpression */:
116553
116681
  return emitPartiallyEmittedExpression(node);
116554
- case 354 /* CommaListExpression */:
116682
+ case 355 /* CommaListExpression */:
116555
116683
  return emitCommaList(node);
116556
- case 355 /* SyntheticReferenceExpression */:
116684
+ case 356 /* SyntheticReferenceExpression */:
116557
116685
  return Debug.fail("SyntheticReferenceExpression should not be printed");
116558
116686
  }
116559
116687
  }
@@ -118397,6 +118525,21 @@ function createPrinter(printerOptions = {}, handlers = {}) {
118397
118525
  emit(tag.name);
118398
118526
  emitJSDocComment(tag.comment);
118399
118527
  }
118528
+ function emitJSDocImportTag(tag) {
118529
+ emitJSDocTagName(tag.tagName);
118530
+ writeSpace();
118531
+ if (tag.importClause) {
118532
+ emit(tag.importClause);
118533
+ writeSpace();
118534
+ emitTokenWithComment(161 /* FromKeyword */, tag.importClause.end, writeKeyword, tag);
118535
+ writeSpace();
118536
+ }
118537
+ emitExpression(tag.moduleSpecifier);
118538
+ if (tag.attributes) {
118539
+ emitWithLeadingSpace(tag.attributes);
118540
+ }
118541
+ emitJSDocComment(tag.comment);
118542
+ }
118400
118543
  function emitJSDocNameReference(node) {
118401
118544
  writeSpace();
118402
118545
  writePunctuation("{");
@@ -119809,7 +119952,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119809
119952
  emitLeadingComments(
119810
119953
  pos,
119811
119954
  /*isEmittedNode*/
119812
- node.kind !== 352 /* NotEmittedStatement */
119955
+ node.kind !== 353 /* NotEmittedStatement */
119813
119956
  );
119814
119957
  }
119815
119958
  if (!skipLeadingComments || pos >= 0 && (emitFlags & 1024 /* NoLeadingComments */) !== 0) {
@@ -119833,7 +119976,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119833
119976
  containerPos = savedContainerPos;
119834
119977
  containerEnd = savedContainerEnd;
119835
119978
  declarationListContainerEnd = savedDeclarationListContainerEnd;
119836
- if (!skipTrailingComments && node.kind !== 352 /* NotEmittedStatement */) {
119979
+ if (!skipTrailingComments && node.kind !== 353 /* NotEmittedStatement */) {
119837
119980
  emitTrailingComments(end);
119838
119981
  }
119839
119982
  }
@@ -120085,7 +120228,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
120085
120228
  const emitFlags = getEmitFlags(node);
120086
120229
  const sourceMapRange = getSourceMapRange(node);
120087
120230
  const source = sourceMapRange.source || sourceMapSource;
120088
- if (node.kind !== 352 /* NotEmittedStatement */ && (emitFlags & 32 /* NoLeadingSourceMap */) === 0 && sourceMapRange.pos >= 0) {
120231
+ if (node.kind !== 353 /* NotEmittedStatement */ && (emitFlags & 32 /* NoLeadingSourceMap */) === 0 && sourceMapRange.pos >= 0) {
120089
120232
  emitSourcePos(sourceMapRange.source || sourceMapSource, skipSourceTrivia(source, sourceMapRange.pos));
120090
120233
  }
120091
120234
  if (emitFlags & 128 /* NoNestedSourceMaps */) {
@@ -120098,7 +120241,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
120098
120241
  if (emitFlags & 128 /* NoNestedSourceMaps */) {
120099
120242
  sourceMapsDisabled = false;
120100
120243
  }
120101
- if (node.kind !== 352 /* NotEmittedStatement */ && (emitFlags & 64 /* NoTrailingSourceMap */) === 0 && sourceMapRange.end >= 0) {
120244
+ if (node.kind !== 353 /* NotEmittedStatement */ && (emitFlags & 64 /* NoTrailingSourceMap */) === 0 && sourceMapRange.end >= 0) {
120102
120245
  emitSourcePos(sourceMapRange.source || sourceMapSource, sourceMapRange.end);
120103
120246
  }
120104
120247
  }
@@ -123022,7 +123165,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
123022
123165
  );
123023
123166
  }
123024
123167
  if (file.flags & 4194304 /* PossiblyContainsDynamicImport */ || isJavaScriptFile) {
123025
- collectDynamicImportOrRequireCalls(file);
123168
+ collectDynamicImportOrRequireOrJsDocImportCalls(file);
123026
123169
  }
123027
123170
  file.imports = imports || emptyArray;
123028
123171
  file.moduleAugmentations = moduleAugmentations || emptyArray;
@@ -123066,7 +123209,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
123066
123209
  }
123067
123210
  }
123068
123211
  }
123069
- function collectDynamicImportOrRequireCalls(file2) {
123212
+ function collectDynamicImportOrRequireOrJsDocImportCalls(file2) {
123070
123213
  const r = /import|require/g;
123071
123214
  while (r.exec(file2.text) !== null) {
123072
123215
  const node = getNodeAtPosition(file2, r.lastIndex);
@@ -123095,6 +123238,16 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
123095
123238
  false
123096
123239
  );
123097
123240
  imports = append(imports, node.argument.literal);
123241
+ } else if (isJavaScriptFile && isJSDocImportTag(node)) {
123242
+ const moduleNameExpr = getExternalModuleName(node);
123243
+ if (moduleNameExpr && isStringLiteral(moduleNameExpr) && moduleNameExpr.text) {
123244
+ setParentRecursive(
123245
+ node,
123246
+ /*incremental*/
123247
+ false
123248
+ );
123249
+ imports = append(imports, moduleNameExpr);
123250
+ }
123098
123251
  }
123099
123252
  }
123100
123253
  }
@@ -132982,7 +133135,7 @@ function symbolEscapedNameNoDefault(symbol) {
132982
133135
  });
132983
133136
  }
132984
133137
  function isModuleSpecifierLike(node) {
132985
- return isStringLiteralLike(node) && (isExternalModuleReference(node.parent) || isImportDeclaration(node.parent) || isRequireCall(
133138
+ return isStringLiteralLike(node) && (isExternalModuleReference(node.parent) || isImportDeclaration(node.parent) || isJSDocImportTag(node.parent) || isRequireCall(
132986
133139
  node.parent,
132987
133140
  /*requireStringLiteralLikeArgument*/
132988
133141
  false
@@ -136359,14 +136512,14 @@ function getSourceFileToImportFromResolved(importLiteral, resolved, oldToNew, so
136359
136512
  return newFileName && { newFileName, updated: true };
136360
136513
  }
136361
136514
  }
136362
- function updateImportsWorker(sourceFile, changeTracker, updateRef, updateImport2) {
136515
+ function updateImportsWorker(sourceFile, changeTracker, updateRef, updateImport) {
136363
136516
  for (const ref of sourceFile.referencedFiles || emptyArray) {
136364
136517
  const updated = updateRef(ref.fileName);
136365
136518
  if (updated !== void 0 && updated !== sourceFile.text.slice(ref.pos, ref.end))
136366
136519
  changeTracker.replaceRangeWithText(sourceFile, ref, updated);
136367
136520
  }
136368
136521
  for (const importStringLiteral of sourceFile.imports) {
136369
- const updated = updateImport2(importStringLiteral);
136522
+ const updated = updateImport(importStringLiteral);
136370
136523
  if (updated !== void 0 && updated !== importStringLiteral.text)
136371
136524
  changeTracker.replaceRangeWithText(sourceFile, createStringRange(importStringLiteral, sourceFile), updated);
136372
136525
  }
@@ -138790,8 +138943,8 @@ function getImportConversionInfo(context, considerPartialSpans = true) {
138790
138943
  const { file } = context;
138791
138944
  const span = getRefactorContextSpan(context);
138792
138945
  const token = getTokenAtPosition(file, span.start);
138793
- const importDecl = considerPartialSpans ? findAncestor(token, isImportDeclaration) : getParentNodeInSpan(token, file, span);
138794
- if (!importDecl || !isImportDeclaration(importDecl))
138946
+ const importDecl = considerPartialSpans ? findAncestor(token, or(isImportDeclaration, isJSDocImportTag)) : getParentNodeInSpan(token, file, span);
138947
+ if (importDecl === void 0 || !(isImportDeclaration(importDecl) || isJSDocImportTag(importDecl)))
138795
138948
  return { error: "Selection is not an import declaration." };
138796
138949
  const end = span.start + span.length;
138797
138950
  const nextToken = findNextToken(importDecl, importDecl.parent, file);
@@ -138862,15 +139015,16 @@ function doChangeNamespaceToNamed(sourceFile, checker, changes, toConvert, allow
138862
139015
  ));
138863
139016
  });
138864
139017
  const importDecl = toConvert.parent.parent;
138865
- if (usedAsNamespaceOrDefault && !allowSyntheticDefaultImports) {
138866
- changes.insertNodeAfter(sourceFile, importDecl, updateImport(
139018
+ if (usedAsNamespaceOrDefault && !allowSyntheticDefaultImports && isImportDeclaration(importDecl)) {
139019
+ changes.insertNodeAfter(sourceFile, importDecl, createImport(
138867
139020
  importDecl,
138868
139021
  /*defaultImportName*/
138869
139022
  void 0,
138870
139023
  importSpecifiers
138871
139024
  ));
138872
139025
  } else {
138873
- changes.replaceNode(sourceFile, importDecl, updateImport(importDecl, usedAsNamespaceOrDefault ? factory.createIdentifier(toConvert.name.text) : void 0, importSpecifiers));
139026
+ const defaultImportName = usedAsNamespaceOrDefault ? factory.createIdentifier(toConvert.name.text) : void 0;
139027
+ changes.replaceNode(sourceFile, toConvert.parent, createImportClause(defaultImportName, importSpecifiers));
138874
139028
  }
138875
139029
  }
138876
139030
  function getRightOfPropertyAccessOrQualifiedName(propertyAccessOrQualifiedName) {
@@ -138930,9 +139084,9 @@ function doChangeNamedToNamespaceOrDefault(sourceFile, program, changes, toConve
138930
139084
  toConvert,
138931
139085
  shouldUseDefault ? factory.createIdentifier(namespaceImportName) : factory.createNamespaceImport(factory.createIdentifier(namespaceImportName))
138932
139086
  );
138933
- if (neededNamedImports.size) {
139087
+ if (neededNamedImports.size && isImportDeclaration(importDecl)) {
138934
139088
  const newNamedImports = arrayFrom(neededNamedImports.values(), (element) => factory.createImportSpecifier(element.isTypeOnly, element.propertyName && factory.createIdentifier(element.propertyName.text), factory.createIdentifier(element.name.text)));
138935
- changes.insertNodeAfter(sourceFile, toConvert.parent.parent, updateImport(
139089
+ changes.insertNodeAfter(sourceFile, toConvert.parent.parent, createImport(
138936
139090
  importDecl,
138937
139091
  /*defaultImportName*/
138938
139092
  void 0,
@@ -138947,21 +139101,24 @@ function isExportEqualsModule(moduleSpecifier, checker) {
138947
139101
  const exportEquals = checker.resolveExternalModuleSymbol(externalModule);
138948
139102
  return externalModule !== exportEquals;
138949
139103
  }
138950
- function updateImport(old, defaultImportName, elements) {
139104
+ function createImport(node, defaultImportName, elements) {
138951
139105
  return factory.createImportDeclaration(
138952
139106
  /*modifiers*/
138953
139107
  void 0,
138954
- factory.createImportClause(
138955
- /*isTypeOnly*/
138956
- false,
138957
- defaultImportName,
138958
- elements && elements.length ? factory.createNamedImports(elements) : void 0
138959
- ),
138960
- old.moduleSpecifier,
139108
+ createImportClause(defaultImportName, elements),
139109
+ node.moduleSpecifier,
138961
139110
  /*attributes*/
138962
139111
  void 0
138963
139112
  );
138964
139113
  }
139114
+ function createImportClause(defaultImportName, elements) {
139115
+ return factory.createImportClause(
139116
+ /*isTypeOnly*/
139117
+ false,
139118
+ defaultImportName,
139119
+ elements && elements.length ? factory.createNamedImports(elements) : void 0
139120
+ );
139121
+ }
138965
139122
 
138966
139123
  // src/services/refactors/extractType.ts
138967
139124
  var refactorName3 = "Extract type";
@@ -144184,7 +144341,7 @@ var NodeObject = class {
144184
144341
  if (!children.length) {
144185
144342
  return void 0;
144186
144343
  }
144187
- const child = find(children, (kid) => kid.kind < 309 /* FirstJSDocNode */ || kid.kind > 350 /* LastJSDocNode */);
144344
+ const child = find(children, (kid) => kid.kind < 309 /* FirstJSDocNode */ || kid.kind > 351 /* LastJSDocNode */);
144188
144345
  return child.kind < 166 /* FirstNode */ ? child : child.getFirstToken(sourceFile);
144189
144346
  }
144190
144347
  getLastToken(sourceFile) {
@@ -144251,7 +144408,7 @@ function addSyntheticNodes(nodes, pos, end, parent2) {
144251
144408
  }
144252
144409
  }
144253
144410
  function createSyntaxList(nodes, parent2) {
144254
- const list = createNode(351 /* SyntaxList */, nodes.pos, nodes.end, parent2);
144411
+ const list = createNode(352 /* SyntaxList */, nodes.pos, nodes.end, parent2);
144255
144412
  list._children = [];
144256
144413
  let pos = nodes.pos;
144257
144414
  for (const node of nodes) {
@@ -149856,7 +150013,7 @@ registerCodeFix({
149856
150013
  const declaration = getDeclaration2(context.sourceFile, context.span.start);
149857
150014
  if (declaration) {
149858
150015
  const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange11(t, context.sourceFile, declaration));
149859
- const importDeclarationChanges = declaration.kind === 276 /* ImportSpecifier */ && canConvertImportDeclarationForSpecifier(declaration, context.sourceFile, context.program) ? ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange11(t, context.sourceFile, declaration.parent.parent.parent)) : void 0;
150016
+ const importDeclarationChanges = declaration.kind === 276 /* ImportSpecifier */ && isImportDeclaration(declaration.parent.parent.parent) && canConvertImportDeclarationForSpecifier(declaration, context.sourceFile, context.program) ? ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange11(t, context.sourceFile, declaration.parent.parent.parent)) : void 0;
149860
150017
  const mainAction = createCodeFixAction(
149861
150018
  fixId13,
149862
150019
  changes,
@@ -149882,7 +150039,7 @@ registerCodeFix({
149882
150039
  if ((errorDeclaration == null ? void 0 : errorDeclaration.kind) === 272 /* ImportDeclaration */ && !fixedImportDeclarations.has(errorDeclaration)) {
149883
150040
  doChange11(changes, diag2.file, errorDeclaration);
149884
150041
  fixedImportDeclarations.add(errorDeclaration);
149885
- } else if ((errorDeclaration == null ? void 0 : errorDeclaration.kind) === 276 /* ImportSpecifier */ && !fixedImportDeclarations.has(errorDeclaration.parent.parent.parent) && canConvertImportDeclarationForSpecifier(errorDeclaration, diag2.file, context.program)) {
150042
+ } else if ((errorDeclaration == null ? void 0 : errorDeclaration.kind) === 276 /* ImportSpecifier */ && isImportDeclaration(errorDeclaration.parent.parent.parent) && !fixedImportDeclarations.has(errorDeclaration.parent.parent.parent) && canConvertImportDeclarationForSpecifier(errorDeclaration, diag2.file, context.program)) {
149886
150043
  doChange11(changes, diag2.file, errorDeclaration.parent.parent.parent);
149887
150044
  fixedImportDeclarations.add(errorDeclaration.parent.parent.parent);
149888
150045
  } else if ((errorDeclaration == null ? void 0 : errorDeclaration.kind) === 276 /* ImportSpecifier */) {
@@ -150754,6 +150911,7 @@ function getNamespaceLikeImportText(declaration) {
150754
150911
  return (_a = tryCast(declaration.name, isIdentifier)) == null ? void 0 : _a.text;
150755
150912
  case 271 /* ImportEqualsDeclaration */:
150756
150913
  return declaration.name.text;
150914
+ case 351 /* JSDocImportTag */:
150757
150915
  case 272 /* ImportDeclaration */:
150758
150916
  return (_c = tryCast((_b = declaration.importClause) == null ? void 0 : _b.namedBindings, isNamespaceImport)) == null ? void 0 : _c.name.text;
150759
150917
  default:
@@ -150831,7 +150989,7 @@ function createExistingImportMap(checker, importingFile, compilerOptions) {
150831
150989
  if (moduleSymbol) {
150832
150990
  (importMap || (importMap = createMultiMap())).add(getSymbolId(moduleSymbol), i.parent);
150833
150991
  }
150834
- } else if (i.kind === 272 /* ImportDeclaration */ || i.kind === 271 /* ImportEqualsDeclaration */) {
150992
+ } else if (i.kind === 272 /* ImportDeclaration */ || i.kind === 271 /* ImportEqualsDeclaration */ || i.kind === 351 /* JSDocImportTag */) {
150835
150993
  const moduleSymbol = checker.getSymbolAtLocation(moduleSpecifier);
150836
150994
  if (moduleSymbol) {
150837
150995
  (importMap || (importMap = createMultiMap())).add(getSymbolId(moduleSymbol), i);
@@ -150840,11 +150998,11 @@ function createExistingImportMap(checker, importingFile, compilerOptions) {
150840
150998
  }
150841
150999
  return {
150842
151000
  getImportsForExportInfo: ({ moduleSymbol, exportKind, targetFlags, symbol }) => {
150843
- if (!(targetFlags & 111551 /* Value */) && isSourceFileJS(importingFile))
150844
- return emptyArray;
150845
151001
  const matchingDeclarations = importMap == null ? void 0 : importMap.get(getSymbolId(moduleSymbol));
150846
151002
  if (!matchingDeclarations)
150847
151003
  return emptyArray;
151004
+ if (isSourceFileJS(importingFile) && !(targetFlags & 111551 /* Value */) && !every(matchingDeclarations, isJSDocImportTag))
151005
+ return emptyArray;
150848
151006
  const importKind = getImportKind(importingFile, exportKind, compilerOptions);
150849
151007
  return matchingDeclarations.map((declaration) => ({ declaration, importKind, symbol, targetFlags }));
150850
151008
  }
@@ -157104,7 +157262,7 @@ function getInfo19(sourceFile, pos) {
157104
157262
  const { parent: parent2 } = name;
157105
157263
  if (isImportEqualsDeclaration(parent2) && isExternalModuleReference(parent2.moduleReference)) {
157106
157264
  return { importNode: parent2, name, moduleSpecifier: parent2.moduleReference.expression };
157107
- } else if (isNamespaceImport(parent2)) {
157265
+ } else if (isNamespaceImport(parent2) && isImportDeclaration(parent2.parent.parent)) {
157108
157266
  const importNode = parent2.parent.parent;
157109
157267
  return { importNode, name, moduleSpecifier: importNode.moduleSpecifier };
157110
157268
  }
@@ -159614,6 +159772,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
159614
159772
  const insideComment = isInComment(sourceFile, position, currentToken);
159615
159773
  log("getCompletionData: Is inside comment: " + (timestamp() - start));
159616
159774
  let insideJsDocTagTypeExpression = false;
159775
+ let insideJsDocImportTag = false;
159617
159776
  let isInSnippetScope = false;
159618
159777
  if (insideComment) {
159619
159778
  if (hasDocComment(sourceFile, position)) {
@@ -159631,24 +159790,28 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
159631
159790
  if (tag.tagName.pos <= position && position <= tag.tagName.end) {
159632
159791
  return { kind: 1 /* JsDocTagName */ };
159633
159792
  }
159634
- const typeExpression = tryGetTypeExpressionFromTag(tag);
159635
- if (typeExpression) {
159636
- currentToken = getTokenAtPosition(sourceFile, position);
159637
- if (!currentToken || !isDeclarationName(currentToken) && (currentToken.parent.kind !== 348 /* JSDocPropertyTag */ || currentToken.parent.name !== currentToken)) {
159638
- insideJsDocTagTypeExpression = isCurrentlyEditingNode(typeExpression);
159793
+ if (isJSDocImportTag(tag)) {
159794
+ insideJsDocImportTag = true;
159795
+ } else {
159796
+ const typeExpression = tryGetTypeExpressionFromTag(tag);
159797
+ if (typeExpression) {
159798
+ currentToken = getTokenAtPosition(sourceFile, position);
159799
+ if (!currentToken || !isDeclarationName(currentToken) && (currentToken.parent.kind !== 348 /* JSDocPropertyTag */ || currentToken.parent.name !== currentToken)) {
159800
+ insideJsDocTagTypeExpression = isCurrentlyEditingNode(typeExpression);
159801
+ }
159802
+ }
159803
+ if (!insideJsDocTagTypeExpression && isJSDocParameterTag(tag) && (nodeIsMissing(tag.name) || tag.name.pos <= position && position <= tag.name.end)) {
159804
+ return { kind: 3 /* JsDocParameterName */, tag };
159639
159805
  }
159640
- }
159641
- if (!insideJsDocTagTypeExpression && isJSDocParameterTag(tag) && (nodeIsMissing(tag.name) || tag.name.pos <= position && position <= tag.name.end)) {
159642
- return { kind: 3 /* JsDocParameterName */, tag };
159643
159806
  }
159644
159807
  }
159645
- if (!insideJsDocTagTypeExpression) {
159808
+ if (!insideJsDocTagTypeExpression && !insideJsDocImportTag) {
159646
159809
  log("Returning an empty list because completion was inside a regular comment or plain text part of a JsDoc comment.");
159647
159810
  return void 0;
159648
159811
  }
159649
159812
  }
159650
159813
  start = timestamp();
159651
- const isJsOnlyLocation = !insideJsDocTagTypeExpression && isSourceFileJS(sourceFile);
159814
+ const isJsOnlyLocation = !insideJsDocTagTypeExpression && !insideJsDocImportTag && isSourceFileJS(sourceFile);
159652
159815
  const tokens = getRelevantTokens(position, sourceFile);
159653
159816
  const previousToken = tokens.previousToken;
159654
159817
  let contextToken = tokens.contextToken;
@@ -160161,7 +160324,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
160161
160324
  }
160162
160325
  }
160163
160326
  function isTypeOnlyCompletion() {
160164
- return insideJsDocTagTypeExpression || !!importStatementCompletion && isTypeOnlyImportOrExportDeclaration(location.parent) || !isContextTokenValueLocation(contextToken) && (isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker) || isPartOfTypeNode(location) || isContextTokenTypeLocation(contextToken));
160327
+ return insideJsDocTagTypeExpression || insideJsDocImportTag || !!importStatementCompletion && isTypeOnlyImportOrExportDeclaration(location.parent) || !isContextTokenValueLocation(contextToken) && (isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker) || isPartOfTypeNode(location) || isContextTokenTypeLocation(contextToken));
160165
160328
  }
160166
160329
  function isContextTokenValueLocation(contextToken2) {
160167
160330
  return contextToken2 && (contextToken2.kind === 114 /* TypeOfKeyword */ && (contextToken2.parent.kind === 186 /* TypeQuery */ || isTypeOfExpression(contextToken2.parent)) || contextToken2.kind === 131 /* AssertsKeyword */ && contextToken2.parent.kind === 182 /* TypePredicate */);
@@ -161185,7 +161348,7 @@ function getPropertiesForCompletion(type, checker) {
161185
161348
  }
161186
161349
  function tryGetObjectTypeDeclarationCompletionContainer(sourceFile, contextToken, location, position) {
161187
161350
  switch (location.kind) {
161188
- case 351 /* SyntaxList */:
161351
+ case 352 /* SyntaxList */:
161189
161352
  return tryCast(location.parent, isObjectTypeDeclaration);
161190
161353
  case 1 /* EndOfFileToken */:
161191
161354
  const cls = tryCast(lastOrUndefined(cast(location.parent, isSourceFile).statements), isObjectTypeDeclaration);
@@ -161416,13 +161579,13 @@ function getSingleLineReplacementSpanForImportCompletionNode(node) {
161416
161579
  var _a;
161417
161580
  if (!node)
161418
161581
  return void 0;
161419
- const top = findAncestor(node, or(isImportDeclaration, isImportEqualsDeclaration)) ?? node;
161582
+ const top = findAncestor(node, or(isImportDeclaration, isImportEqualsDeclaration, isJSDocImportTag)) ?? node;
161420
161583
  const sourceFile = top.getSourceFile();
161421
161584
  if (rangeIsOnSingleLine(top, sourceFile)) {
161422
161585
  return createTextSpanFromNode(top, sourceFile);
161423
161586
  }
161424
161587
  Debug.assert(top.kind !== 102 /* ImportKeyword */ && top.kind !== 276 /* ImportSpecifier */);
161425
- const potentialSplitPoint = top.kind === 272 /* ImportDeclaration */ ? getPotentiallyInvalidImportSpecifier((_a = top.importClause) == null ? void 0 : _a.namedBindings) ?? top.moduleSpecifier : top.moduleReference;
161588
+ const potentialSplitPoint = top.kind === 272 /* ImportDeclaration */ || top.kind === 351 /* JSDocImportTag */ ? getPotentiallyInvalidImportSpecifier((_a = top.importClause) == null ? void 0 : _a.namedBindings) ?? top.moduleSpecifier : top.moduleReference;
161426
161589
  const withoutModuleSpecifier = {
161427
161590
  pos: top.getFirstToken().getStart(),
161428
161591
  end: potentialSplitPoint.pos
@@ -161718,6 +161881,7 @@ function getStringLiteralCompletionEntries(sourceFile, node, position, program,
161718
161881
  case 272 /* ImportDeclaration */:
161719
161882
  case 278 /* ExportDeclaration */:
161720
161883
  case 283 /* ExternalModuleReference */:
161884
+ case 351 /* JSDocImportTag */:
161721
161885
  return { kind: 0 /* Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, program, host, preferences) };
161722
161886
  case 296 /* CaseClause */:
161723
161887
  const tracker = newCaseClauseTracker(typeChecker, parent2.parent.clauses);
@@ -162514,6 +162678,7 @@ function getImportersForExport(sourceFiles, sourceFilesSet, allDirectImports, {
162514
162678
  );
162515
162679
  break;
162516
162680
  case 272 /* ImportDeclaration */:
162681
+ case 351 /* JSDocImportTag */:
162517
162682
  directImports.push(direct);
162518
162683
  const namedBindings = direct.importClause && direct.importClause.namedBindings;
162519
162684
  if (namedBindings && namedBindings.kind === 274 /* NamespaceImport */) {
@@ -166247,6 +166412,7 @@ var jsDocTagNames = [
166247
166412
  "host",
166248
166413
  "ignore",
166249
166414
  "implements",
166415
+ "import",
166250
166416
  "inheritdoc",
166251
166417
  "inner",
166252
166418
  "instance",
@@ -174749,6 +174915,7 @@ __export(ts_exports2, {
174749
174915
  isJSDocEnumTag: () => isJSDocEnumTag,
174750
174916
  isJSDocFunctionType: () => isJSDocFunctionType,
174751
174917
  isJSDocImplementsTag: () => isJSDocImplementsTag,
174918
+ isJSDocImportTag: () => isJSDocImportTag,
174752
174919
  isJSDocIndexSignature: () => isJSDocIndexSignature,
174753
174920
  isJSDocLikeText: () => isJSDocLikeText,
174754
174921
  isJSDocLink: () => isJSDocLink,
@@ -188951,6 +189118,7 @@ if (typeof console !== "undefined") {
188951
189118
  isJSDocEnumTag,
188952
189119
  isJSDocFunctionType,
188953
189120
  isJSDocImplementsTag,
189121
+ isJSDocImportTag,
188954
189122
  isJSDocIndexSignature,
188955
189123
  isJSDocLikeText,
188956
189124
  isJSDocLink,