typescript 4.7.0-dev.20220408 → 4.7.0-dev.20220417

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.
@@ -294,7 +294,7 @@ var ts;
294
294
  // The following is baselined as a literal template type without intervention
295
295
  /** The version of the TypeScript compiler release */
296
296
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
297
- ts.version = ts.versionMajorMinor + ".0-dev.20220408";
297
+ ts.version = ts.versionMajorMinor + ".0-dev.20220417";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -4854,7 +4854,6 @@ var ts;
4854
4854
  NodeBuilderFlags[NodeBuilderFlags["UseAliasDefinedOutsideCurrentScope"] = 16384] = "UseAliasDefinedOutsideCurrentScope";
4855
4855
  NodeBuilderFlags[NodeBuilderFlags["UseSingleQuotesForStringLiteralType"] = 268435456] = "UseSingleQuotesForStringLiteralType";
4856
4856
  NodeBuilderFlags[NodeBuilderFlags["NoTypeReduction"] = 536870912] = "NoTypeReduction";
4857
- NodeBuilderFlags[NodeBuilderFlags["NoUndefinedOptionalParameterType"] = 1073741824] = "NoUndefinedOptionalParameterType";
4858
4857
  // Error handling
4859
4858
  NodeBuilderFlags[NodeBuilderFlags["AllowThisInObjectLiteral"] = 32768] = "AllowThisInObjectLiteral";
4860
4859
  NodeBuilderFlags[NodeBuilderFlags["AllowQualifiedNameInPlaceOfIdentifier"] = 65536] = "AllowQualifiedNameInPlaceOfIdentifier";
@@ -15160,6 +15159,10 @@ var ts;
15160
15159
  }
15161
15160
  }
15162
15161
  ts.isAnyImportSyntax = isAnyImportSyntax;
15162
+ function isAnyImportOrBareOrAccessedRequire(node) {
15163
+ return isAnyImportSyntax(node) || isVariableDeclarationInitializedToBareOrAccessedRequire(node);
15164
+ }
15165
+ ts.isAnyImportOrBareOrAccessedRequire = isAnyImportOrBareOrAccessedRequire;
15163
15166
  function isLateVisibilityPaintedStatement(node) {
15164
15167
  switch (node.kind) {
15165
15168
  case 266 /* ImportDeclaration */:
@@ -16520,17 +16523,13 @@ var ts;
16520
16523
  if (isPropertyNameLiteral(name) && isPropertyNameLiteral(initializer)) {
16521
16524
  return getTextOfIdentifierOrLiteral(name) === getTextOfIdentifierOrLiteral(initializer);
16522
16525
  }
16523
- if (ts.isIdentifier(name) && isLiteralLikeAccess(initializer) &&
16526
+ if (ts.isMemberName(name) && isLiteralLikeAccess(initializer) &&
16524
16527
  (initializer.expression.kind === 108 /* ThisKeyword */ ||
16525
16528
  ts.isIdentifier(initializer.expression) &&
16526
16529
  (initializer.expression.escapedText === "window" ||
16527
16530
  initializer.expression.escapedText === "self" ||
16528
16531
  initializer.expression.escapedText === "global"))) {
16529
- var nameOrArgument = getNameOrArgument(initializer);
16530
- if (ts.isPrivateIdentifier(nameOrArgument)) {
16531
- ts.Debug.fail("Unexpected PrivateIdentifier in name expression with literal-like access.");
16532
- }
16533
- return isSameEntityName(name, nameOrArgument);
16532
+ return isSameEntityName(name, getNameOrArgument(initializer));
16534
16533
  }
16535
16534
  if (isLiteralLikeAccess(name) && isLiteralLikeAccess(initializer)) {
16536
16535
  return getElementOrPropertyAccessName(name) === getElementOrPropertyAccessName(initializer)
@@ -16738,14 +16737,14 @@ var ts;
16738
16737
  }
16739
16738
  ts.isFunctionSymbol = isFunctionSymbol;
16740
16739
  function tryGetModuleSpecifierFromDeclaration(node) {
16741
- var _a, _b, _c;
16740
+ var _a, _b;
16742
16741
  switch (node.kind) {
16743
16742
  case 254 /* VariableDeclaration */:
16744
- return node.initializer.arguments[0].text;
16743
+ return (_a = ts.findAncestor(node.initializer, function (node) { return isRequireCall(node, /*requireStringLiteralLikeArgument*/ true); })) === null || _a === void 0 ? void 0 : _a.arguments[0];
16745
16744
  case 266 /* ImportDeclaration */:
16746
- return (_a = ts.tryCast(node.moduleSpecifier, ts.isStringLiteralLike)) === null || _a === void 0 ? void 0 : _a.text;
16745
+ return ts.tryCast(node.moduleSpecifier, ts.isStringLiteralLike);
16747
16746
  case 265 /* ImportEqualsDeclaration */:
16748
- return (_c = ts.tryCast((_b = ts.tryCast(node.moduleReference, ts.isExternalModuleReference)) === null || _b === void 0 ? void 0 : _b.expression, ts.isStringLiteralLike)) === null || _c === void 0 ? void 0 : _c.text;
16747
+ return ts.tryCast((_b = ts.tryCast(node.moduleReference, ts.isExternalModuleReference)) === null || _b === void 0 ? void 0 : _b.expression, ts.isStringLiteralLike);
16749
16748
  default:
16750
16749
  ts.Debug.assertNever(node);
16751
16750
  }
@@ -17260,7 +17259,10 @@ var ts;
17260
17259
  return parent.propertyName === node;
17261
17260
  case 275 /* ExportSpecifier */:
17262
17261
  case 285 /* JsxAttribute */:
17263
- // Any name in an export specifier or JSX Attribute
17262
+ case 279 /* JsxSelfClosingElement */:
17263
+ case 280 /* JsxOpeningElement */:
17264
+ case 281 /* JsxClosingElement */:
17265
+ // Any name in an export specifier or JSX Attribute or Jsx Element
17264
17266
  return true;
17265
17267
  }
17266
17268
  return false;
@@ -17276,21 +17278,28 @@ var ts;
17276
17278
  // export = <EntityNameExpression>
17277
17279
  // export default <EntityNameExpression>
17278
17280
  // module.exports = <EntityNameExpression>
17279
- // {<Identifier>}
17280
- // {name: <EntityNameExpression>}
17281
+ // module.exports.x = <EntityNameExpression>
17282
+ // const x = require("...")
17283
+ // const { x } = require("...")
17284
+ // const x = require("...").y
17285
+ // const { x } = require("...").y
17281
17286
  function isAliasSymbolDeclaration(node) {
17282
- return node.kind === 265 /* ImportEqualsDeclaration */ ||
17287
+ if (node.kind === 265 /* ImportEqualsDeclaration */ ||
17283
17288
  node.kind === 264 /* NamespaceExportDeclaration */ ||
17284
17289
  node.kind === 267 /* ImportClause */ && !!node.name ||
17285
17290
  node.kind === 268 /* NamespaceImport */ ||
17286
17291
  node.kind === 274 /* NamespaceExport */ ||
17287
17292
  node.kind === 270 /* ImportSpecifier */ ||
17288
17293
  node.kind === 275 /* ExportSpecifier */ ||
17289
- node.kind === 271 /* ExportAssignment */ && exportAssignmentIsAlias(node) ||
17290
- ts.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 /* ModuleExports */ && exportAssignmentIsAlias(node) ||
17291
- ts.isPropertyAccessExpression(node) && ts.isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 63 /* EqualsToken */ && isAliasableExpression(node.parent.right) ||
17292
- node.kind === 297 /* ShorthandPropertyAssignment */ ||
17293
- node.kind === 296 /* PropertyAssignment */ && isAliasableExpression(node.initializer);
17294
+ node.kind === 271 /* ExportAssignment */ && exportAssignmentIsAlias(node)) {
17295
+ return true;
17296
+ }
17297
+ return isInJSFile(node) && (ts.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 /* ModuleExports */ && exportAssignmentIsAlias(node) ||
17298
+ ts.isPropertyAccessExpression(node)
17299
+ && ts.isBinaryExpression(node.parent)
17300
+ && node.parent.left === node
17301
+ && node.parent.operatorToken.kind === 63 /* EqualsToken */
17302
+ && isAliasableExpression(node.parent.right));
17294
17303
  }
17295
17304
  ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration;
17296
17305
  function getAliasDeclarationFromName(node) {
@@ -17301,6 +17310,7 @@ var ts;
17301
17310
  case 275 /* ExportSpecifier */:
17302
17311
  case 271 /* ExportAssignment */:
17303
17312
  case 265 /* ImportEqualsDeclaration */:
17313
+ case 274 /* NamespaceExport */:
17304
17314
  return node.parent;
17305
17315
  case 161 /* QualifiedName */:
17306
17316
  do {
@@ -19127,6 +19137,11 @@ var ts;
19127
19137
  (node.parent.kind === 206 /* PropertyAccessExpression */ && node.parent.name === node);
19128
19138
  }
19129
19139
  ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess;
19140
+ function isRightSideOfAccessExpression(node) {
19141
+ return ts.isPropertyAccessExpression(node.parent) && node.parent.name === node
19142
+ || ts.isElementAccessExpression(node.parent) && node.parent.argumentExpression === node;
19143
+ }
19144
+ ts.isRightSideOfAccessExpression = isRightSideOfAccessExpression;
19130
19145
  function isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName(node) {
19131
19146
  return ts.isQualifiedName(node.parent) && node.parent.right === node
19132
19147
  || ts.isPropertyAccessExpression(node.parent) && node.parent.name === node
@@ -19778,6 +19793,41 @@ var ts;
19778
19793
  return expr;
19779
19794
  }
19780
19795
  ts.getLeftmostAccessExpression = getLeftmostAccessExpression;
19796
+ function forEachNameInAccessChainWalkingLeft(name, action) {
19797
+ if (isAccessExpression(name.parent) && isRightSideOfAccessExpression(name)) {
19798
+ return walkAccessExpression(name.parent);
19799
+ }
19800
+ function walkAccessExpression(access) {
19801
+ if (access.kind === 206 /* PropertyAccessExpression */) {
19802
+ var res = action(access.name);
19803
+ if (res !== undefined) {
19804
+ return res;
19805
+ }
19806
+ }
19807
+ else if (access.kind === 207 /* ElementAccessExpression */) {
19808
+ if (ts.isIdentifier(access.argumentExpression) || ts.isStringLiteralLike(access.argumentExpression)) {
19809
+ var res = action(access.argumentExpression);
19810
+ if (res !== undefined) {
19811
+ return res;
19812
+ }
19813
+ }
19814
+ else {
19815
+ // Chain interrupted by non-static-name access 'x[expr()].y.z'
19816
+ return undefined;
19817
+ }
19818
+ }
19819
+ if (isAccessExpression(access.expression)) {
19820
+ return walkAccessExpression(access.expression);
19821
+ }
19822
+ if (ts.isIdentifier(access.expression)) {
19823
+ // End of chain at Identifier 'x.y.z'
19824
+ return action(access.expression);
19825
+ }
19826
+ // End of chain at non-Identifier 'x().y.z'
19827
+ return undefined;
19828
+ }
19829
+ }
19830
+ ts.forEachNameInAccessChainWalkingLeft = forEachNameInAccessChainWalkingLeft;
19781
19831
  function getLeftmostExpression(node, stopAtCallExpressions) {
19782
19832
  while (true) {
19783
19833
  switch (node.kind) {
@@ -20725,6 +20775,7 @@ var ts;
20725
20775
  ts.supportedJSExtensionsFlat = ts.flatten(ts.supportedJSExtensions);
20726
20776
  var allSupportedExtensions = [[".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */, ".js" /* Js */, ".jsx" /* Jsx */], [".cts" /* Cts */, ".d.cts" /* Dcts */, ".cjs" /* Cjs */], [".mts" /* Mts */, ".d.mts" /* Dmts */, ".mjs" /* Mjs */]];
20727
20777
  var allSupportedExtensionsWithJson = __spreadArray(__spreadArray([], allSupportedExtensions, true), [[".json" /* Json */]], false);
20778
+ ts.supportedDeclarationExtensions = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */];
20728
20779
  function getSupportedExtensions(options, extraFileExtensions) {
20729
20780
  var needJsExtensions = options && getAllowJSCompilerOption(options);
20730
20781
  if (!extraFileExtensions || extraFileExtensions.length === 0) {
@@ -21413,6 +21464,11 @@ var ts;
21413
21464
  return state > 1 /* NodeModules */ ? { topLevelNodeModulesIndex: topLevelNodeModulesIndex, topLevelPackageNameIndex: topLevelPackageNameIndex, packageRootIndex: packageRootIndex, fileNameIndex: fileNameIndex } : undefined;
21414
21465
  }
21415
21466
  ts.getNodeModulePathParts = getNodeModulePathParts;
21467
+ function getParameterTypeNode(parameter) {
21468
+ var _a;
21469
+ return parameter.kind === 340 /* JSDocParameterTag */ ? (_a = parameter.typeExpression) === null || _a === void 0 ? void 0 : _a.type : parameter.type;
21470
+ }
21471
+ ts.getParameterTypeNode = getParameterTypeNode;
21416
21472
  })(ts || (ts = {}));
21417
21473
  /* @internal */
21418
21474
  var ts;
@@ -35566,34 +35622,10 @@ var ts;
35566
35622
  case 20 /* OpenParenToken */: // foo<x>(
35567
35623
  case 14 /* NoSubstitutionTemplateLiteral */: // foo<T> `...`
35568
35624
  case 15 /* TemplateHead */: // foo<T> `...${100}...`
35569
- // These tokens can't follow in a call expression, nor can they start an
35570
- // expression. So, consider the type argument list part of an instantiation
35571
- // expression.
35572
- // falls through
35573
- case 27 /* CommaToken */: // foo<x>,
35574
- case 24 /* DotToken */: // foo<x>.
35575
- case 28 /* QuestionDotToken */: // foo<x>?.
35576
- case 21 /* CloseParenToken */: // foo<x>)
35577
- case 23 /* CloseBracketToken */: // foo<x>]
35578
- case 58 /* ColonToken */: // foo<x>:
35579
- case 26 /* SemicolonToken */: // foo<x>;
35580
- case 57 /* QuestionToken */: // foo<x>?
35581
- case 34 /* EqualsEqualsToken */: // foo<x> ==
35582
- case 36 /* EqualsEqualsEqualsToken */: // foo<x> ===
35583
- case 35 /* ExclamationEqualsToken */: // foo<x> !=
35584
- case 37 /* ExclamationEqualsEqualsToken */: // foo<x> !==
35585
- case 55 /* AmpersandAmpersandToken */: // foo<x> &&
35586
- case 56 /* BarBarToken */: // foo<x> ||
35587
- case 60 /* QuestionQuestionToken */: // foo<x> ??
35588
- case 52 /* CaretToken */: // foo<x> ^
35589
- case 50 /* AmpersandToken */: // foo<x> &
35590
- case 51 /* BarToken */: // foo<x> |
35591
- case 19 /* CloseBraceToken */: // foo<x> }
35592
- case 1 /* EndOfFileToken */: // foo<x>
35593
35625
  return true;
35594
35626
  }
35595
- // Treat anything else as an expression.
35596
- return false;
35627
+ // Consider something a type argument list only if the following token can't start an expression.
35628
+ return !isStartOfExpression();
35597
35629
  }
35598
35630
  function parsePrimaryExpression() {
35599
35631
  switch (token()) {
@@ -38811,7 +38843,7 @@ var ts;
38811
38843
  })(IncrementalParser || (IncrementalParser = {}));
38812
38844
  /** @internal */
38813
38845
  function isDeclarationFileName(fileName) {
38814
- return ts.fileExtensionIsOneOf(fileName, [".d.ts" /* Dts */, ".d.mts" /* Dmts */, ".d.cts" /* Dcts */]);
38846
+ return ts.fileExtensionIsOneOf(fileName, ts.supportedDeclarationExtensions);
38815
38847
  }
38816
38848
  ts.isDeclarationFileName = isDeclarationFileName;
38817
38849
  function parseResolutionMode(mode, pos, end, reportDiagnostic) {
@@ -42319,7 +42351,8 @@ var ts;
42319
42351
  Extensions[Extensions["JavaScript"] = 1] = "JavaScript";
42320
42352
  Extensions[Extensions["Json"] = 2] = "Json";
42321
42353
  Extensions[Extensions["TSConfig"] = 3] = "TSConfig";
42322
- Extensions[Extensions["DtsOnly"] = 4] = "DtsOnly"; /** Only '.d.ts' */
42354
+ Extensions[Extensions["DtsOnly"] = 4] = "DtsOnly";
42355
+ Extensions[Extensions["TsOnly"] = 5] = "TsOnly";
42323
42356
  })(Extensions || (Extensions = {}));
42324
42357
  /** Used with `Extensions.DtsOnly` to extract the path from TypeScript results. */
42325
42358
  function resolvedTypeScriptOnly(resolved) {
@@ -43264,7 +43297,21 @@ var ts;
43264
43297
  return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, initialDir, { moduleResolution: ts.ModuleResolutionKind.NodeJs, allowJs: true }, host, /*cache*/ undefined, jsOnlyExtensions, /*redirectedReferences*/ undefined);
43265
43298
  }
43266
43299
  function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, lookupConfig) {
43267
- return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, ts.getDirectoryPath(containingFile), compilerOptions, host, cache, lookupConfig ? tsconfigExtensions : (compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions), redirectedReference);
43300
+ var extensions;
43301
+ if (lookupConfig) {
43302
+ extensions = tsconfigExtensions;
43303
+ }
43304
+ else if (compilerOptions.noDtsResolution) {
43305
+ extensions = [Extensions.TsOnly];
43306
+ if (compilerOptions.allowJs)
43307
+ extensions.push(Extensions.JavaScript);
43308
+ if (compilerOptions.resolveJsonModule)
43309
+ extensions.push(Extensions.Json);
43310
+ }
43311
+ else {
43312
+ extensions = compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions;
43313
+ }
43314
+ return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, ts.getDirectoryPath(containingFile), compilerOptions, host, cache, extensions, redirectedReference);
43268
43315
  }
