typescript 5.5.0-dev.20240326 → 5.5.0-dev.20240328

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
@@ -402,6 +402,7 @@ __export(typescript_exports, {
402
402
  createEmitAndSemanticDiagnosticsBuilderProgram: () => createEmitAndSemanticDiagnosticsBuilderProgram,
403
403
  createEmitHelperFactory: () => createEmitHelperFactory,
404
404
  createEmptyExports: () => createEmptyExports,
405
+ createEvaluator: () => createEvaluator,
405
406
  createExpressionForJsxElement: () => createExpressionForJsxElement,
406
407
  createExpressionForJsxFragment: () => createExpressionForJsxFragment,
407
408
  createExpressionForObjectLiteralElementLike: () => createExpressionForObjectLiteralElementLike,
@@ -1466,6 +1467,7 @@ __export(typescript_exports, {
1466
1467
  isJSDocEnumTag: () => isJSDocEnumTag,
1467
1468
  isJSDocFunctionType: () => isJSDocFunctionType,
1468
1469
  isJSDocImplementsTag: () => isJSDocImplementsTag,
1470
+ isJSDocImportTag: () => isJSDocImportTag,
1469
1471
  isJSDocIndexSignature: () => isJSDocIndexSignature,
1470
1472
  isJSDocLikeText: () => isJSDocLikeText,
1471
1473
  isJSDocLink: () => isJSDocLink,
@@ -2326,7 +2328,7 @@ module.exports = __toCommonJS(typescript_exports);
2326
2328
 
2327
2329
  // src/compiler/corePublic.ts
2328
2330
  var versionMajorMinor = "5.5";
2329
- var version = `${versionMajorMinor}.0-dev.20240326`;
2331
+ var version = `${versionMajorMinor}.0-dev.20240328`;
2330
2332
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2331
2333
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2332
2334
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -6071,12 +6073,13 @@ var SyntaxKind = /* @__PURE__ */ ((SyntaxKind5) => {
6071
6073
  SyntaxKind5[SyntaxKind5["JSDocPropertyTag"] = 348] = "JSDocPropertyTag";
6072
6074
  SyntaxKind5[SyntaxKind5["JSDocThrowsTag"] = 349] = "JSDocThrowsTag";
6073
6075
  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";
6076
+ SyntaxKind5[SyntaxKind5["JSDocImportTag"] = 351] = "JSDocImportTag";
6077
+ SyntaxKind5[SyntaxKind5["SyntaxList"] = 352] = "SyntaxList";
6078
+ SyntaxKind5[SyntaxKind5["NotEmittedStatement"] = 353] = "NotEmittedStatement";
6079
+ SyntaxKind5[SyntaxKind5["PartiallyEmittedExpression"] = 354] = "PartiallyEmittedExpression";
6080
+ SyntaxKind5[SyntaxKind5["CommaListExpression"] = 355] = "CommaListExpression";
6081
+ SyntaxKind5[SyntaxKind5["SyntheticReferenceExpression"] = 356] = "SyntheticReferenceExpression";
6082
+ SyntaxKind5[SyntaxKind5["Count"] = 357] = "Count";
6080
6083
  SyntaxKind5[SyntaxKind5["FirstAssignment"] = 64 /* EqualsToken */] = "FirstAssignment";
6081
6084
  SyntaxKind5[SyntaxKind5["LastAssignment"] = 79 /* CaretEqualsToken */] = "LastAssignment";
6082
6085
  SyntaxKind5[SyntaxKind5["FirstCompoundAssignment"] = 65 /* PlusEqualsToken */] = "FirstCompoundAssignment";
@@ -6105,9 +6108,9 @@ var SyntaxKind = /* @__PURE__ */ ((SyntaxKind5) => {
6105
6108
  SyntaxKind5[SyntaxKind5["LastStatement"] = 259 /* DebuggerStatement */] = "LastStatement";
6106
6109
  SyntaxKind5[SyntaxKind5["FirstNode"] = 166 /* QualifiedName */] = "FirstNode";
6107
6110
  SyntaxKind5[SyntaxKind5["FirstJSDocNode"] = 309 /* JSDocTypeExpression */] = "FirstJSDocNode";
6108
- SyntaxKind5[SyntaxKind5["LastJSDocNode"] = 350 /* JSDocSatisfiesTag */] = "LastJSDocNode";
6111
+ SyntaxKind5[SyntaxKind5["LastJSDocNode"] = 351 /* JSDocImportTag */] = "LastJSDocNode";
6109
6112
  SyntaxKind5[SyntaxKind5["FirstJSDocTagNode"] = 327 /* JSDocTag */] = "FirstJSDocTagNode";
6110
- SyntaxKind5[SyntaxKind5["LastJSDocTagNode"] = 350 /* JSDocSatisfiesTag */] = "LastJSDocTagNode";
6113
+ SyntaxKind5[SyntaxKind5["LastJSDocTagNode"] = 351 /* JSDocImportTag */] = "LastJSDocTagNode";
6111
6114
  SyntaxKind5[SyntaxKind5["FirstContextualKeyword"] = 128 /* AbstractKeyword */] = "FirstContextualKeyword";
6112
6115
  SyntaxKind5[SyntaxKind5["LastContextualKeyword"] = 165 /* OfKeyword */] = "LastContextualKeyword";
6113
6116
  return SyntaxKind5;
@@ -6693,6 +6696,7 @@ var ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => {
6693
6696
  ObjectFlags3[ObjectFlags3["ContainsSpread"] = 2097152] = "ContainsSpread";
6694
6697
  ObjectFlags3[ObjectFlags3["ObjectRestType"] = 4194304] = "ObjectRestType";
6695
6698
  ObjectFlags3[ObjectFlags3["InstantiationExpressionType"] = 8388608] = "InstantiationExpressionType";
6699
+ ObjectFlags3[ObjectFlags3["SingleSignatureType"] = 134217728] = "SingleSignatureType";
6696
6700
  ObjectFlags3[ObjectFlags3["IsClassInstanceClone"] = 16777216] = "IsClassInstanceClone";
6697
6701
  ObjectFlags3[ObjectFlags3["IdenticalBaseTypeCalculated"] = 33554432] = "IdenticalBaseTypeCalculated";
6698
6702
  ObjectFlags3[ObjectFlags3["IdenticalBaseTypeExists"] = 67108864] = "IdenticalBaseTypeExists";
@@ -12042,7 +12046,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12042
12046
  var tokenValue;
12043
12047
  var tokenFlags;
12044
12048
  var commentDirectives;
12045
- var inJSDocType = 0;
12049
+ var skipJsDocLeadingAsterisks = 0;
12046
12050
  var scriptKind = 0 /* Unknown */;
12047
12051
  var jsDocParsingMode = 0 /* ParseAll */;
12048
12052
  setText(text, start, length2);
@@ -12093,7 +12097,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12093
12097
  setOnError,
12094
12098
  resetTokenState,
12095
12099
  setTextPos: resetTokenState,
12096
- setInJSDocType,
12100
+ setSkipJsDocLeadingAsterisks,
12097
12101
  tryScan,
12098
12102
  lookAhead,
12099
12103
  scanRange
@@ -12809,7 +12813,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12809
12813
  return pos += 2, token = 43 /* AsteriskAsteriskToken */;
12810
12814
  }
12811
12815
  pos++;
12812
- if (inJSDocType && !asteriskSeen && tokenFlags & 1 /* PrecedingLineBreak */) {
12816
+ if (skipJsDocLeadingAsterisks && !asteriskSeen && tokenFlags & 1 /* PrecedingLineBreak */) {
12813
12817
  asteriskSeen = true;
12814
12818
  continue;
12815
12819
  }
@@ -13587,8 +13591,8 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13587
13591
  tokenValue = void 0;
13588
13592
  tokenFlags = 0 /* None */;
13589
13593
  }
13590
- function setInJSDocType(inType) {
13591
- inJSDocType += inType ? 1 : -1;
13594
+ function setSkipJsDocLeadingAsterisks(skip) {
13595
+ skipJsDocLeadingAsterisks += skip ? 1 : -1;
13592
13596
  }
13593
13597
  }
13594
13598
  function codePointAt(s, i) {
@@ -14791,8 +14795,8 @@ function isExpressionKind(kind) {
14791
14795
  case 230 /* SpreadElement */:
14792
14796
  case 234 /* AsExpression */:
14793
14797
  case 232 /* OmittedExpression */:
14794
- case 354 /* CommaListExpression */:
14795
- case 353 /* PartiallyEmittedExpression */:
14798
+ case 355 /* CommaListExpression */:
14799
+ case 354 /* PartiallyEmittedExpression */:
14796
14800
  case 238 /* SatisfiesExpression */:
14797
14801
  return true;
14798
14802
  default:
@@ -14977,7 +14981,7 @@ function isDeclarationStatementKind(kind) {
14977
14981
  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
14982
  }
14979
14983
  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 */;
14984
+ 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
14985
  }
14982
14986
  function isDeclaration(node) {
14983
14987
  if (node.kind === 168 /* TypeParameter */) {
@@ -15038,13 +15042,13 @@ function isCaseOrDefaultClause(node) {
15038
15042
  return kind === 296 /* CaseClause */ || kind === 297 /* DefaultClause */;
15039
15043
  }
15040
15044
  function isJSDocNode(node) {
15041
- return node.kind >= 309 /* FirstJSDocNode */ && node.kind <= 350 /* LastJSDocNode */;
15045
+ return node.kind >= 309 /* FirstJSDocNode */ && node.kind <= 351 /* LastJSDocNode */;
15042
15046
  }
15043
15047
  function isJSDocCommentContainingNode(node) {
15044
15048
  return node.kind === 320 /* JSDoc */ || node.kind === 319 /* JSDocNamepathType */ || node.kind === 321 /* JSDocText */ || isJSDocLinkLike(node) || isJSDocTag(node) || isJSDocTypeLiteral(node) || isJSDocSignature(node);
15045
15049
  }
15046
15050
  function isJSDocTag(node) {
15047
- return node.kind >= 327 /* FirstJSDocTagNode */ && node.kind <= 350 /* LastJSDocTagNode */;
15051
+ return node.kind >= 327 /* FirstJSDocTagNode */ && node.kind <= 351 /* LastJSDocTagNode */;
15048
15052
  }
15049
15053
  function isSetAccessor(node) {
15050
15054
  return node.kind === 178 /* SetAccessor */;
@@ -15542,7 +15546,7 @@ function getTokenPosOfNode(node, sourceFile, includeJsDoc) {
15542
15546
  if (includeJsDoc && hasJSDocNodes(node)) {
15543
15547
  return getTokenPosOfNode(node.jsDoc[0], sourceFile);
15544
15548
  }
15545
- if (node.kind === 351 /* SyntaxList */ && node._children.length > 0) {
15549
+ if (node.kind === 352 /* SyntaxList */ && node._children.length > 0) {
15546
15550
  return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc);
15547
15551
  }
15548
15552
  return skipTrivia(
@@ -17578,6 +17582,7 @@ function tryGetModuleSpecifierFromDeclaration(node) {
17578
17582
  ))) == null ? void 0 : _a.arguments[0];
17579
17583
  case 272 /* ImportDeclaration */:
17580
17584
  case 278 /* ExportDeclaration */:
17585
+ case 351 /* JSDocImportTag */:
17581
17586
  return tryCast(node.moduleSpecifier, isStringLiteralLike);
17582
17587
  case 271 /* ImportEqualsDeclaration */:
17583
17588
  return tryCast((_b = tryCast(node.moduleReference, isExternalModuleReference)) == null ? void 0 : _b.expression, isStringLiteralLike);
@@ -17602,6 +17607,7 @@ function tryGetImportFromModuleSpecifier(node) {
17602
17607
  switch (node.parent.kind) {
17603
17608
  case 272 /* ImportDeclaration */:
17604
17609
  case 278 /* ExportDeclaration */:
17610
+ case 351 /* JSDocImportTag */:
17605
17611
  return node.parent;
17606
17612
  case 283 /* ExternalModuleReference */:
17607
17613
  return node.parent.parent;
@@ -17622,6 +17628,7 @@ function getExternalModuleName(node) {
17622
17628
  switch (node.kind) {
17623
17629
  case 272 /* ImportDeclaration */:
17624
17630
  case 278 /* ExportDeclaration */:
17631
+ case 351 /* JSDocImportTag */:
17625
17632
  return node.moduleSpecifier;
17626
17633
  case 271 /* ImportEqualsDeclaration */:
17627
17634
  return node.moduleReference.kind === 283 /* ExternalModuleReference */ ? node.moduleReference.expression : void 0;
@@ -17648,7 +17655,7 @@ function getNamespaceDeclarationNode(node) {
17648
17655
  }
17649
17656
  }
17650
17657
  function isDefaultImport(node) {
17651
- return node.kind === 272 /* ImportDeclaration */ && !!node.importClause && !!node.importClause.name;
17658
+ return (node.kind === 272 /* ImportDeclaration */ || node.kind === 351 /* JSDocImportTag */) && !!node.importClause && !!node.importClause.name;
17652
17659
  }
17653
17660
  function forEachImportClauseDeclaration(node, action) {
17654
17661
  if (node.name) {
@@ -18538,7 +18545,7 @@ var OperatorPrecedence = /* @__PURE__ */ ((OperatorPrecedence2) => {
18538
18545
  })(OperatorPrecedence || {});
18539
18546
  function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) {
18540
18547
  switch (nodeKind) {
18541
- case 354 /* CommaListExpression */:
18548
+ case 355 /* CommaListExpression */:
18542
18549
  return 0 /* Comma */;
18543
18550
  case 230 /* SpreadElement */:
18544
18551
  return 1 /* Spread */;
@@ -20235,7 +20242,7 @@ function getLeftmostExpression(node, stopAtCallExpressions) {
20235
20242
  case 212 /* ElementAccessExpression */:
20236
20243
  case 211 /* PropertyAccessExpression */:
20237
20244
  case 235 /* NonNullExpression */:
20238
- case 353 /* PartiallyEmittedExpression */:
20245
+ case 354 /* PartiallyEmittedExpression */:
20239
20246
  case 238 /* SatisfiesExpression */:
20240
20247
  node = node.expression;
20241
20248
  continue;
@@ -21677,7 +21684,7 @@ function getContainingNodeArray(node) {
21677
21684
  return parent2.types;
21678
21685
  case 189 /* TupleType */:
21679
21686
  case 209 /* ArrayLiteralExpression */:
21680
- case 354 /* CommaListExpression */:
21687
+ case 355 /* CommaListExpression */:
21681
21688
  case 275 /* NamedImports */:
21682
21689
  case 279 /* NamedExports */:
21683
21690
  return parent2.elements;
@@ -21930,6 +21937,91 @@ function isSyntacticallyString(expr) {
21930
21937
  }
21931
21938
  return false;
21932
21939
  }
21940
+ function createEvaluator({ evaluateElementAccessExpression, evaluateEntityNameExpression }) {
21941
+ function evaluate(expr, location) {
21942
+ switch (expr.kind) {
21943
+ case 224 /* PrefixUnaryExpression */:
21944
+ const value = evaluate(expr.operand, location);
21945
+ if (typeof value === "number") {
21946
+ switch (expr.operator) {
21947
+ case 40 /* PlusToken */:
21948
+ return value;
21949
+ case 41 /* MinusToken */:
21950
+ return -value;
21951
+ case 55 /* TildeToken */:
21952
+ return ~value;
21953
+ }
21954
+ }
21955
+ break;
21956
+ case 226 /* BinaryExpression */:
21957
+ const left = evaluate(expr.left, location);
21958
+ const right = evaluate(expr.right, location);
21959
+ if (typeof left === "number" && typeof right === "number") {
21960
+ switch (expr.operatorToken.kind) {
21961
+ case 52 /* BarToken */:
21962
+ return left | right;
21963
+ case 51 /* AmpersandToken */:
21964
+ return left & right;
21965
+ case 49 /* GreaterThanGreaterThanToken */:
21966
+ return left >> right;
21967
+ case 50 /* GreaterThanGreaterThanGreaterThanToken */:
21968
+ return left >>> right;
21969
+ case 48 /* LessThanLessThanToken */:
21970
+ return left << right;
21971
+ case 53 /* CaretToken */:
21972
+ return left ^ right;
21973
+ case 42 /* AsteriskToken */:
21974
+ return left * right;
21975
+ case 44 /* SlashToken */:
21976
+ return left / right;
21977
+ case 40 /* PlusToken */:
21978
+ return left + right;
21979
+ case 41 /* MinusToken */:
21980
+ return left - right;
21981
+ case 45 /* PercentToken */:
21982
+ return left % right;
21983
+ case 43 /* AsteriskAsteriskToken */:
21984
+ return left ** right;
21985
+ }
21986
+ } else if ((typeof left === "string" || typeof left === "number") && (typeof right === "string" || typeof right === "number") && expr.operatorToken.kind === 40 /* PlusToken */) {
21987
+ return "" + left + right;
21988
+ }
21989
+ break;
21990
+ case 11 /* StringLiteral */:
21991
+ case 15 /* NoSubstitutionTemplateLiteral */:
21992
+ return expr.text;
21993
+ case 228 /* TemplateExpression */:
21994
+ return evaluateTemplateExpression(expr, location);
21995
+ case 9 /* NumericLiteral */:
21996
+ return +expr.text;
21997
+ case 217 /* ParenthesizedExpression */:
21998
+ return evaluate(expr.expression, location);
21999
+ case 80 /* Identifier */:
22000
+ return evaluateEntityNameExpression(expr, location);
22001
+ case 211 /* PropertyAccessExpression */:
22002
+ if (isEntityNameExpression(expr)) {
22003
+ return evaluateEntityNameExpression(expr, location);
22004
+ }
22005
+ break;
22006
+ case 212 /* ElementAccessExpression */:
22007
+ return evaluateElementAccessExpression(expr, location);
22008
+ }
22009
+ return void 0;
22010
+ }
22011
+ function evaluateTemplateExpression(expr, location) {
22012
+ let result = expr.head.text;
22013
+ for (const span of expr.templateSpans) {
22014
+ const value = evaluate(span.expression, location);
22015
+ if (value === void 0) {
22016
+ return void 0;
22017
+ }
22018
+ result += value;
22019
+ result += span.literal.text;
22020
+ }
22021
+ return result;
22022
+ }
22023
+ return evaluate;
22024
+ }
21933
22025
 
21934
22026
  // src/compiler/factory/baseNodeFactory.ts
21935
22027
  function createBaseNodeFactory() {
@@ -22804,7 +22896,7 @@ function createNodeFactory(flags, baseFactory2) {
22804
22896
  updateImportEqualsDeclaration,
22805
22897
  createImportDeclaration,
22806
22898
  updateImportDeclaration,
22807
- createImportClause,
22899
+ createImportClause: createImportClause2,
22808
22900
  updateImportClause,
22809
22901
  createAssertClause,
22810
22902
  updateAssertClause,
@@ -22898,6 +22990,8 @@ function createNodeFactory(flags, baseFactory2) {
22898
22990
  updateJSDocImplementsTag,
22899
22991
  createJSDocSeeTag,
22900
22992
  updateJSDocSeeTag,
22993
+ createJSDocImportTag,
22994
+ updateJSDocImportTag,
22901
22995
  createJSDocNameReference,
22902
22996
  updateJSDocNameReference,
22903
22997
  createJSDocMemberName,
@@ -25237,7 +25331,7 @@ function createNodeFactory(flags, baseFactory2) {
25237
25331
  function updateImportDeclaration(node, modifiers, importClause, moduleSpecifier, attributes) {
25238
25332
  return node.modifiers !== modifiers || node.importClause !== importClause || node.moduleSpecifier !== moduleSpecifier || node.attributes !== attributes ? update(createImportDeclaration(modifiers, importClause, moduleSpecifier, attributes), node) : node;
25239
25333
  }
25240
- function createImportClause(isTypeOnly, name, namedBindings) {
25334
+ function createImportClause2(isTypeOnly, name, namedBindings) {
25241
25335
  const node = createBaseDeclaration(273 /* ImportClause */);
25242
25336
  node.isTypeOnly = isTypeOnly;
25243
25337
  node.name = name;
@@ -25250,7 +25344,7 @@ function createNodeFactory(flags, baseFactory2) {
25250
25344
  return node;
25251
25345
  }
25252
25346
  function updateImportClause(node, isTypeOnly, name, namedBindings) {
25253
- return node.isTypeOnly !== isTypeOnly || node.name !== name || node.namedBindings !== namedBindings ? update(createImportClause(isTypeOnly, name, namedBindings), node) : node;
25347
+ return node.isTypeOnly !== isTypeOnly || node.name !== name || node.namedBindings !== namedBindings ? update(createImportClause2(isTypeOnly, name, namedBindings), node) : node;
25254
25348
  }
25255
25349
  function createAssertClause(elements, multiLine) {
25256
25350
  const node = createBaseNode(300 /* AssertClause */);
@@ -25670,6 +25764,17 @@ function createNodeFactory(flags, baseFactory2) {
25670
25764
  function updateJSDocEnumTag(node, tagName = getDefaultTagName(node), typeExpression, comment) {
25671
25765
  return node.tagName !== tagName || node.typeExpression !== typeExpression || node.comment !== comment ? update(createJSDocEnumTag(tagName, typeExpression, comment), node) : node;
25672
25766
  }
25767
+ function createJSDocImportTag(tagName, importClause, moduleSpecifier, attributes, comment) {
25768
+ const node = createBaseJSDocTag(351 /* JSDocImportTag */, tagName ?? createIdentifier("import"), comment);
25769
+ node.importClause = importClause;
25770
+ node.moduleSpecifier = moduleSpecifier;
25771
+ node.attributes = attributes;
25772
+ node.comment = comment;
25773
+ return node;
25774
+ }
25775
+ function updateJSDocImportTag(node, tagName, importClause, moduleSpecifier, attributes, comment) {
25776
+ 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;
25777
+ }
25673
25778
  function createJSDocText(text) {
25674
25779
  const node = createBaseNode(321 /* JSDocText */);
25675
25780
  node.text = text;
@@ -26067,18 +26172,18 @@ function createNodeFactory(flags, baseFactory2) {
26067
26172
  return node;
26068
26173
  }
26069
26174
  function createSyntaxList3(children) {
26070
- const node = createBaseNode(351 /* SyntaxList */);
26175
+ const node = createBaseNode(352 /* SyntaxList */);
26071
26176
  node._children = children;
26072
26177
  return node;
26073
26178
  }
26074
26179
  function createNotEmittedStatement(original) {
26075
- const node = createBaseNode(352 /* NotEmittedStatement */);
26180
+ const node = createBaseNode(353 /* NotEmittedStatement */);
26076
26181
  node.original = original;
26077
26182
  setTextRange(node, original);
26078
26183
  return node;
26079
26184
  }
26080
26185
  function createPartiallyEmittedExpression(expression, original) {
26081
- const node = createBaseNode(353 /* PartiallyEmittedExpression */);
26186
+ const node = createBaseNode(354 /* PartiallyEmittedExpression */);
26082
26187
  node.expression = expression;
26083
26188
  node.original = original;
26084
26189
  node.transformFlags |= propagateChildFlags(node.expression) | 1 /* ContainsTypeScript */;
@@ -26100,7 +26205,7 @@ function createNodeFactory(flags, baseFactory2) {
26100
26205
  return node;
26101
26206
  }
26102
26207
  function createCommaListExpression(elements) {
26103
- const node = createBaseNode(354 /* CommaListExpression */);
26208
+ const node = createBaseNode(355 /* CommaListExpression */);
26104
26209
  node.elements = createNodeArray(sameFlatMap(elements, flattenCommaElements));
26105
26210
  node.transformFlags |= propagateChildrenFlags(node.elements);
26106
26211
  return node;
@@ -26109,7 +26214,7 @@ function createNodeFactory(flags, baseFactory2) {
26109
26214
  return node.elements !== elements ? update(createCommaListExpression(elements), node) : node;
26110
26215
  }
26111
26216
  function createSyntheticReferenceExpression(expression, thisArg) {
26112
- const node = createBaseNode(355 /* SyntheticReferenceExpression */);
26217
+ const node = createBaseNode(356 /* SyntheticReferenceExpression */);
26113
26218
  node.expression = expression;
26114
26219
  node.thisArg = thisArg;
26115
26220
  node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.thisArg);
@@ -26355,7 +26460,7 @@ function createNodeFactory(flags, baseFactory2) {
26355
26460
  return updateSatisfiesExpression(outerExpression, expression, outerExpression.type);
26356
26461
  case 235 /* NonNullExpression */:
26357
26462
  return updateNonNullExpression(outerExpression, expression);
26358
- case 353 /* PartiallyEmittedExpression */:
26463
+ case 354 /* PartiallyEmittedExpression */:
26359
26464
  return updatePartiallyEmittedExpression(outerExpression, expression);
26360
26465
  }
26361
26466
  }
@@ -26765,6 +26870,8 @@ function getDefaultTagNameForKind(kind) {
26765
26870
  return "augments";
26766
26871
  case 329 /* JSDocImplementsTag */:
26767
26872
  return "implements";
26873
+ case 351 /* JSDocImportTag */:
26874
+ return "import";
26768
26875
  default:
26769
26876
  return Debug.fail(`Unsupported kind: ${Debug.formatSyntaxKind(kind)}`);
26770
26877
  }
@@ -26905,7 +27012,7 @@ function getTransformFlagsSubtreeExclusions(kind) {
26905
27012
  case 216 /* TypeAssertionExpression */:
26906
27013
  case 238 /* SatisfiesExpression */:
26907
27014
  case 234 /* AsExpression */:
26908
- case 353 /* PartiallyEmittedExpression */:
27015
+ case 354 /* PartiallyEmittedExpression */:
26909
27016
  case 217 /* ParenthesizedExpression */:
26910
27017
  case 108 /* SuperKeyword */:
26911
27018
  return -2147483648 /* OuterExpressionExcludes */;
@@ -28617,10 +28724,10 @@ function isSyntheticExpression(node) {
28617
28724
  return node.kind === 237 /* SyntheticExpression */;
28618
28725
  }
28619
28726
  function isPartiallyEmittedExpression(node) {
28620
- return node.kind === 353 /* PartiallyEmittedExpression */;
28727
+ return node.kind === 354 /* PartiallyEmittedExpression */;
28621
28728
  }
28622
28729
  function isCommaListExpression(node) {
28623
- return node.kind === 354 /* CommaListExpression */;
28730
+ return node.kind === 355 /* CommaListExpression */;
28624
28731
  }
28625
28732
  function isTemplateSpan(node) {
28626
28733
  return node.kind === 239 /* TemplateSpan */;
@@ -28770,10 +28877,10 @@ function isMissingDeclaration(node) {
28770
28877
  return node.kind === 282 /* MissingDeclaration */;
28771
28878
  }
28772
28879
  function isNotEmittedStatement(node) {
28773
- return node.kind === 352 /* NotEmittedStatement */;
28880
+ return node.kind === 353 /* NotEmittedStatement */;
28774
28881
  }
28775
28882
  function isSyntheticReference(node) {
28776
- return node.kind === 355 /* SyntheticReferenceExpression */;
28883
+ return node.kind === 356 /* SyntheticReferenceExpression */;
28777
28884
  }
28778
28885
  function isExternalModuleReference(node) {
28779
28886
  return node.kind === 283 /* ExternalModuleReference */;
@@ -28967,8 +29074,11 @@ function isJSDocSatisfiesTag(node) {
28967
29074
  function isJSDocThrowsTag(node) {
28968
29075
  return node.kind === 349 /* JSDocThrowsTag */;
28969
29076
  }
29077
+ function isJSDocImportTag(node) {
29078
+ return node.kind === 351 /* JSDocImportTag */;
29079
+ }
28970
29080
  function isSyntaxList(n) {
28971
- return n.kind === 351 /* SyntaxList */;
29081
+ return n.kind === 352 /* SyntaxList */;
28972
29082
  }
28973
29083
 
28974
29084
  // src/compiler/factory/utilities.ts
@@ -29363,7 +29473,7 @@ function isOuterExpression(node, kinds = 15 /* All */) {
29363
29473
  return (kinds & 2 /* TypeAssertions */) !== 0;
29364
29474
  case 235 /* NonNullExpression */:
29365
29475
  return (kinds & 4 /* NonNullAssertions */) !== 0;
29366
- case 353 /* PartiallyEmittedExpression */:
29476
+ case 354 /* PartiallyEmittedExpression */:
29367
29477
  return (kinds & 8 /* PartiallyEmittedExpressions */) !== 0;
29368
29478
  }
29369
29479
  return false;
@@ -30454,7 +30564,7 @@ var forEachChildTable = {
30454
30564
  [282 /* MissingDeclaration */]: function forEachChildInMissingDeclaration(node, cbNode, cbNodes) {
30455
30565
  return visitNodes(cbNode, cbNodes, node.modifiers);
30456
30566
  },
30457
- [354 /* CommaListExpression */]: function forEachChildInCommaListExpression(node, cbNode, cbNodes) {
30567
+ [355 /* CommaListExpression */]: function forEachChildInCommaListExpression(node, cbNode, cbNodes) {
30458
30568
  return visitNodes(cbNode, cbNodes, node.elements);
30459
30569
  },
30460
30570
  [284 /* JsxElement */]: function forEachChildInJsxElement(node, cbNode, cbNodes) {
@@ -30549,7 +30659,8 @@ var forEachChildTable = {
30549
30659
  [336 /* JSDocReadonlyTag */]: forEachChildInJSDocTag,
30550
30660
  [331 /* JSDocDeprecatedTag */]: forEachChildInJSDocTag,
30551
30661
  [337 /* JSDocOverrideTag */]: forEachChildInJSDocTag,
30552
- [353 /* PartiallyEmittedExpression */]: forEachChildInPartiallyEmittedExpression
30662
+ [351 /* JSDocImportTag */]: forEachChildInJSDocImportTag,
30663
+ [354 /* PartiallyEmittedExpression */]: forEachChildInPartiallyEmittedExpression
30553
30664
  };
30554
30665
  function forEachChildInCallOrConstructSignature(node, cbNode, cbNodes) {
30555
30666
  return visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode2(cbNode, node.type);
@@ -30600,6 +30711,9 @@ function forEachChildInJSDocLinkCodeOrPlain(node, cbNode, _cbNodes) {
30600
30711
  function forEachChildInJSDocTag(node, cbNode, cbNodes) {
30601
30712
  return visitNode2(cbNode, node.tagName) || (typeof node.comment === "string" ? void 0 : visitNodes(cbNode, cbNodes, node.comment));
30602
30713
  }
30714
+ function forEachChildInJSDocImportTag(node, cbNode, cbNodes) {
30715
+ 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));
30716
+ }
30603
30717
  function forEachChildInPartiallyEmittedExpression(node, cbNode, _cbNodes) {
30604
30718
  return visitNode2(cbNode, node.expression);
30605
30719
  }
@@ -32607,7 +32721,7 @@ var Parser;
32607
32721
  );
32608
32722
  }
32609
32723
  function parseJSDocType() {
32610
- scanner2.setInJSDocType(true);
32724
+ scanner2.setSkipJsDocLeadingAsterisks(true);
32611
32725
  const pos = getNodePos();
32612
32726
  if (parseOptional(144 /* ModuleKeyword */)) {
32613
32727
  const moduleTag = factory2.createJSDocNamepathType(
@@ -32626,12 +32740,12 @@ var Parser;
32626
32740
  nextTokenJSDoc();
32627
32741
  }
32628
32742
  }
32629
- scanner2.setInJSDocType(false);
32743
+ scanner2.setSkipJsDocLeadingAsterisks(false);
32630
32744
  return finishNode(moduleTag, pos);
32631
32745
  }
32632
32746
  const hasDotDotDot = parseOptional(26 /* DotDotDotToken */);
32633
32747
  let type = parseTypeOrTypePredicate();
32634
- scanner2.setInJSDocType(false);
32748
+ scanner2.setSkipJsDocLeadingAsterisks(false);
32635
32749
  if (hasDotDotDot) {
32636
32750
  type = finishNode(factory2.createJSDocVariadicType(type), pos);
32637
32751
  }
@@ -36194,22 +36308,28 @@ var Parser;
36194
36308
  if (identifier && !tokenAfterImportedIdentifierDefinitelyProducesImportDeclaration()) {
36195
36309
  return parseImportEqualsDeclaration(pos, hasJSDoc, modifiers, identifier, isTypeOnly);
36196
36310
  }
36311
+ const importClause = tryParseImportClause(identifier, afterImportPos, isTypeOnly);
36312
+ const moduleSpecifier = parseModuleSpecifier();
36313
+ const attributes = tryParseImportAttributes();
36314
+ parseSemicolon();
36315
+ const node = factory2.createImportDeclaration(modifiers, importClause, moduleSpecifier, attributes);
36316
+ return withJSDoc(finishNode(node, pos), hasJSDoc);
36317
+ }
36318
+ function tryParseImportClause(identifier, pos, isTypeOnly, skipJsDocLeadingAsterisks = false) {
36197
36319
  let importClause;
36198
36320
  if (identifier || // import id
36199
36321
  token() === 42 /* AsteriskToken */ || // import *
36200
36322
  token() === 19 /* OpenBraceToken */) {
36201
- importClause = parseImportClause(identifier, afterImportPos, isTypeOnly);
36323
+ importClause = parseImportClause(identifier, pos, isTypeOnly, skipJsDocLeadingAsterisks);
36202
36324
  parseExpected(161 /* FromKeyword */);
36203
36325
  }
36204
- const moduleSpecifier = parseModuleSpecifier();
36326
+ return importClause;
36327
+ }
36328
+ function tryParseImportAttributes() {
36205
36329
  const currentToken2 = token();
36206
- let attributes;
36207
36330
  if ((currentToken2 === 118 /* WithKeyword */ || currentToken2 === 132 /* AssertKeyword */) && !scanner2.hasPrecedingLineBreak()) {
36208
- attributes = parseImportAttributes(currentToken2);
36331
+ return parseImportAttributes(currentToken2);
36209
36332
  }
36210
- parseSemicolon();
36211
- const node = factory2.createImportDeclaration(modifiers, importClause, moduleSpecifier, attributes);
36212
- return withJSDoc(finishNode(node, pos), hasJSDoc);
36213
36333
  }
36214
36334
  function parseImportAttribute() {
36215
36335
  const pos = getNodePos();
@@ -36276,10 +36396,14 @@ var Parser;
36276
36396
  const finished = withJSDoc(finishNode(node, pos), hasJSDoc);
36277
36397
  return finished;
36278
36398
  }
36279
- function parseImportClause(identifier, pos, isTypeOnly) {
36399
+ function parseImportClause(identifier, pos, isTypeOnly, skipJsDocLeadingAsterisks) {
36280
36400
  let namedBindings;
36281
36401
  if (!identifier || parseOptional(28 /* CommaToken */)) {
36402
+ if (skipJsDocLeadingAsterisks)
36403
+ scanner2.setSkipJsDocLeadingAsterisks(true);
36282
36404
  namedBindings = token() === 42 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(275 /* NamedImports */);
36405
+ if (skipJsDocLeadingAsterisks)
36406
+ scanner2.setSkipJsDocLeadingAsterisks(false);
36283
36407
  }
36284
36408
  return finishNode(factory2.createImportClause(isTypeOnly, identifier, namedBindings), pos);
36285
36409
  }
@@ -36850,6 +36974,9 @@ var Parser;
36850
36974
  case "throws":
36851
36975
  tag = parseThrowsTag(start2, tagName, margin, indentText);
36852
36976
  break;
36977
+ case "import":
36978
+ tag = parseImportTag(start2, tagName, margin, indentText);
36979
+ break;
36853
36980
  default:
36854
36981
  tag = parseUnknownTag(start2, tagName, margin, indentText);
36855
36982
  break;
@@ -37169,13 +37296,32 @@ var Parser;
37169
37296
  const comments2 = margin !== void 0 && indentText !== void 0 ? parseTrailingTagComments(start2, getNodePos(), margin, indentText) : void 0;
37170
37297
  return finishNode(factory2.createJSDocSatisfiesTag(tagName, typeExpression, comments2), start2);
37171
37298
  }
37299
+ function parseImportTag(start2, tagName, margin, indentText) {
37300
+ const afterImportTagPos = scanner2.getTokenFullStart();
37301
+ let identifier;
37302
+ if (isIdentifier2()) {
37303
+ identifier = parseIdentifier();
37304
+ }
37305
+ const importClause = tryParseImportClause(
37306
+ identifier,
37307
+ afterImportTagPos,
37308
+ /*isTypeOnly*/
37309
+ true,
37310
+ /*skipJsDocLeadingAsterisks*/
37311
+ true
37312
+ );
37313
+ const moduleSpecifier = parseModuleSpecifier();
37314
+ const attributes = tryParseImportAttributes();
37315
+ const comments2 = margin !== void 0 && indentText !== void 0 ? parseTrailingTagComments(start2, getNodePos(), margin, indentText) : void 0;
37316
+ return finishNode(factory2.createJSDocImportTag(tagName, importClause, moduleSpecifier, attributes, comments2), start2);
37317
+ }
37172
37318
  function parseExpressionWithTypeArgumentsForAugments() {
37173
37319
  const usedBrace = parseOptional(19 /* OpenBraceToken */);
37174
37320
  const pos = getNodePos();
37175
37321
  const expression = parsePropertyAccessEntityNameExpression();
37176
- scanner2.setInJSDocType(true);
37322
+ scanner2.setSkipJsDocLeadingAsterisks(true);
37177
37323
  const typeArguments = tryParseTypeArguments();
37178
- scanner2.setInJSDocType(false);
37324
+ scanner2.setSkipJsDocLeadingAsterisks(false);
37179
37325
  const node = factory2.createExpressionWithTypeArguments(expression, typeArguments);
37180
37326
  const res = finishNode(node, pos);
37181
37327
  if (usedBrace) {
@@ -44109,6 +44255,7 @@ function createBinder() {
44109
44255
  var lastContainer;
44110
44256
  var delayedTypeAliases;
44111
44257
  var seenThisKeyword;
44258
+ var jsDocImports;
44112
44259
  var currentFlow;
44113
44260
  var currentBreakTarget;
44114
44261
  var currentContinueTarget;
@@ -44156,6 +44303,7 @@ function createBinder() {
44156
44303
  file.symbolCount = symbolCount;
44157
44304
  file.classifiableNames = classifiableNames;
44158
44305
  delayedBindJSDocTypedefTag();
44306
+ bindJSDocImports();
44159
44307
  }
44160
44308
  file = void 0;
44161
44309
  options = void 0;
@@ -44166,6 +44314,7 @@ function createBinder() {
44166
44314
  blockScopeContainer = void 0;
44167
44315
  lastContainer = void 0;
44168
44316
  delayedTypeAliases = void 0;
44317
+ jsDocImports = void 0;
44169
44318
  seenThisKeyword = false;
44170
44319
  currentFlow = void 0;
44171
44320
  currentBreakTarget = void 0;
@@ -44600,6 +44749,9 @@ function createBinder() {
44600
44749
  case 340 /* JSDocEnumTag */:
44601
44750
  bindJSDocTypeAlias(node);
44602
44751
  break;
44752
+ case 351 /* JSDocImportTag */:
44753
+ bindJSDocImportTag(node);
44754
+ break;
44603
44755
  case 307 /* SourceFile */: {
44604
44756
  bindEachFunctionsFirst(node.statements);
44605
44757
  bind(node.endOfFileToken);
@@ -45332,6 +45484,12 @@ function createBinder() {
45332
45484
  addDeclarationToSymbol(host.symbol, host, 32 /* Class */);
45333
45485
  }
45334
45486
  }
45487
+ function bindJSDocImportTag(node) {
45488
+ bind(node.tagName);
45489
+ if (typeof node.comment !== "string") {
45490
+ bindEach(node.comment);
45491
+ }
45492
+ }
45335
45493
  function bindOptionalExpression(node, trueTarget, falseTarget) {
45336
45494
  doWithConditionalBranches(bind, node, trueTarget, falseTarget);
45337
45495
  if (!isOptionalChain(node) || isOutermostOptionalChain(node)) {
@@ -45648,6 +45806,31 @@ function createBinder() {
45648
45806
  parent2 = saveParent;
45649
45807
  currentFlow = saveCurrentFlow;
45650
45808
  }
45809
+ function bindJSDocImports() {
45810
+ if (jsDocImports === void 0) {
45811
+ return;
45812
+ }
45813
+ const saveContainer = container;
45814
+ const saveLastContainer = lastContainer;
45815
+ const saveBlockScopeContainer = blockScopeContainer;
45816
+ const saveParent = parent2;
45817
+ const saveCurrentFlow = currentFlow;
45818
+ for (const jsDocImportTag of jsDocImports) {
45819
+ const host = getJSDocHost(jsDocImportTag);
45820
+ const enclosingContainer = host ? getEnclosingContainer(host) : void 0;
45821
+ const enclosingBlockScopeContainer = host ? getEnclosingBlockScopeContainer(host) : void 0;
45822
+ container = enclosingContainer || file;
45823
+ blockScopeContainer = enclosingBlockScopeContainer || file;
45824
+ currentFlow = initFlowNode({ flags: 2 /* Start */ });
45825
+ parent2 = jsDocImportTag;
45826
+ bind(jsDocImportTag.importClause);
45827
+ }
45828
+ container = saveContainer;
45829
+ lastContainer = saveLastContainer;
45830
+ blockScopeContainer = saveBlockScopeContainer;
45831
+ parent2 = saveParent;
45832
+ currentFlow = saveCurrentFlow;
45833
+ }
45651
45834
  function checkContextualIdentifier(node) {
45652
45835
  if (!file.parseDiagnostics.length && !(node.flags & 33554432 /* Ambient */) && !(node.flags & 16777216 /* JSDoc */) && !isIdentifierName(node)) {
45653
45836
  const originalKeywordKind = identifierToKeywordKind(node);
@@ -46072,6 +46255,8 @@ function createBinder() {
46072
46255
  return (delayedTypeAliases || (delayedTypeAliases = [])).push(node);
46073
46256
  case 339 /* JSDocOverloadTag */:
46074
46257
  return bind(node.typeExpression);
46258
+ case 351 /* JSDocImportTag */:
46259
+ return (jsDocImports || (jsDocImports = [])).push(node);
46075
46260
  }
46076
46261
  }
46077
46262
  function bindPropertyWorker(node) {
@@ -48036,6 +48221,10 @@ function createTypeChecker(host) {
48036
48221
  var checkBinaryExpression = createCheckBinaryExpression();
48037
48222
  var emitResolver = createResolver();
48038
48223
  var nodeBuilder = createNodeBuilder();
48224
+ var evaluate = createEvaluator({
48225
+ evaluateElementAccessExpression,
48226
+ evaluateEntityNameExpression
48227
+ });
48039
48228
  var globals = createSymbolTable();
48040
48229
  var undefinedSymbol = createSymbol(4 /* Property */, "undefined");
48041
48230
  undefinedSymbol.declarations = [];
@@ -49800,6 +49989,7 @@ function createTypeChecker(host) {
49800
49989
  case 346 /* JSDocTypedefTag */:
49801
49990
  case 338 /* JSDocCallbackTag */:
49802
49991
  case 340 /* JSDocEnumTag */:
49992
+ case 351 /* JSDocImportTag */:
49803
49993
  const root = getJSDocRoot(location);
49804
49994
  if (root) {
49805
49995
  location = root.parent;
@@ -51292,7 +51482,7 @@ function createTypeChecker(host) {
51292
51482
  return ambientModule;
51293
51483
  }
51294
51484
  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(
51485
+ 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
51486
  location.initializer,
51297
51487
  /*requireStringLiteralLikeArgument*/
51298
51488
  true
@@ -53205,7 +53395,7 @@ function createTypeChecker(host) {
53205
53395
  }
53206
53396
  const abstractSignatures = filter(resolved.constructSignatures, (signature) => !!(signature.flags & 4 /* Abstract */));
53207
53397
  if (some(abstractSignatures)) {
53208
- const types = map(abstractSignatures, getOrCreateTypeFromSignature);
53398
+ const types = map(abstractSignatures, (s) => getOrCreateTypeFromSignature(s));
53209
53399
  const typeElementCount = resolved.callSignatures.length + (resolved.constructSignatures.length - abstractSignatures.length) + resolved.indexInfos.length + // exclude `prototype` when writing a class expression as a type literal, as per
53210
53400
  // the logic in `createTypeNodesFromResolvedType`.
53211
53401
  (context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */ ? countWhere(resolved.properties, (p) => !(p.flags & 4194304 /* Prototype */)) : length(resolved.properties));
@@ -54520,7 +54710,7 @@ function createTypeChecker(host) {
54520
54710
  const type = getDeclaredTypeOfSymbol(sym);
54521
54711
  const name = sym.flags & 262144 /* TypeParameter */ ? typeParameterToName(type, context) : factory.cloneNode(node);
54522
54712
  name.symbol = sym;
54523
- return { introducesError, node: setEmitFlags(setOriginalNode(name, node), 16777216 /* NoAsciiEscaping */) };
54713
+ return { introducesError, node: setTextRange(setEmitFlags(setOriginalNode(name, node), 16777216 /* NoAsciiEscaping */), node) };
54524
54714
  }
54525
54715
  }
54526
54716
  return { introducesError, node };
@@ -54530,7 +54720,6 @@ function createTypeChecker(host) {
54530
54720
  cancellationToken.throwIfCancellationRequested();
54531
54721
  }
54532
54722
  let hadError = false;
54533
- const file = getSourceFileOfNode(existing);
54534
54723
  const transformed = visitNode(existing, visitExistingNodeTreeSymbols, isTypeNode);
54535
54724
  if (hadError) {
54536
54725
  return void 0;
@@ -54681,8 +54870,17 @@ function createTypeChecker(host) {
54681
54870
  return result;
54682
54871
  }
54683
54872
  }
54684
- if (file && isTupleTypeNode(node) && !nodeIsSynthesized(node) && getLineAndCharacterOfPosition(file, node.pos).line === getLineAndCharacterOfPosition(file, node.end).line) {
54685
- setEmitFlags(node, 1 /* SingleLine */);
54873
+ if (isTupleTypeNode(node) || isTypeLiteralNode(node) || isMappedTypeNode(node)) {
54874
+ const visited = visitEachChild(
54875
+ node,
54876
+ visitExistingNodeTreeSymbols,
54877
+ /*context*/
54878
+ void 0
54879
+ );
54880
+ const clone2 = setTextRange(visited === node ? factory.cloneNode(node) : visited, node);
54881
+ const flags = getEmitFlags(clone2);
54882
+ setEmitFlags(clone2, flags | (context.flags & 1024 /* MultilineObjectLiterals */ && isTypeLiteralNode(node) ? 0 : 1 /* SingleLine */));
54883
+ return clone2;
54686
54884
  }
54687
54885
  return visitEachChild(
54688
54886
  node,
@@ -55668,19 +55866,20 @@ function createTypeChecker(host) {
55668
55866
  case 273 /* ImportClause */: {
55669
55867
  const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
55670
55868
  const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.moduleSpecifier;
55869
+ const attributes = isImportDeclaration(node.parent) ? node.parent.attributes : void 0;
55870
+ const isTypeOnly = isJSDocImportTag(node.parent);
55671
55871
  addResult(
55672
55872
  factory.createImportDeclaration(
55673
55873
  /*modifiers*/
55674
55874
  void 0,
55675
55875
  factory.createImportClause(
55676
- /*isTypeOnly*/
55677
- false,
55876
+ isTypeOnly,
55678
55877
  factory.createIdentifier(localName),
55679
55878
  /*namedBindings*/
55680
55879
  void 0
55681
55880
  ),
55682
55881
  specifier2,
55683
- node.parent.attributes
55882
+ attributes
55684
55883
  ),
55685
55884
  0 /* None */
55686
55885
  );
@@ -55689,13 +55888,13 @@ function createTypeChecker(host) {
55689
55888
  case 274 /* NamespaceImport */: {
55690
55889
  const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
55691
55890
  const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.moduleSpecifier;
55891
+ const isTypeOnly = isJSDocImportTag(node.parent.parent);
55692
55892
  addResult(
55693
55893
  factory.createImportDeclaration(
55694
55894
  /*modifiers*/
55695
55895
  void 0,
55696
55896
  factory.createImportClause(
55697
- /*isTypeOnly*/
55698
- false,
55897
+ isTypeOnly,
55699
55898
  /*name*/
55700
55899
  void 0,
55701
55900
  factory.createNamespaceImport(factory.createIdentifier(localName))
@@ -55723,13 +55922,13 @@ function createTypeChecker(host) {
55723
55922
  case 276 /* ImportSpecifier */: {
55724
55923
  const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
55725
55924
  const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.parent.moduleSpecifier;
55925
+ const isTypeOnly = isJSDocImportTag(node.parent.parent.parent);
55726
55926
  addResult(
55727
55927
  factory.createImportDeclaration(
55728
55928
  /*modifiers*/
55729
55929
  void 0,
55730
55930
  factory.createImportClause(
55731
- /*isTypeOnly*/
55732
- false,
55931
+ isTypeOnly,
55733
55932
  /*name*/
55734
55933
  void 0,
55735
55934
  factory.createNamedImports([
@@ -58409,7 +58608,7 @@ function createTypeChecker(host) {
58409
58608
  if (!lateSymbol)
58410
58609
  lateSymbols.set(memberName, lateSymbol = createSymbol(0 /* None */, memberName, 4096 /* Late */));
58411
58610
  const earlySymbol = earlySymbols && earlySymbols.get(memberName);
58412
- if (!(parent2.flags & 32 /* Class */) && (lateSymbol.flags & getExcludedSymbolFlags(symbolFlags) || earlySymbol)) {
58611
+ if (!(parent2.flags & 32 /* Class */) && lateSymbol.flags & getExcludedSymbolFlags(symbolFlags)) {
58413
58612
  const declarations = earlySymbol ? concatenate(earlySymbol.declarations, lateSymbol.declarations) : lateSymbol.declarations;
58414
58613
  const name = !(type.flags & 8192 /* UniqueESSymbol */) && unescapeLeadingUnderscores(memberName) || declarationNameToString(declName);
58415
58614
  forEach(declarations, (declaration) => error2(getNameOfDeclaration(declaration) || declaration, Diagnostics.Property_0_was_also_declared_here, name));
@@ -59361,11 +59560,15 @@ function createTypeChecker(host) {
59361
59560
  const modifiers = getMappedTypeModifiers(type);
59362
59561
  return modifiers & 8 /* ExcludeOptional */ ? -1 : modifiers & 4 /* IncludeOptional */ ? 1 : 0;
59363
59562
  }
59364
- function getModifiersTypeOptionality(type) {
59365
- return type.flags & 2097152 /* Intersection */ ? Math.max(...map(type.types, getModifiersTypeOptionality)) : getObjectFlags(type) & 32 /* Mapped */ ? getCombinedMappedTypeOptionality(type) : 0;
59366
- }
59367
59563
  function getCombinedMappedTypeOptionality(type) {
59368
- return getMappedTypeOptionality(type) || getModifiersTypeOptionality(getModifiersTypeFromMappedType(type));
59564
+ if (getObjectFlags(type) & 32 /* Mapped */) {
59565
+ return getMappedTypeOptionality(type) || getCombinedMappedTypeOptionality(getModifiersTypeFromMappedType(type));
59566
+ }
59567
+ if (type.flags & 2097152 /* Intersection */) {
59568
+ const optionality = getCombinedMappedTypeOptionality(type.types[0]);
59569
+ return every(type.types, (t, i) => i === 0 || getCombinedMappedTypeOptionality(t) === optionality) ? optionality : 0;
59570
+ }
59571
+ return 0;
59369
59572
  }
59370
59573
  function isPartialMappedType(type) {
59371
59574
  return !!(getObjectFlags(type) & 32 /* Mapped */ && getMappedTypeModifiers(type) & 4 /* IncludeOptional */);
@@ -60642,6 +60845,12 @@ function createTypeChecker(host) {
60642
60845
  isInJSFile(signature.declaration)
60643
60846
  );
60644
60847
  }
60848
+ function getImplementationSignature(signature) {
60849
+ return signature.typeParameters ? signature.implementationSignatureCache || (signature.implementationSignatureCache = createImplementationSignature(signature)) : signature;
60850
+ }
60851
+ function createImplementationSignature(signature) {
60852
+ return signature.typeParameters ? instantiateSignature(signature, createTypeMapper([], [])) : signature;
60853
+ }
60645
60854
  function getBaseSignature(signature) {
60646
60855
  const typeParameters = signature.typeParameters;
60647
60856
  if (typeParameters) {
@@ -60664,12 +60873,22 @@ function createTypeChecker(host) {
60664
60873
  }
60665
60874
  return signature;
60666
60875
  }
60667
- function getOrCreateTypeFromSignature(signature) {
60876
+ function getOrCreateTypeFromSignature(signature, outerTypeParameters) {
60668
60877
  var _a;
60669
60878
  if (!signature.isolatedSignatureType) {
60670
60879
  const kind = (_a = signature.declaration) == null ? void 0 : _a.kind;
60671
60880
  const isConstructor = kind === void 0 || kind === 176 /* Constructor */ || kind === 180 /* ConstructSignature */ || kind === 185 /* ConstructorType */;
60672
- const type = createObjectType(16 /* Anonymous */);
60881
+ const type = createObjectType(16 /* Anonymous */ | 134217728 /* SingleSignatureType */, createSymbol(16 /* Function */, "__function" /* Function */));
60882
+ if (signature.declaration && !nodeIsSynthesized(signature.declaration)) {
60883
+ type.symbol.declarations = [signature.declaration];
60884
+ type.symbol.valueDeclaration = signature.declaration;
60885
+ }
60886
+ outerTypeParameters || (outerTypeParameters = signature.declaration && getOuterTypeParameters(
60887
+ signature.declaration,
60888
+ /*includeThisTypes*/
60889
+ true
60890
+ ));
60891
+ type.outerTypeParameters = outerTypeParameters;
60673
60892
  type.members = emptySymbols;
60674
60893
  type.properties = emptyArray;
60675
60894
  type.callSignatures = !isConstructor ? [signature] : emptyArray;
@@ -63158,13 +63377,18 @@ function createTypeChecker(host) {
63158
63377
  const mapper = createTypeMapper([getTypeParameterFromMappedType(objectType)], [index]);
63159
63378
  const templateMapper = combineTypeMappers(objectType.mapper, mapper);
63160
63379
  const instantiatedTemplateType = instantiateType(getTemplateTypeFromMappedType(objectType.target || objectType), templateMapper);
63380
+ const isOptional = getMappedTypeOptionality(objectType) > 0 || (isGenericType(objectType) ? getCombinedMappedTypeOptionality(getModifiersTypeFromMappedType(objectType)) > 0 : couldAccessOptionalProperty(objectType, index));
63161
63381
  return addOptionality(
63162
63382
  instantiatedTemplateType,
63163
63383
  /*isProperty*/
63164
63384
  true,
63165
- getCombinedMappedTypeOptionality(objectType) > 0
63385
+ isOptional
63166
63386
  );
63167
63387
  }
63388
+ function couldAccessOptionalProperty(objectType, indexType) {
63389
+ const indexConstraint = getBaseConstraintOfType(indexType);
63390
+ return !!indexConstraint && some(getPropertiesOfType(objectType), (p) => !!(p.flags & 16777216 /* Optional */) && isTypeAssignableTo(getLiteralTypeFromProperty(p, 8576 /* StringOrNumberLiteralOrUnique */), indexConstraint));
63391
+ }
63168
63392
  function getIndexedAccessType(objectType, indexType, accessFlags = 0 /* None */, accessNode, aliasSymbol, aliasTypeArguments) {
63169
63393
  return getIndexedAccessTypeOrUndefined(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments) || (accessNode ? errorType : unknownType);
63170
63394
  }
@@ -64075,7 +64299,7 @@ function createTypeChecker(host) {
64075
64299
  const declaration = type.objectFlags & 4 /* Reference */ ? type.node : type.objectFlags & 8388608 /* InstantiationExpressionType */ ? type.node : type.symbol.declarations[0];
64076
64300
  const links = getNodeLinks(declaration);
64077
64301
  const target = type.objectFlags & 4 /* Reference */ ? links.resolvedType : type.objectFlags & 64 /* Instantiated */ ? type.target : type;
64078
- let typeParameters = links.outerTypeParameters;
64302
+ let typeParameters = type.objectFlags & 134217728 /* SingleSignatureType */ ? type.outerTypeParameters : links.outerTypeParameters;
64079
64303
  if (!typeParameters) {
64080
64304
  let outerTypeParameters = getOuterTypeParameters(
64081
64305
  declaration,
@@ -64255,6 +64479,9 @@ function createTypeChecker(host) {
64255
64479
  if (type.objectFlags & 8388608 /* InstantiationExpressionType */) {
64256
64480
  result.node = type.node;
64257
64481
  }
64482
+ if (type.objectFlags & 134217728 /* SingleSignatureType */) {
64483
+ result.outerTypeParameters = type.outerTypeParameters;
64484
+ }
64258
64485
  result.target = type;
64259
64486
  result.mapper = mapper;
64260
64487
  result.aliasSymbol = aliasSymbol || type.aliasSymbol;
@@ -68886,7 +69113,7 @@ function createTypeChecker(host) {
68886
69113
  if (objectFlags & 524288 /* CouldContainTypeVariablesComputed */) {
68887
69114
  return !!(objectFlags & 1048576 /* CouldContainTypeVariables */);
68888
69115
  }
68889
- const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
69116
+ const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 134217728 /* SingleSignatureType */ && !!length(type.outerTypeParameters) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
68890
69117
  if (type.flags & 3899393 /* ObjectFlagsType */) {
68891
69118
  type.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (result ? 1048576 /* CouldContainTypeVariables */ : 0);
68892
69119
  }
@@ -69170,6 +69397,9 @@ function createTypeChecker(host) {
69170
69397
  pos = p;
69171
69398
  }
69172
69399
  }
69400
+ function isTupleOfSelf(typeParameter, type) {
69401
+ return isTupleType(type) && getTupleElementType(type, 0) === getIndexedAccessType(typeParameter, getNumberLiteralType(0)) && !getTypeOfPropertyOfType(type, "1");
69402
+ }
69173
69403
  function inferTypes(inferences, originalSource, originalTarget, priority = 0 /* None */, contravariant = false) {
69174
69404
  let bivariant = false;
69175
69405
  let propagationType;
@@ -69255,6 +69485,9 @@ function createTypeChecker(host) {
69255
69485
  inference.priority = priority;
69256
69486
  }
69257
69487
  if (priority === inference.priority) {
69488
+ if (isTupleOfSelf(inference.typeParameter, candidate)) {
69489
+ return;
69490
+ }
69258
69491
  if (contravariant && !bivariant) {
69259
69492
  if (!contains(inference.contraCandidates, candidate)) {
69260
69493
  inference.contraCandidates = append(inference.contraCandidates, candidate);
@@ -69935,13 +70168,20 @@ function createTypeChecker(host) {
69935
70168
  return getFlowCacheKey(node.expression, declaredType, initialType, flowContainer);
69936
70169
  case 166 /* QualifiedName */:
69937
70170
  const left = getFlowCacheKey(node.left, declaredType, initialType, flowContainer);
69938
- return left && left + "." + node.right.escapedText;
70171
+ return left && `${left}.${node.right.escapedText}`;
69939
70172
  case 211 /* PropertyAccessExpression */:
69940
70173
  case 212 /* ElementAccessExpression */:
69941
70174
  const propName = getAccessedPropertyName(node);
69942
70175
  if (propName !== void 0) {
69943
70176
  const key = getFlowCacheKey(node.expression, declaredType, initialType, flowContainer);
69944
- return key && key + "." + propName;
70177
+ return key && `${key}.${propName}`;
70178
+ }
70179
+ if (isElementAccessExpression(node) && isIdentifier(node.argumentExpression)) {
70180
+ const symbol = getResolvedSymbol(node.argumentExpression);
70181
+ if (isConstantVariable(symbol) || isParameterOrMutableLocalVariable(symbol) && !isSymbolAssigned(symbol)) {
70182
+ const key = getFlowCacheKey(node.expression, declaredType, initialType, flowContainer);
70183
+ return key && `${key}.@${getSymbolId(symbol)}`;
70184
+ }
69945
70185
  }
69946
70186
  break;
69947
70187
  case 206 /* ObjectBindingPattern */:
@@ -69978,8 +70218,19 @@ function createTypeChecker(host) {
69978
70218
  case 211 /* PropertyAccessExpression */:
69979
70219
  case 212 /* ElementAccessExpression */:
69980
70220
  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);
70221
+ if (sourcePropertyName !== void 0) {
70222
+ const targetPropertyName = isAccessExpression(target) ? getAccessedPropertyName(target) : void 0;
70223
+ if (targetPropertyName !== void 0) {
70224
+ return targetPropertyName === sourcePropertyName && isMatchingReference(source.expression, target.expression);
70225
+ }
70226
+ }
70227
+ if (isElementAccessExpression(source) && isElementAccessExpression(target) && isIdentifier(source.argumentExpression) && isIdentifier(target.argumentExpression)) {
70228
+ const symbol = getResolvedSymbol(source.argumentExpression);
70229
+ if (symbol === getResolvedSymbol(target.argumentExpression) && (isConstantVariable(symbol) || isParameterOrMutableLocalVariable(symbol) && !isSymbolAssigned(symbol))) {
70230
+ return isMatchingReference(source.expression, target.expression);
70231
+ }
70232
+ }
70233
+ break;
69983
70234
  case 166 /* QualifiedName */:
69984
70235
  return isAccessExpression(target) && source.right.escapedText === getAccessedPropertyName(target) && isMatchingReference(source.left, target.expression);
69985
70236
  case 226 /* BinaryExpression */:
@@ -76175,7 +76426,7 @@ function createTypeChecker(host) {
76175
76426
  argument = skipParentheses(argument);
76176
76427
  return isSatisfiesExpression(argument) ? skipParentheses(argument.expression) : argument;
76177
76428
  }
76178
- function getSignatureApplicabilityError(node, args, signature, relation, checkMode, reportErrors2, containingMessageChain) {
76429
+ function getSignatureApplicabilityError(node, args, signature, relation, checkMode, reportErrors2, containingMessageChain, inferenceContext) {
76179
76430
  const errorOutputContainer = { errors: void 0, skipLogging: true };
76180
76431
  if (isJsxOpeningLikeElement(node)) {
76181
76432
  if (!checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation, checkMode, reportErrors2, containingMessageChain, errorOutputContainer)) {
@@ -76209,7 +76460,8 @@ function createTypeChecker(host) {
76209
76460
  void 0,
76210
76461
  checkMode
76211
76462
  );
76212
- const checkArgType = checkMode & 4 /* SkipContextSensitive */ ? getRegularTypeOfObjectLiteral(argType) : argType;
76463
+ const regularArgType = checkMode & 4 /* SkipContextSensitive */ ? getRegularTypeOfObjectLiteral(argType) : argType;
76464
+ const checkArgType = inferenceContext ? instantiateType(regularArgType, inferenceContext.nonFixingMapper) : regularArgType;
76213
76465
  const effectiveCheckArgumentNode = getEffectiveCheckNode(arg);
76214
76466
  if (!checkTypeRelatedToAndOptionallyElaborate(checkArgType, paramType, relation, reportErrors2 ? effectiveCheckArgumentNode : void 0, effectiveCheckArgumentNode, headMessage, containingMessageChain, errorOutputContainer)) {
76215
76467
  Debug.assert(!reportErrors2 || !!errorOutputContainer.errors, "parameter should have errors when reporting errors");
@@ -76621,7 +76873,9 @@ function createTypeChecker(host) {
76621
76873
  0 /* Normal */,
76622
76874
  /*reportErrors*/
76623
76875
  true,
76624
- () => chain
76876
+ () => chain,
76877
+ /*inferenceContext*/
76878
+ void 0
76625
76879
  );
76626
76880
  if (diags) {
76627
76881
  for (const d of diags) {
@@ -76657,7 +76911,9 @@ function createTypeChecker(host) {
76657
76911
  0 /* Normal */,
76658
76912
  /*reportErrors*/
76659
76913
  true,
76660
- chain2
76914
+ chain2,
76915
+ /*inferenceContext*/
76916
+ void 0
76661
76917
  );
76662
76918
  if (diags2) {
76663
76919
  if (diags2.length <= min2) {
@@ -76748,6 +77004,8 @@ function createTypeChecker(host) {
76748
77004
  /*reportErrors*/
76749
77005
  false,
76750
77006
  /*containingMessageChain*/
77007
+ void 0,
77008
+ /*inferenceContext*/
76751
77009
  void 0
76752
77010
  )) {
76753
77011
  candidatesForArgumentError = [candidate];
@@ -76756,13 +77014,16 @@ function createTypeChecker(host) {
76756
77014
  return candidate;
76757
77015
  }
76758
77016
  for (let candidateIndex = 0; candidateIndex < candidates2.length; candidateIndex++) {
76759
- const candidate = candidates2[candidateIndex];
77017
+ let candidate = candidates2[candidateIndex];
76760
77018
  if (!hasCorrectTypeArgumentArity(candidate, typeArguments) || !hasCorrectArity(node, args, candidate, signatureHelpTrailingComma2)) {
76761
77019
  continue;
76762
77020
  }
76763
77021
  let checkCandidate;
76764
77022
  let inferenceContext;
76765
77023
  if (candidate.typeParameters) {
77024
+ if (candidate.declaration && findAncestor(node, (a) => a === candidate.declaration)) {
77025
+ candidate = getImplementationSignature(candidate);
77026
+ }
76766
77027
  let typeArgumentTypes;
76767
77028
  if (some(typeArguments)) {
76768
77029
  typeArgumentTypes = checkTypeArguments(
@@ -76782,7 +77043,7 @@ function createTypeChecker(host) {
76782
77043
  /*flags*/
76783
77044
  isInJSFile(node) ? 2 /* AnyDefault */ : 0 /* None */
76784
77045
  );
76785
- typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode | 8 /* SkipGenericFunctions */, inferenceContext);
77046
+ typeArgumentTypes = instantiateTypes(inferTypeArguments(node, candidate, args, argCheckMode | 8 /* SkipGenericFunctions */, inferenceContext), inferenceContext.nonFixingMapper);
76786
77047
  argCheckMode |= inferenceContext.flags & 4 /* SkippedGenericFunction */ ? 8 /* SkipGenericFunctions */ : 0 /* Normal */;
76787
77048
  }
76788
77049
  checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext && inferenceContext.inferredTypeParameters);
@@ -76802,7 +77063,8 @@ function createTypeChecker(host) {
76802
77063
  /*reportErrors*/
76803
77064
  false,
76804
77065
  /*containingMessageChain*/
76805
- void 0
77066
+ void 0,
77067
+ inferenceContext
76806
77068
  )) {
76807
77069
  (candidatesForArgumentError || (candidatesForArgumentError = [])).push(checkCandidate);
76808
77070
  continue;
@@ -76810,7 +77072,7 @@ function createTypeChecker(host) {
76810
77072
  if (argCheckMode) {
76811
77073
  argCheckMode = 0 /* Normal */;
76812
77074
  if (inferenceContext) {
76813
- const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
77075
+ const typeArgumentTypes = instantiateTypes(inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext), inferenceContext.mapper);
76814
77076
  checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
76815
77077
  if (getNonArrayRestType(candidate) && !hasCorrectArity(node, args, checkCandidate, signatureHelpTrailingComma2)) {
76816
77078
  candidateForArgumentArityError = checkCandidate;
@@ -76826,7 +77088,8 @@ function createTypeChecker(host) {
76826
77088
  /*reportErrors*/
76827
77089
  false,
76828
77090
  /*containingMessageChain*/
76829
- void 0
77091
+ void 0,
77092
+ inferenceContext
76830
77093
  )) {
76831
77094
  (candidatesForArgumentError || (candidatesForArgumentError = [])).push(checkCandidate);
76832
77095
  continue;
@@ -80366,7 +80629,7 @@ function createTypeChecker(host) {
80366
80629
  ) || unknownType, isTemplateLiteralContextualType)) {
80367
80630
  return getTemplateLiteralType(texts, types);
80368
80631
  }
80369
- const evaluated = node.parent.kind !== 215 /* TaggedTemplateExpression */ && evaluateTemplateExpression(node);
80632
+ const evaluated = node.parent.kind !== 215 /* TaggedTemplateExpression */ && evaluate(node);
80370
80633
  return evaluated ? getFreshTypeOfLiteralType(getStringLiteralType(evaluated)) : stringType;
80371
80634
  }
80372
80635
  function isTemplateLiteralContextualType(type) {
@@ -80580,7 +80843,7 @@ function createTypeChecker(host) {
80580
80843
  }
80581
80844
  }
80582
80845
  }
80583
- return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, context));
80846
+ return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, context), flatMap(inferenceContexts, (c) => c && map(c.inferences, (i) => i.typeParameter)).slice());
80584
80847
  }
80585
80848
  }
80586
80849
  }
@@ -80755,7 +81018,8 @@ function createTypeChecker(host) {
80755
81018
  if (getIsolatedModules(compilerOptions)) {
80756
81019
  Debug.assert(!!(type.symbol.flags & 128 /* ConstEnum */));
80757
81020
  const constEnumDeclaration = type.symbol.valueDeclaration;
80758
- if (constEnumDeclaration.flags & 33554432 /* Ambient */ && !isValidTypeOnlyAliasUseSite(node)) {
81021
+ const redirect = host.getRedirectReferenceForResolutionFromSourceOfProject(getSourceFileOfNode(constEnumDeclaration).resolvedPath);
81022
+ if (constEnumDeclaration.flags & 33554432 /* Ambient */ && !isValidTypeOnlyAliasUseSite(node) && (!redirect || !shouldPreserveConstEnums(redirect.commandLine.options))) {
80759
81023
  error2(node, Diagnostics.Cannot_access_ambient_const_enums_when_0_is_enabled, isolatedModulesLikeFlagName);
80760
81024
  }
80761
81025
  }
@@ -82610,6 +82874,9 @@ function createTypeChecker(host) {
82610
82874
  error2(node.tagName, Diagnostics.An_arrow_function_cannot_have_a_this_parameter);
82611
82875
  }
82612
82876
  }
82877
+ function checkJSDocImportTag(node) {
82878
+ checkImportAttributes(node);
82879
+ }
82613
82880
  function checkJSDocImplementsTag(node) {
82614
82881
  const classLike = getEffectiveJSDocHost(node);
82615
82882
  if (!classLike || !isClassDeclaration(classLike) && !isClassExpression(classLike)) {
@@ -85339,122 +85606,53 @@ function createTypeChecker(host) {
85339
85606
  }
85340
85607
  return false;
85341
85608
  }
85342
- function evaluate(expr, location) {
85343
- switch (expr.kind) {
85344
- case 224 /* PrefixUnaryExpression */:
85345
- const value = evaluate(expr.operand, location);
85346
- if (typeof value === "number") {
85347
- switch (expr.operator) {
85348
- case 40 /* PlusToken */:
85349
- return value;
85350
- case 41 /* MinusToken */:
85351
- return -value;
85352
- case 55 /* TildeToken */:
85353
- return ~value;
85354
- }
85355
- }
85356
- break;
85357
- case 226 /* BinaryExpression */:
85358
- const left = evaluate(expr.left, location);
85359
- const right = evaluate(expr.right, location);
85360
- if (typeof left === "number" && typeof right === "number") {
85361
- switch (expr.operatorToken.kind) {
85362
- case 52 /* BarToken */:
85363
- return left | right;
85364
- case 51 /* AmpersandToken */:
85365
- return left & right;
85366
- case 49 /* GreaterThanGreaterThanToken */:
85367
- return left >> right;
85368
- case 50 /* GreaterThanGreaterThanGreaterThanToken */:
85369
- return left >>> right;
85370
- case 48 /* LessThanLessThanToken */:
85371
- return left << right;
85372
- case 53 /* CaretToken */:
85373
- return left ^ right;
85374
- case 42 /* AsteriskToken */:
85375
- return left * right;
85376
- case 44 /* SlashToken */:
85377
- return left / right;
85378
- case 40 /* PlusToken */:
85379
- return left + right;
85380
- case 41 /* MinusToken */:
85381
- return left - right;
85382
- case 45 /* PercentToken */:
85383
- return left % right;
85384
- case 43 /* AsteriskAsteriskToken */:
85385
- return left ** right;
85386
- }
85387
- } else if ((typeof left === "string" || typeof left === "number") && (typeof right === "string" || typeof right === "number") && expr.operatorToken.kind === 40 /* PlusToken */) {
85388
- return "" + left + right;
85389
- }
85390
- break;
85391
- case 11 /* StringLiteral */:
85392
- case 15 /* NoSubstitutionTemplateLiteral */:
85393
- return expr.text;
85394
- case 228 /* TemplateExpression */:
85395
- return evaluateTemplateExpression(expr, location);
85396
- case 9 /* NumericLiteral */:
85397
- checkGrammarNumericLiteral(expr);
85398
- return +expr.text;
85399
- case 217 /* ParenthesizedExpression */:
85400
- return evaluate(expr.expression, location);
85401
- case 80 /* Identifier */: {
85402
- const identifier = expr;
85403
- if (isInfinityOrNaNString(identifier.escapedText) && resolveEntityName(
85404
- identifier,
85405
- 111551 /* Value */,
85406
- /*ignoreErrors*/
85407
- true
85408
- ) === getGlobalSymbol(
85409
- identifier.escapedText,
85410
- 111551 /* Value */,
85411
- /*diagnostic*/
85412
- void 0
85413
- )) {
85414
- return +identifier.escapedText;
85415
- }
85609
+ function evaluateEntityNameExpression(expr, location) {
85610
+ const symbol = resolveEntityName(
85611
+ expr,
85612
+ 111551 /* Value */,
85613
+ /*ignoreErrors*/
85614
+ true
85615
+ );
85616
+ if (!symbol)
85617
+ return void 0;
85618
+ if (expr.kind === 80 /* Identifier */) {
85619
+ const identifier = expr;
85620
+ if (isInfinityOrNaNString(identifier.escapedText) && symbol === getGlobalSymbol(
85621
+ identifier.escapedText,
85622
+ 111551 /* Value */,
85623
+ /*diagnostic*/
85624
+ void 0
85625
+ )) {
85626
+ return +identifier.escapedText;
85416
85627
  }
85417
- case 211 /* PropertyAccessExpression */:
85418
- if (isEntityNameExpression(expr)) {
85419
- const symbol = resolveEntityName(
85420
- expr,
85421
- 111551 /* Value */,
85422
- /*ignoreErrors*/
85423
- true
85424
- );
85425
- if (symbol) {
85426
- if (symbol.flags & 8 /* EnumMember */) {
85427
- return location ? evaluateEnumMember(expr, symbol, location) : getEnumMemberValue(symbol.valueDeclaration);
85428
- }
85429
- if (isConstantVariable(symbol)) {
85430
- const declaration = symbol.valueDeclaration;
85431
- if (declaration && isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && (!location || declaration !== location && isBlockScopedNameDeclaredBeforeUse(declaration, location))) {
85432
- return evaluate(declaration.initializer, declaration);
85433
- }
85434
- }
85435
- }
85436
- }
85437
- break;
85438
- case 212 /* ElementAccessExpression */:
85439
- const root = expr.expression;
85440
- if (isEntityNameExpression(root) && isStringLiteralLike(expr.argumentExpression)) {
85441
- const rootSymbol = resolveEntityName(
85442
- root,
85443
- 111551 /* Value */,
85444
- /*ignoreErrors*/
85445
- true
85446
- );
85447
- if (rootSymbol && rootSymbol.flags & 384 /* Enum */) {
85448
- const name = escapeLeadingUnderscores(expr.argumentExpression.text);
85449
- const member = rootSymbol.exports.get(name);
85450
- if (member) {
85451
- return location ? evaluateEnumMember(expr, member, location) : getEnumMemberValue(member.valueDeclaration);
85452
- }
85453
- }
85628
+ }
85629
+ if (symbol.flags & 8 /* EnumMember */) {
85630
+ return location ? evaluateEnumMember(expr, symbol, location) : getEnumMemberValue(symbol.valueDeclaration);
85631
+ }
85632
+ if (isConstantVariable(symbol)) {
85633
+ const declaration = symbol.valueDeclaration;
85634
+ if (declaration && isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && (!location || declaration !== location && isBlockScopedNameDeclaredBeforeUse(declaration, location))) {
85635
+ return evaluate(declaration.initializer, declaration);
85636
+ }
85637
+ }
85638
+ }
85639
+ function evaluateElementAccessExpression(expr, location) {
85640
+ const root = expr.expression;
85641
+ if (isEntityNameExpression(root) && isStringLiteralLike(expr.argumentExpression)) {
85642
+ const rootSymbol = resolveEntityName(
85643
+ root,
85644
+ 111551 /* Value */,
85645
+ /*ignoreErrors*/
85646
+ true
85647
+ );
85648
+ if (rootSymbol && rootSymbol.flags & 384 /* Enum */) {
85649
+ const name = escapeLeadingUnderscores(expr.argumentExpression.text);
85650
+ const member = rootSymbol.exports.get(name);
85651
+ if (member) {
85652
+ return location ? evaluateEnumMember(expr, member, location) : getEnumMemberValue(member.valueDeclaration);
85454
85653
  }
85455
- break;
85654
+ }
85456
85655
  }
85457
- return void 0;
85458
85656
  }
85459
85657
  function evaluateEnumMember(expr, symbol, location) {
85460
85658
  const declaration = symbol.valueDeclaration;
@@ -85468,18 +85666,6 @@ function createTypeChecker(host) {
85468
85666
  }
85469
85667
  return getEnumMemberValue(declaration);
85470
85668
  }
85471
- function evaluateTemplateExpression(expr, location) {
85472
- let result = expr.head.text;
85473
- for (const span of expr.templateSpans) {
85474
- const value = evaluate(span.expression, location);
85475
- if (value === void 0) {
85476
- return void 0;
85477
- }
85478
- result += value;
85479
- result += span.literal.text;
85480
- }
85481
- return result;
85482
- }
85483
85669
  function checkEnumDeclaration(node) {
85484
85670
  addLazyDiagnostic(() => checkEnumDeclarationWorker(node));
85485
85671
  }
@@ -85877,7 +86063,8 @@ function createTypeChecker(host) {
85877
86063
  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
86064
  return grammarErrorOnNode(node, message);
85879
86065
  }
85880
- if (isImportDeclaration(declaration) ? (_a = declaration.importClause) == null ? void 0 : _a.isTypeOnly : declaration.isTypeOnly) {
86066
+ const isTypeOnly = isJSDocImportTag(declaration) || (isImportDeclaration(declaration) ? (_a = declaration.importClause) == null ? void 0 : _a.isTypeOnly : declaration.isTypeOnly);
86067
+ if (isTypeOnly) {
85881
86068
  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
86069
  }
85883
86070
  if (override) {
@@ -86328,6 +86515,8 @@ function createTypeChecker(host) {
86328
86515
  return checkJSDocSatisfiesTag(node);
86329
86516
  case 343 /* JSDocThisTag */:
86330
86517
  return checkJSDocThisTag(node);
86518
+ case 351 /* JSDocImportTag */:
86519
+ return checkJSDocImportTag(node);
86331
86520
  case 199 /* IndexedAccessType */:
86332
86521
  return checkIndexedAccessType(node);
86333
86522
  case 200 /* MappedType */:
@@ -87131,7 +87320,7 @@ function createTypeChecker(host) {
87131
87320
  return void 0;
87132
87321
  case 11 /* StringLiteral */:
87133
87322
  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(
87323
+ 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
87324
  node.parent,
87136
87325
  /*requireStringLiteralLikeArgument*/
87137
87326
  false
@@ -91272,13 +91461,13 @@ var visitEachChildTable = {
91272
91461
  );
91273
91462
  },
91274
91463
  // Transformation nodes
91275
- [353 /* PartiallyEmittedExpression */]: function visitEachChildOfPartiallyEmittedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
91464
+ [354 /* PartiallyEmittedExpression */]: function visitEachChildOfPartiallyEmittedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
91276
91465
  return context.factory.updatePartiallyEmittedExpression(
91277
91466
  node,
91278
91467
  Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression))
91279
91468
  );
91280
91469
  },
91281
- [354 /* CommaListExpression */]: function visitEachChildOfCommaListExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) {
91470
+ [355 /* CommaListExpression */]: function visitEachChildOfCommaListExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) {
91282
91471
  return context.factory.updateCommaListExpression(
91283
91472
  node,
91284
91473
  nodesVisitor(node.elements, visitor, isExpression)
@@ -95122,7 +95311,7 @@ function transformClassFields(context) {
95122
95311
  /*discarded*/
95123
95312
  true
95124
95313
  );
95125
- case 354 /* CommaListExpression */:
95314
+ case 355 /* CommaListExpression */:
95126
95315
  return visitCommaListExpression(
95127
95316
  node,
95128
95317
  /*discarded*/
@@ -98215,7 +98404,7 @@ function transformESDecorators(context) {
98215
98404
  return visitForStatement(node);
98216
98405
  case 244 /* ExpressionStatement */:
98217
98406
  return visitExpressionStatement(node);
98218
- case 354 /* CommaListExpression */:
98407
+ case 355 /* CommaListExpression */:
98219
98408
  return visitCommaListExpression(
98220
98409
  node,
98221
98410
  /*discarded*/
@@ -98227,7 +98416,7 @@ function transformESDecorators(context) {
98227
98416
  /*discarded*/
98228
98417
  false
98229
98418
  );
98230
- case 353 /* PartiallyEmittedExpression */:
98419
+ case 354 /* PartiallyEmittedExpression */:
98231
98420
  return visitPartiallyEmittedExpression(
98232
98421
  node,
98233
98422
  /*discarded*/
@@ -98313,7 +98502,7 @@ function transformESDecorators(context) {
98313
98502
  /*discarded*/
98314
98503
  true
98315
98504
  );
98316
- case 354 /* CommaListExpression */:
98505
+ case 355 /* CommaListExpression */:
98317
98506
  return visitCommaListExpression(
98318
98507
  node,
98319
98508
  /*discarded*/
@@ -100904,7 +101093,7 @@ function transformES2018(context) {
100904
101093
  return visitObjectLiteralExpression(node);
100905
101094
  case 226 /* BinaryExpression */:
100906
101095
  return visitBinaryExpression(node, expressionResultIsUnused2);
100907
- case 354 /* CommaListExpression */:
101096
+ case 355 /* CommaListExpression */:
100908
101097
  return visitCommaListExpression(node, expressionResultIsUnused2);
100909
101098
  case 299 /* CatchClause */:
100910
101099
  return visitCatchClause(node);
@@ -104127,7 +104316,7 @@ function transformES2015(context) {
104127
104316
  return visitParenthesizedExpression(node, expressionResultIsUnused2);
104128
104317
  case 226 /* BinaryExpression */:
104129
104318
  return visitBinaryExpression(node, expressionResultIsUnused2);
104130
- case 354 /* CommaListExpression */:
104319
+ case 355 /* CommaListExpression */:
104131
104320
  return visitCommaListExpression(node, expressionResultIsUnused2);
104132
104321
  case 15 /* NoSubstitutionTemplateLiteral */:
104133
104322
  case 16 /* TemplateHead */:
@@ -107422,7 +107611,7 @@ function transformGenerators(context) {
107422
107611
  switch (node.kind) {
107423
107612
  case 226 /* BinaryExpression */:
107424
107613
  return visitBinaryExpression(node);
107425
- case 354 /* CommaListExpression */:
107614
+ case 355 /* CommaListExpression */:
107426
107615
  return visitCommaListExpression(node);
107427
107616
  case 227 /* ConditionalExpression */:
107428
107617
  return visitConditionalExpression(node);
@@ -109812,7 +110001,7 @@ function transformModule(context) {
109812
110001
  return visitExpressionStatement(node);
109813
110002
  case 217 /* ParenthesizedExpression */:
109814
110003
  return visitParenthesizedExpression(node, valueIsDiscarded);
109815
- case 353 /* PartiallyEmittedExpression */:
110004
+ case 354 /* PartiallyEmittedExpression */:
109816
110005
  return visitPartiallyEmittedExpression(node, valueIsDiscarded);
109817
110006
  case 213 /* CallExpression */:
109818
110007
  if (isImportCall(node) && currentSourceFile.impliedNodeFormat === void 0) {
@@ -112205,7 +112394,7 @@ function transformSystemModule(context) {
112205
112394
  return visitExpressionStatement(node);
112206
112395
  case 217 /* ParenthesizedExpression */:
112207
112396
  return visitParenthesizedExpression(node, valueIsDiscarded);
112208
- case 353 /* PartiallyEmittedExpression */:
112397
+ case 354 /* PartiallyEmittedExpression */:
112209
112398
  return visitPartiallyEmittedExpression(node, valueIsDiscarded);
112210
112399
  case 226 /* BinaryExpression */:
112211
112400
  if (isDestructuringAssignment(node)) {
@@ -114218,6 +114407,8 @@ function transformDeclarations(context) {
114218
114407
  }
114219
114408
  if (isDeclaration(input) && isDeclarationAndNotVisible(input))
114220
114409
  return;
114410
+ if (isJSDocImportTag(input))
114411
+ return;
114221
114412
  if (isFunctionLike(input) && resolver.isImplementationOfOverload(input))
114222
114413
  return;
114223
114414
  let previousEnclosingDeclaration;
@@ -114865,7 +115056,7 @@ function noEmitNotification(hint, node, callback) {
114865
115056
  }
114866
115057
  function transformNodes(resolver, host, factory2, options, nodes, transformers, allowDtsFiles) {
114867
115058
  var _a, _b;
114868
- const enabledSyntaxKindFeatures = new Array(356 /* Count */);
115059
+ const enabledSyntaxKindFeatures = new Array(357 /* Count */);
114869
115060
  let lexicalEnvironmentVariableDeclarations;
114870
115061
  let lexicalEnvironmentFunctionDeclarations;
114871
115062
  let lexicalEnvironmentStatements;
@@ -116444,7 +116635,9 @@ function createPrinter(printerOptions = {}, handlers = {}) {
116444
116635
  return emitJSDocTypedefTag(node);
116445
116636
  case 347 /* JSDocSeeTag */:
116446
116637
  return emitJSDocSeeTag(node);
116447
- case 352 /* NotEmittedStatement */:
116638
+ case 351 /* JSDocImportTag */:
116639
+ return emitJSDocImportTag(node);
116640
+ case 353 /* NotEmittedStatement */:
116448
116641
  return;
116449
116642
  }
116450
116643
  if (isExpression(node)) {
@@ -116545,15 +116738,15 @@ function createPrinter(printerOptions = {}, handlers = {}) {
116545
116738
  return emitJsxSelfClosingElement(node);
116546
116739
  case 288 /* JsxFragment */:
116547
116740
  return emitJsxFragment(node);
116548
- case 351 /* SyntaxList */:
116741
+ case 352 /* SyntaxList */:
116549
116742
  return Debug.fail("SyntaxList should not be printed");
116550
- case 352 /* NotEmittedStatement */:
116743
+ case 353 /* NotEmittedStatement */:
116551
116744
  return;
116552
- case 353 /* PartiallyEmittedExpression */:
116745
+ case 354 /* PartiallyEmittedExpression */:
116553
116746
  return emitPartiallyEmittedExpression(node);
116554
- case 354 /* CommaListExpression */:
116747
+ case 355 /* CommaListExpression */:
116555
116748
  return emitCommaList(node);
116556
- case 355 /* SyntheticReferenceExpression */:
116749
+ case 356 /* SyntheticReferenceExpression */:
116557
116750
  return Debug.fail("SyntheticReferenceExpression should not be printed");
116558
116751
  }
116559
116752
  }
@@ -118397,6 +118590,21 @@ function createPrinter(printerOptions = {}, handlers = {}) {
118397
118590
  emit(tag.name);
118398
118591
  emitJSDocComment(tag.comment);
118399
118592
  }
118593
+ function emitJSDocImportTag(tag) {
118594
+ emitJSDocTagName(tag.tagName);
118595
+ writeSpace();
118596
+ if (tag.importClause) {
118597
+ emit(tag.importClause);
118598
+ writeSpace();
118599
+ emitTokenWithComment(161 /* FromKeyword */, tag.importClause.end, writeKeyword, tag);
118600
+ writeSpace();
118601
+ }
118602
+ emitExpression(tag.moduleSpecifier);
118603
+ if (tag.attributes) {
118604
+ emitWithLeadingSpace(tag.attributes);
118605
+ }
118606
+ emitJSDocComment(tag.comment);
118607
+ }
118400
118608
  function emitJSDocNameReference(node) {
118401
118609
  writeSpace();
118402
118610
  writePunctuation("{");
@@ -119809,7 +120017,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119809
120017
  emitLeadingComments(
119810
120018
  pos,
119811
120019
  /*isEmittedNode*/
119812
- node.kind !== 352 /* NotEmittedStatement */
120020
+ node.kind !== 353 /* NotEmittedStatement */
119813
120021
  );
119814
120022
  }
119815
120023
  if (!skipLeadingComments || pos >= 0 && (emitFlags & 1024 /* NoLeadingComments */) !== 0) {
@@ -119833,7 +120041,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119833
120041
  containerPos = savedContainerPos;
119834
120042
  containerEnd = savedContainerEnd;
119835
120043
  declarationListContainerEnd = savedDeclarationListContainerEnd;
119836
- if (!skipTrailingComments && node.kind !== 352 /* NotEmittedStatement */) {
120044
+ if (!skipTrailingComments && node.kind !== 353 /* NotEmittedStatement */) {
119837
120045
  emitTrailingComments(end);
119838
120046
  }
119839
120047
  }
@@ -120085,7 +120293,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
120085
120293
  const emitFlags = getEmitFlags(node);
120086
120294
  const sourceMapRange = getSourceMapRange(node);
120087
120295
  const source = sourceMapRange.source || sourceMapSource;
120088
- if (node.kind !== 352 /* NotEmittedStatement */ && (emitFlags & 32 /* NoLeadingSourceMap */) === 0 && sourceMapRange.pos >= 0) {
120296
+ if (node.kind !== 353 /* NotEmittedStatement */ && (emitFlags & 32 /* NoLeadingSourceMap */) === 0 && sourceMapRange.pos >= 0) {
120089
120297
  emitSourcePos(sourceMapRange.source || sourceMapSource, skipSourceTrivia(source, sourceMapRange.pos));
120090
120298
  }
120091
120299
  if (emitFlags & 128 /* NoNestedSourceMaps */) {
@@ -120098,7 +120306,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
120098
120306
  if (emitFlags & 128 /* NoNestedSourceMaps */) {
120099
120307
  sourceMapsDisabled = false;
120100
120308
  }
120101
- if (node.kind !== 352 /* NotEmittedStatement */ && (emitFlags & 64 /* NoTrailingSourceMap */) === 0 && sourceMapRange.end >= 0) {
120309
+ if (node.kind !== 353 /* NotEmittedStatement */ && (emitFlags & 64 /* NoTrailingSourceMap */) === 0 && sourceMapRange.end >= 0) {
120102
120310
  emitSourcePos(sourceMapRange.source || sourceMapSource, sourceMapRange.end);
120103
120311
  }
120104
120312
  }
@@ -121880,6 +122088,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
121880
122088
  getResolvedProjectReferenceByPath,
121881
122089
  forEachResolvedProjectReference: forEachResolvedProjectReference2,
121882
122090
  isSourceOfProjectReferenceRedirect,
122091
+ getRedirectReferenceForResolutionFromSourceOfProject,
121883
122092
  emitBuildInfo,
121884
122093
  fileExists,
121885
122094
  readFile,
@@ -123022,7 +123231,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
123022
123231
  );
123023
123232
  }
123024
123233
  if (file.flags & 4194304 /* PossiblyContainsDynamicImport */ || isJavaScriptFile) {
123025
- collectDynamicImportOrRequireCalls(file);
123234
+ collectDynamicImportOrRequireOrJsDocImportCalls(file);
123026
123235
  }
123027
123236
  file.imports = imports || emptyArray;
123028
123237
  file.moduleAugmentations = moduleAugmentations || emptyArray;
@@ -123066,7 +123275,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
123066
123275
  }
123067
123276
  }
123068
123277
  }
123069
- function collectDynamicImportOrRequireCalls(file2) {
123278
+ function collectDynamicImportOrRequireOrJsDocImportCalls(file2) {
123070
123279
  const r = /import|require/g;
123071
123280
  while (r.exec(file2.text) !== null) {
123072
123281
  const node = getNodeAtPosition(file2, r.lastIndex);
@@ -123095,6 +123304,16 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
123095
123304
  false
123096
123305
  );
123097
123306
  imports = append(imports, node.argument.literal);
123307
+ } else if (isJavaScriptFile && isJSDocImportTag(node)) {
123308
+ const moduleNameExpr = getExternalModuleName(node);
123309
+ if (moduleNameExpr && isStringLiteral(moduleNameExpr) && moduleNameExpr.text) {
123310
+ setParentRecursive(
123311
+ node,
123312
+ /*incremental*/
123313
+ false
123314
+ );
123315
+ imports = append(imports, moduleNameExpr);
123316
+ }
123098
123317
  }
123099
123318
  }
123100
123319
  }
@@ -132982,7 +133201,7 @@ function symbolEscapedNameNoDefault(symbol) {
132982
133201
  });
132983
133202
  }
132984
133203
  function isModuleSpecifierLike(node) {
132985
- return isStringLiteralLike(node) && (isExternalModuleReference(node.parent) || isImportDeclaration(node.parent) || isRequireCall(
133204
+ return isStringLiteralLike(node) && (isExternalModuleReference(node.parent) || isImportDeclaration(node.parent) || isJSDocImportTag(node.parent) || isRequireCall(
132986
133205
  node.parent,
132987
133206
  /*requireStringLiteralLikeArgument*/
132988
133207
  false
@@ -136359,14 +136578,14 @@ function getSourceFileToImportFromResolved(importLiteral, resolved, oldToNew, so
136359
136578
  return newFileName && { newFileName, updated: true };
136360
136579
  }
136361
136580
  }
136362
- function updateImportsWorker(sourceFile, changeTracker, updateRef, updateImport2) {
136581
+ function updateImportsWorker(sourceFile, changeTracker, updateRef, updateImport) {
136363
136582
  for (const ref of sourceFile.referencedFiles || emptyArray) {
136364
136583
  const updated = updateRef(ref.fileName);
136365
136584
  if (updated !== void 0 && updated !== sourceFile.text.slice(ref.pos, ref.end))
136366
136585
  changeTracker.replaceRangeWithText(sourceFile, ref, updated);
136367
136586
  }
136368
136587
  for (const importStringLiteral of sourceFile.imports) {
136369
- const updated = updateImport2(importStringLiteral);
136588
+ const updated = updateImport(importStringLiteral);
136370
136589
  if (updated !== void 0 && updated !== importStringLiteral.text)
136371
136590
  changeTracker.replaceRangeWithText(sourceFile, createStringRange(importStringLiteral, sourceFile), updated);
136372
136591
  }
@@ -138790,8 +139009,8 @@ function getImportConversionInfo(context, considerPartialSpans = true) {
138790
139009
  const { file } = context;
138791
139010
  const span = getRefactorContextSpan(context);
138792
139011
  const token = getTokenAtPosition(file, span.start);
138793
- const importDecl = considerPartialSpans ? findAncestor(token, isImportDeclaration) : getParentNodeInSpan(token, file, span);
138794
- if (!importDecl || !isImportDeclaration(importDecl))
139012
+ const importDecl = considerPartialSpans ? findAncestor(token, or(isImportDeclaration, isJSDocImportTag)) : getParentNodeInSpan(token, file, span);
139013
+ if (importDecl === void 0 || !(isImportDeclaration(importDecl) || isJSDocImportTag(importDecl)))
138795
139014
  return { error: "Selection is not an import declaration." };
138796
139015
  const end = span.start + span.length;
138797
139016
  const nextToken = findNextToken(importDecl, importDecl.parent, file);
@@ -138862,15 +139081,16 @@ function doChangeNamespaceToNamed(sourceFile, checker, changes, toConvert, allow
138862
139081
  ));
138863
139082
  });
138864
139083
  const importDecl = toConvert.parent.parent;
138865
- if (usedAsNamespaceOrDefault && !allowSyntheticDefaultImports) {
138866
- changes.insertNodeAfter(sourceFile, importDecl, updateImport(
139084
+ if (usedAsNamespaceOrDefault && !allowSyntheticDefaultImports && isImportDeclaration(importDecl)) {
139085
+ changes.insertNodeAfter(sourceFile, importDecl, createImport(
138867
139086
  importDecl,
138868
139087
  /*defaultImportName*/
138869
139088
  void 0,
138870
139089
  importSpecifiers
138871
139090
  ));
138872
139091
  } else {
138873
- changes.replaceNode(sourceFile, importDecl, updateImport(importDecl, usedAsNamespaceOrDefault ? factory.createIdentifier(toConvert.name.text) : void 0, importSpecifiers));
139092
+ const defaultImportName = usedAsNamespaceOrDefault ? factory.createIdentifier(toConvert.name.text) : void 0;
139093
+ changes.replaceNode(sourceFile, toConvert.parent, createImportClause(defaultImportName, importSpecifiers));
138874
139094
  }
138875
139095
  }
138876
139096
  function getRightOfPropertyAccessOrQualifiedName(propertyAccessOrQualifiedName) {
@@ -138930,9 +139150,9 @@ function doChangeNamedToNamespaceOrDefault(sourceFile, program, changes, toConve
138930
139150
  toConvert,
138931
139151
  shouldUseDefault ? factory.createIdentifier(namespaceImportName) : factory.createNamespaceImport(factory.createIdentifier(namespaceImportName))
138932
139152
  );
138933
- if (neededNamedImports.size) {
139153
+ if (neededNamedImports.size && isImportDeclaration(importDecl)) {
138934
139154
  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(
139155
+ changes.insertNodeAfter(sourceFile, toConvert.parent.parent, createImport(
138936
139156
  importDecl,
138937
139157
  /*defaultImportName*/
138938
139158
  void 0,
@@ -138947,21 +139167,24 @@ function isExportEqualsModule(moduleSpecifier, checker) {
138947
139167
  const exportEquals = checker.resolveExternalModuleSymbol(externalModule);
138948
139168
  return externalModule !== exportEquals;
138949
139169
  }
138950
- function updateImport(old, defaultImportName, elements) {
139170
+ function createImport(node, defaultImportName, elements) {
138951
139171
  return factory.createImportDeclaration(
138952
139172
  /*modifiers*/
138953
139173
  void 0,
138954
- factory.createImportClause(
138955
- /*isTypeOnly*/
138956
- false,
138957
- defaultImportName,
138958
- elements && elements.length ? factory.createNamedImports(elements) : void 0
138959
- ),
138960
- old.moduleSpecifier,
139174
+ createImportClause(defaultImportName, elements),
139175
+ node.moduleSpecifier,
138961
139176
  /*attributes*/
138962
139177
  void 0
138963
139178
  );
138964
139179
  }
139180
+ function createImportClause(defaultImportName, elements) {
139181
+ return factory.createImportClause(
139182
+ /*isTypeOnly*/
139183
+ false,
139184
+ defaultImportName,
139185
+ elements && elements.length ? factory.createNamedImports(elements) : void 0
139186
+ );
139187
+ }
138965
139188
 
138966
139189
  // src/services/refactors/extractType.ts
138967
139190
  var refactorName3 = "Extract type";
@@ -144184,7 +144407,7 @@ var NodeObject = class {
144184
144407
  if (!children.length) {
144185
144408
  return void 0;
144186
144409
  }
144187
- const child = find(children, (kid) => kid.kind < 309 /* FirstJSDocNode */ || kid.kind > 350 /* LastJSDocNode */);
144410
+ const child = find(children, (kid) => kid.kind < 309 /* FirstJSDocNode */ || kid.kind > 351 /* LastJSDocNode */);
144188
144411
  return child.kind < 166 /* FirstNode */ ? child : child.getFirstToken(sourceFile);
144189
144412
  }
144190
144413
  getLastToken(sourceFile) {
@@ -144251,7 +144474,7 @@ function addSyntheticNodes(nodes, pos, end, parent2) {
144251
144474
  }
144252
144475
  }
144253
144476
  function createSyntaxList(nodes, parent2) {
144254
- const list = createNode(351 /* SyntaxList */, nodes.pos, nodes.end, parent2);
144477
+ const list = createNode(352 /* SyntaxList */, nodes.pos, nodes.end, parent2);
144255
144478
  list._children = [];
144256
144479
  let pos = nodes.pos;
144257
144480
  for (const node of nodes) {
@@ -149856,7 +150079,7 @@ registerCodeFix({
149856
150079
  const declaration = getDeclaration2(context.sourceFile, context.span.start);
149857
150080
  if (declaration) {
149858
150081
  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;
150082
+ 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
150083
  const mainAction = createCodeFixAction(
149861
150084
  fixId13,
149862
150085
  changes,
@@ -149882,7 +150105,7 @@ registerCodeFix({
149882
150105
  if ((errorDeclaration == null ? void 0 : errorDeclaration.kind) === 272 /* ImportDeclaration */ && !fixedImportDeclarations.has(errorDeclaration)) {
149883
150106
  doChange11(changes, diag2.file, errorDeclaration);
149884
150107
  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)) {
150108
+ } 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
150109
  doChange11(changes, diag2.file, errorDeclaration.parent.parent.parent);
149887
150110
  fixedImportDeclarations.add(errorDeclaration.parent.parent.parent);
149888
150111
  } else if ((errorDeclaration == null ? void 0 : errorDeclaration.kind) === 276 /* ImportSpecifier */) {
@@ -150754,6 +150977,7 @@ function getNamespaceLikeImportText(declaration) {
150754
150977
  return (_a = tryCast(declaration.name, isIdentifier)) == null ? void 0 : _a.text;
150755
150978
  case 271 /* ImportEqualsDeclaration */:
150756
150979
  return declaration.name.text;
150980
+ case 351 /* JSDocImportTag */:
150757
150981
  case 272 /* ImportDeclaration */:
150758
150982
  return (_c = tryCast((_b = declaration.importClause) == null ? void 0 : _b.namedBindings, isNamespaceImport)) == null ? void 0 : _c.name.text;
150759
150983
  default:
@@ -150831,7 +151055,7 @@ function createExistingImportMap(checker, importingFile, compilerOptions) {
150831
151055
  if (moduleSymbol) {
150832
151056
  (importMap || (importMap = createMultiMap())).add(getSymbolId(moduleSymbol), i.parent);
150833
151057
  }
150834
- } else if (i.kind === 272 /* ImportDeclaration */ || i.kind === 271 /* ImportEqualsDeclaration */) {
151058
+ } else if (i.kind === 272 /* ImportDeclaration */ || i.kind === 271 /* ImportEqualsDeclaration */ || i.kind === 351 /* JSDocImportTag */) {
150835
151059
  const moduleSymbol = checker.getSymbolAtLocation(moduleSpecifier);
150836
151060
  if (moduleSymbol) {
150837
151061
  (importMap || (importMap = createMultiMap())).add(getSymbolId(moduleSymbol), i);
@@ -150840,11 +151064,11 @@ function createExistingImportMap(checker, importingFile, compilerOptions) {
150840
151064
  }
150841
151065
  return {
150842
151066
  getImportsForExportInfo: ({ moduleSymbol, exportKind, targetFlags, symbol }) => {
150843
- if (!(targetFlags & 111551 /* Value */) && isSourceFileJS(importingFile))
150844
- return emptyArray;
150845
151067
  const matchingDeclarations = importMap == null ? void 0 : importMap.get(getSymbolId(moduleSymbol));
150846
151068
  if (!matchingDeclarations)
150847
151069
  return emptyArray;
151070
+ if (isSourceFileJS(importingFile) && !(targetFlags & 111551 /* Value */) && !every(matchingDeclarations, isJSDocImportTag))
151071
+ return emptyArray;
150848
151072
  const importKind = getImportKind(importingFile, exportKind, compilerOptions);
150849
151073
  return matchingDeclarations.map((declaration) => ({ declaration, importKind, symbol, targetFlags }));
150850
151074
  }
@@ -157104,7 +157328,7 @@ function getInfo19(sourceFile, pos) {
157104
157328
  const { parent: parent2 } = name;
157105
157329
  if (isImportEqualsDeclaration(parent2) && isExternalModuleReference(parent2.moduleReference)) {
157106
157330
  return { importNode: parent2, name, moduleSpecifier: parent2.moduleReference.expression };
157107
- } else if (isNamespaceImport(parent2)) {
157331
+ } else if (isNamespaceImport(parent2) && isImportDeclaration(parent2.parent.parent)) {
157108
157332
  const importNode = parent2.parent.parent;
157109
157333
  return { importNode, name, moduleSpecifier: importNode.moduleSpecifier };
157110
157334
  }
@@ -159273,7 +159497,8 @@ function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, con
159273
159497
  }
159274
159498
  function symbolAppearsToBeTypeOnly(symbol) {
159275
159499
  var _a;
159276
- return !(symbol.flags & 111551 /* Value */) && (!isInJSFile((_a = symbol.declarations) == null ? void 0 : _a[0]) || !!(symbol.flags & 788968 /* Type */));
159500
+ const flags = getCombinedLocalAndExportSymbolFlags(skipAlias(symbol, typeChecker));
159501
+ return !(flags & 111551 /* Value */) && (!isInJSFile((_a = symbol.declarations) == null ? void 0 : _a[0]) || !!(flags & 788968 /* Type */));
159277
159502
  }
159278
159503
  }
159279
159504
  function getLabelCompletionAtPosition(node) {
@@ -159614,6 +159839,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
159614
159839
  const insideComment = isInComment(sourceFile, position, currentToken);
159615
159840
  log("getCompletionData: Is inside comment: " + (timestamp() - start));
159616
159841
  let insideJsDocTagTypeExpression = false;
159842
+ let insideJsDocImportTag = false;
159617
159843
  let isInSnippetScope = false;
159618
159844
  if (insideComment) {
159619
159845
  if (hasDocComment(sourceFile, position)) {
@@ -159631,24 +159857,28 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
159631
159857
  if (tag.tagName.pos <= position && position <= tag.tagName.end) {
159632
159858
  return { kind: 1 /* JsDocTagName */ };
159633
159859
  }
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);
159860
+ if (isJSDocImportTag(tag)) {
159861
+ insideJsDocImportTag = true;
159862
+ } else {
159863
+ const typeExpression = tryGetTypeExpressionFromTag(tag);
159864
+ if (typeExpression) {
159865
+ currentToken = getTokenAtPosition(sourceFile, position);
159866
+ if (!currentToken || !isDeclarationName(currentToken) && (currentToken.parent.kind !== 348 /* JSDocPropertyTag */ || currentToken.parent.name !== currentToken)) {
159867
+ insideJsDocTagTypeExpression = isCurrentlyEditingNode(typeExpression);
159868
+ }
159869
+ }
159870
+ if (!insideJsDocTagTypeExpression && isJSDocParameterTag(tag) && (nodeIsMissing(tag.name) || tag.name.pos <= position && position <= tag.name.end)) {
159871
+ return { kind: 3 /* JsDocParameterName */, tag };
159639
159872
  }
159640
- }
159641
- if (!insideJsDocTagTypeExpression && isJSDocParameterTag(tag) && (nodeIsMissing(tag.name) || tag.name.pos <= position && position <= tag.name.end)) {
159642
- return { kind: 3 /* JsDocParameterName */, tag };
159643
159873
  }
159644
159874
  }
159645
- if (!insideJsDocTagTypeExpression) {
159875
+ if (!insideJsDocTagTypeExpression && !insideJsDocImportTag) {
159646
159876
  log("Returning an empty list because completion was inside a regular comment or plain text part of a JsDoc comment.");
159647
159877
  return void 0;
159648
159878
  }
159649
159879
  }
159650
159880
  start = timestamp();
159651
- const isJsOnlyLocation = !insideJsDocTagTypeExpression && isSourceFileJS(sourceFile);
159881
+ const isJsOnlyLocation = !insideJsDocTagTypeExpression && !insideJsDocImportTag && isSourceFileJS(sourceFile);
159652
159882
  const tokens = getRelevantTokens(position, sourceFile);
159653
159883
  const previousToken = tokens.previousToken;
159654
159884
  let contextToken = tokens.contextToken;
@@ -160161,7 +160391,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
160161
160391
  }
160162
160392
  }
160163
160393
  function isTypeOnlyCompletion() {
160164
- return insideJsDocTagTypeExpression || !!importStatementCompletion && isTypeOnlyImportOrExportDeclaration(location.parent) || !isContextTokenValueLocation(contextToken) && (isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker) || isPartOfTypeNode(location) || isContextTokenTypeLocation(contextToken));
160394
+ return insideJsDocTagTypeExpression || insideJsDocImportTag || !!importStatementCompletion && isTypeOnlyImportOrExportDeclaration(location.parent) || !isContextTokenValueLocation(contextToken) && (isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker) || isPartOfTypeNode(location) || isContextTokenTypeLocation(contextToken));
160165
160395
  }
160166
160396
  function isContextTokenValueLocation(contextToken2) {
160167
160397
  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 +161415,7 @@ function getPropertiesForCompletion(type, checker) {
161185
161415
  }
161186
161416
  function tryGetObjectTypeDeclarationCompletionContainer(sourceFile, contextToken, location, position) {
161187
161417
  switch (location.kind) {
161188
- case 351 /* SyntaxList */:
161418
+ case 352 /* SyntaxList */:
161189
161419
  return tryCast(location.parent, isObjectTypeDeclaration);
161190
161420
  case 1 /* EndOfFileToken */:
161191
161421
  const cls = tryCast(lastOrUndefined(cast(location.parent, isSourceFile).statements), isObjectTypeDeclaration);
@@ -161416,13 +161646,13 @@ function getSingleLineReplacementSpanForImportCompletionNode(node) {
161416
161646
  var _a;
161417
161647
  if (!node)
161418
161648
  return void 0;
161419
- const top = findAncestor(node, or(isImportDeclaration, isImportEqualsDeclaration)) ?? node;
161649
+ const top = findAncestor(node, or(isImportDeclaration, isImportEqualsDeclaration, isJSDocImportTag)) ?? node;
161420
161650
  const sourceFile = top.getSourceFile();
161421
161651
  if (rangeIsOnSingleLine(top, sourceFile)) {
161422
161652
  return createTextSpanFromNode(top, sourceFile);
161423
161653
  }
161424
161654
  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;
161655
+ const potentialSplitPoint = top.kind === 272 /* ImportDeclaration */ || top.kind === 351 /* JSDocImportTag */ ? getPotentiallyInvalidImportSpecifier((_a = top.importClause) == null ? void 0 : _a.namedBindings) ?? top.moduleSpecifier : top.moduleReference;
161426
161656
  const withoutModuleSpecifier = {
161427
161657
  pos: top.getFirstToken().getStart(),
161428
161658
  end: potentialSplitPoint.pos
@@ -161718,6 +161948,7 @@ function getStringLiteralCompletionEntries(sourceFile, node, position, program,
161718
161948
  case 272 /* ImportDeclaration */:
161719
161949
  case 278 /* ExportDeclaration */:
161720
161950
  case 283 /* ExternalModuleReference */:
161951
+ case 351 /* JSDocImportTag */:
161721
161952
  return { kind: 0 /* Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, program, host, preferences) };
161722
161953
  case 296 /* CaseClause */:
161723
161954
  const tracker = newCaseClauseTracker(typeChecker, parent2.parent.clauses);
@@ -162514,6 +162745,7 @@ function getImportersForExport(sourceFiles, sourceFilesSet, allDirectImports, {
162514
162745
  );
162515
162746
  break;
162516
162747
  case 272 /* ImportDeclaration */:
162748
+ case 351 /* JSDocImportTag */:
162517
162749
  directImports.push(direct);
162518
162750
  const namedBindings = direct.importClause && direct.importClause.namedBindings;
162519
162751
  if (namedBindings && namedBindings.kind === 274 /* NamespaceImport */) {
@@ -166247,6 +166479,7 @@ var jsDocTagNames = [
166247
166479
  "host",
166248
166480
  "ignore",
166249
166481
  "implements",
166482
+ "import",
166250
166483
  "inheritdoc",
166251
166484
  "inner",
166252
166485
  "instance",
@@ -173685,6 +173918,7 @@ __export(ts_exports2, {
173685
173918
  createEmitAndSemanticDiagnosticsBuilderProgram: () => createEmitAndSemanticDiagnosticsBuilderProgram,
173686
173919
  createEmitHelperFactory: () => createEmitHelperFactory,
173687
173920
  createEmptyExports: () => createEmptyExports,
173921
+ createEvaluator: () => createEvaluator,
173688
173922
  createExpressionForJsxElement: () => createExpressionForJsxElement,
173689
173923
  createExpressionForJsxFragment: () => createExpressionForJsxFragment,
173690
173924
  createExpressionForObjectLiteralElementLike: () => createExpressionForObjectLiteralElementLike,
@@ -174749,6 +174983,7 @@ __export(ts_exports2, {
174749
174983
  isJSDocEnumTag: () => isJSDocEnumTag,
174750
174984
  isJSDocFunctionType: () => isJSDocFunctionType,
174751
174985
  isJSDocImplementsTag: () => isJSDocImplementsTag,
174986
+ isJSDocImportTag: () => isJSDocImportTag,
174752
174987
  isJSDocIndexSignature: () => isJSDocIndexSignature,
174753
174988
  isJSDocLikeText: () => isJSDocLikeText,
174754
174989
  isJSDocLink: () => isJSDocLink,
@@ -179902,7 +180137,16 @@ function createWatchFactoryHostUsingWatchEvents(service, canUseWatchEvents) {
179902
180137
  recursive ? watchedDirectoriesRecursive : watchedDirectories,
179903
180138
  path,
179904
180139
  callback,
179905
- (id) => ({ eventName: CreateDirectoryWatcherEvent, data: { id, path, recursive: !!recursive } })
180140
+ (id) => ({
180141
+ eventName: CreateDirectoryWatcherEvent,
180142
+ data: {
180143
+ id,
180144
+ path,
180145
+ recursive: !!recursive,
180146
+ // Special case node_modules as we watch it for changes to closed script infos as well
180147
+ ignoreUpdate: !path.endsWith("/node_modules") ? true : void 0
180148
+ }
180149
+ })
179906
180150
  );
179907
180151
  }
179908
180152
  function getOrCreateFileWatcher({ pathToId, idToCallbacks }, path, callback, event) {
@@ -179929,24 +180173,28 @@ function createWatchFactoryHostUsingWatchEvents(service, canUseWatchEvents) {
179929
180173
  }
179930
180174
  };
179931
180175
  }
179932
- function onWatchChange({ id, path, eventType }) {
179933
- onFileWatcherCallback(id, path, eventType);
179934
- onDirectoryWatcherCallback(watchedDirectories, id, path, eventType);
179935
- onDirectoryWatcherCallback(watchedDirectoriesRecursive, id, path, eventType);
180176
+ function onWatchChange(args) {
180177
+ if (isArray(args))
180178
+ args.forEach(onWatchChangeRequestArgs);
180179
+ else
180180
+ onWatchChangeRequestArgs(args);
180181
+ }
180182
+ function onWatchChangeRequestArgs({ id, created, deleted, updated }) {
180183
+ onWatchEventType(id, created, 0 /* Created */);
180184
+ onWatchEventType(id, deleted, 2 /* Deleted */);
180185
+ onWatchEventType(id, updated, 1 /* Changed */);
179936
180186
  }
179937
- function onFileWatcherCallback(id, eventPath, eventType) {
179938
- var _a;
179939
- (_a = watchedFiles.idToCallbacks.get(id)) == null ? void 0 : _a.forEach((callback) => {
179940
- const eventKind = eventType === "create" ? 0 /* Created */ : eventType === "delete" ? 2 /* Deleted */ : 1 /* Changed */;
179941
- callback(eventPath, eventKind);
179942
- });
180187
+ function onWatchEventType(id, paths, eventKind) {
180188
+ if (!(paths == null ? void 0 : paths.length))
180189
+ return;
180190
+ forEachCallback(watchedFiles, id, paths, (callback, eventPath) => callback(eventPath, eventKind));
180191
+ forEachCallback(watchedDirectories, id, paths, (callback, eventPath) => callback(eventPath));
180192
+ forEachCallback(watchedDirectoriesRecursive, id, paths, (callback, eventPath) => callback(eventPath));
179943
180193
  }
179944
- function onDirectoryWatcherCallback({ idToCallbacks }, id, eventPath, eventType) {
180194
+ function forEachCallback(hostWatcherMap, id, eventPaths, cb) {
179945
180195
  var _a;
179946
- if (eventType === "update")
179947
- return;
179948
- (_a = idToCallbacks.get(id)) == null ? void 0 : _a.forEach((callback) => {
179949
- callback(eventPath);
180196
+ (_a = hostWatcherMap.idToCallbacks.get(id)) == null ? void 0 : _a.forEach((callback) => {
180197
+ eventPaths.forEach((eventPath) => cb(callback, normalizeSlashes(eventPath)));
179950
180198
  });
179951
180199
  }
179952
180200
  }
@@ -182919,7 +183167,6 @@ Dynamic files must always be opened with service's current directory or service
182919
183167
  (fileName, eventKind) => {
182920
183168
  switch (eventKind) {
182921
183169
  case 0 /* Created */:
182922
- return Debug.fail();
182923
183170
  case 1 /* Changed */:
182924
183171
  this.packageJsonCache.addOrUpdate(fileName, path);
182925
183172
  this.onPackageJsonChange(result);
@@ -187887,6 +188134,7 @@ if (typeof console !== "undefined") {
187887
188134
  createEmitAndSemanticDiagnosticsBuilderProgram,
187888
188135
  createEmitHelperFactory,
187889
188136
  createEmptyExports,
188137
+ createEvaluator,
187890
188138
  createExpressionForJsxElement,
187891
188139
  createExpressionForJsxFragment,
187892
188140
  createExpressionForObjectLiteralElementLike,
@@ -188951,6 +189199,7 @@ if (typeof console !== "undefined") {
188951
189199
  isJSDocEnumTag,
188952
189200
  isJSDocFunctionType,
188953
189201
  isJSDocImplementsTag,
189202
+ isJSDocImportTag,
188954
189203
  isJSDocIndexSignature,
188955
189204
  isJSDocLikeText,
188956
189205
  isJSDocLink,