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/tsc.js CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.5";
21
- var version = `${versionMajorMinor}.0-dev.20240326`;
21
+ var version = `${versionMajorMinor}.0-dev.20240328`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -3346,12 +3346,13 @@ var SyntaxKind = /* @__PURE__ */ ((SyntaxKind4) => {
3346
3346
  SyntaxKind4[SyntaxKind4["JSDocPropertyTag"] = 348] = "JSDocPropertyTag";
3347
3347
  SyntaxKind4[SyntaxKind4["JSDocThrowsTag"] = 349] = "JSDocThrowsTag";
3348
3348
  SyntaxKind4[SyntaxKind4["JSDocSatisfiesTag"] = 350] = "JSDocSatisfiesTag";
3349
- SyntaxKind4[SyntaxKind4["SyntaxList"] = 351] = "SyntaxList";
3350
- SyntaxKind4[SyntaxKind4["NotEmittedStatement"] = 352] = "NotEmittedStatement";
3351
- SyntaxKind4[SyntaxKind4["PartiallyEmittedExpression"] = 353] = "PartiallyEmittedExpression";
3352
- SyntaxKind4[SyntaxKind4["CommaListExpression"] = 354] = "CommaListExpression";
3353
- SyntaxKind4[SyntaxKind4["SyntheticReferenceExpression"] = 355] = "SyntheticReferenceExpression";
3354
- SyntaxKind4[SyntaxKind4["Count"] = 356] = "Count";
3349
+ SyntaxKind4[SyntaxKind4["JSDocImportTag"] = 351] = "JSDocImportTag";
3350
+ SyntaxKind4[SyntaxKind4["SyntaxList"] = 352] = "SyntaxList";
3351
+ SyntaxKind4[SyntaxKind4["NotEmittedStatement"] = 353] = "NotEmittedStatement";
3352
+ SyntaxKind4[SyntaxKind4["PartiallyEmittedExpression"] = 354] = "PartiallyEmittedExpression";
3353
+ SyntaxKind4[SyntaxKind4["CommaListExpression"] = 355] = "CommaListExpression";
3354
+ SyntaxKind4[SyntaxKind4["SyntheticReferenceExpression"] = 356] = "SyntheticReferenceExpression";
3355
+ SyntaxKind4[SyntaxKind4["Count"] = 357] = "Count";
3355
3356
  SyntaxKind4[SyntaxKind4["FirstAssignment"] = 64 /* EqualsToken */] = "FirstAssignment";
3356
3357
  SyntaxKind4[SyntaxKind4["LastAssignment"] = 79 /* CaretEqualsToken */] = "LastAssignment";
3357
3358
  SyntaxKind4[SyntaxKind4["FirstCompoundAssignment"] = 65 /* PlusEqualsToken */] = "FirstCompoundAssignment";
@@ -3380,9 +3381,9 @@ var SyntaxKind = /* @__PURE__ */ ((SyntaxKind4) => {
3380
3381
  SyntaxKind4[SyntaxKind4["LastStatement"] = 259 /* DebuggerStatement */] = "LastStatement";
3381
3382
  SyntaxKind4[SyntaxKind4["FirstNode"] = 166 /* QualifiedName */] = "FirstNode";
3382
3383
  SyntaxKind4[SyntaxKind4["FirstJSDocNode"] = 309 /* JSDocTypeExpression */] = "FirstJSDocNode";
3383
- SyntaxKind4[SyntaxKind4["LastJSDocNode"] = 350 /* JSDocSatisfiesTag */] = "LastJSDocNode";
3384
+ SyntaxKind4[SyntaxKind4["LastJSDocNode"] = 351 /* JSDocImportTag */] = "LastJSDocNode";
3384
3385
  SyntaxKind4[SyntaxKind4["FirstJSDocTagNode"] = 327 /* JSDocTag */] = "FirstJSDocTagNode";
3385
- SyntaxKind4[SyntaxKind4["LastJSDocTagNode"] = 350 /* JSDocSatisfiesTag */] = "LastJSDocTagNode";
3386
+ SyntaxKind4[SyntaxKind4["LastJSDocTagNode"] = 351 /* JSDocImportTag */] = "LastJSDocTagNode";
3386
3387
  SyntaxKind4[SyntaxKind4["FirstContextualKeyword"] = 128 /* AbstractKeyword */] = "FirstContextualKeyword";
3387
3388
  SyntaxKind4[SyntaxKind4["LastContextualKeyword"] = 165 /* OfKeyword */] = "LastContextualKeyword";
3388
3389
  return SyntaxKind4;
@@ -3698,6 +3699,7 @@ var ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => {
3698
3699
  ObjectFlags3[ObjectFlags3["ContainsSpread"] = 2097152] = "ContainsSpread";
3699
3700
  ObjectFlags3[ObjectFlags3["ObjectRestType"] = 4194304] = "ObjectRestType";
3700
3701
  ObjectFlags3[ObjectFlags3["InstantiationExpressionType"] = 8388608] = "InstantiationExpressionType";
3702
+ ObjectFlags3[ObjectFlags3["SingleSignatureType"] = 134217728] = "SingleSignatureType";
3701
3703
  ObjectFlags3[ObjectFlags3["IsClassInstanceClone"] = 16777216] = "IsClassInstanceClone";
3702
3704
  ObjectFlags3[ObjectFlags3["IdenticalBaseTypeCalculated"] = 33554432] = "IdenticalBaseTypeCalculated";
3703
3705
  ObjectFlags3[ObjectFlags3["IdenticalBaseTypeExists"] = 67108864] = "IdenticalBaseTypeExists";
@@ -8466,7 +8468,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8466
8468
  var tokenValue;
8467
8469
  var tokenFlags;
8468
8470
  var commentDirectives;
8469
- var inJSDocType = 0;
8471
+ var skipJsDocLeadingAsterisks = 0;
8470
8472
  var scriptKind = 0 /* Unknown */;
8471
8473
  var jsDocParsingMode = 0 /* ParseAll */;
8472
8474
  setText(text, start, length2);
@@ -8517,7 +8519,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8517
8519
  setOnError,
8518
8520
  resetTokenState,
8519
8521
  setTextPos: resetTokenState,
8520
- setInJSDocType,
8522
+ setSkipJsDocLeadingAsterisks,
8521
8523
  tryScan,
8522
8524
  lookAhead,
8523
8525
  scanRange
@@ -9233,7 +9235,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9233
9235
  return pos += 2, token = 43 /* AsteriskAsteriskToken */;
9234
9236
  }
9235
9237
  pos++;
9236
- if (inJSDocType && !asteriskSeen && tokenFlags & 1 /* PrecedingLineBreak */) {
9238
+ if (skipJsDocLeadingAsterisks && !asteriskSeen && tokenFlags & 1 /* PrecedingLineBreak */) {
9237
9239
  asteriskSeen = true;
9238
9240
  continue;
9239
9241
  }
@@ -10011,8 +10013,8 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
10011
10013
  tokenValue = void 0;
10012
10014
  tokenFlags = 0 /* None */;
10013
10015
  }
10014
- function setInJSDocType(inType) {
10015
- inJSDocType += inType ? 1 : -1;
10016
+ function setSkipJsDocLeadingAsterisks(skip) {
10017
+ skipJsDocLeadingAsterisks += skip ? 1 : -1;
10016
10018
  }
10017
10019
  }
10018
10020
  function codePointAt(s, i) {
@@ -11065,8 +11067,8 @@ function isExpressionKind(kind) {
11065
11067
  case 230 /* SpreadElement */:
11066
11068
  case 234 /* AsExpression */:
11067
11069
  case 232 /* OmittedExpression */:
11068
- case 354 /* CommaListExpression */:
11069
- case 353 /* PartiallyEmittedExpression */:
11070
+ case 355 /* CommaListExpression */:
11071
+ case 354 /* PartiallyEmittedExpression */:
11070
11072
  case 238 /* SatisfiesExpression */:
11071
11073
  return true;
11072
11074
  default:
@@ -11237,7 +11239,7 @@ function isDeclarationStatementKind(kind) {
11237
11239
  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 */;
11238
11240
  }
11239
11241
  function isStatementKindButNotDeclarationKind(kind) {
11240
- 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 */;
11242
+ 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 */;
11241
11243
  }
11242
11244
  function isDeclaration(node) {
11243
11245
  if (node.kind === 168 /* TypeParameter */) {
@@ -11298,10 +11300,10 @@ function isCaseOrDefaultClause(node) {
11298
11300
  return kind === 296 /* CaseClause */ || kind === 297 /* DefaultClause */;
11299
11301
  }
11300
11302
  function isJSDocNode(node) {
11301
- return node.kind >= 309 /* FirstJSDocNode */ && node.kind <= 350 /* LastJSDocNode */;
11303
+ return node.kind >= 309 /* FirstJSDocNode */ && node.kind <= 351 /* LastJSDocNode */;
11302
11304
  }
11303
11305
  function isJSDocTag(node) {
11304
- return node.kind >= 327 /* FirstJSDocTagNode */ && node.kind <= 350 /* LastJSDocTagNode */;
11306
+ return node.kind >= 327 /* FirstJSDocTagNode */ && node.kind <= 351 /* LastJSDocTagNode */;
11305
11307
  }
11306
11308
  function isSetAccessor(node) {
11307
11309
  return node.kind === 178 /* SetAccessor */;
@@ -11742,7 +11744,7 @@ function getTokenPosOfNode(node, sourceFile, includeJsDoc) {
11742
11744
  if (includeJsDoc && hasJSDocNodes(node)) {
11743
11745
  return getTokenPosOfNode(node.jsDoc[0], sourceFile);
11744
11746
  }
11745
- if (node.kind === 351 /* SyntaxList */ && node._children.length > 0) {
11747
+ if (node.kind === 352 /* SyntaxList */ && node._children.length > 0) {
11746
11748
  return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc);
11747
11749
  }
11748
11750
  return skipTrivia(
@@ -13696,6 +13698,7 @@ function tryGetModuleSpecifierFromDeclaration(node) {
13696
13698
  ))) == null ? void 0 : _a.arguments[0];
13697
13699
  case 272 /* ImportDeclaration */:
13698
13700
  case 278 /* ExportDeclaration */:
13701
+ case 351 /* JSDocImportTag */:
13699
13702
  return tryCast(node.moduleSpecifier, isStringLiteralLike);
13700
13703
  case 271 /* ImportEqualsDeclaration */:
13701
13704
  return tryCast((_b = tryCast(node.moduleReference, isExternalModuleReference)) == null ? void 0 : _b.expression, isStringLiteralLike);
@@ -13717,6 +13720,7 @@ function getExternalModuleName(node) {
13717
13720
  switch (node.kind) {
13718
13721
  case 272 /* ImportDeclaration */:
13719
13722
  case 278 /* ExportDeclaration */:
13723
+ case 351 /* JSDocImportTag */:
13720
13724
  return node.moduleSpecifier;
13721
13725
  case 271 /* ImportEqualsDeclaration */:
13722
13726
  return node.moduleReference.kind === 283 /* ExternalModuleReference */ ? node.moduleReference.expression : void 0;
@@ -13743,7 +13747,7 @@ function getNamespaceDeclarationNode(node) {
13743
13747
  }
13744
13748
  }
13745
13749
  function isDefaultImport(node) {
13746
- return node.kind === 272 /* ImportDeclaration */ && !!node.importClause && !!node.importClause.name;
13750
+ return (node.kind === 272 /* ImportDeclaration */ || node.kind === 351 /* JSDocImportTag */) && !!node.importClause && !!node.importClause.name;
13747
13751
  }
13748
13752
  function hasQuestionToken(node) {
13749
13753
  if (node) {
@@ -14516,7 +14520,7 @@ function getOperator(expression) {
14516
14520
  }
14517
14521
  function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) {
14518
14522
  switch (nodeKind) {
14519
- case 354 /* CommaListExpression */:
14523
+ case 355 /* CommaListExpression */:
14520
14524
  return 0 /* Comma */;
14521
14525
  case 230 /* SpreadElement */:
14522
14526
  return 1 /* Spread */;
@@ -16065,7 +16069,7 @@ function getLeftmostExpression(node, stopAtCallExpressions) {
16065
16069
  case 212 /* ElementAccessExpression */:
16066
16070
  case 211 /* PropertyAccessExpression */:
16067
16071
  case 235 /* NonNullExpression */:
16068
- case 353 /* PartiallyEmittedExpression */:
16072
+ case 354 /* PartiallyEmittedExpression */:
16069
16073
  case 238 /* SatisfiesExpression */:
16070
16074
  node = node.expression;
16071
16075
  continue;
@@ -17452,7 +17456,7 @@ function getContainingNodeArray(node) {
17452
17456
  return parent.types;
17453
17457
  case 189 /* TupleType */:
17454
17458
  case 209 /* ArrayLiteralExpression */:
17455
- case 354 /* CommaListExpression */:
17459
+ case 355 /* CommaListExpression */:
17456
17460
  case 275 /* NamedImports */:
17457
17461
  case 279 /* NamedExports */:
17458
17462
  return parent.elements;
@@ -17694,6 +17698,91 @@ function isSyntacticallyString(expr) {
17694
17698
  }
17695
17699
  return false;
17696
17700
  }
17701
+ function createEvaluator({ evaluateElementAccessExpression, evaluateEntityNameExpression }) {
17702
+ function evaluate(expr, location) {
17703
+ switch (expr.kind) {
17704
+ case 224 /* PrefixUnaryExpression */:
17705
+ const value = evaluate(expr.operand, location);
17706
+ if (typeof value === "number") {
17707
+ switch (expr.operator) {
17708
+ case 40 /* PlusToken */:
17709
+ return value;
17710
+ case 41 /* MinusToken */:
17711
+ return -value;
17712
+ case 55 /* TildeToken */:
17713
+ return ~value;
17714
+ }
17715
+ }
17716
+ break;
17717
+ case 226 /* BinaryExpression */:
17718
+ const left = evaluate(expr.left, location);
17719
+ const right = evaluate(expr.right, location);
17720
+ if (typeof left === "number" && typeof right === "number") {
17721
+ switch (expr.operatorToken.kind) {
17722
+ case 52 /* BarToken */:
17723
+ return left | right;
17724
+ case 51 /* AmpersandToken */:
17725
+ return left & right;
17726
+ case 49 /* GreaterThanGreaterThanToken */:
17727
+ return left >> right;
17728
+ case 50 /* GreaterThanGreaterThanGreaterThanToken */:
17729
+ return left >>> right;
17730
+ case 48 /* LessThanLessThanToken */:
17731
+ return left << right;
17732
+ case 53 /* CaretToken */:
17733
+ return left ^ right;
17734
+ case 42 /* AsteriskToken */:
17735
+ return left * right;
17736
+ case 44 /* SlashToken */:
17737
+ return left / right;
17738
+ case 40 /* PlusToken */:
17739
+ return left + right;
17740
+ case 41 /* MinusToken */:
17741
+ return left - right;
17742
+ case 45 /* PercentToken */:
17743
+ return left % right;
17744
+ case 43 /* AsteriskAsteriskToken */:
17745
+ return left ** right;
17746
+ }
17747
+ } else if ((typeof left === "string" || typeof left === "number") && (typeof right === "string" || typeof right === "number") && expr.operatorToken.kind === 40 /* PlusToken */) {
17748
+ return "" + left + right;
17749
+ }
17750
+ break;
17751
+ case 11 /* StringLiteral */:
17752
+ case 15 /* NoSubstitutionTemplateLiteral */:
17753
+ return expr.text;
17754
+ case 228 /* TemplateExpression */:
17755
+ return evaluateTemplateExpression(expr, location);
17756
+ case 9 /* NumericLiteral */:
17757
+ return +expr.text;
17758
+ case 217 /* ParenthesizedExpression */:
17759
+ return evaluate(expr.expression, location);
17760
+ case 80 /* Identifier */:
17761
+ return evaluateEntityNameExpression(expr, location);
17762
+ case 211 /* PropertyAccessExpression */:
17763
+ if (isEntityNameExpression(expr)) {
17764
+ return evaluateEntityNameExpression(expr, location);
17765
+ }
17766
+ break;
17767
+ case 212 /* ElementAccessExpression */:
17768
+ return evaluateElementAccessExpression(expr, location);
17769
+ }
17770
+ return void 0;
17771
+ }
17772
+ function evaluateTemplateExpression(expr, location) {
17773
+ let result = expr.head.text;
17774
+ for (const span of expr.templateSpans) {
17775
+ const value = evaluate(span.expression, location);
17776
+ if (value === void 0) {
17777
+ return void 0;
17778
+ }
17779
+ result += value;
17780
+ result += span.literal.text;
17781
+ }
17782
+ return result;
17783
+ }
17784
+ return evaluate;
17785
+ }
17697
17786
 
17698
17787
  // src/compiler/factory/baseNodeFactory.ts
17699
17788
  function createBaseNodeFactory() {
@@ -18651,6 +18740,8 @@ function createNodeFactory(flags, baseFactory2) {
18651
18740
  updateJSDocImplementsTag,
18652
18741
  createJSDocSeeTag,
18653
18742
  updateJSDocSeeTag,
18743
+ createJSDocImportTag,
18744
+ updateJSDocImportTag,
18654
18745
  createJSDocNameReference,
18655
18746
  updateJSDocNameReference,
18656
18747
  createJSDocMemberName,
@@ -21423,6 +21514,17 @@ function createNodeFactory(flags, baseFactory2) {
21423
21514
  function updateJSDocEnumTag(node, tagName = getDefaultTagName(node), typeExpression, comment) {
21424
21515
  return node.tagName !== tagName || node.typeExpression !== typeExpression || node.comment !== comment ? update(createJSDocEnumTag(tagName, typeExpression, comment), node) : node;
21425
21516
  }
21517
+ function createJSDocImportTag(tagName, importClause, moduleSpecifier, attributes, comment) {
21518
+ const node = createBaseJSDocTag(351 /* JSDocImportTag */, tagName ?? createIdentifier("import"), comment);
21519
+ node.importClause = importClause;
21520
+ node.moduleSpecifier = moduleSpecifier;
21521
+ node.attributes = attributes;
21522
+ node.comment = comment;
21523
+ return node;
21524
+ }
21525
+ function updateJSDocImportTag(node, tagName, importClause, moduleSpecifier, attributes, comment) {
21526
+ 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;
21527
+ }
21426
21528
  function createJSDocText(text) {
21427
21529
  const node = createBaseNode(321 /* JSDocText */);
21428
21530
  node.text = text;
@@ -21820,18 +21922,18 @@ function createNodeFactory(flags, baseFactory2) {
21820
21922
  return node;
21821
21923
  }
21822
21924
  function createSyntaxList(children) {
21823
- const node = createBaseNode(351 /* SyntaxList */);
21925
+ const node = createBaseNode(352 /* SyntaxList */);
21824
21926
  node._children = children;
21825
21927
  return node;
21826
21928
  }
21827
21929
  function createNotEmittedStatement(original) {
21828
- const node = createBaseNode(352 /* NotEmittedStatement */);
21930
+ const node = createBaseNode(353 /* NotEmittedStatement */);
21829
21931
  node.original = original;
21830
21932
  setTextRange(node, original);
21831
21933
  return node;
21832
21934
  }
21833
21935
  function createPartiallyEmittedExpression(expression, original) {
21834
- const node = createBaseNode(353 /* PartiallyEmittedExpression */);
21936
+ const node = createBaseNode(354 /* PartiallyEmittedExpression */);
21835
21937
  node.expression = expression;
21836
21938
  node.original = original;
21837
21939
  node.transformFlags |= propagateChildFlags(node.expression) | 1 /* ContainsTypeScript */;
@@ -21853,7 +21955,7 @@ function createNodeFactory(flags, baseFactory2) {
21853
21955
  return node;
21854
21956
  }
21855
21957
  function createCommaListExpression(elements) {
21856
- const node = createBaseNode(354 /* CommaListExpression */);
21958
+ const node = createBaseNode(355 /* CommaListExpression */);
21857
21959
  node.elements = createNodeArray(sameFlatMap(elements, flattenCommaElements));
21858
21960
  node.transformFlags |= propagateChildrenFlags(node.elements);
21859
21961
  return node;
@@ -21862,7 +21964,7 @@ function createNodeFactory(flags, baseFactory2) {
21862
21964
  return node.elements !== elements ? update(createCommaListExpression(elements), node) : node;
21863
21965
  }
21864
21966
  function createSyntheticReferenceExpression(expression, thisArg) {
21865
- const node = createBaseNode(355 /* SyntheticReferenceExpression */);
21967
+ const node = createBaseNode(356 /* SyntheticReferenceExpression */);
21866
21968
  node.expression = expression;
21867
21969
  node.thisArg = thisArg;
21868
21970
  node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.thisArg);
@@ -22108,7 +22210,7 @@ function createNodeFactory(flags, baseFactory2) {
22108
22210
  return updateSatisfiesExpression(outerExpression, expression, outerExpression.type);
22109
22211
  case 235 /* NonNullExpression */:
22110
22212
  return updateNonNullExpression(outerExpression, expression);
22111
- case 353 /* PartiallyEmittedExpression */:
22213
+ case 354 /* PartiallyEmittedExpression */:
22112
22214
  return updatePartiallyEmittedExpression(outerExpression, expression);
22113
22215
  }
22114
22216
  }
@@ -22518,6 +22620,8 @@ function getDefaultTagNameForKind(kind) {
22518
22620
  return "augments";
22519
22621
  case 329 /* JSDocImplementsTag */:
22520
22622
  return "implements";
22623
+ case 351 /* JSDocImportTag */:
22624
+ return "import";
22521
22625
  default:
22522
22626
  return Debug.fail(`Unsupported kind: ${Debug.formatSyntaxKind(kind)}`);
22523
22627
  }
@@ -22658,7 +22762,7 @@ function getTransformFlagsSubtreeExclusions(kind) {
22658
22762
  case 216 /* TypeAssertionExpression */:
22659
22763
  case 238 /* SatisfiesExpression */:
22660
22764
  case 234 /* AsExpression */:
22661
- case 353 /* PartiallyEmittedExpression */:
22765
+ case 354 /* PartiallyEmittedExpression */:
22662
22766
  case 217 /* ParenthesizedExpression */:
22663
22767
  case 108 /* SuperKeyword */:
22664
22768
  return -2147483648 /* OuterExpressionExcludes */;
@@ -24296,10 +24400,10 @@ function isMetaProperty(node) {
24296
24400
  return node.kind === 236 /* MetaProperty */;
24297
24401
  }
24298
24402
  function isPartiallyEmittedExpression(node) {
24299
- return node.kind === 353 /* PartiallyEmittedExpression */;
24403
+ return node.kind === 354 /* PartiallyEmittedExpression */;
24300
24404
  }
24301
24405
  function isCommaListExpression(node) {
24302
- return node.kind === 354 /* CommaListExpression */;
24406
+ return node.kind === 355 /* CommaListExpression */;
24303
24407
  }
24304
24408
  function isTemplateSpan(node) {
24305
24409
  return node.kind === 239 /* TemplateSpan */;
@@ -24422,10 +24526,10 @@ function isExportSpecifier(node) {
24422
24526
  return node.kind === 281 /* ExportSpecifier */;
24423
24527
  }
24424
24528
  function isNotEmittedStatement(node) {
24425
- return node.kind === 352 /* NotEmittedStatement */;
24529
+ return node.kind === 353 /* NotEmittedStatement */;
24426
24530
  }
24427
24531
  function isSyntheticReference(node) {
24428
- return node.kind === 355 /* SyntheticReferenceExpression */;
24532
+ return node.kind === 356 /* SyntheticReferenceExpression */;
24429
24533
  }
24430
24534
  function isExternalModuleReference(node) {
24431
24535
  return node.kind === 283 /* ExternalModuleReference */;
@@ -24592,6 +24696,9 @@ function isJSDocImplementsTag(node) {
24592
24696
  function isJSDocSatisfiesTag(node) {
24593
24697
  return node.kind === 350 /* JSDocSatisfiesTag */;
24594
24698
  }
24699
+ function isJSDocImportTag(node) {
24700
+ return node.kind === 351 /* JSDocImportTag */;
24701
+ }
24595
24702
 
24596
24703
  // src/compiler/factory/utilities.ts
24597
24704
  function createEmptyExports(factory2) {
@@ -24974,7 +25081,7 @@ function isOuterExpression(node, kinds = 15 /* All */) {
24974
25081
  return (kinds & 2 /* TypeAssertions */) !== 0;
24975
25082
  case 235 /* NonNullExpression */:
24976
25083
  return (kinds & 4 /* NonNullAssertions */) !== 0;
24977
- case 353 /* PartiallyEmittedExpression */:
25084
+ case 354 /* PartiallyEmittedExpression */:
24978
25085
  return (kinds & 8 /* PartiallyEmittedExpressions */) !== 0;
24979
25086
  }
24980
25087
  return false;
@@ -26050,7 +26157,7 @@ var forEachChildTable = {
26050
26157
  [282 /* MissingDeclaration */]: function forEachChildInMissingDeclaration(node, cbNode, cbNodes) {
26051
26158
  return visitNodes(cbNode, cbNodes, node.modifiers);
26052
26159
  },
26053
- [354 /* CommaListExpression */]: function forEachChildInCommaListExpression(node, cbNode, cbNodes) {
26160
+ [355 /* CommaListExpression */]: function forEachChildInCommaListExpression(node, cbNode, cbNodes) {
26054
26161
  return visitNodes(cbNode, cbNodes, node.elements);
26055
26162
  },
26056
26163
  [284 /* JsxElement */]: function forEachChildInJsxElement(node, cbNode, cbNodes) {
@@ -26145,7 +26252,8 @@ var forEachChildTable = {
26145
26252
  [336 /* JSDocReadonlyTag */]: forEachChildInJSDocTag,
26146
26253
  [331 /* JSDocDeprecatedTag */]: forEachChildInJSDocTag,
26147
26254
  [337 /* JSDocOverrideTag */]: forEachChildInJSDocTag,
26148
- [353 /* PartiallyEmittedExpression */]: forEachChildInPartiallyEmittedExpression
26255
+ [351 /* JSDocImportTag */]: forEachChildInJSDocImportTag,
26256
+ [354 /* PartiallyEmittedExpression */]: forEachChildInPartiallyEmittedExpression
26149
26257
  };
26150
26258
  function forEachChildInCallOrConstructSignature(node, cbNode, cbNodes) {
26151
26259
  return visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode2(cbNode, node.type);
@@ -26196,6 +26304,9 @@ function forEachChildInJSDocLinkCodeOrPlain(node, cbNode, _cbNodes) {
26196
26304
  function forEachChildInJSDocTag(node, cbNode, cbNodes) {
26197
26305
  return visitNode2(cbNode, node.tagName) || (typeof node.comment === "string" ? void 0 : visitNodes(cbNode, cbNodes, node.comment));
26198
26306
  }
26307
+ function forEachChildInJSDocImportTag(node, cbNode, cbNodes) {
26308
+ 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));
26309
+ }
26199
26310
  function forEachChildInPartiallyEmittedExpression(node, cbNode, _cbNodes) {
26200
26311
  return visitNode2(cbNode, node.expression);
26201
26312
  }
@@ -28188,7 +28299,7 @@ var Parser;
28188
28299
  );
28189
28300
  }
28190
28301
  function parseJSDocType() {
28191
- scanner.setInJSDocType(true);
28302
+ scanner.setSkipJsDocLeadingAsterisks(true);
28192
28303
  const pos = getNodePos();
28193
28304
  if (parseOptional(144 /* ModuleKeyword */)) {
28194
28305
  const moduleTag = factory2.createJSDocNamepathType(
@@ -28207,12 +28318,12 @@ var Parser;
28207
28318
  nextTokenJSDoc();
28208
28319
  }
28209
28320
  }
28210
- scanner.setInJSDocType(false);
28321
+ scanner.setSkipJsDocLeadingAsterisks(false);
28211
28322
  return finishNode(moduleTag, pos);
28212
28323
  }
28213
28324
  const hasDotDotDot = parseOptional(26 /* DotDotDotToken */);
28214
28325
  let type = parseTypeOrTypePredicate();
28215
- scanner.setInJSDocType(false);
28326
+ scanner.setSkipJsDocLeadingAsterisks(false);
28216
28327
  if (hasDotDotDot) {
28217
28328
  type = finishNode(factory2.createJSDocVariadicType(type), pos);
28218
28329
  }
@@ -31775,22 +31886,28 @@ var Parser;
31775
31886
  if (identifier && !tokenAfterImportedIdentifierDefinitelyProducesImportDeclaration()) {
31776
31887
  return parseImportEqualsDeclaration(pos, hasJSDoc, modifiers, identifier, isTypeOnly);
31777
31888
  }
31889
+ const importClause = tryParseImportClause(identifier, afterImportPos, isTypeOnly);
31890
+ const moduleSpecifier = parseModuleSpecifier();
31891
+ const attributes = tryParseImportAttributes();
31892
+ parseSemicolon();
31893
+ const node = factory2.createImportDeclaration(modifiers, importClause, moduleSpecifier, attributes);
31894
+ return withJSDoc(finishNode(node, pos), hasJSDoc);
31895
+ }
31896
+ function tryParseImportClause(identifier, pos, isTypeOnly, skipJsDocLeadingAsterisks = false) {
31778
31897
  let importClause;
31779
31898
  if (identifier || // import id
31780
31899
  token() === 42 /* AsteriskToken */ || // import *
31781
31900
  token() === 19 /* OpenBraceToken */) {
31782
- importClause = parseImportClause(identifier, afterImportPos, isTypeOnly);
31901
+ importClause = parseImportClause(identifier, pos, isTypeOnly, skipJsDocLeadingAsterisks);
31783
31902
  parseExpected(161 /* FromKeyword */);
31784
31903
  }
31785
- const moduleSpecifier = parseModuleSpecifier();
31904
+ return importClause;
31905
+ }
31906
+ function tryParseImportAttributes() {
31786
31907
  const currentToken2 = token();
31787
- let attributes;
31788
31908
  if ((currentToken2 === 118 /* WithKeyword */ || currentToken2 === 132 /* AssertKeyword */) && !scanner.hasPrecedingLineBreak()) {
31789
- attributes = parseImportAttributes(currentToken2);
31909
+ return parseImportAttributes(currentToken2);
31790
31910
  }
31791
- parseSemicolon();
31792
- const node = factory2.createImportDeclaration(modifiers, importClause, moduleSpecifier, attributes);
31793
- return withJSDoc(finishNode(node, pos), hasJSDoc);
31794
31911
  }
31795
31912
  function parseImportAttribute() {
31796
31913
  const pos = getNodePos();
@@ -31857,10 +31974,14 @@ var Parser;
31857
31974
  const finished = withJSDoc(finishNode(node, pos), hasJSDoc);
31858
31975
  return finished;
31859
31976
  }
31860
- function parseImportClause(identifier, pos, isTypeOnly) {
31977
+ function parseImportClause(identifier, pos, isTypeOnly, skipJsDocLeadingAsterisks) {
31861
31978
  let namedBindings;
31862
31979
  if (!identifier || parseOptional(28 /* CommaToken */)) {
31980
+ if (skipJsDocLeadingAsterisks)
31981
+ scanner.setSkipJsDocLeadingAsterisks(true);
31863
31982
  namedBindings = token() === 42 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(275 /* NamedImports */);
31983
+ if (skipJsDocLeadingAsterisks)
31984
+ scanner.setSkipJsDocLeadingAsterisks(false);
31864
31985
  }
31865
31986
  return finishNode(factory2.createImportClause(isTypeOnly, identifier, namedBindings), pos);
31866
31987
  }
@@ -32431,6 +32552,9 @@ var Parser;
32431
32552
  case "throws":
32432
32553
  tag = parseThrowsTag(start2, tagName, margin, indentText);
32433
32554
  break;
32555
+ case "import":
32556
+ tag = parseImportTag(start2, tagName, margin, indentText);
32557
+ break;
32434
32558
  default:
32435
32559
  tag = parseUnknownTag(start2, tagName, margin, indentText);
32436
32560
  break;
@@ -32750,13 +32874,32 @@ var Parser;
32750
32874
  const comments2 = margin !== void 0 && indentText !== void 0 ? parseTrailingTagComments(start2, getNodePos(), margin, indentText) : void 0;
32751
32875
  return finishNode(factory2.createJSDocSatisfiesTag(tagName, typeExpression, comments2), start2);
32752
32876
  }
32877
+ function parseImportTag(start2, tagName, margin, indentText) {
32878
+ const afterImportTagPos = scanner.getTokenFullStart();
32879
+ let identifier;
32880
+ if (isIdentifier2()) {
32881
+ identifier = parseIdentifier();
32882
+ }
32883
+ const importClause = tryParseImportClause(
32884
+ identifier,
32885
+ afterImportTagPos,
32886
+ /*isTypeOnly*/
32887
+ true,
32888
+ /*skipJsDocLeadingAsterisks*/
32889
+ true
32890
+ );
32891
+ const moduleSpecifier = parseModuleSpecifier();
32892
+ const attributes = tryParseImportAttributes();
32893
+ const comments2 = margin !== void 0 && indentText !== void 0 ? parseTrailingTagComments(start2, getNodePos(), margin, indentText) : void 0;
32894
+ return finishNode(factory2.createJSDocImportTag(tagName, importClause, moduleSpecifier, attributes, comments2), start2);
32895
+ }
32753
32896
  function parseExpressionWithTypeArgumentsForAugments() {
32754
32897
  const usedBrace = parseOptional(19 /* OpenBraceToken */);
32755
32898
  const pos = getNodePos();
32756
32899
  const expression = parsePropertyAccessEntityNameExpression();
32757
- scanner.setInJSDocType(true);
32900
+ scanner.setSkipJsDocLeadingAsterisks(true);
32758
32901
  const typeArguments = tryParseTypeArguments();
32759
- scanner.setInJSDocType(false);
32902
+ scanner.setSkipJsDocLeadingAsterisks(false);
32760
32903
  const node = factory2.createExpressionWithTypeArguments(expression, typeArguments);
32761
32904
  const res = finishNode(node, pos);
32762
32905
  if (usedBrace) {
@@ -39435,6 +39578,7 @@ function createBinder() {
39435
39578
  var lastContainer;
39436
39579
  var delayedTypeAliases;
39437
39580
  var seenThisKeyword;
39581
+ var jsDocImports;
39438
39582
  var currentFlow;
39439
39583
  var currentBreakTarget;
39440
39584
  var currentContinueTarget;
@@ -39482,6 +39626,7 @@ function createBinder() {
39482
39626
  file.symbolCount = symbolCount;
39483
39627
  file.classifiableNames = classifiableNames;
39484
39628
  delayedBindJSDocTypedefTag();
39629
+ bindJSDocImports();
39485
39630
  }
39486
39631
  file = void 0;
39487
39632
  options = void 0;
@@ -39492,6 +39637,7 @@ function createBinder() {
39492
39637
  blockScopeContainer = void 0;
39493
39638
  lastContainer = void 0;
39494
39639
  delayedTypeAliases = void 0;
39640
+ jsDocImports = void 0;
39495
39641
  seenThisKeyword = false;
39496
39642
  currentFlow = void 0;
39497
39643
  currentBreakTarget = void 0;
@@ -39926,6 +40072,9 @@ function createBinder() {
39926
40072
  case 340 /* JSDocEnumTag */:
39927
40073
  bindJSDocTypeAlias(node);
39928
40074
  break;
40075
+ case 351 /* JSDocImportTag */:
40076
+ bindJSDocImportTag(node);
40077
+ break;
39929
40078
  case 307 /* SourceFile */: {
39930
40079
  bindEachFunctionsFirst(node.statements);
39931
40080
  bind(node.endOfFileToken);
@@ -40658,6 +40807,12 @@ function createBinder() {
40658
40807
  addDeclarationToSymbol(host.symbol, host, 32 /* Class */);
40659
40808
  }
40660
40809
  }
40810
+ function bindJSDocImportTag(node) {
40811
+ bind(node.tagName);
40812
+ if (typeof node.comment !== "string") {
40813
+ bindEach(node.comment);
40814
+ }
40815
+ }
40661
40816
  function bindOptionalExpression(node, trueTarget, falseTarget) {
40662
40817
  doWithConditionalBranches(bind, node, trueTarget, falseTarget);
40663
40818
  if (!isOptionalChain(node) || isOutermostOptionalChain(node)) {
@@ -40974,6 +41129,31 @@ function createBinder() {
40974
41129
  parent = saveParent;
40975
41130
  currentFlow = saveCurrentFlow;
40976
41131
  }
41132
+ function bindJSDocImports() {
41133
+ if (jsDocImports === void 0) {
41134
+ return;
41135
+ }
41136
+ const saveContainer = container;
41137
+ const saveLastContainer = lastContainer;
41138
+ const saveBlockScopeContainer = blockScopeContainer;
41139
+ const saveParent = parent;
41140
+ const saveCurrentFlow = currentFlow;
41141
+ for (const jsDocImportTag of jsDocImports) {
41142
+ const host = getJSDocHost(jsDocImportTag);
41143
+ const enclosingContainer = host ? getEnclosingContainer(host) : void 0;
41144
+ const enclosingBlockScopeContainer = host ? getEnclosingBlockScopeContainer(host) : void 0;
41145
+ container = enclosingContainer || file;
41146
+ blockScopeContainer = enclosingBlockScopeContainer || file;
41147
+ currentFlow = initFlowNode({ flags: 2 /* Start */ });
41148
+ parent = jsDocImportTag;
41149
+ bind(jsDocImportTag.importClause);
41150
+ }
41151
+ container = saveContainer;
41152
+ lastContainer = saveLastContainer;
41153
+ blockScopeContainer = saveBlockScopeContainer;
41154
+ parent = saveParent;
41155
+ currentFlow = saveCurrentFlow;
41156
+ }
40977
41157
  function checkContextualIdentifier(node) {
40978
41158
  if (!file.parseDiagnostics.length && !(node.flags & 33554432 /* Ambient */) && !(node.flags & 16777216 /* JSDoc */) && !isIdentifierName(node)) {
40979
41159
  const originalKeywordKind = identifierToKeywordKind(node);
@@ -41398,6 +41578,8 @@ function createBinder() {
41398
41578
  return (delayedTypeAliases || (delayedTypeAliases = [])).push(node);
41399
41579
  case 339 /* JSDocOverloadTag */:
41400
41580
  return bind(node.typeExpression);
41581
+ case 351 /* JSDocImportTag */:
41582
+ return (jsDocImports || (jsDocImports = [])).push(node);
41401
41583
  }
41402
41584
  }
41403
41585
  function bindPropertyWorker(node) {
@@ -43274,6 +43456,10 @@ function createTypeChecker(host) {
43274
43456
  var checkBinaryExpression = createCheckBinaryExpression();
43275
43457
  var emitResolver = createResolver();
43276
43458
  var nodeBuilder = createNodeBuilder();
43459
+ var evaluate = createEvaluator({
43460
+ evaluateElementAccessExpression,
43461
+ evaluateEntityNameExpression
43462
+ });
43277
43463
  var globals = createSymbolTable();
43278
43464
  var undefinedSymbol = createSymbol(4 /* Property */, "undefined");
43279
43465
  undefinedSymbol.declarations = [];
@@ -45038,6 +45224,7 @@ function createTypeChecker(host) {
45038
45224
  case 346 /* JSDocTypedefTag */:
45039
45225
  case 338 /* JSDocCallbackTag */:
45040
45226
  case 340 /* JSDocEnumTag */:
45227
+ case 351 /* JSDocImportTag */:
45041
45228
  const root = getJSDocRoot(location);
45042
45229
  if (root) {
45043
45230
  location = root.parent;
@@ -46530,7 +46717,7 @@ function createTypeChecker(host) {
46530
46717
  return ambientModule;
46531
46718
  }
46532
46719
  const currentSourceFile = getSourceFileOfNode(location);
46533
- 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(
46720
+ 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(
46534
46721
  location.initializer,
46535
46722
  /*requireStringLiteralLikeArgument*/
46536
46723
  true
@@ -48443,7 +48630,7 @@ function createTypeChecker(host) {
48443
48630
  }
48444
48631
  const abstractSignatures = filter(resolved.constructSignatures, (signature) => !!(signature.flags & 4 /* Abstract */));
48445
48632
  if (some(abstractSignatures)) {
48446
- const types = map(abstractSignatures, getOrCreateTypeFromSignature);
48633
+ const types = map(abstractSignatures, (s) => getOrCreateTypeFromSignature(s));
48447
48634
  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
48448
48635
  // the logic in `createTypeNodesFromResolvedType`.
48449
48636
  (context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */ ? countWhere(resolved.properties, (p) => !(p.flags & 4194304 /* Prototype */)) : length(resolved.properties));
@@ -49758,7 +49945,7 @@ function createTypeChecker(host) {
49758
49945
  const type = getDeclaredTypeOfSymbol(sym);
49759
49946
  const name = sym.flags & 262144 /* TypeParameter */ ? typeParameterToName(type, context) : factory.cloneNode(node);
49760
49947
  name.symbol = sym;
49761
- return { introducesError, node: setEmitFlags(setOriginalNode(name, node), 16777216 /* NoAsciiEscaping */) };
49948
+ return { introducesError, node: setTextRange(setEmitFlags(setOriginalNode(name, node), 16777216 /* NoAsciiEscaping */), node) };
49762
49949
  }
49763
49950
  }
49764
49951
  return { introducesError, node };
@@ -49768,7 +49955,6 @@ function createTypeChecker(host) {
49768
49955
  cancellationToken.throwIfCancellationRequested();
49769
49956
  }
49770
49957
  let hadError = false;
49771
- const file = getSourceFileOfNode(existing);
49772
49958
  const transformed = visitNode(existing, visitExistingNodeTreeSymbols, isTypeNode);
49773
49959
  if (hadError) {
49774
49960
  return void 0;
@@ -49919,8 +50105,17 @@ function createTypeChecker(host) {
49919
50105
  return result;
49920
50106
  }
49921
50107
  }
49922
- if (file && isTupleTypeNode(node) && !nodeIsSynthesized(node) && getLineAndCharacterOfPosition(file, node.pos).line === getLineAndCharacterOfPosition(file, node.end).line) {
49923
- setEmitFlags(node, 1 /* SingleLine */);
50108
+ if (isTupleTypeNode(node) || isTypeLiteralNode(node) || isMappedTypeNode(node)) {
50109
+ const visited = visitEachChild(
50110
+ node,
50111
+ visitExistingNodeTreeSymbols,
50112
+ /*context*/
50113
+ void 0
50114
+ );
50115
+ const clone = setTextRange(visited === node ? factory.cloneNode(node) : visited, node);
50116
+ const flags = getEmitFlags(clone);
50117
+ setEmitFlags(clone, flags | (context.flags & 1024 /* MultilineObjectLiterals */ && isTypeLiteralNode(node) ? 0 : 1 /* SingleLine */));
50118
+ return clone;
49924
50119
  }
49925
50120
  return visitEachChild(
49926
50121
  node,
@@ -50906,19 +51101,20 @@ function createTypeChecker(host) {
50906
51101
  case 273 /* ImportClause */: {
50907
51102
  const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
50908
51103
  const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.moduleSpecifier;
51104
+ const attributes = isImportDeclaration(node.parent) ? node.parent.attributes : void 0;
51105
+ const isTypeOnly = isJSDocImportTag(node.parent);
50909
51106
  addResult(
50910
51107
  factory.createImportDeclaration(
50911
51108
  /*modifiers*/
50912
51109
  void 0,
50913
51110
  factory.createImportClause(
50914
- /*isTypeOnly*/
50915
- false,
51111
+ isTypeOnly,
50916
51112
  factory.createIdentifier(localName),
50917
51113
  /*namedBindings*/
50918
51114
  void 0
50919
51115
  ),
50920
51116
  specifier2,
50921
- node.parent.attributes
51117
+ attributes
50922
51118
  ),
50923
51119
  0 /* None */
50924
51120
  );
@@ -50927,13 +51123,13 @@ function createTypeChecker(host) {
50927
51123
  case 274 /* NamespaceImport */: {
50928
51124
  const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
50929
51125
  const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.moduleSpecifier;
51126
+ const isTypeOnly = isJSDocImportTag(node.parent.parent);
50930
51127
  addResult(
50931
51128
  factory.createImportDeclaration(
50932
51129
  /*modifiers*/
50933
51130
  void 0,
50934
51131
  factory.createImportClause(
50935
- /*isTypeOnly*/
50936
- false,
51132
+ isTypeOnly,
50937
51133
  /*name*/
50938
51134
  void 0,
50939
51135
  factory.createNamespaceImport(factory.createIdentifier(localName))
@@ -50961,13 +51157,13 @@ function createTypeChecker(host) {
50961
51157
  case 276 /* ImportSpecifier */: {
50962
51158
  const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
50963
51159
  const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.parent.moduleSpecifier;
51160
+ const isTypeOnly = isJSDocImportTag(node.parent.parent.parent);
50964
51161
  addResult(
50965
51162
  factory.createImportDeclaration(
50966
51163
  /*modifiers*/
50967
51164
  void 0,
50968
51165
  factory.createImportClause(
50969
- /*isTypeOnly*/
50970
- false,
51166
+ isTypeOnly,
50971
51167
  /*name*/
50972
51168
  void 0,
50973
51169
  factory.createNamedImports([
@@ -53647,7 +53843,7 @@ function createTypeChecker(host) {
53647
53843
  if (!lateSymbol)
53648
53844
  lateSymbols.set(memberName, lateSymbol = createSymbol(0 /* None */, memberName, 4096 /* Late */));
53649
53845
  const earlySymbol = earlySymbols && earlySymbols.get(memberName);
53650
- if (!(parent.flags & 32 /* Class */) && (lateSymbol.flags & getExcludedSymbolFlags(symbolFlags) || earlySymbol)) {
53846
+ if (!(parent.flags & 32 /* Class */) && lateSymbol.flags & getExcludedSymbolFlags(symbolFlags)) {
53651
53847
  const declarations = earlySymbol ? concatenate(earlySymbol.declarations, lateSymbol.declarations) : lateSymbol.declarations;
53652
53848
  const name = !(type.flags & 8192 /* UniqueESSymbol */) && unescapeLeadingUnderscores(memberName) || declarationNameToString(declName);
53653
53849
  forEach(declarations, (declaration) => error(getNameOfDeclaration(declaration) || declaration, Diagnostics.Property_0_was_also_declared_here, name));
@@ -54599,11 +54795,15 @@ function createTypeChecker(host) {
54599
54795
  const modifiers = getMappedTypeModifiers(type);
54600
54796
  return modifiers & 8 /* ExcludeOptional */ ? -1 : modifiers & 4 /* IncludeOptional */ ? 1 : 0;
54601
54797
  }
54602
- function getModifiersTypeOptionality(type) {
54603
- return type.flags & 2097152 /* Intersection */ ? Math.max(...map(type.types, getModifiersTypeOptionality)) : getObjectFlags(type) & 32 /* Mapped */ ? getCombinedMappedTypeOptionality(type) : 0;
54604
- }
54605
54798
  function getCombinedMappedTypeOptionality(type) {
54606
- return getMappedTypeOptionality(type) || getModifiersTypeOptionality(getModifiersTypeFromMappedType(type));
54799
+ if (getObjectFlags(type) & 32 /* Mapped */) {
54800
+ return getMappedTypeOptionality(type) || getCombinedMappedTypeOptionality(getModifiersTypeFromMappedType(type));
54801
+ }
54802
+ if (type.flags & 2097152 /* Intersection */) {
54803
+ const optionality = getCombinedMappedTypeOptionality(type.types[0]);
54804
+ return every(type.types, (t, i) => i === 0 || getCombinedMappedTypeOptionality(t) === optionality) ? optionality : 0;
54805
+ }
54806
+ return 0;
54607
54807
  }
54608
54808
  function isPartialMappedType(type) {
54609
54809
  return !!(getObjectFlags(type) & 32 /* Mapped */ && getMappedTypeModifiers(type) & 4 /* IncludeOptional */);
@@ -55880,6 +56080,12 @@ function createTypeChecker(host) {
55880
56080
  isInJSFile(signature.declaration)
55881
56081
  );
55882
56082
  }
56083
+ function getImplementationSignature(signature) {
56084
+ return signature.typeParameters ? signature.implementationSignatureCache || (signature.implementationSignatureCache = createImplementationSignature(signature)) : signature;
56085
+ }
56086
+ function createImplementationSignature(signature) {
56087
+ return signature.typeParameters ? instantiateSignature(signature, createTypeMapper([], [])) : signature;
56088
+ }
55883
56089
  function getBaseSignature(signature) {
55884
56090
  const typeParameters = signature.typeParameters;
55885
56091
  if (typeParameters) {
@@ -55902,12 +56108,22 @@ function createTypeChecker(host) {
55902
56108
  }
55903
56109
  return signature;
55904
56110
  }
55905
- function getOrCreateTypeFromSignature(signature) {
56111
+ function getOrCreateTypeFromSignature(signature, outerTypeParameters) {
55906
56112
  var _a;
55907
56113
  if (!signature.isolatedSignatureType) {
55908
56114
  const kind = (_a = signature.declaration) == null ? void 0 : _a.kind;
55909
56115
  const isConstructor = kind === void 0 || kind === 176 /* Constructor */ || kind === 180 /* ConstructSignature */ || kind === 185 /* ConstructorType */;
55910
- const type = createObjectType(16 /* Anonymous */);
56116
+ const type = createObjectType(16 /* Anonymous */ | 134217728 /* SingleSignatureType */, createSymbol(16 /* Function */, "__function" /* Function */));
56117
+ if (signature.declaration && !nodeIsSynthesized(signature.declaration)) {
56118
+ type.symbol.declarations = [signature.declaration];
56119
+ type.symbol.valueDeclaration = signature.declaration;
56120
+ }
56121
+ outerTypeParameters || (outerTypeParameters = signature.declaration && getOuterTypeParameters(
56122
+ signature.declaration,
56123
+ /*includeThisTypes*/
56124
+ true
56125
+ ));
56126
+ type.outerTypeParameters = outerTypeParameters;
55911
56127
  type.members = emptySymbols;
55912
56128
  type.properties = emptyArray;
55913
56129
  type.callSignatures = !isConstructor ? [signature] : emptyArray;
@@ -58396,13 +58612,18 @@ function createTypeChecker(host) {
58396
58612
  const mapper = createTypeMapper([getTypeParameterFromMappedType(objectType)], [index]);
58397
58613
  const templateMapper = combineTypeMappers(objectType.mapper, mapper);
58398
58614
  const instantiatedTemplateType = instantiateType(getTemplateTypeFromMappedType(objectType.target || objectType), templateMapper);
58615
+ const isOptional = getMappedTypeOptionality(objectType) > 0 || (isGenericType(objectType) ? getCombinedMappedTypeOptionality(getModifiersTypeFromMappedType(objectType)) > 0 : couldAccessOptionalProperty(objectType, index));
58399
58616
  return addOptionality(
58400
58617
  instantiatedTemplateType,
58401
58618
  /*isProperty*/
58402
58619
  true,
58403
- getCombinedMappedTypeOptionality(objectType) > 0
58620
+ isOptional
58404
58621
  );
58405
58622
  }
58623
+ function couldAccessOptionalProperty(objectType, indexType) {
58624
+ const indexConstraint = getBaseConstraintOfType(indexType);
58625
+ return !!indexConstraint && some(getPropertiesOfType(objectType), (p) => !!(p.flags & 16777216 /* Optional */) && isTypeAssignableTo(getLiteralTypeFromProperty(p, 8576 /* StringOrNumberLiteralOrUnique */), indexConstraint));
58626
+ }
58406
58627
  function getIndexedAccessType(objectType, indexType, accessFlags = 0 /* None */, accessNode, aliasSymbol, aliasTypeArguments) {
58407
58628
  return getIndexedAccessTypeOrUndefined(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments) || (accessNode ? errorType : unknownType);
58408
58629
  }
@@ -59313,7 +59534,7 @@ function createTypeChecker(host) {
59313
59534
  const declaration = type.objectFlags & 4 /* Reference */ ? type.node : type.objectFlags & 8388608 /* InstantiationExpressionType */ ? type.node : type.symbol.declarations[0];
59314
59535
  const links = getNodeLinks(declaration);
59315
59536
  const target = type.objectFlags & 4 /* Reference */ ? links.resolvedType : type.objectFlags & 64 /* Instantiated */ ? type.target : type;
59316
- let typeParameters = links.outerTypeParameters;
59537
+ let typeParameters = type.objectFlags & 134217728 /* SingleSignatureType */ ? type.outerTypeParameters : links.outerTypeParameters;
59317
59538
  if (!typeParameters) {
59318
59539
  let outerTypeParameters = getOuterTypeParameters(
59319
59540
  declaration,
@@ -59493,6 +59714,9 @@ function createTypeChecker(host) {
59493
59714
  if (type.objectFlags & 8388608 /* InstantiationExpressionType */) {
59494
59715
  result.node = type.node;
59495
59716
  }
59717
+ if (type.objectFlags & 134217728 /* SingleSignatureType */) {
59718
+ result.outerTypeParameters = type.outerTypeParameters;
59719
+ }
59496
59720
  result.target = type;
59497
59721
  result.mapper = mapper;
59498
59722
  result.aliasSymbol = aliasSymbol || type.aliasSymbol;
@@ -64124,7 +64348,7 @@ function createTypeChecker(host) {
64124
64348
  if (objectFlags & 524288 /* CouldContainTypeVariablesComputed */) {
64125
64349
  return !!(objectFlags & 1048576 /* CouldContainTypeVariables */);
64126
64350
  }
64127
- 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));
64351
+ 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));
64128
64352
  if (type.flags & 3899393 /* ObjectFlagsType */) {
64129
64353
  type.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (result ? 1048576 /* CouldContainTypeVariables */ : 0);
64130
64354
  }
@@ -64408,6 +64632,9 @@ function createTypeChecker(host) {
64408
64632
  pos = p;
64409
64633
  }
64410
64634
  }
64635
+ function isTupleOfSelf(typeParameter, type) {
64636
+ return isTupleType(type) && getTupleElementType(type, 0) === getIndexedAccessType(typeParameter, getNumberLiteralType(0)) && !getTypeOfPropertyOfType(type, "1");
64637
+ }
64411
64638
  function inferTypes(inferences, originalSource, originalTarget, priority = 0 /* None */, contravariant = false) {
64412
64639
  let bivariant = false;
64413
64640
  let propagationType;
@@ -64493,6 +64720,9 @@ function createTypeChecker(host) {
64493
64720
  inference.priority = priority;
64494
64721
  }
64495
64722
  if (priority === inference.priority) {
64723
+ if (isTupleOfSelf(inference.typeParameter, candidate)) {
64724
+ return;
64725
+ }
64496
64726
  if (contravariant && !bivariant) {
64497
64727
  if (!contains(inference.contraCandidates, candidate)) {
64498
64728
  inference.contraCandidates = append(inference.contraCandidates, candidate);
@@ -65173,13 +65403,20 @@ function createTypeChecker(host) {
65173
65403
  return getFlowCacheKey(node.expression, declaredType, initialType, flowContainer);
65174
65404
  case 166 /* QualifiedName */:
65175
65405
  const left = getFlowCacheKey(node.left, declaredType, initialType, flowContainer);
65176
- return left && left + "." + node.right.escapedText;
65406
+ return left && `${left}.${node.right.escapedText}`;
65177
65407
  case 211 /* PropertyAccessExpression */:
65178
65408
  case 212 /* ElementAccessExpression */:
65179
65409
  const propName = getAccessedPropertyName(node);
65180
65410
  if (propName !== void 0) {
65181
65411
  const key = getFlowCacheKey(node.expression, declaredType, initialType, flowContainer);
65182
- return key && key + "." + propName;
65412
+ return key && `${key}.${propName}`;
65413
+ }
65414
+ if (isElementAccessExpression(node) && isIdentifier(node.argumentExpression)) {
65415
+ const symbol = getResolvedSymbol(node.argumentExpression);
65416
+ if (isConstantVariable(symbol) || isParameterOrMutableLocalVariable(symbol) && !isSymbolAssigned(symbol)) {
65417
+ const key = getFlowCacheKey(node.expression, declaredType, initialType, flowContainer);
65418
+ return key && `${key}.@${getSymbolId(symbol)}`;
65419
+ }
65183
65420
  }
65184
65421
  break;
65185
65422
  case 206 /* ObjectBindingPattern */:
@@ -65216,8 +65453,19 @@ function createTypeChecker(host) {
65216
65453
  case 211 /* PropertyAccessExpression */:
65217
65454
  case 212 /* ElementAccessExpression */:
65218
65455
  const sourcePropertyName = getAccessedPropertyName(source);
65219
- const targetPropertyName = isAccessExpression(target) ? getAccessedPropertyName(target) : void 0;
65220
- return sourcePropertyName !== void 0 && targetPropertyName !== void 0 && targetPropertyName === sourcePropertyName && isMatchingReference(source.expression, target.expression);
65456
+ if (sourcePropertyName !== void 0) {
65457
+ const targetPropertyName = isAccessExpression(target) ? getAccessedPropertyName(target) : void 0;
65458
+ if (targetPropertyName !== void 0) {
65459
+ return targetPropertyName === sourcePropertyName && isMatchingReference(source.expression, target.expression);
65460
+ }
65461
+ }
65462
+ if (isElementAccessExpression(source) && isElementAccessExpression(target) && isIdentifier(source.argumentExpression) && isIdentifier(target.argumentExpression)) {
65463
+ const symbol = getResolvedSymbol(source.argumentExpression);
65464
+ if (symbol === getResolvedSymbol(target.argumentExpression) && (isConstantVariable(symbol) || isParameterOrMutableLocalVariable(symbol) && !isSymbolAssigned(symbol))) {
65465
+ return isMatchingReference(source.expression, target.expression);
65466
+ }
65467
+ }
65468
+ break;
65221
65469
  case 166 /* QualifiedName */:
65222
65470
  return isAccessExpression(target) && source.right.escapedText === getAccessedPropertyName(target) && isMatchingReference(source.left, target.expression);
65223
65471
  case 226 /* BinaryExpression */:
@@ -71413,7 +71661,7 @@ function createTypeChecker(host) {
71413
71661
  argument = skipParentheses(argument);
71414
71662
  return isSatisfiesExpression(argument) ? skipParentheses(argument.expression) : argument;
71415
71663
  }
71416
- function getSignatureApplicabilityError(node, args, signature, relation, checkMode, reportErrors2, containingMessageChain) {
71664
+ function getSignatureApplicabilityError(node, args, signature, relation, checkMode, reportErrors2, containingMessageChain, inferenceContext) {
71417
71665
  const errorOutputContainer = { errors: void 0, skipLogging: true };
71418
71666
  if (isJsxOpeningLikeElement(node)) {
71419
71667
  if (!checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation, checkMode, reportErrors2, containingMessageChain, errorOutputContainer)) {
@@ -71447,7 +71695,8 @@ function createTypeChecker(host) {
71447
71695
  void 0,
71448
71696
  checkMode
71449
71697
  );
71450
- const checkArgType = checkMode & 4 /* SkipContextSensitive */ ? getRegularTypeOfObjectLiteral(argType) : argType;
71698
+ const regularArgType = checkMode & 4 /* SkipContextSensitive */ ? getRegularTypeOfObjectLiteral(argType) : argType;
71699
+ const checkArgType = inferenceContext ? instantiateType(regularArgType, inferenceContext.nonFixingMapper) : regularArgType;
71451
71700
  const effectiveCheckArgumentNode = getEffectiveCheckNode(arg);
71452
71701
  if (!checkTypeRelatedToAndOptionallyElaborate(checkArgType, paramType, relation, reportErrors2 ? effectiveCheckArgumentNode : void 0, effectiveCheckArgumentNode, headMessage, containingMessageChain, errorOutputContainer)) {
71453
71702
  Debug.assert(!reportErrors2 || !!errorOutputContainer.errors, "parameter should have errors when reporting errors");
@@ -71859,7 +72108,9 @@ function createTypeChecker(host) {
71859
72108
  0 /* Normal */,
71860
72109
  /*reportErrors*/
71861
72110
  true,
71862
- () => chain
72111
+ () => chain,
72112
+ /*inferenceContext*/
72113
+ void 0
71863
72114
  );
71864
72115
  if (diags) {
71865
72116
  for (const d of diags) {
@@ -71895,7 +72146,9 @@ function createTypeChecker(host) {
71895
72146
  0 /* Normal */,
71896
72147
  /*reportErrors*/
71897
72148
  true,
71898
- chain2
72149
+ chain2,
72150
+ /*inferenceContext*/
72151
+ void 0
71899
72152
  );
71900
72153
  if (diags2) {
71901
72154
  if (diags2.length <= min2) {
@@ -71986,6 +72239,8 @@ function createTypeChecker(host) {
71986
72239
  /*reportErrors*/
71987
72240
  false,
71988
72241
  /*containingMessageChain*/
72242
+ void 0,
72243
+ /*inferenceContext*/
71989
72244
  void 0
71990
72245
  )) {
71991
72246
  candidatesForArgumentError = [candidate];
@@ -71994,13 +72249,16 @@ function createTypeChecker(host) {
71994
72249
  return candidate;
71995
72250
  }
71996
72251
  for (let candidateIndex = 0; candidateIndex < candidates2.length; candidateIndex++) {
71997
- const candidate = candidates2[candidateIndex];
72252
+ let candidate = candidates2[candidateIndex];
71998
72253
  if (!hasCorrectTypeArgumentArity(candidate, typeArguments) || !hasCorrectArity(node, args, candidate, signatureHelpTrailingComma2)) {
71999
72254
  continue;
72000
72255
  }
72001
72256
  let checkCandidate;
72002
72257
  let inferenceContext;
72003
72258
  if (candidate.typeParameters) {
72259
+ if (candidate.declaration && findAncestor(node, (a) => a === candidate.declaration)) {
72260
+ candidate = getImplementationSignature(candidate);
72261
+ }
72004
72262
  let typeArgumentTypes;
72005
72263
  if (some(typeArguments)) {
72006
72264
  typeArgumentTypes = checkTypeArguments(
@@ -72020,7 +72278,7 @@ function createTypeChecker(host) {
72020
72278
  /*flags*/
72021
72279
  isInJSFile(node) ? 2 /* AnyDefault */ : 0 /* None */
72022
72280
  );
72023
- typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode | 8 /* SkipGenericFunctions */, inferenceContext);
72281
+ typeArgumentTypes = instantiateTypes(inferTypeArguments(node, candidate, args, argCheckMode | 8 /* SkipGenericFunctions */, inferenceContext), inferenceContext.nonFixingMapper);
72024
72282
  argCheckMode |= inferenceContext.flags & 4 /* SkippedGenericFunction */ ? 8 /* SkipGenericFunctions */ : 0 /* Normal */;
72025
72283
  }
72026
72284
  checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext && inferenceContext.inferredTypeParameters);
@@ -72040,7 +72298,8 @@ function createTypeChecker(host) {
72040
72298
  /*reportErrors*/
72041
72299
  false,
72042
72300
  /*containingMessageChain*/
72043
- void 0
72301
+ void 0,
72302
+ inferenceContext
72044
72303
  )) {
72045
72304
  (candidatesForArgumentError || (candidatesForArgumentError = [])).push(checkCandidate);
72046
72305
  continue;
@@ -72048,7 +72307,7 @@ function createTypeChecker(host) {
72048
72307
  if (argCheckMode) {
72049
72308
  argCheckMode = 0 /* Normal */;
72050
72309
  if (inferenceContext) {
72051
- const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
72310
+ const typeArgumentTypes = instantiateTypes(inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext), inferenceContext.mapper);
72052
72311
  checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
72053
72312
  if (getNonArrayRestType(candidate) && !hasCorrectArity(node, args, checkCandidate, signatureHelpTrailingComma2)) {
72054
72313
  candidateForArgumentArityError = checkCandidate;
@@ -72064,7 +72323,8 @@ function createTypeChecker(host) {
72064
72323
  /*reportErrors*/
72065
72324
  false,
72066
72325
  /*containingMessageChain*/
72067
- void 0
72326
+ void 0,
72327
+ inferenceContext
72068
72328
  )) {
72069
72329
  (candidatesForArgumentError || (candidatesForArgumentError = [])).push(checkCandidate);
72070
72330
  continue;
@@ -75604,7 +75864,7 @@ function createTypeChecker(host) {
75604
75864
  ) || unknownType, isTemplateLiteralContextualType)) {
75605
75865
  return getTemplateLiteralType(texts, types);
75606
75866
  }
75607
- const evaluated = node.parent.kind !== 215 /* TaggedTemplateExpression */ && evaluateTemplateExpression(node);
75867
+ const evaluated = node.parent.kind !== 215 /* TaggedTemplateExpression */ && evaluate(node);
75608
75868
  return evaluated ? getFreshTypeOfLiteralType(getStringLiteralType(evaluated)) : stringType;
75609
75869
  }
75610
75870
  function isTemplateLiteralContextualType(type) {
@@ -75818,7 +76078,7 @@ function createTypeChecker(host) {
75818
76078
  }
75819
76079
  }
75820
76080
  }
75821
- return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, context));
76081
+ return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, context), flatMap(inferenceContexts, (c) => c && map(c.inferences, (i) => i.typeParameter)).slice());
75822
76082
  }
75823
76083
  }
75824
76084
  }
@@ -75993,7 +76253,8 @@ function createTypeChecker(host) {
75993
76253
  if (getIsolatedModules(compilerOptions)) {
75994
76254
  Debug.assert(!!(type.symbol.flags & 128 /* ConstEnum */));
75995
76255
  const constEnumDeclaration = type.symbol.valueDeclaration;
75996
- if (constEnumDeclaration.flags & 33554432 /* Ambient */ && !isValidTypeOnlyAliasUseSite(node)) {
76256
+ const redirect = host.getRedirectReferenceForResolutionFromSourceOfProject(getSourceFileOfNode(constEnumDeclaration).resolvedPath);
76257
+ if (constEnumDeclaration.flags & 33554432 /* Ambient */ && !isValidTypeOnlyAliasUseSite(node) && (!redirect || !shouldPreserveConstEnums(redirect.commandLine.options))) {
75997
76258
  error(node, Diagnostics.Cannot_access_ambient_const_enums_when_0_is_enabled, isolatedModulesLikeFlagName);
75998
76259
  }
75999
76260
  }
@@ -77848,6 +78109,9 @@ function createTypeChecker(host) {
77848
78109
  error(node.tagName, Diagnostics.An_arrow_function_cannot_have_a_this_parameter);
77849
78110
  }
77850
78111
  }
78112
+ function checkJSDocImportTag(node) {
78113
+ checkImportAttributes(node);
78114
+ }
77851
78115
  function checkJSDocImplementsTag(node) {
77852
78116
  const classLike = getEffectiveJSDocHost(node);
77853
78117
  if (!classLike || !isClassDeclaration(classLike) && !isClassExpression(classLike)) {
@@ -80577,122 +80841,53 @@ function createTypeChecker(host) {
80577
80841
  }
80578
80842
  return false;
80579
80843
  }
80580
- function evaluate(expr, location) {
80581
- switch (expr.kind) {
80582
- case 224 /* PrefixUnaryExpression */:
80583
- const value = evaluate(expr.operand, location);
80584
- if (typeof value === "number") {
80585
- switch (expr.operator) {
80586
- case 40 /* PlusToken */:
80587
- return value;
80588
- case 41 /* MinusToken */:
80589
- return -value;
80590
- case 55 /* TildeToken */:
80591
- return ~value;
80592
- }
80593
- }
80594
- break;
80595
- case 226 /* BinaryExpression */:
80596
- const left = evaluate(expr.left, location);
80597
- const right = evaluate(expr.right, location);
80598
- if (typeof left === "number" && typeof right === "number") {
80599
- switch (expr.operatorToken.kind) {
80600
- case 52 /* BarToken */:
80601
- return left | right;
80602
- case 51 /* AmpersandToken */:
80603
- return left & right;
80604
- case 49 /* GreaterThanGreaterThanToken */:
80605
- return left >> right;
80606
- case 50 /* GreaterThanGreaterThanGreaterThanToken */:
80607
- return left >>> right;
80608
- case 48 /* LessThanLessThanToken */:
80609
- return left << right;
80610
- case 53 /* CaretToken */:
80611
- return left ^ right;
80612
- case 42 /* AsteriskToken */:
80613
- return left * right;
80614
- case 44 /* SlashToken */:
80615
- return left / right;
80616
- case 40 /* PlusToken */:
80617
- return left + right;
80618
- case 41 /* MinusToken */:
80619
- return left - right;
80620
- case 45 /* PercentToken */:
80621
- return left % right;
80622
- case 43 /* AsteriskAsteriskToken */:
80623
- return left ** right;
80624
- }
80625
- } else if ((typeof left === "string" || typeof left === "number") && (typeof right === "string" || typeof right === "number") && expr.operatorToken.kind === 40 /* PlusToken */) {
80626
- return "" + left + right;
80627
- }
80628
- break;
80629
- case 11 /* StringLiteral */:
80630
- case 15 /* NoSubstitutionTemplateLiteral */:
80631
- return expr.text;
80632
- case 228 /* TemplateExpression */:
80633
- return evaluateTemplateExpression(expr, location);
80634
- case 9 /* NumericLiteral */:
80635
- checkGrammarNumericLiteral(expr);
80636
- return +expr.text;
80637
- case 217 /* ParenthesizedExpression */:
80638
- return evaluate(expr.expression, location);
80639
- case 80 /* Identifier */: {
80640
- const identifier = expr;
80641
- if (isInfinityOrNaNString(identifier.escapedText) && resolveEntityName(
80642
- identifier,
80643
- 111551 /* Value */,
80644
- /*ignoreErrors*/
80645
- true
80646
- ) === getGlobalSymbol(
80647
- identifier.escapedText,
80648
- 111551 /* Value */,
80649
- /*diagnostic*/
80650
- void 0
80651
- )) {
80652
- return +identifier.escapedText;
80653
- }
80844
+ function evaluateEntityNameExpression(expr, location) {
80845
+ const symbol = resolveEntityName(
80846
+ expr,
80847
+ 111551 /* Value */,
80848
+ /*ignoreErrors*/
80849
+ true
80850
+ );
80851
+ if (!symbol)
80852
+ return void 0;
80853
+ if (expr.kind === 80 /* Identifier */) {
80854
+ const identifier = expr;
80855
+ if (isInfinityOrNaNString(identifier.escapedText) && symbol === getGlobalSymbol(
80856
+ identifier.escapedText,
80857
+ 111551 /* Value */,
80858
+ /*diagnostic*/
80859
+ void 0
80860
+ )) {
80861
+ return +identifier.escapedText;
80654
80862
  }
80655
- case 211 /* PropertyAccessExpression */:
80656
- if (isEntityNameExpression(expr)) {
80657
- const symbol = resolveEntityName(
80658
- expr,
80659
- 111551 /* Value */,
80660
- /*ignoreErrors*/
80661
- true
80662
- );
80663
- if (symbol) {
80664
- if (symbol.flags & 8 /* EnumMember */) {
80665
- return location ? evaluateEnumMember(expr, symbol, location) : getEnumMemberValue(symbol.valueDeclaration);
80666
- }
80667
- if (isConstantVariable(symbol)) {
80668
- const declaration = symbol.valueDeclaration;
80669
- if (declaration && isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && (!location || declaration !== location && isBlockScopedNameDeclaredBeforeUse(declaration, location))) {
80670
- return evaluate(declaration.initializer, declaration);
80671
- }
80672
- }
80673
- }
80674
- }
80675
- break;
80676
- case 212 /* ElementAccessExpression */:
80677
- const root = expr.expression;
80678
- if (isEntityNameExpression(root) && isStringLiteralLike(expr.argumentExpression)) {
80679
- const rootSymbol = resolveEntityName(
80680
- root,
80681
- 111551 /* Value */,
80682
- /*ignoreErrors*/
80683
- true
80684
- );
80685
- if (rootSymbol && rootSymbol.flags & 384 /* Enum */) {
80686
- const name = escapeLeadingUnderscores(expr.argumentExpression.text);
80687
- const member = rootSymbol.exports.get(name);
80688
- if (member) {
80689
- return location ? evaluateEnumMember(expr, member, location) : getEnumMemberValue(member.valueDeclaration);
80690
- }
80691
- }
80863
+ }
80864
+ if (symbol.flags & 8 /* EnumMember */) {
80865
+ return location ? evaluateEnumMember(expr, symbol, location) : getEnumMemberValue(symbol.valueDeclaration);
80866
+ }
80867
+ if (isConstantVariable(symbol)) {
80868
+ const declaration = symbol.valueDeclaration;
80869
+ if (declaration && isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && (!location || declaration !== location && isBlockScopedNameDeclaredBeforeUse(declaration, location))) {
80870
+ return evaluate(declaration.initializer, declaration);
80871
+ }
80872
+ }
80873
+ }
80874
+ function evaluateElementAccessExpression(expr, location) {
80875
+ const root = expr.expression;
80876
+ if (isEntityNameExpression(root) && isStringLiteralLike(expr.argumentExpression)) {
80877
+ const rootSymbol = resolveEntityName(
80878
+ root,
80879
+ 111551 /* Value */,
80880
+ /*ignoreErrors*/
80881
+ true
80882
+ );
80883
+ if (rootSymbol && rootSymbol.flags & 384 /* Enum */) {
80884
+ const name = escapeLeadingUnderscores(expr.argumentExpression.text);
80885
+ const member = rootSymbol.exports.get(name);
80886
+ if (member) {
80887
+ return location ? evaluateEnumMember(expr, member, location) : getEnumMemberValue(member.valueDeclaration);
80692
80888
  }
80693
- break;
80889
+ }
80694
80890
  }
80695
- return void 0;
80696
80891
  }
80697
80892
  function evaluateEnumMember(expr, symbol, location) {
80698
80893
  const declaration = symbol.valueDeclaration;
@@ -80706,18 +80901,6 @@ function createTypeChecker(host) {
80706
80901
  }
80707
80902
  return getEnumMemberValue(declaration);
80708
80903
  }
80709
- function evaluateTemplateExpression(expr, location) {
80710
- let result = expr.head.text;
80711
- for (const span of expr.templateSpans) {
80712
- const value = evaluate(span.expression, location);
80713
- if (value === void 0) {
80714
- return void 0;
80715
- }
80716
- result += value;
80717
- result += span.literal.text;
80718
- }
80719
- return result;
80720
- }
80721
80904
  function checkEnumDeclaration(node) {
80722
80905
  addLazyDiagnostic(() => checkEnumDeclarationWorker(node));
80723
80906
  }
@@ -81115,7 +81298,8 @@ function createTypeChecker(host) {
81115
81298
  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;
81116
81299
  return grammarErrorOnNode(node, message);
81117
81300
  }
81118
- if (isImportDeclaration(declaration) ? (_a = declaration.importClause) == null ? void 0 : _a.isTypeOnly : declaration.isTypeOnly) {
81301
+ const isTypeOnly = isJSDocImportTag(declaration) || (isImportDeclaration(declaration) ? (_a = declaration.importClause) == null ? void 0 : _a.isTypeOnly : declaration.isTypeOnly);
81302
+ if (isTypeOnly) {
81119
81303
  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);
81120
81304
  }
81121
81305
  if (override) {
@@ -81566,6 +81750,8 @@ function createTypeChecker(host) {
81566
81750
  return checkJSDocSatisfiesTag(node);
81567
81751
  case 343 /* JSDocThisTag */:
81568
81752
  return checkJSDocThisTag(node);
81753
+ case 351 /* JSDocImportTag */:
81754
+ return checkJSDocImportTag(node);
81569
81755
  case 199 /* IndexedAccessType */:
81570
81756
  return checkIndexedAccessType(node);
81571
81757
  case 200 /* MappedType */:
@@ -82369,7 +82555,7 @@ function createTypeChecker(host) {
82369
82555
  return void 0;
82370
82556
  case 11 /* StringLiteral */:
82371
82557
  case 15 /* NoSubstitutionTemplateLiteral */:
82372
- 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(
82558
+ 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(
82373
82559
  node.parent,
82374
82560
  /*requireStringLiteralLikeArgument*/
82375
82561
  false
@@ -86510,13 +86696,13 @@ var visitEachChildTable = {
86510
86696
  );
86511
86697
  },
86512
86698
  // Transformation nodes
86513
- [353 /* PartiallyEmittedExpression */]: function visitEachChildOfPartiallyEmittedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
86699
+ [354 /* PartiallyEmittedExpression */]: function visitEachChildOfPartiallyEmittedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
86514
86700
  return context.factory.updatePartiallyEmittedExpression(
86515
86701
  node,
86516
86702
  Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression))
86517
86703
  );
86518
86704
  },
86519
- [354 /* CommaListExpression */]: function visitEachChildOfCommaListExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) {
86705
+ [355 /* CommaListExpression */]: function visitEachChildOfCommaListExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) {
86520
86706
  return context.factory.updateCommaListExpression(
86521
86707
  node,
86522
86708
  nodesVisitor(node.elements, visitor, isExpression)
@@ -90173,7 +90359,7 @@ function transformClassFields(context) {
90173
90359
  /*discarded*/
90174
90360
  true
90175
90361
  );
90176
- case 354 /* CommaListExpression */:
90362
+ case 355 /* CommaListExpression */:
90177
90363
  return visitCommaListExpression(
90178
90364
  node,
90179
90365
  /*discarded*/
@@ -93266,7 +93452,7 @@ function transformESDecorators(context) {
93266
93452
  return visitForStatement(node);
93267
93453
  case 244 /* ExpressionStatement */:
93268
93454
  return visitExpressionStatement(node);
93269
- case 354 /* CommaListExpression */:
93455
+ case 355 /* CommaListExpression */:
93270
93456
  return visitCommaListExpression(
93271
93457
  node,
93272
93458
  /*discarded*/
@@ -93278,7 +93464,7 @@ function transformESDecorators(context) {
93278
93464
  /*discarded*/
93279
93465
  false
93280
93466
  );
93281
- case 353 /* PartiallyEmittedExpression */:
93467
+ case 354 /* PartiallyEmittedExpression */:
93282
93468
  return visitPartiallyEmittedExpression(
93283
93469
  node,
93284
93470
  /*discarded*/
@@ -93364,7 +93550,7 @@ function transformESDecorators(context) {
93364
93550
  /*discarded*/
93365
93551
  true
93366
93552
  );
93367
- case 354 /* CommaListExpression */:
93553
+ case 355 /* CommaListExpression */:
93368
93554
  return visitCommaListExpression(
93369
93555
  node,
93370
93556
  /*discarded*/
@@ -95955,7 +96141,7 @@ function transformES2018(context) {
95955
96141
  return visitObjectLiteralExpression(node);
95956
96142
  case 226 /* BinaryExpression */:
95957
96143
  return visitBinaryExpression(node, expressionResultIsUnused2);
95958
- case 354 /* CommaListExpression */:
96144
+ case 355 /* CommaListExpression */:
95959
96145
  return visitCommaListExpression(node, expressionResultIsUnused2);
95960
96146
  case 299 /* CatchClause */:
95961
96147
  return visitCatchClause(node);
@@ -99178,7 +99364,7 @@ function transformES2015(context) {
99178
99364
  return visitParenthesizedExpression(node, expressionResultIsUnused2);
99179
99365
  case 226 /* BinaryExpression */:
99180
99366
  return visitBinaryExpression(node, expressionResultIsUnused2);
99181
- case 354 /* CommaListExpression */:
99367
+ case 355 /* CommaListExpression */:
99182
99368
  return visitCommaListExpression(node, expressionResultIsUnused2);
99183
99369
  case 15 /* NoSubstitutionTemplateLiteral */:
99184
99370
  case 16 /* TemplateHead */:
@@ -102473,7 +102659,7 @@ function transformGenerators(context) {
102473
102659
  switch (node.kind) {
102474
102660
  case 226 /* BinaryExpression */:
102475
102661
  return visitBinaryExpression(node);
102476
- case 354 /* CommaListExpression */:
102662
+ case 355 /* CommaListExpression */:
102477
102663
  return visitCommaListExpression(node);
102478
102664
  case 227 /* ConditionalExpression */:
102479
102665
  return visitConditionalExpression(node);
@@ -104863,7 +105049,7 @@ function transformModule(context) {
104863
105049
  return visitExpressionStatement(node);
104864
105050
  case 217 /* ParenthesizedExpression */:
104865
105051
  return visitParenthesizedExpression(node, valueIsDiscarded);
104866
- case 353 /* PartiallyEmittedExpression */:
105052
+ case 354 /* PartiallyEmittedExpression */:
104867
105053
  return visitPartiallyEmittedExpression(node, valueIsDiscarded);
104868
105054
  case 213 /* CallExpression */:
104869
105055
  if (isImportCall(node) && currentSourceFile.impliedNodeFormat === void 0) {
@@ -107256,7 +107442,7 @@ function transformSystemModule(context) {
107256
107442
  return visitExpressionStatement(node);
107257
107443
  case 217 /* ParenthesizedExpression */:
107258
107444
  return visitParenthesizedExpression(node, valueIsDiscarded);
107259
- case 353 /* PartiallyEmittedExpression */:
107445
+ case 354 /* PartiallyEmittedExpression */:
107260
107446
  return visitPartiallyEmittedExpression(node, valueIsDiscarded);
107261
107447
  case 226 /* BinaryExpression */:
107262
107448
  if (isDestructuringAssignment(node)) {
@@ -109269,6 +109455,8 @@ function transformDeclarations(context) {
109269
109455
  }
109270
109456
  if (isDeclaration(input) && isDeclarationAndNotVisible(input))
109271
109457
  return;
109458
+ if (isJSDocImportTag(input))
109459
+ return;
109272
109460
  if (isFunctionLike(input) && resolver.isImplementationOfOverload(input))
109273
109461
  return;
109274
109462
  let previousEnclosingDeclaration;
@@ -109916,7 +110104,7 @@ function noEmitNotification(hint, node, callback) {
109916
110104
  }
109917
110105
  function transformNodes(resolver, host, factory2, options, nodes, transformers, allowDtsFiles) {
109918
110106
  var _a, _b;
109919
- const enabledSyntaxKindFeatures = new Array(356 /* Count */);
110107
+ const enabledSyntaxKindFeatures = new Array(357 /* Count */);
109920
110108
  let lexicalEnvironmentVariableDeclarations;
109921
110109
  let lexicalEnvironmentFunctionDeclarations;
109922
110110
  let lexicalEnvironmentStatements;
@@ -111484,7 +111672,9 @@ function createPrinter(printerOptions = {}, handlers = {}) {
111484
111672
  return emitJSDocTypedefTag(node);
111485
111673
  case 347 /* JSDocSeeTag */:
111486
111674
  return emitJSDocSeeTag(node);
111487
- case 352 /* NotEmittedStatement */:
111675
+ case 351 /* JSDocImportTag */:
111676
+ return emitJSDocImportTag(node);
111677
+ case 353 /* NotEmittedStatement */:
111488
111678
  return;
111489
111679
  }
111490
111680
  if (isExpression(node)) {
@@ -111585,15 +111775,15 @@ function createPrinter(printerOptions = {}, handlers = {}) {
111585
111775
  return emitJsxSelfClosingElement(node);
111586
111776
  case 288 /* JsxFragment */:
111587
111777
  return emitJsxFragment(node);
111588
- case 351 /* SyntaxList */:
111778
+ case 352 /* SyntaxList */:
111589
111779
  return Debug.fail("SyntaxList should not be printed");
111590
- case 352 /* NotEmittedStatement */:
111780
+ case 353 /* NotEmittedStatement */:
111591
111781
  return;
111592
- case 353 /* PartiallyEmittedExpression */:
111782
+ case 354 /* PartiallyEmittedExpression */:
111593
111783
  return emitPartiallyEmittedExpression(node);
111594
- case 354 /* CommaListExpression */:
111784
+ case 355 /* CommaListExpression */:
111595
111785
  return emitCommaList(node);
111596
- case 355 /* SyntheticReferenceExpression */:
111786
+ case 356 /* SyntheticReferenceExpression */:
111597
111787
  return Debug.fail("SyntheticReferenceExpression should not be printed");
111598
111788
  }
111599
111789
  }
@@ -113437,6 +113627,21 @@ function createPrinter(printerOptions = {}, handlers = {}) {
113437
113627
  emit(tag.name);
113438
113628
  emitJSDocComment(tag.comment);
113439
113629
  }
113630
+ function emitJSDocImportTag(tag) {
113631
+ emitJSDocTagName(tag.tagName);
113632
+ writeSpace();
113633
+ if (tag.importClause) {
113634
+ emit(tag.importClause);
113635
+ writeSpace();
113636
+ emitTokenWithComment(161 /* FromKeyword */, tag.importClause.end, writeKeyword, tag);
113637
+ writeSpace();
113638
+ }
113639
+ emitExpression(tag.moduleSpecifier);
113640
+ if (tag.attributes) {
113641
+ emitWithLeadingSpace(tag.attributes);
113642
+ }
113643
+ emitJSDocComment(tag.comment);
113644
+ }
113440
113645
  function emitJSDocNameReference(node) {
113441
113646
  writeSpace();
113442
113647
  writePunctuation("{");
@@ -114849,7 +115054,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
114849
115054
  emitLeadingComments(
114850
115055
  pos,
114851
115056
  /*isEmittedNode*/
114852
- node.kind !== 352 /* NotEmittedStatement */
115057
+ node.kind !== 353 /* NotEmittedStatement */
114853
115058
  );
114854
115059
  }
114855
115060
  if (!skipLeadingComments || pos >= 0 && (emitFlags & 1024 /* NoLeadingComments */) !== 0) {
@@ -114873,7 +115078,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
114873
115078
  containerPos = savedContainerPos;
114874
115079
  containerEnd = savedContainerEnd;
114875
115080
  declarationListContainerEnd = savedDeclarationListContainerEnd;
114876
- if (!skipTrailingComments && node.kind !== 352 /* NotEmittedStatement */) {
115081
+ if (!skipTrailingComments && node.kind !== 353 /* NotEmittedStatement */) {
114877
115082
  emitTrailingComments(end);
114878
115083
  }
114879
115084
  }
@@ -115125,7 +115330,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
115125
115330
  const emitFlags = getEmitFlags(node);
115126
115331
  const sourceMapRange = getSourceMapRange(node);
115127
115332
  const source = sourceMapRange.source || sourceMapSource;
115128
- if (node.kind !== 352 /* NotEmittedStatement */ && (emitFlags & 32 /* NoLeadingSourceMap */) === 0 && sourceMapRange.pos >= 0) {
115333
+ if (node.kind !== 353 /* NotEmittedStatement */ && (emitFlags & 32 /* NoLeadingSourceMap */) === 0 && sourceMapRange.pos >= 0) {
115129
115334
  emitSourcePos(sourceMapRange.source || sourceMapSource, skipSourceTrivia(source, sourceMapRange.pos));
115130
115335
  }
115131
115336
  if (emitFlags & 128 /* NoNestedSourceMaps */) {
@@ -115138,7 +115343,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
115138
115343
  if (emitFlags & 128 /* NoNestedSourceMaps */) {
115139
115344
  sourceMapsDisabled = false;
115140
115345
  }
115141
- if (node.kind !== 352 /* NotEmittedStatement */ && (emitFlags & 64 /* NoTrailingSourceMap */) === 0 && sourceMapRange.end >= 0) {
115346
+ if (node.kind !== 353 /* NotEmittedStatement */ && (emitFlags & 64 /* NoTrailingSourceMap */) === 0 && sourceMapRange.end >= 0) {
115142
115347
  emitSourcePos(sourceMapRange.source || sourceMapSource, sourceMapRange.end);
115143
115348
  }
115144
115349
  }
@@ -116877,6 +117082,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
116877
117082
  getResolvedProjectReferenceByPath,
116878
117083
  forEachResolvedProjectReference: forEachResolvedProjectReference2,
116879
117084
  isSourceOfProjectReferenceRedirect,
117085
+ getRedirectReferenceForResolutionFromSourceOfProject,
116880
117086
  emitBuildInfo,
116881
117087
  fileExists,
116882
117088
  readFile,
@@ -118019,7 +118225,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118019
118225
  );
118020
118226
  }
118021
118227
  if (file.flags & 4194304 /* PossiblyContainsDynamicImport */ || isJavaScriptFile) {
118022
- collectDynamicImportOrRequireCalls(file);
118228
+ collectDynamicImportOrRequireOrJsDocImportCalls(file);
118023
118229
  }
118024
118230
  file.imports = imports || emptyArray;
118025
118231
  file.moduleAugmentations = moduleAugmentations || emptyArray;
@@ -118063,7 +118269,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118063
118269
  }
118064
118270
  }
118065
118271
  }
118066
- function collectDynamicImportOrRequireCalls(file2) {
118272
+ function collectDynamicImportOrRequireOrJsDocImportCalls(file2) {
118067
118273
  const r = /import|require/g;
118068
118274
  while (r.exec(file2.text) !== null) {
118069
118275
  const node = getNodeAtPosition(file2, r.lastIndex);
@@ -118092,6 +118298,16 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118092
118298
  false
118093
118299
  );
118094
118300
  imports = append(imports, node.argument.literal);
118301
+ } else if (isJavaScriptFile && isJSDocImportTag(node)) {
118302
+ const moduleNameExpr = getExternalModuleName(node);
118303
+ if (moduleNameExpr && isStringLiteral(moduleNameExpr) && moduleNameExpr.text) {
118304
+ setParentRecursive(
118305
+ node,
118306
+ /*incremental*/
118307
+ false
118308
+ );
118309
+ imports = append(imports, moduleNameExpr);
118310
+ }
118095
118311
  }
118096
118312
  }
118097
118313
  }