43269
43316
  ts.nodeModuleNameResolver = nodeModuleNameResolver;
43270
43317
  function nodeModuleNameResolverWorker(features, moduleName, containingDirectory, compilerOptions, host, cache, extensions, redirectedReference) {
@@ -43273,6 +43320,10 @@ var ts;
43273
43320
  var failedLookupLocations = [];
43274
43321
  // conditions are only used by the node12/nodenext resolver - there's no priority order in the list,
43275
43322
  //it's essentially a set (priority is determined by object insertion order in the object we look at).
43323
+ var conditions = features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"];
43324
+ if (compilerOptions.noDtsResolution) {
43325
+ conditions.pop();
43326
+ }
43276
43327
  var state = {
43277
43328
  compilerOptions: compilerOptions,
43278
43329
  host: host,
@@ -43280,7 +43331,7 @@ var ts;
43280
43331
  failedLookupLocations: failedLookupLocations,
43281
43332
  packageJsonInfoCache: cache,
43282
43333
  features: features,
43283
- conditions: features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"]
43334
+ conditions: conditions,
43284
43335
  };
43285
43336
  var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); });
43286
43337
  return createResolvedModuleWithFailedLookupLocations((_a = result === null || result === void 0 ? void 0 : result.value) === null || _a === void 0 ? void 0 : _a.resolved, (_b = result === null || result === void 0 ? void 0 : result.value) === null || _b === void 0 ? void 0 : _b.isExternalLibraryImport, failedLookupLocations, state.resultFromCache);
@@ -43456,9 +43507,9 @@ var ts;
43456
43507
  }
43457
43508
  }
43458
43509
  function loadJSOrExactTSFileName(extensions, candidate, onlyRecordFailures, state) {
43459
- if ((extensions === Extensions.TypeScript || extensions === Extensions.DtsOnly) && ts.fileExtensionIsOneOf(candidate, [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */])) {
43510
+ if ((extensions === Extensions.TypeScript || extensions === Extensions.DtsOnly) && ts.isDeclarationFileName(candidate)) {
43460
43511
  var result = tryFile(candidate, onlyRecordFailures, state);
43461
- return result !== undefined ? { path: candidate, ext: ts.forEach([".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */], function (e) { return ts.fileExtensionIs(candidate, e) ? e : undefined; }) } : undefined;
43512
+ return result !== undefined ? { path: candidate, ext: ts.forEach(ts.supportedDeclarationExtensions, function (e) { return ts.fileExtensionIs(candidate, e) ? e : undefined; }) } : undefined;
43462
43513
  }
43463
43514
  return loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state);
43464
43515
  }
@@ -43488,20 +43539,22 @@ var ts;
43488
43539
  default: return tryExtension(".d.ts" /* Dts */);
43489
43540
  }
43490
43541
  case Extensions.TypeScript:
43542
+ case Extensions.TsOnly:
43543
+ var useDts = extensions === Extensions.TypeScript;
43491
43544
  switch (originalExtension) {
43492
43545
  case ".mjs" /* Mjs */:
43493
43546
  case ".mts" /* Mts */:
43494
43547
  case ".d.mts" /* Dmts */:
43495
- return tryExtension(".mts" /* Mts */) || tryExtension(".d.mts" /* Dmts */);
43548
+ return tryExtension(".mts" /* Mts */) || (useDts ? tryExtension(".d.mts" /* Dmts */) : undefined);
43496
43549
  case ".cjs" /* Cjs */:
43497
43550
  case ".cts" /* Cts */:
43498
43551
  case ".d.cts" /* Dcts */:
43499
- return tryExtension(".cts" /* Cts */) || tryExtension(".d.cts" /* Dcts */);
43552
+ return tryExtension(".cts" /* Cts */) || (useDts ? tryExtension(".d.cts" /* Dcts */) : undefined);
43500
43553
  case ".json" /* Json */:
43501
43554
  candidate += ".json" /* Json */;
43502
- return tryExtension(".d.ts" /* Dts */);
43555
+ return useDts ? tryExtension(".d.ts" /* Dts */) : undefined;
43503
43556
  default:
43504
- return tryExtension(".ts" /* Ts */) || tryExtension(".tsx" /* Tsx */) || tryExtension(".d.ts" /* Dts */);
43557
+ return tryExtension(".ts" /* Ts */) || tryExtension(".tsx" /* Tsx */) || (useDts ? tryExtension(".d.ts" /* Dts */) : undefined);
43505
43558
  }
43506
43559
  case Extensions.JavaScript:
43507
43560
  switch (originalExtension) {
@@ -43728,6 +43781,7 @@ var ts;
43728
43781
  switch (extensions) {
43729
43782
  case Extensions.JavaScript:
43730
43783
  case Extensions.Json:
43784
+ case Extensions.TsOnly:
43731
43785
  packageFile = readPackageJsonMainField(jsonContent, candidate, state);
43732
43786
  break;
43733
43787
  case Extensions.TypeScript:
@@ -43800,14 +43854,16 @@ var ts;
43800
43854
  function extensionIsOk(extensions, extension) {
43801
43855
  switch (extensions) {
43802
43856
  case Extensions.JavaScript:
43803
- return extension === ".js" /* Js */ || extension === ".jsx" /* Jsx */;
43857
+ return extension === ".js" /* Js */ || extension === ".jsx" /* Jsx */ || extension === ".mjs" /* Mjs */ || extension === ".cjs" /* Cjs */;
43804
43858
  case Extensions.TSConfig:
43805
43859
  case Extensions.Json:
43806
43860
  return extension === ".json" /* Json */;
43807
43861
  case Extensions.TypeScript:
43808
- return extension === ".ts" /* Ts */ || extension === ".tsx" /* Tsx */ || extension === ".d.ts" /* Dts */;
43862
+ return extension === ".ts" /* Ts */ || extension === ".tsx" /* Tsx */ || extension === ".mts" /* Mts */ || extension === ".cts" /* Cts */ || extension === ".d.ts" /* Dts */ || extension === ".d.mts" /* Dmts */ || extension === ".d.cts" /* Dcts */;
43863
+ case Extensions.TsOnly:
43864
+ return extension === ".ts" /* Ts */ || extension === ".tsx" /* Tsx */ || extension === ".mts" /* Mts */ || extension === ".cts" /* Cts */;
43809
43865
  case Extensions.DtsOnly:
43810
- return extension === ".d.ts" /* Dts */;
43866
+ return extension === ".d.ts" /* Dts */ || extension === ".d.mts" /* Dmts */ || extension === ".d.cts" /* Dcts */;
43811
43867
  }
43812
43868
  }
43813
43869
  /* @internal */
@@ -53109,9 +53165,6 @@ var ts;
53109
53165
  if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) {
53110
53166
  parameterType = getOptionalType(parameterType);
53111
53167
  }
53112
- if ((context.flags & 1073741824 /* NoUndefinedOptionalParameterType */) && parameterDeclaration && !ts.isJSDocParameterTag(parameterDeclaration) && isOptionalUninitializedParameter(parameterDeclaration)) {
53113
- parameterType = getTypeWithFacts(parameterType, 524288 /* NEUndefined */);
53114
- }
53115
53168
  var parameterTypeNode = serializeTypeForDeclaration(context, parameterType, parameterSymbol, context.enclosingDeclaration, privateSymbolVisitor, bundledImports);
53116
53169
  var modifiers = !(context.flags & 8192 /* OmitParameterModifiers */) && preserveModifierFlags && parameterDeclaration && parameterDeclaration.modifiers ? parameterDeclaration.modifiers.map(ts.factory.cloneNode) : undefined;
53117
53170
  var isRest = parameterDeclaration && ts.isRestParameter(parameterDeclaration) || ts.getCheckFlags(parameterSymbol) & 32768 /* RestParameter */;
@@ -53670,7 +53723,7 @@ var ts;
53670
53723
  if (declWithExistingAnnotation && !ts.isFunctionLikeDeclaration(declWithExistingAnnotation) && !ts.isGetAccessorDeclaration(declWithExistingAnnotation)) {
53671
53724
  // try to reuse the existing annotation
53672
53725
  var existing = ts.getEffectiveTypeAnnotationNode(declWithExistingAnnotation);
53673
- if (getTypeFromTypeNode(existing) === type && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
53726
+ if (typeNodeIsEquivalentToType(existing, declWithExistingAnnotation, type) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
53674
53727
  var result_6 = serializeExistingTypeNode(context, existing, includePrivateSymbol, bundled);
53675
53728
  if (result_6) {
53676
53729
  return result_6;
@@ -53687,6 +53740,16 @@ var ts;
53687
53740
  context.flags = oldFlags;
53688
53741
  return result;
53689
53742
  }
53743
+ function typeNodeIsEquivalentToType(typeNode, annotatedDeclaration, type) {
53744
+ var typeFromTypeNode = getTypeFromTypeNode(typeNode);
53745
+ if (typeFromTypeNode === type) {
53746
+ return true;
53747
+ }
53748
+ if (ts.isParameter(annotatedDeclaration) && annotatedDeclaration.questionToken) {
53749
+ return getTypeWithFacts(type, 524288 /* NEUndefined */) === typeFromTypeNode;
53750
+ }
53751
+ return false;
53752
+ }
53690
53753
  function serializeReturnTypeForSignature(context, type, signature, includePrivateSymbol, bundled) {
53691
53754
  if (!isErrorType(type) && context.enclosingDeclaration) {
53692
53755
  var annotation = signature.declaration && ts.getEffectiveReturnTypeNode(signature.declaration);
@@ -55958,7 +56021,7 @@ var ts;
55958
56021
  }
55959
56022
  }
55960
56023
  var sourceTypes = ts.some(constructorTypes, function (t) { return !!(t.flags & ~98304 /* Nullable */); }) ? constructorTypes : types; // TODO: GH#18217
55961
- type = getUnionType(sourceTypes, 2 /* Subtype */);
56024
+ type = getUnionType(sourceTypes);
55962
56025
  }
55963
56026
  }
55964
56027
  var widened = getWidenedType(addOptionality(type, /*isProperty*/ false, definedInMethod && !definedInConstructor));
@@ -58707,8 +58770,9 @@ var ts;
58707
58770
  // levels of nesting, we are presumably exploring a repeating pattern with a long cycle that hasn't
58708
58771
  // yet triggered the deeply nested limiter. We have no test cases that actually get to 50 levels of
58709
58772
  // nesting, so it is effectively just a safety stop.
58710
- if (stack.length < 10 || stack.length < 50 && !isDeeplyNestedType(t, stack, stack.length)) {
58711
- stack.push(t);
58773
+ var identity_1 = getRecursionIdentity(t);
58774
+ if (stack.length < 10 || stack.length < 50 && !ts.contains(stack, identity_1)) {
58775
+ stack.push(identity_1);
58712
58776
  result = computeBaseConstraint(getSimplifiedType(t, /*writing*/ false));
58713
58777
  stack.pop();
58714
58778
  }
@@ -66906,12 +66970,12 @@ var ts;
66906
66970
  function isDeeplyNestedType(type, stack, depth, maxDepth) {
66907
66971
  if (maxDepth === void 0) { maxDepth = 3; }
66908
66972
  if (depth >= maxDepth) {
66909
- var identity_1 = getRecursionIdentity(type);
66973
+ var identity_2 = getRecursionIdentity(type);
66910
66974
  var count = 0;
66911
66975
  var lastTypeId = 0;
66912
66976
  for (var i = 0; i < depth; i++) {
66913
66977
  var t = stack[i];
66914
- if (getRecursionIdentity(t) === identity_1) {
66978
+ if (getRecursionIdentity(t) === identity_2) {
66915
66979
  // We only count occurrences with a higher type id than the previous occurrence, since higher
66916
66980
  // type ids are an indicator of newer instantiations caused by recursion.
66917
66981
  if (t.id >= lastTypeId) {
@@ -79725,11 +79789,16 @@ var ts;
79725
79789
  if (constraintType && defaultType) {
79726
79790
  checkTypeAssignableTo(defaultType, getTypeWithThisArgument(instantiateType(constraintType, makeUnaryTypeMapper(typeParameter, defaultType)), defaultType), node.default, ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1);
79727
79791
  }
79728
- if (node.parent.kind === 258 /* InterfaceDeclaration */ || node.parent.kind === 257 /* ClassDeclaration */ || node.parent.kind === 259 /* TypeAliasDeclaration */) {
79792
+ checkNodeDeferred(node);
79793
+ addLazyDiagnostic(function () { return checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0); });
79794
+ }
79795
+ function checkTypeParameterDeferred(node) {
79796
+ if (ts.isInterfaceDeclaration(node.parent) || ts.isClassLike(node.parent) || ts.isTypeAliasDeclaration(node.parent)) {
79797
+ var typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfNode(node));
79729
79798
  var modifiers = getVarianceModifiers(typeParameter);
79730
79799
  if (modifiers) {
79731
79800
  var symbol = getSymbolOfNode(node.parent);
79732
- if (node.parent.kind === 259 /* TypeAliasDeclaration */ && !(ts.getObjectFlags(getDeclaredTypeOfSymbol(symbol)) & (16 /* Anonymous */ | 32 /* Mapped */))) {
79801
+ if (ts.isTypeAliasDeclaration(node.parent) && !(ts.getObjectFlags(getDeclaredTypeOfSymbol(symbol)) & (16 /* Anonymous */ | 32 /* Mapped */))) {
79733
79802
  error(node, ts.Diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types);
79734
79803
  }
79735
79804
  else if (modifiers === 32768 /* In */ || modifiers === 65536 /* Out */) {
@@ -79742,7 +79811,6 @@ var ts;
79742
79811
  }
79743
79812
  }
79744
79813
  }
79745
- addLazyDiagnostic(function () { return checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0); });
79746
79814
  }
79747
79815
  function checkParameter(node) {
79748
79816
  // Grammar checking
@@ -80232,7 +80300,7 @@ var ts;
80232
80300
  superCallStatement = statement;
80233
80301
  break;
80234
80302
  }
80235
- if (!ts.isPrologueDirective(statement) && nodeImmediatelyReferencesSuperOrThis(statement)) {
80303
+ if (nodeImmediatelyReferencesSuperOrThis(statement)) {
80236
80304
  break;
80237
80305
  }
80238
80306
  }
@@ -85585,6 +85653,9 @@ var ts;
85585
85653
  case 226 /* ClassExpression */:
85586
85654
  checkClassExpressionDeferred(node);
85587
85655
  break;
85656
+ case 163 /* TypeParameter */:
85657
+ checkTypeParameterDeferred(node);
85658
+ break;
85588
85659
  case 279 /* JsxSelfClosingElement */:
85589
85660
  checkJsxSelfClosingElementDeferred(node);
85590
85661
  break;
@@ -86681,11 +86752,6 @@ var ts;
86681
86752
  !parameter.initializer &&
86682
86753
  ts.hasSyntacticModifier(parameter, 16476 /* ParameterPropertyModifier */);
86683
86754
  }
86684
- function isOptionalUninitializedParameter(parameter) {
86685
- return !!strictNullChecks &&
86686
- isOptionalParameter(parameter) &&
86687
- !parameter.initializer;
86688
- }
86689
86755
  function isExpandoFunctionDeclaration(node) {
86690
86756
  var declaration = ts.getParseTreeNode(node, ts.isFunctionDeclaration);
86691
86757
  if (!declaration) {
@@ -87602,8 +87668,7 @@ var ts;
87602
87668
  case 144 /* OutKeyword */:
87603
87669
  var inOutFlag = modifier.kind === 101 /* InKeyword */ ? 32768 /* In */ : 65536 /* Out */;
87604
87670
  var inOutText = modifier.kind === 101 /* InKeyword */ ? "in" : "out";
87605
- if (node.kind !== 163 /* TypeParameter */ || (node.parent.kind !== 258 /* InterfaceDeclaration */ &&
87606
- node.parent.kind !== 257 /* ClassDeclaration */ && node.parent.kind !== 259 /* TypeAliasDeclaration */)) {
87671
+ if (node.kind !== 163 /* TypeParameter */ || !(ts.isInterfaceDeclaration(node.parent) || ts.isClassLike(node.parent) || ts.isTypeAliasDeclaration(node.parent))) {
87607
87672
  return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias, inOutText);
87608
87673
  }
87609
87674
  if (flags & inOutFlag) {
@@ -92837,11 +92902,11 @@ var ts;
92837
92902
  }
92838
92903
  var statements = [];
92839
92904
  resumeLexicalEnvironment();
92840
- var indexAfterLastPrologueStatement = factory.copyPrologue(body.statements, statements, /*ensureUseStrict*/ false, visitor);
92841
- var superStatementIndex = ts.findSuperStatementIndex(body.statements, indexAfterLastPrologueStatement);
92905
+ var prologueStatementCount = factory.copyPrologue(body.statements, statements, /*ensureUseStrict*/ false, visitor);
92906
+ var superStatementIndex = ts.findSuperStatementIndex(body.statements, prologueStatementCount);
92842
92907
  // If there was a super call, visit existing statements up to and including it
92843
92908
  if (superStatementIndex >= 0) {
92844
- ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, indexAfterLastPrologueStatement, superStatementIndex + 1 - indexAfterLastPrologueStatement));
92909
+ ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, prologueStatementCount, superStatementIndex + 1 - prologueStatementCount));
92845
92910
  }
92846
92911
  // Transform parameters into property assignments. Transforms this:
92847
92912
  //
@@ -92860,12 +92925,12 @@ var ts;
92860
92925
  if (superStatementIndex >= 0) {
92861
92926
  ts.addRange(statements, parameterPropertyAssignments);
92862
92927
  }
92863
- // Since there was no super() call, parameter properties are the first statements in the constructor
92928
+ // Since there was no super() call, parameter properties are the first statements in the constructor after any prologue statements
92864
92929
  else {
92865
- statements = ts.addRange(parameterPropertyAssignments, statements);
92930
+ statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, prologueStatementCount), true), parameterPropertyAssignments, true), statements.slice(prologueStatementCount), true);
92866
92931
  }
92867
- // Add remaining statements from the body, skipping the super() call if it was found
92868
- ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, superStatementIndex + 1));
92932
+ // Add remaining statements from the body, skipping the super() call if it was found and any (already added) prologue statements
92933
+ ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, superStatementIndex + 1 + prologueStatementCount));
92869
92934
  // End the lexical environment.
92870
92935
  statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment());
92871
92936
  var block = factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), body.statements), /*multiLine*/ true);
@@ -109764,7 +109829,7 @@ var ts;
109764
109829
  addOutput(buildInfoPath);
109765
109830
  }
109766
109831
  function getOwnOutputFileNames(configFile, inputFileName, ignoreCase, addOutput, getCommonSourceDirectory) {
109767
- if (ts.fileExtensionIs(inputFileName, ".d.ts" /* Dts */))
109832
+ if (ts.isDeclarationFileName(inputFileName))
109768
109833
  return;
109769
109834
  var js = getOutputJSFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory);
109770
109835
  addOutput(js);
@@ -109809,7 +109874,7 @@ var ts;
109809
109874
  /*@internal*/
109810
109875
  function getCommonSourceDirectoryOfConfig(_a, ignoreCase) {
109811
109876
  var options = _a.options, fileNames = _a.fileNames;
109812
- return getCommonSourceDirectory(options, function () { return ts.filter(fileNames, function (file) { return !(options.noEmitForJsFiles && ts.fileExtensionIsOneOf(file, ts.supportedJSExtensionsFlat)) && !ts.fileExtensionIs(file, ".d.ts" /* Dts */); }); }, ts.getDirectoryPath(ts.normalizeSlashes(ts.Debug.checkDefined(options.configFilePath))), ts.createGetCanonicalFileName(!ignoreCase));
109877
+ return getCommonSourceDirectory(options, function () { return ts.filter(fileNames, function (file) { return !(options.noEmitForJsFiles && ts.fileExtensionIsOneOf(file, ts.supportedJSExtensionsFlat)) && !ts.isDeclarationFileName(file); }); }, ts.getDirectoryPath(ts.normalizeSlashes(ts.Debug.checkDefined(options.configFilePath))), ts.createGetCanonicalFileName(!ignoreCase));
109813
109878
  }
109814
109879
  ts.getCommonSourceDirectoryOfConfig = getCommonSourceDirectoryOfConfig;
109815
109880
  /*@internal*/
@@ -109851,7 +109916,7 @@ var ts;
109851
109916
  var getCommonSourceDirectory = ts.memoize(function () { return getCommonSourceDirectoryOfConfig(configFile, ignoreCase); });
109852
109917
  for (var _a = 0, _b = configFile.fileNames; _a < _b.length; _a++) {
109853
109918
  var inputFileName = _b[_a];
109854
- if (ts.fileExtensionIs(inputFileName, ".d.ts" /* Dts */))
109919
+ if (ts.isDeclarationFileName(inputFileName))
109855
109920
  continue;
109856
109921
  var jsFilePath = getOutputJSFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory);
109857
109922
  if (jsFilePath)
@@ -115201,7 +115266,7 @@ var ts;
115201
115266
  if (ts.outFile(options) || options.outDir)
115202
115267
  return false;
115203
115268
  // File if emitted next to input needs to be ignored
115204
- if (ts.fileExtensionIs(fileOrDirectoryPath, ".d.ts" /* Dts */)) {
115269
+ if (ts.isDeclarationFileName(fileOrDirectoryPath)) {
115205
115270
  // If its declaration directory: its not ignored if not excluded by config
115206
115271
  if (options.declarationDir)
115207
115272
  return false;
@@ -116374,7 +116439,7 @@ var ts;
116374
116439
  var getCommonSourceDirectory_2 = ts.memoize(function () { return ts.getCommonSourceDirectoryOfConfig(parsedRef.commandLine, !host.useCaseSensitiveFileNames()); });
116375
116440
  for (var _b = 0, _c = parsedRef.commandLine.fileNames; _b < _c.length; _b++) {
116376
116441
  var fileName = _c[_b];
116377
- if (!ts.fileExtensionIs(fileName, ".d.ts" /* Dts */) && !ts.fileExtensionIs(fileName, ".json" /* Json */)) {
116442
+ if (!ts.isDeclarationFileName(fileName) && !ts.fileExtensionIs(fileName, ".json" /* Json */)) {
116378
116443
  processProjectReferenceFile(ts.getOutputDeclarationFileName(fileName, parsedRef.commandLine, !host.useCaseSensitiveFileNames(), getCommonSourceDirectory_2), { kind: ts.FileIncludeKind.OutputFromProjectReference, index: index });
116379
116444
  }
116380
116445
  }
@@ -116565,7 +116630,7 @@ var ts;
116565
116630
  }
116566
116631
  function getRedirectReferenceForResolution(file) {
116567
116632
  var redirect = getResolvedProjectReferenceToRedirect(file.originalFileName);
116568
- if (redirect || !ts.fileExtensionIsOneOf(file.originalFileName, [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */]))
116633
+ if (redirect || !ts.isDeclarationFileName(file.originalFileName))
116569
116634
  return redirect;
116570
116635
  // The originalFileName could not be actual source file name if file found was d.ts from referecned project
116571
116636
  // So in this case try to look up if this is output from referenced project, if it is use the redirected project in that case
@@ -117956,7 +118021,7 @@ var ts;
117956
118021
  }
117957
118022
  function getProjectReferenceRedirectProject(fileName) {
117958
118023
  // Ignore dts or any json files
117959
- if (!resolvedProjectReferences || !resolvedProjectReferences.length || ts.fileExtensionIs(fileName, ".d.ts" /* Dts */) || ts.fileExtensionIs(fileName, ".json" /* Json */)) {
118024
+ if (!resolvedProjectReferences || !resolvedProjectReferences.length || ts.isDeclarationFileName(fileName) || ts.fileExtensionIs(fileName, ".json" /* Json */)) {
117960
118025
  return undefined;
117961
118026
  }
117962
118027
  // If this file is produced by a referenced project, we need to rewrite it to
@@ -118005,7 +118070,7 @@ var ts;
118005
118070
  else {
118006
118071
  var getCommonSourceDirectory_3 = ts.memoize(function () { return ts.getCommonSourceDirectoryOfConfig(resolvedRef.commandLine, !host.useCaseSensitiveFileNames()); });
118007
118072
  ts.forEach(resolvedRef.commandLine.fileNames, function (fileName) {
118008
- if (!ts.fileExtensionIs(fileName, ".d.ts" /* Dts */) && !ts.fileExtensionIs(fileName, ".json" /* Json */)) {
118073
+ if (!ts.isDeclarationFileName(fileName) && !ts.fileExtensionIs(fileName, ".json" /* Json */)) {
118009
118074
  var outputDts = ts.getOutputDeclarationFileName(fileName, resolvedRef.commandLine, !host.useCaseSensitiveFileNames(), getCommonSourceDirectory_3);
118010
118075
  mapFromToProjectReferenceRedirectSource.set(toPath(outputDts), fileName);
118011
118076
  }
@@ -118806,7 +118871,7 @@ var ts;
118806
118871
  if (options.outDir) {
118807
118872
  return ts.containsPath(options.outDir, filePath, currentDirectory, !host.useCaseSensitiveFileNames());
118808
118873
  }
118809
- if (ts.fileExtensionIsOneOf(filePath, ts.supportedJSExtensionsFlat) || ts.fileExtensionIs(filePath, ".d.ts" /* Dts */)) {
118874
+ if (ts.fileExtensionIsOneOf(filePath, ts.supportedJSExtensionsFlat) || ts.isDeclarationFileName(filePath)) {
118810
118875
  // Otherwise just check if sourceFile with the name exists
118811
118876
  var filePathWithoutExtension = ts.removeFileExtension(filePath);
118812
118877
  return !!getSourceFileByPath((filePathWithoutExtension + ".ts" /* Ts */)) ||
@@ -119139,13 +119204,9 @@ var ts;
119139
119204
  ts.getFileEmitOutput = getFileEmitOutput;
119140
119205
  var BuilderState;
119141
119206
  (function (BuilderState) {
119142
- var manyToManyPathMapCount = 0;
119143
119207
  function createManyToManyPathMap() {
119144
119208
  function create(forward, reverse, deleted) {
119145
- var version = 0;
119146
119209
  var map = {
119147
- id: manyToManyPathMapCount++,
119148
- version: function () { return version; },
119149
119210
  clone: function () { return create(new ts.Map(forward), new ts.Map(reverse), deleted && new ts.Set(deleted)); },
119150
119211
  forEach: function (fn) { return forward.forEach(fn); },
119151
119212
  getKeys: function (v) { return reverse.get(v); },
@@ -119161,30 +119222,29 @@ var ts;
119161
119222
  }
119162
119223
  set.forEach(function (v) { return deleteFromMultimap(reverse, v, k); });
119163
119224
  forward.delete(k);
119164
- version++;
119165
119225
  return true;
119166
119226
  },
119167
119227
  set: function (k, vSet) {
119168
- var changed = !!(deleted === null || deleted === void 0 ? void 0 : deleted.delete(k));
119228
+ deleted === null || deleted === void 0 ? void 0 : deleted.delete(k);
119169
119229
  var existingVSet = forward.get(k);
119170
119230
  forward.set(k, vSet);
119171
119231
  existingVSet === null || existingVSet === void 0 ? void 0 : existingVSet.forEach(function (v) {
119172
119232
  if (!vSet.has(v)) {
119173
- changed = true;
119174
119233
  deleteFromMultimap(reverse, v, k);
119175
119234
  }
119176
119235
  });
119177
119236
  vSet.forEach(function (v) {
119178
119237
  if (!(existingVSet === null || existingVSet === void 0 ? void 0 : existingVSet.has(v))) {
119179
- changed = true;
119180
119238
  addToMultimap(reverse, v, k);
119181
119239
  }
119182
119240
  });
119183
- if (changed) {
119184
- version++;
119185
- }
119186
119241
  return map;
119187
119242
  },
119243
+ clear: function () {
119244
+ forward.clear();
119245
+ reverse.clear();
119246
+ deleted === null || deleted === void 0 ? void 0 : deleted.clear();
119247
+ }
119188
119248
  };
119189
119249
  return map;
119190
119250
  }
@@ -119199,11 +119259,10 @@ var ts;
119199
119259
  }
119200
119260
  set.add(v);
119201
119261
  }
119202
- function deleteFromMultimap(map, k, v, removeEmpty) {
119203
- if (removeEmpty === void 0) { removeEmpty = true; }
119262
+ function deleteFromMultimap(map, k, v) {
119204
119263
  var set = map.get(k);
119205
119264
  if (set === null || set === void 0 ? void 0 : set.delete(v)) {
119206
- if (removeEmpty && !set.size) {
119265
+ if (!set.size) {
119207
119266
  map.delete(k);
119208
119267
  }
119209
119268
  return true;
@@ -119432,7 +119491,7 @@ var ts;
119432
119491
  /*forceDtsEmit*/ true);
119433
119492
  var firstDts_1 = ts.firstOrUndefined(emitOutput_1.outputFiles);
119434
119493
  if (firstDts_1) {
119435
- ts.Debug.assert(ts.fileExtensionIsOneOf(firstDts_1.name, [".d.ts" /* Dts */, ".d.mts" /* Dmts */, ".d.cts" /* Dcts */]), "File extension for signature expected to be dts", function () { return "Found: " + ts.getAnyExtensionFromPath(firstDts_1.name) + " for " + firstDts_1.name + ":: All output files: " + JSON.stringify(emitOutput_1.outputFiles.map(function (f) { return f.name; })); });
119494
+ ts.Debug.assert(ts.isDeclarationFileName(firstDts_1.name), "File extension for signature expected to be dts", function () { return "Found: " + ts.getAnyExtensionFromPath(firstDts_1.name) + " for " + firstDts_1.name + ":: All output files: " + JSON.stringify(emitOutput_1.outputFiles.map(function (f) { return f.name; })); });
119436
119495
  latestSignature = (computeHash || ts.generateDjb2Hash)(firstDts_1.text);
119437
119496
  if (exportedModulesMapCache && latestSignature !== prevSignature) {
119438
119497
  updateExportedModules(sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
@@ -119490,20 +119549,6 @@ var ts;
119490
119549
  var _a;
119491
119550
  if (exportedModulesMapCache) {
119492
119551
  ts.Debug.assert(!!state.exportedModulesMap);
119493
- var cacheId = exportedModulesMapCache.id;
119494
- var cacheVersion = exportedModulesMapCache.version();
119495
- if (state.previousCache) {
119496
- if (state.previousCache.id === cacheId && state.previousCache.version === cacheVersion) {
119497
- // If this is the same cache at the same version as last time this BuilderState
119498
- // was updated, there's no need to update again
119499
- return;
119500
- }
119501
- state.previousCache.id = cacheId;
119502
- state.previousCache.version = cacheVersion;
119503
- }
119504
- else {
119505
- state.previousCache = { id: cacheId, version: cacheVersion };
119506
- }
119507
119552
  (_a = exportedModulesMapCache.deletedKeys()) === null || _a === void 0 ? void 0 : _a.forEach(function (path) { return state.exportedModulesMap.deleteKey(path); });
119508
119553
  exportedModulesMapCache.forEach(function (exportedModules, path) { return state.exportedModulesMap.set(path, exportedModules); });
119509
119554
  }
@@ -119837,7 +119882,8 @@ var ts;
119837
119882
  * This is to allow the callers to be able to actually remove affected file only when the operation is complete
119838
119883
  * eg. if during diagnostics check cancellation token ends up cancelling the request, the affected file should be retained
119839
119884
  */
119840
- function getNextAffectedFile(state, cancellationToken, computeHash) {
119885
+ function getNextAffectedFile(state, cancellationToken, computeHash, host) {
119886
+ var _a;
119841
119887
  while (true) {
119842
119888
  var affectedFiles = state.affectedFiles;
119843
119889
  if (affectedFiles) {
@@ -119848,7 +119894,7 @@ var ts;
119848
119894
  if (!seenAffectedFiles.has(affectedFile.resolvedPath)) {
119849
119895
  // Set the next affected file as seen and remove the cached semantic diagnostics
119850
119896
  state.affectedFilesIndex = affectedFilesIndex;
119851
- handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash);
119897
+ handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
119852
119898
  return affectedFile;
119853
119899
  }
119854
119900
  affectedFilesIndex++;
@@ -119860,6 +119906,7 @@ var ts;
119860
119906
  ts.BuilderState.updateSignaturesFromCache(state, state.currentAffectedFilesSignatures);
119861
119907
  state.currentAffectedFilesSignatures.clear();
119862
119908
  ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
119909
+ (_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clear();
119863
119910
  state.affectedFiles = undefined;
119864
119911
  }
119865
119912
  // Get next changed file
@@ -119889,6 +119936,11 @@ var ts;
119889
119936
  state.seenAffectedFiles = new ts.Set();
119890
119937
  }
119891
119938
  }
119939
+ function clearAffectedFilesPendingEmit(state) {
119940
+ state.affectedFilesPendingEmit = undefined;
119941
+ state.affectedFilesPendingEmitKind = undefined;
119942
+ state.affectedFilesPendingEmitIndex = undefined;
119943
+ }
119892
119944
  /**
119893
119945
  * Returns next file to be emitted from files that retrieved semantic diagnostics but did not emit yet
119894
119946
  */
@@ -119908,9 +119960,7 @@ var ts;
119908
119960
  }
119909
119961
  }
119910
119962
  }
119911
- state.affectedFilesPendingEmit = undefined;
119912
- state.affectedFilesPendingEmitKind = undefined;
119913
- state.affectedFilesPendingEmitIndex = undefined;
119963
+ clearAffectedFilesPendingEmit(state);
119914
119964
  }
119915
119965
  return undefined;
119916
119966
  }
@@ -119918,7 +119968,7 @@ var ts;
119918
119968
  * Handles semantic diagnostics and dts emit for affectedFile and files, that are referencing modules that export entities from affected file
119919
119969
  * This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
119920
119970
  */
119921
- function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash) {
119971
+ function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
119922
119972
  var _a;
119923
119973
  removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
119924
119974
  // If affected files is everything except default library, then nothing more to do
@@ -119943,14 +119993,14 @@ var ts;
119943
119993
  ts.Debug.assert(state.hasCalledUpdateShapeSignature.has(affectedFile.resolvedPath) || ((_a = state.currentAffectedFilesSignatures) === null || _a === void 0 ? void 0 : _a.has(affectedFile.resolvedPath)), "Signature not updated for affected file: " + affectedFile.fileName);
119944
119994
  }
119945
119995
  if (!state.compilerOptions.assumeChangesOnlyAffectDirectDependencies) {
119946
- forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, function (state, path) { return handleDtsMayChangeOf(state, path, cancellationToken, computeHash); });
119996
+ forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, function (state, path) { return handleDtsMayChangeOf(state, path, cancellationToken, computeHash, host); });
119947
119997
  }
119948
119998
  }
119949
119999
  /**
119950
120000
  * Handle the dts may change, so they need to be added to pending emit if dts emit is enabled,
119951
120001
  * Also we need to make sure signature is updated for these files
119952
120002
  */
119953
- function handleDtsMayChangeOf(state, path, cancellationToken, computeHash) {
120003
+ function handleDtsMayChangeOf(state, path, cancellationToken, computeHash, host) {
119954
120004
  removeSemanticDiagnosticsOf(state, path);
119955
120005
  if (!state.changedFilesSet.has(path)) {
119956
120006
  var program = ts.Debug.checkDefined(state.program);
@@ -119961,8 +120011,7 @@ var ts;
119961
120011
  // This ensures that we dont later during incremental builds considering wrong signature.
119962
120012
  // Eg where this also is needed to ensure that .tsbuildinfo generated by incremental build should be same as if it was first fresh build
119963
120013
  // But we avoid expensive full shape computation, as using file version as shape is enough for correctness.
119964
- ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap,
119965
- /* useFileVersionAsSignature */ true);
120014
+ ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap, !host.disableUseFileVersionAsSignature);
119966
120015
  // If not dts emit, nothing more to do
119967
120016
  if (ts.getEmitDeclarations(state.compilerOptions)) {
119968
120017
  addToAffectedFilesPendingEmit(state, path, 0 /* DtsOnly */);
@@ -120159,13 +120208,18 @@ var ts;
120159
120208
  var signature = state.currentAffectedFilesSignatures && state.currentAffectedFilesSignatures.get(key);
120160
120209
  var actualSignature = signature !== null && signature !== void 0 ? signature : value.signature;
120161
120210
  return value.version === actualSignature ?
120162
- value.affectsGlobalScope ?
120163
- { version: value.version, signature: undefined, affectsGlobalScope: true, impliedFormat: value.impliedFormat } :
120211
+ value.affectsGlobalScope || value.impliedFormat ?
120212
+ // If file version is same as signature, dont serialize signature
120213
+ { version: value.version, signature: undefined, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
120214
+ // If file info only contains version and signature and both are same we can just write string
120164
120215
  value.version :
120165
- actualSignature !== undefined ?
120216
+ actualSignature !== undefined ? // If signature is not same as version, encode signature in the fileInfo
120166
120217
  signature === undefined ?
120218
+ // If we havent computed signature, use fileInfo as is
120167
120219
  value :
120220
+ // Serialize fileInfo with new updated signature
120168
120221
  { version: value.version, signature: signature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
120222
+ // Signature of the FileInfo is undefined, serialize it as false
120169
120223
  { version: value.version, signature: false, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat };
120170
120224
  });
120171
120225
  var referencedMap;
@@ -120410,7 +120464,7 @@ var ts;
120410
120464
  * in that order would be used to write the files
120411
120465
  */
120412
120466
  function emitNextAffectedFile(writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
120413
- var affected = getNextAffectedFile(state, cancellationToken, computeHash);
120467
+ var affected = getNextAffectedFile(state, cancellationToken, computeHash, host);
120414
120468
  var emitKind = 1 /* Full */;
120415
120469
  var isPendingEmitFile = false;
120416
120470
  if (!affected) {
@@ -120455,54 +120509,48 @@ var ts;
120455
120509
  * in that order would be used to write the files
120456
120510
  */
120457
120511
  function emit(targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
120458
- var restorePendingEmitOnHandlingNoEmitSuccess = false;
120459
- var savedAffectedFilesPendingEmit;
120460
- var savedAffectedFilesPendingEmitKind;
120461
- var savedAffectedFilesPendingEmitIndex;
120462
- // Backup and restore affected pendings emit state for non emit Builder if noEmitOnError is enabled and emitBuildInfo could be written in case there are errors
120463
- // This ensures pending files to emit is updated in tsbuildinfo
120464
- // Note that when there are no errors, emit proceeds as if everything is emitted as it is callers reponsibility to write the files to disk if at all (because its builder that doesnt track files to emit)
120465
- if (kind !== BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram &&
120466
- !targetSourceFile &&
120467
- !ts.outFile(state.compilerOptions) &&
120468
- !state.compilerOptions.noEmit &&
120469
- state.compilerOptions.noEmitOnError) {
120470
- restorePendingEmitOnHandlingNoEmitSuccess = true;
120471
- savedAffectedFilesPendingEmit = state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice();
120472
- savedAffectedFilesPendingEmitKind = state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind);
120473
- savedAffectedFilesPendingEmitIndex = state.affectedFilesPendingEmitIndex;
120474
- }
120512
+ var _a;
120475
120513
  if (kind === BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram) {
120476
120514
  assertSourceFileOkWithoutNextAffectedCall(state, targetSourceFile);
120477
120515
  }
120478
120516
  var result = ts.handleNoEmitOptions(builderProgram, targetSourceFile, writeFile, cancellationToken);
120479
120517
  if (result)
120480
120518
  return result;
120481
- if (restorePendingEmitOnHandlingNoEmitSuccess) {
120482
- state.affectedFilesPendingEmit = savedAffectedFilesPendingEmit;
120483
- state.affectedFilesPendingEmitKind = savedAffectedFilesPendingEmitKind;
120484
- state.affectedFilesPendingEmitIndex = savedAffectedFilesPendingEmitIndex;
120485
- }
120486
120519
  // Emit only affected files if using builder for emit
120487
- if (!targetSourceFile && kind === BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram) {
120488
- // Emit and report any errors we ran into.
120489
- var sourceMaps = [];
120490
- var emitSkipped = false;
120491
- var diagnostics = void 0;
120492
- var emittedFiles = [];
120493
- var affectedEmitResult = void 0;
120494
- while (affectedEmitResult = emitNextAffectedFile(writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers)) {
120495
- emitSkipped = emitSkipped || affectedEmitResult.result.emitSkipped;
120496
- diagnostics = ts.addRange(diagnostics, affectedEmitResult.result.diagnostics);
120497
- emittedFiles = ts.addRange(emittedFiles, affectedEmitResult.result.emittedFiles);
120498
- sourceMaps = ts.addRange(sourceMaps, affectedEmitResult.result.sourceMaps);
120520
+ if (!targetSourceFile) {
120521
+ if (kind === BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram) {
120522
+ // Emit and report any errors we ran into.
120523
+ var sourceMaps = [];
120524
+ var emitSkipped = false;
120525
+ var diagnostics = void 0;
120526
+ var emittedFiles = [];
120527
+ var affectedEmitResult = void 0;
120528
+ while (affectedEmitResult = emitNextAffectedFile(writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers)) {
120529
+ emitSkipped = emitSkipped || affectedEmitResult.result.emitSkipped;
120530
+ diagnostics = ts.addRange(diagnostics, affectedEmitResult.result.diagnostics);
120531
+ emittedFiles = ts.addRange(emittedFiles, affectedEmitResult.result.emittedFiles);
120532
+ sourceMaps = ts.addRange(sourceMaps, affectedEmitResult.result.sourceMaps);
120533
+ }
120534
+ return {
120535
+ emitSkipped: emitSkipped,
120536
+ diagnostics: diagnostics || ts.emptyArray,
120537
+ emittedFiles: emittedFiles,
120538
+ sourceMaps: sourceMaps
120539
+ };
120540
+ }
120541
+ // In non Emit builder, clear affected files pending emit
120542
+ else if ((_a = state.affectedFilesPendingEmitKind) === null || _a === void 0 ? void 0 : _a.size) {
120543
+ ts.Debug.assert(kind === BuilderProgramKind.SemanticDiagnosticsBuilderProgram);
120544
+ // State can clear affected files pending emit if
120545
+ if (!emitOnlyDtsFiles // If we are doing complete emit, affected files pending emit can be cleared
120546
+ // If every file pending emit is pending on only dts emit
120547
+ || ts.every(state.affectedFilesPendingEmit, function (path, index) {
120548
+ return index < state.affectedFilesPendingEmitIndex ||
120549
+ state.affectedFilesPendingEmitKind.get(path) === 0 /* DtsOnly */;
120550
+ })) {
120551
+ clearAffectedFilesPendingEmit(state);
120552
+ }
120499
120553
  }
120500
- return {
120501
- emitSkipped: emitSkipped,
120502
- diagnostics: diagnostics || ts.emptyArray,
120503
- emittedFiles: emittedFiles,
120504
- sourceMaps: sourceMaps
120505
- };
120506
120554
  }
120507
120555
  return ts.Debug.checkDefined(state.program).emit(targetSourceFile, writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
120508
120556
  }
@@ -120512,7 +120560,7 @@ var ts;
120512
120560
  */
120513
120561
  function getSemanticDiagnosticsOfNextAffectedFile(cancellationToken, ignoreSourceFile) {
120514
120562
  while (true) {
120515
- var affected = getNextAffectedFile(state, cancellationToken, computeHash);
120563
+ var affected = getNextAffectedFile(state, cancellationToken, computeHash, host);
120516
120564
  if (!affected) {
120517
120565
  // Done
120518
120566
  return undefined;
@@ -123632,9 +123680,6 @@ var ts;
123632
123680
  function newer(date1, date2) {
123633
123681
  return date2 > date1 ? date2 : date1;
123634
123682
  }
123635
- function isDeclarationFile(fileName) {
123636
- return ts.fileExtensionIs(fileName, ".d.ts" /* Dts */);
123637
- }
123638
123683
  /*@internal*/
123639
123684
  function isCircularBuildOrder(buildOrder) {
123640
123685
  return !!buildOrder && !!buildOrder.buildOrder;
@@ -124197,7 +124242,7 @@ var ts;
124197
124242
  outputFiles.forEach(function (_a) {
124198
124243
  var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
124199
124244
  var priorChangeTime;
124200
- if (!anyDtsChanged && isDeclarationFile(name)) {
124245
+ if (!anyDtsChanged && ts.isDeclarationFileName(name)) {
124201
124246
  // Check for unchanged .d.ts files
124202
124247
  if (host.fileExists(name) && state.readFileWithCache(name) === text) {
124203
124248
  priorChangeTime = host.getModifiedTime(name);
@@ -124538,7 +124583,7 @@ var ts;
124538
124583
  // In addition to file timestamps, we also keep track of when a .d.ts file
124539
124584
  // had its file touched but not had its contents changed - this allows us
124540
124585
  // to skip a downstream typecheck
124541
- if (isDeclarationFile(output)) {
124586
+ if (ts.isDeclarationFileName(output)) {
124542
124587
  var outputModifiedTime = ts.getModifiedTime(host, output);
124543
124588
  newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, outputModifiedTime);
124544
124589
  }
@@ -124692,7 +124737,7 @@ var ts;
124692
124737
  reportVerbose = false;
124693
124738
  reportStatus(state, verboseMessage, proj.options.configFilePath);
124694
124739
  }
124695
- if (isDeclarationFile(file)) {
124740
+ if (ts.isDeclarationFileName(file)) {
124696
124741
  priorNewestUpdateTime = newer(priorNewestUpdateTime, ts.getModifiedTime(host, file));
124697
124742
  }
124698
124743
  host.setModifiedTime(file, now);
@@ -132004,17 +132049,13 @@ var ts;
132004
132049
  }
132005
132050
  }
132006
132051
  if (origin && originIsObjectLiteralMethod(origin)) {
132007
- var importAdder = void 0;
132008
- (insertText = origin.insertText, isSnippet = origin.isSnippet, importAdder = origin.importAdder, labelDetails = origin.labelDetails);
132052
+ (insertText = origin.insertText, isSnippet = origin.isSnippet, labelDetails = origin.labelDetails);
132009
132053
  if (!preferences.useLabelDetailsInCompletionEntries) {
132010
132054
  name = name + labelDetails.detail;
132011
132055
  labelDetails = undefined;
132012
132056
  }
132013
132057
  source = CompletionSource.ObjectLiteralMethodSnippet;
132014
132058
  sortText = Completions.SortText.SortBelow(sortText);
132015
- if (importAdder.hasFixes()) {
132016
- hasAction = true;
132017
- }
132018
132059
  }
132019
132060
  if (isJsxIdentifierExpected && !isRightOfOpenTag && preferences.includeCompletionsWithSnippetText && preferences.jsxAttributeCompletionStyle && preferences.jsxAttributeCompletionStyle !== "none") {
132020
132061
  var useBraces_1 = preferences.jsxAttributeCompletionStyle === "braces";
@@ -132237,8 +132278,7 @@ var ts;
132237
132278
  var isSnippet = preferences.includeCompletionsWithSnippetText || undefined;
132238
132279
  var insertText = name;
132239
132280
  var sourceFile = enclosingDeclaration.getSourceFile();
132240
- var importAdder = ts.codefix.createImportAdder(sourceFile, program, preferences, host);
132241
- var method = createObjectLiteralMethod(symbol, enclosingDeclaration, sourceFile, program, host, preferences, importAdder);
132281
+ var method = createObjectLiteralMethod(symbol, enclosingDeclaration, sourceFile, program, host, preferences);
132242
132282
  if (!method) {
132243
132283
  return undefined;
132244
132284
  }
@@ -132267,16 +132307,15 @@ var ts;
132267
132307
  /*modifiers*/ undefined,
132268
132308
  /*name*/ "", method.questionToken, method.typeParameters, method.parameters, method.type);
132269
132309
  var labelDetails = { detail: signaturePrinter.printNode(4 /* Unspecified */, methodSignature, sourceFile) };
132270
- return { isSnippet: isSnippet, insertText: insertText, importAdder: importAdder, labelDetails: labelDetails };
132310
+ return { isSnippet: isSnippet, insertText: insertText, labelDetails: labelDetails };
132271
132311
  }
132272
132312
  ;
132273
- function createObjectLiteralMethod(symbol, enclosingDeclaration, sourceFile, program, host, preferences, importAdder) {
132313
+ function createObjectLiteralMethod(symbol, enclosingDeclaration, sourceFile, program, host, preferences) {
132274
132314
  var declarations = symbol.getDeclarations();
132275
132315
  if (!(declarations && declarations.length)) {
132276
132316
  return undefined;
132277
132317
  }
132278
132318
  var checker = program.getTypeChecker();
132279
- var scriptTarget = ts.getEmitScriptTarget(program.getCompilerOptions());
132280
132319
  var declaration = declarations[0];
132281
132320
  var name = ts.getSynthesizedDeepClone(ts.getNameOfDeclaration(declaration), /*includeTrivia*/ false);
132282
132321
  var type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration));
@@ -132309,11 +132348,6 @@ var ts;
132309
132348
  if (!typeNode || !ts.isFunctionTypeNode(typeNode)) {
132310
132349
  return undefined;
132311
132350
  }
132312
- var importableReference = ts.codefix.tryGetAutoImportableReferenceFromTypeNode(typeNode, scriptTarget);
132313
- if (importableReference) {
132314
- typeNode = importableReference.typeNode;
132315
- ts.codefix.importSymbols(importAdder, importableReference.symbols);
132316
- }
132317
132351
  var body = void 0;
132318
132352
  if (preferences.includeCompletionsWithSnippetText) {
132319
132353
  var emptyStmt = ts.factory.createEmptyStatement();
@@ -132323,11 +132357,19 @@ var ts;
132323
132357
  else {
132324
132358
  body = ts.factory.createBlock([], /* multiline */ true);
132325
132359
  }
132360
+ var parameters = typeNode.parameters.map(function (typedParam) {
132361
+ return ts.factory.createParameterDeclaration(
132362
+ /*decorators*/ undefined,
132363
+ /*modifiers*/ undefined, typedParam.dotDotDotToken, typedParam.name, typedParam.questionToken,
132364
+ /*type*/ undefined, typedParam.initializer);
132365
+ });
132326
132366
  return ts.factory.createMethodDeclaration(
132327
132367
  /*decorators*/ undefined,
132328
132368
  /*modifiers*/ undefined,
132329
132369
  /*asteriskToken*/ undefined, name,
132330
- /*questionToken*/ undefined, typeNode.typeParameters, typeNode.parameters, typeNode.type, body);
132370
+ /*questionToken*/ undefined,
132371
+ /*typeParameters*/ undefined, parameters,
132372
+ /*type*/ undefined, body);
132331
132373
  }
132332
132374
  default:
132333
132375
  return undefined;
@@ -132690,20 +132732,6 @@ var ts;
132690
132732
  };
132691
132733
  }
132692
132734
  }
132693
- if (source === CompletionSource.ObjectLiteralMethodSnippet) {
132694
- var enclosingDeclaration = tryGetObjectLikeCompletionContainer(contextToken);
132695
- var importAdder = getEntryForObjectLiteralMethodCompletion(symbol, name, enclosingDeclaration, program, host, compilerOptions, preferences, formatContext).importAdder;
132696
- if (importAdder.hasFixes()) {
132697
- var changes = ts.textChanges.ChangeTracker.with({ host: host, formatContext: formatContext, preferences: preferences }, importAdder.writeFixes);
132698
- return {
132699
- sourceDisplay: undefined,
132700
- codeActions: [{
132701
- changes: changes,
132702
- description: ts.diagnosticToString([ts.Diagnostics.Includes_imports_of_types_referenced_by_0, name]),
132703
- }],
132704
- };
132705
- }
132706
- }
132707
132735
  if (originIsTypeOnlyAlias(origin)) {
132708
132736
  var codeAction_1 = ts.codefix.getPromoteTypeOnlyCompletionAction(sourceFile, origin.declaration.name, program, host, formatContext, preferences);
132709
132737
  ts.Debug.assertIsDefined(codeAction_1, "Expected to have a code action for promoting type-only alias");
@@ -135524,7 +135552,7 @@ var ts;
135524
135552
  // It is fairly suspicious to have one path in two buckets - you'd expect dependencies to have similar configurations.
135525
135553
  // If this occurs unexpectedly, the fix is likely to synchronize the project settings.
135526
135554
  // Skip .d.ts files to reduce noise (should also cover most of node_modules).
135527
- var otherBucketKey = !ts.fileExtensionIs(path, ".d.ts" /* Dts */) &&
135555
+ var otherBucketKey = !ts.isDeclarationFileName(path) &&
135528
135556
  ts.forEachEntry(buckets, function (bucket, bucketKey) { return bucketKey !== key && bucket.has(path) && bucketKey; });
135529
135557
  if (otherBucketKey) {
135530
135558
  ts.tracing.instant("session" /* Session */, "documentRegistryBucketOverlap", { path: path, key1: otherBucketKey, key2: key });
@@ -137464,6 +137492,30 @@ var ts;
137464
137492
  }
137465
137493
  }
137466
137494
  Core.eachSymbolReferenceInFile = eachSymbolReferenceInFile;
137495
+ function getTopMostDeclarationNamesInFile(declarationName, sourceFile) {
137496
+ var candidates = ts.filter(getPossibleSymbolReferenceNodes(sourceFile, declarationName), function (name) { return !!ts.getDeclarationFromName(name); });
137497
+ return candidates.reduce(function (topMost, decl) {
137498
+ var depth = getDepth(decl);
137499
+ if (!ts.some(topMost.declarationNames) || depth === topMost.depth) {
137500
+ topMost.declarationNames.push(decl);
137501
+ topMost.depth = depth;
137502
+ }
137503
+ else if (depth < topMost.depth) {
137504
+ topMost.declarationNames = [decl];
137505
+ topMost.depth = depth;
137506
+ }
137507
+ return topMost;
137508
+ }, { depth: Infinity, declarationNames: [] }).declarationNames;
137509
+ function getDepth(declaration) {
137510
+ var depth = 0;
137511
+ while (declaration) {
137512
+ declaration = ts.getContainerNode(declaration);
137513
+ depth++;
137514
+ }
137515
+ return depth;
137516
+ }
137517
+ }
137518
+ Core.getTopMostDeclarationNamesInFile = getTopMostDeclarationNamesInFile;
137467
137519
  function someSignatureUsage(signature, sourceFiles, checker, cb) {
137468
137520
  if (!signature.name || !ts.isIdentifier(signature.name))
137469
137521
  return false;
@@ -139100,7 +139152,9 @@ var ts;
139100
139152
  (function (ts) {
139101
139153
  var GoToDefinition;
139102
139154
  (function (GoToDefinition) {
139103
- function getDefinitionAtPosition(program, sourceFile, position) {
139155
+ function getDefinitionAtPosition(program, sourceFile, position, searchOtherFilesOnly) {
139156
+ var _a;
139157
+ var _b;
139104
139158
  var resolvedRef = getReferenceAtPosition(sourceFile, position, program);
139105
139159
  var fileReferenceDefinition = resolvedRef && [getDefinitionInfoForFileReference(resolvedRef.reference.fileName, resolvedRef.fileName, resolvedRef.unverified)] || ts.emptyArray;
139106
139160
  if (resolvedRef === null || resolvedRef === void 0 ? void 0 : resolvedRef.file) {
@@ -139123,33 +139177,63 @@ var ts;
139123
139177
  }
139124
139178
  if (ts.isStaticModifier(node) && ts.isClassStaticBlockDeclaration(node.parent)) {
139125
139179
  var classDecl = node.parent.parent;
139126
- var symbol_1 = getSymbol(classDecl, typeChecker);
139180
+ var _c = getSymbol(classDecl, typeChecker), symbol_1 = _c.symbol, failedAliasResolution_1 = _c.failedAliasResolution;
139127
139181
  var staticBlocks = ts.filter(classDecl.members, ts.isClassStaticBlockDeclaration);
139128
139182
  var containerName_1 = symbol_1 ? typeChecker.symbolToString(symbol_1, classDecl) : "";
139129
139183
  var sourceFile_1 = node.getSourceFile();
139130
139184
  return ts.map(staticBlocks, function (staticBlock) {
139131
139185
  var pos = ts.moveRangePastModifiers(staticBlock).pos;
139132
139186
  pos = ts.skipTrivia(sourceFile_1.text, pos);
139133
- return createDefinitionInfoFromName(typeChecker, staticBlock, "constructor" /* constructorImplementationElement */, "static {}", containerName_1, { start: pos, length: "static".length });
139187
+ return createDefinitionInfoFromName(typeChecker, staticBlock, "constructor" /* constructorImplementationElement */, "static {}", containerName_1, /*unverified*/ false, failedAliasResolution_1, { start: pos, length: "static".length });
139134
139188
  });
139135
139189
  }
139136
- var symbol = getSymbol(node, typeChecker);
139190
+ var _d = getSymbol(node, typeChecker), symbol = _d.symbol, failedAliasResolution = _d.failedAliasResolution;
139191
+ var fallbackNode = node;
139192
+ if (searchOtherFilesOnly && failedAliasResolution) {
139193
+ // We couldn't resolve the specific import, try on the module specifier.
139194
+ var importDeclaration = ts.forEach(__spreadArray([node], (symbol === null || symbol === void 0 ? void 0 : symbol.declarations) || ts.emptyArray, true), function (n) { return ts.findAncestor(n, ts.isAnyImportOrBareOrAccessedRequire); });
139195
+ var moduleSpecifier = importDeclaration && ts.tryGetModuleSpecifierFromDeclaration(importDeclaration);
139196
+ if (moduleSpecifier) {
139197
+ (_a = getSymbol(moduleSpecifier, typeChecker), symbol = _a.symbol, failedAliasResolution = _a.failedAliasResolution);
139198
+ fallbackNode = moduleSpecifier;
139199
+ }
139200
+ }
139201
+ if (!symbol && ts.isModuleSpecifierLike(fallbackNode)) {
139202
+ // We couldn't resolve the module specifier as an external module, but it could
139203
+ // be that module resolution succeeded but the target was not a module.
139204
+ var ref = (_b = sourceFile.resolvedModules) === null || _b === void 0 ? void 0 : _b.get(fallbackNode.text, ts.getModeForUsageLocation(sourceFile, fallbackNode));
139205
+ if (ref) {
139206
+ return [{
139207
+ name: fallbackNode.text,
139208
+ fileName: ref.resolvedFileName,
139209
+ containerName: undefined,
139210
+ containerKind: undefined,
139211
+ kind: "script" /* scriptElement */,
139212
+ textSpan: ts.createTextSpan(0, 0),
139213
+ failedAliasResolution: failedAliasResolution,
139214
+ isAmbient: ts.isDeclarationFileName(ref.resolvedFileName),
139215
+ unverified: fallbackNode !== node,
139216
+ }];
139217
+ }
139218
+ }
139137
139219
  // Could not find a symbol e.g. node is string or number keyword,
139138
139220
  // or the symbol was an internal symbol and does not have a declaration e.g. undefined symbol
139139
139221
  if (!symbol) {
139140
139222
  return ts.concatenate(fileReferenceDefinition, getDefinitionInfoForIndexSignatures(node, typeChecker));
139141
139223
  }
139224
+ if (searchOtherFilesOnly && ts.every(symbol.declarations, function (d) { return d.getSourceFile().fileName === sourceFile.fileName; }))
139225
+ return undefined;
139142
139226
  var calledDeclaration = tryGetSignatureDeclaration(typeChecker, node);
139143
139227
  // Don't go to the component constructor definition for a JSX element, just go to the component definition.
139144
139228
  if (calledDeclaration && !(ts.isJsxOpeningLikeElement(node.parent) && isConstructorLike(calledDeclaration))) {
139145
- var sigInfo = createDefinitionFromSignatureDeclaration(typeChecker, calledDeclaration);
139229
+ var sigInfo = createDefinitionFromSignatureDeclaration(typeChecker, calledDeclaration, failedAliasResolution);
139146
139230
  // For a function, if this is the original function definition, return just sigInfo.
139147
139231
  // If this is the original constructor definition, parent is the class.
139148
139232
  if (typeChecker.getRootSymbols(symbol).some(function (s) { return symbolMatchesSignature(s, calledDeclaration); })) {
139149
139233
  return [sigInfo];
139150
139234
  }
139151
139235
  else {
139152
- var defs = getDefinitionFromSymbol(typeChecker, symbol, node, calledDeclaration) || ts.emptyArray;
139236
+ var defs = getDefinitionFromSymbol(typeChecker, symbol, node, failedAliasResolution, calledDeclaration) || ts.emptyArray;
139153
139237
  // For a 'super()' call, put the signature first, else put the variable first.
139154
139238
  return node.kind === 106 /* SuperKeyword */ ? __spreadArray([sigInfo], defs, true) : __spreadArray(__spreadArray([], defs, true), [sigInfo], false);
139155
139239
  }
@@ -139161,7 +139245,7 @@ var ts;
139161
139245
  // assignment. This case and others are handled by the following code.
139162
139246
  if (node.parent.kind === 297 /* ShorthandPropertyAssignment */) {
139163
139247
  var shorthandSymbol_1 = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration);
139164
- var definitions = (shorthandSymbol_1 === null || shorthandSymbol_1 === void 0 ? void 0 : shorthandSymbol_1.declarations) ? shorthandSymbol_1.declarations.map(function (decl) { return createDefinitionInfo(decl, typeChecker, shorthandSymbol_1, node); }) : ts.emptyArray;
139248
+ var definitions = (shorthandSymbol_1 === null || shorthandSymbol_1 === void 0 ? void 0 : shorthandSymbol_1.declarations) ? shorthandSymbol_1.declarations.map(function (decl) { return createDefinitionInfo(decl, typeChecker, shorthandSymbol_1, node, /*unverified*/ false, failedAliasResolution); }) : ts.emptyArray;
139165
139249
  return ts.concatenate(definitions, getDefinitionFromObjectLiteralElement(typeChecker, node) || ts.emptyArray);
139166
139250
  }
139167
139251
  // If the node is the name of a BindingElement within an ObjectBindingPattern instead of just returning the
@@ -139184,7 +139268,7 @@ var ts;
139184
139268
  return prop && getDefinitionFromSymbol(typeChecker, prop, node);
139185
139269
  });
139186
139270
  }
139187
- return ts.concatenate(fileReferenceDefinition, getDefinitionFromObjectLiteralElement(typeChecker, node) || getDefinitionFromSymbol(typeChecker, symbol, node));
139271
+ return ts.concatenate(fileReferenceDefinition, getDefinitionFromObjectLiteralElement(typeChecker, node) || getDefinitionFromSymbol(typeChecker, symbol, node, failedAliasResolution));
139188
139272
  }
139189
139273
  GoToDefinition.getDefinitionAtPosition = getDefinitionAtPosition;
139190
139274
  /**
@@ -139282,24 +139366,24 @@ var ts;
139282
139366
  return undefined;
139283
139367
  }
139284
139368
  if (ts.isImportMeta(node.parent) && node.parent.name === node) {
139285
- return definitionFromType(typeChecker.getTypeAtLocation(node.parent), typeChecker, node.parent);
139369
+ return definitionFromType(typeChecker.getTypeAtLocation(node.parent), typeChecker, node.parent, /*failedAliasResolution*/ false);
139286
139370
  }
139287
- var symbol = getSymbol(node, typeChecker);
139371
+ var _a = getSymbol(node, typeChecker), symbol = _a.symbol, failedAliasResolution = _a.failedAliasResolution;
139288
139372
  if (!symbol)
139289
139373
  return undefined;
139290
139374
  var typeAtLocation = typeChecker.getTypeOfSymbolAtLocation(symbol, node);
139291
139375
  var returnType = tryGetReturnTypeOfFunction(symbol, typeAtLocation, typeChecker);
139292
- var fromReturnType = returnType && definitionFromType(returnType, typeChecker, node);
139376
+ var fromReturnType = returnType && definitionFromType(returnType, typeChecker, node, failedAliasResolution);
139293
139377
  // If a function returns 'void' or some other type with no definition, just return the function definition.
139294
- var typeDefinitions = fromReturnType && fromReturnType.length !== 0 ? fromReturnType : definitionFromType(typeAtLocation, typeChecker, node);
139378
+ var typeDefinitions = fromReturnType && fromReturnType.length !== 0 ? fromReturnType : definitionFromType(typeAtLocation, typeChecker, node, failedAliasResolution);
139295
139379
  return typeDefinitions.length ? typeDefinitions
139296
- : !(symbol.flags & 111551 /* Value */) && symbol.flags & 788968 /* Type */ ? getDefinitionFromSymbol(typeChecker, ts.skipAlias(symbol, typeChecker), node)
139380
+ : !(symbol.flags & 111551 /* Value */) && symbol.flags & 788968 /* Type */ ? getDefinitionFromSymbol(typeChecker, ts.skipAlias(symbol, typeChecker), node, failedAliasResolution)
139297
139381
  : undefined;
139298
139382
  }
139299
139383
  GoToDefinition.getTypeDefinitionAtPosition = getTypeDefinitionAtPosition;
139300
- function definitionFromType(type, checker, node) {
139384
+ function definitionFromType(type, checker, node, failedAliasResolution) {
139301
139385
  return ts.flatMap(type.isUnion() && !(type.flags & 32 /* Enum */) ? type.types : [type], function (t) {
139302
- return t.symbol && getDefinitionFromSymbol(checker, t.symbol, node);
139386
+ return t.symbol && getDefinitionFromSymbol(checker, t.symbol, node, failedAliasResolution);
139303
139387
  });
139304
139388
  }
139305
139389
  function tryGetReturnTypeOfFunction(symbol, type, checker) {
@@ -139341,13 +139425,17 @@ var ts;
139341
139425
  // get the aliased symbol instead. This allows for goto def on an import e.g.
139342
139426
  // import {A, B} from "mod";
139343
139427
  // to jump to the implementation directly.
139428
+ var failedAliasResolution = false;
139344
139429
  if ((symbol === null || symbol === void 0 ? void 0 : symbol.declarations) && symbol.flags & 2097152 /* Alias */ && shouldSkipAlias(node, symbol.declarations[0])) {
139345
139430
  var aliased = checker.getAliasedSymbol(symbol);
139346
139431
  if (aliased.declarations) {
139347
- return aliased;
139432
+ return { symbol: aliased };
139433
+ }
139434
+ else {
139435
+ failedAliasResolution = true;
139348
139436
  }
139349
139437
  }
139350
- return symbol;
139438
+ return { symbol: symbol, failedAliasResolution: failedAliasResolution };
139351
139439
  }
139352
139440
  // Go to the original declaration for cases:
139353
139441
  //
@@ -139361,26 +139449,45 @@ var ts;
139361
139449
  if (node.parent === declaration) {
139362
139450
  return true;
139363
139451
  }
139364
- switch (declaration.kind) {
139365
- case 267 /* ImportClause */:
139366
- case 265 /* ImportEqualsDeclaration */:
139367
- return true;
139368
- case 270 /* ImportSpecifier */:
139369
- return declaration.parent.kind === 269 /* NamedImports */;
139370
- case 203 /* BindingElement */:
139371
- case 254 /* VariableDeclaration */:
139372
- return ts.isInJSFile(declaration) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(declaration);
139373
- default:
139374
- return false;
139452
+ if (declaration.kind === 268 /* NamespaceImport */) {
139453
+ return false;
139375
139454
  }
139455
+ return true;
139376
139456
  }
139377
- function getDefinitionFromSymbol(typeChecker, symbol, node, declarationNode) {
139378
- // There are cases when you extend a function by adding properties to it afterwards,
139379
- // we want to strip those extra properties.
139380
- // For deduping purposes, we also want to exclude any declarationNodes if provided.
139381
- var filteredDeclarations = ts.filter(symbol.declarations, function (d) { return d !== declarationNode && (!ts.isAssignmentDeclaration(d) || d === symbol.valueDeclaration); })
139382
- || undefined;
139383
- return getConstructSignatureDefinition() || getCallSignatureDefinition() || ts.map(filteredDeclarations, function (declaration) { return createDefinitionInfo(declaration, typeChecker, symbol, node); });
139457
+ /**
139458
+ * ```ts
139459
+ * function f() {}
139460
+ * f.foo = 0;
139461
+ * ```
139462
+ *
139463
+ * Here, `f` has two declarations: the function declaration, and the identifier in the next line.
139464
+ * The latter is a declaration for `f` because it gives `f` the `SymbolFlags.Namespace` meaning so
139465
+ * it can contain `foo`. However, that declaration is pretty uninteresting and not intuitively a
139466
+ * "definition" for `f`. Ideally, the question we'd like to answer is "what SymbolFlags does this
139467
+ * declaration contribute to the symbol for `f`?" If the answer is just `Namespace` and the
139468
+ * declaration looks like an assignment, that declaration is in no sense a definition for `f`.
139469
+ * But that information is totally lost during binding and/or symbol merging, so we need to do
139470
+ * our best to reconstruct it or use other heuristics. This function (and the logic around its
139471
+ * calling) covers our tests but feels like a hack, and it would be great if someone could come
139472
+ * up with a more precise definition of what counts as a definition.
139473
+ */
139474
+ function isExpandoDeclaration(node) {
139475
+ if (!ts.isAssignmentDeclaration(node))
139476
+ return false;
139477
+ var containingAssignment = ts.findAncestor(node, function (p) {
139478
+ if (ts.isAssignmentExpression(p))
139479
+ return true;
139480
+ if (!ts.isAssignmentDeclaration(p))
139481
+ return "quit";
139482
+ return false;
139483
+ });
139484
+ return !!containingAssignment && ts.getAssignmentDeclarationKind(containingAssignment) === 5 /* Property */;
139485
+ }
139486
+ function getDefinitionFromSymbol(typeChecker, symbol, node, failedAliasResolution, excludeDeclaration) {
139487
+ var filteredDeclarations = ts.filter(symbol.declarations, function (d) { return d !== excludeDeclaration; });
139488
+ var withoutExpandos = ts.filter(filteredDeclarations, function (d) { return !isExpandoDeclaration(d); });
139489
+ var results = ts.some(withoutExpandos) ? withoutExpandos : filteredDeclarations;
139490
+ return getConstructSignatureDefinition() || getCallSignatureDefinition() || ts.map(results, function (declaration) { return createDefinitionInfo(declaration, typeChecker, symbol, node, /*unverified*/ false, failedAliasResolution); });
139384
139491
  function getConstructSignatureDefinition() {
139385
139492
  // Applicable only if we are in a new expression, or we are on a constructor declaration
139386
139493
  // and in either case the symbol has a construct signature definition, i.e. class
@@ -139404,26 +139511,27 @@ var ts;
139404
139511
  return declarations.length
139405
139512
  ? declarationsWithBody.length !== 0
139406
139513
  ? declarationsWithBody.map(function (x) { return createDefinitionInfo(x, typeChecker, symbol, node); })
139407
- : [createDefinitionInfo(ts.last(declarations), typeChecker, symbol, node)]
139514
+ : [createDefinitionInfo(ts.last(declarations), typeChecker, symbol, node, /*unverified*/ false, failedAliasResolution)]
139408
139515
  : undefined;
139409
139516
  }
139410
139517
  }
139411
139518
  /** Creates a DefinitionInfo from a Declaration, using the declaration's name if possible. */
139412
- function createDefinitionInfo(declaration, checker, symbol, node) {
139519
+ function createDefinitionInfo(declaration, checker, symbol, node, unverified, failedAliasResolution) {
139413
139520
  var symbolName = checker.symbolToString(symbol); // Do not get scoped name, just the name of the symbol
139414
139521
  var symbolKind = ts.SymbolDisplay.getSymbolKind(checker, symbol, node);
139415
139522
  var containerName = symbol.parent ? checker.symbolToString(symbol.parent, node) : "";
139416
- return createDefinitionInfoFromName(checker, declaration, symbolKind, symbolName, containerName);
139523
+ return createDefinitionInfoFromName(checker, declaration, symbolKind, symbolName, containerName, unverified, failedAliasResolution);
139417
139524
  }
139525
+ GoToDefinition.createDefinitionInfo = createDefinitionInfo;
139418
139526
  /** Creates a DefinitionInfo directly from the name of a declaration. */
139419
- function createDefinitionInfoFromName(checker, declaration, symbolKind, symbolName, containerName, textSpan) {
139527
+ function createDefinitionInfoFromName(checker, declaration, symbolKind, symbolName, containerName, unverified, failedAliasResolution, textSpan) {
139420
139528
  var sourceFile = declaration.getSourceFile();
139421
139529
  if (!textSpan) {
139422
139530
  var name = ts.getNameOfDeclaration(declaration) || declaration;
139423
139531
  textSpan = ts.createTextSpanFromNode(name, sourceFile);
139424
139532
  }
139425
139533
  return __assign(__assign({ fileName: sourceFile.fileName, textSpan: textSpan, kind: symbolKind, name: symbolName, containerKind: undefined, // TODO: GH#18217
139426
- containerName: containerName }, ts.FindAllReferences.toContextSpan(textSpan, sourceFile, ts.FindAllReferences.getContextNode(declaration))), { isLocal: !isDefinitionVisible(checker, declaration) });
139534
+ containerName: containerName }, ts.FindAllReferences.toContextSpan(textSpan, sourceFile, ts.FindAllReferences.getContextNode(declaration))), { isLocal: !isDefinitionVisible(checker, declaration), isAmbient: !!(declaration.flags & 16777216 /* Ambient */), unverified: unverified, failedAliasResolution: failedAliasResolution });
139427
139535
  }
139428
139536
  function isDefinitionVisible(checker, declaration) {
139429
139537
  if (checker.isDeclarationVisible(declaration))
@@ -139456,8 +139564,8 @@ var ts;
139456
139564
  return false;
139457
139565
  }
139458
139566
  }
139459
- function createDefinitionFromSignatureDeclaration(typeChecker, decl) {
139460
- return createDefinitionInfo(decl, typeChecker, decl.symbol, decl);
139567
+ function createDefinitionFromSignatureDeclaration(typeChecker, decl, failedAliasResolution) {
139568
+ return createDefinitionInfo(decl, typeChecker, decl.symbol, decl, /*unverified*/ false, failedAliasResolution);
139461
139569
  }
139462
139570
  function findReferenceInPosition(refs, pos) {
139463
139571
  return ts.find(refs, function (ref) { return ts.textRangeContainsPositionInclusive(ref, pos); });
@@ -152572,9 +152680,10 @@ var ts;
152572
152680
  // 2. add "member3" to the second import statement's import list
152573
152681
  // and it is up to the user to decide which one fits best.
152574
152682
  return ts.firstDefined(existingImports, function (_a) {
152683
+ var _b;
152575
152684
  var declaration = _a.declaration;
152576
152685
  var namespacePrefix = getNamespaceLikeImportText(declaration);
152577
- var moduleSpecifier = ts.tryGetModuleSpecifierFromDeclaration(declaration);
152686
+ var moduleSpecifier = (_b = ts.tryGetModuleSpecifierFromDeclaration(declaration)) === null || _b === void 0 ? void 0 : _b.text;
152578
152687
  if (namespacePrefix && moduleSpecifier) {
152579
152688
  var moduleSymbol = getTargetModuleFromNamespaceLikeImport(declaration, checker);
152580
152689
  if (moduleSymbol && moduleSymbol.exports.has(ts.escapeLeadingUnderscores(symbolName))) {
@@ -152750,8 +152859,9 @@ var ts;
152750
152859
  return existingDeclaration ? [existingDeclaration] : getNewImportFixes(program, sourceFile, position, isValidTypeOnlyUseSite, useRequire, exportInfos, host, preferences).fixes;
152751
152860
  }
152752
152861
  function newImportInfoFromExistingSpecifier(_a, isValidTypeOnlyUseSite, useRequire, checker, compilerOptions) {
152862
+ var _b;
152753
152863
  var declaration = _a.declaration, importKind = _a.importKind, symbol = _a.symbol, targetFlags = _a.targetFlags;
152754
- var moduleSpecifier = ts.tryGetModuleSpecifierFromDeclaration(declaration);
152864
+ var moduleSpecifier = (_b = ts.tryGetModuleSpecifierFromDeclaration(declaration)) === null || _b === void 0 ? void 0 : _b.text;
152755
152865
  if (moduleSpecifier) {
152756
152866
  var addAsTypeOnly = useRequire
152757
152867
  ? 4 /* NotAllowed */
@@ -157109,7 +157219,6 @@ var ts;
157109
157219
  var checker = program.getTypeChecker();
157110
157220
  var scriptTarget = ts.getEmitScriptTarget(program.getCompilerOptions());
157111
157221
  var flags = 1 /* NoTruncation */
157112
- | 1073741824 /* NoUndefinedOptionalParameterType */
157113
157222
  | 256 /* SuppressAnyReturnType */
157114
157223
  | 524288 /* AllowEmptyTuple */
157115
157224
  | (quotePreference === 0 /* Single */ ? 268435456 /* UseSingleQuotesForStringLiteralType */ : 0 /* None */);
@@ -164690,9 +164799,9 @@ var ts;
164690
164799
  }
164691
164800
  }
164692
164801
  /// Goto definition
164693
- function getDefinitionAtPosition(fileName, position) {
164802
+ function getDefinitionAtPosition(fileName, position, searchOtherFilesOnly) {
164694
164803
  synchronizeHostData();
164695
- return ts.GoToDefinition.getDefinitionAtPosition(program, getValidSourceFile(fileName), position);
164804
+ return ts.GoToDefinition.getDefinitionAtPosition(program, getValidSourceFile(fileName), position, searchOtherFilesOnly);
164696
164805
  }
164697
164806
  function getDefinitionAndBoundSpan(fileName, position) {
164698
164807
  synchronizeHostData();