typescript 4.7.0-dev.20220406 → 4.7.0-dev.20220416

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.20220406";
297
+ ts.version = ts.versionMajorMinor + ".0-dev.20220416";
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";
@@ -8911,6 +8910,7 @@ var ts;
8911
8910
  _0_index_signatures_are_incompatible: diag(2634, ts.DiagnosticCategory.Error, "_0_index_signatures_are_incompatible_2634", "'{0}' index signatures are incompatible."),
8912
8911
  Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable: diag(2635, ts.DiagnosticCategory.Error, "Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable_2635", "Type '{0}' has no signatures for which the type argument list is applicable."),
8913
8912
  Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation: diag(2636, ts.DiagnosticCategory.Error, "Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation_2636", "Type '{0}' is not assignable to type '{1}' as implied by variance annotation."),
8913
+ Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types: diag(2637, ts.DiagnosticCategory.Error, "Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_t_2637", "Variance annotations are only supported in type aliases for object, function, constructor, and mapped types."),
8914
8914
  Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: diag(2649, ts.DiagnosticCategory.Error, "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", "Cannot augment module '{0}' with value exports because it resolves to a non-module entity."),
8915
8915
  A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: diag(2651, ts.DiagnosticCategory.Error, "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums."),
8916
8916
  Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: diag(2652, ts.DiagnosticCategory.Error, "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead."),
@@ -15159,6 +15159,10 @@ var ts;
15159
15159
  }
15160
15160
  }
15161
15161
  ts.isAnyImportSyntax = isAnyImportSyntax;
15162
+ function isAnyImportOrBareOrAccessedRequire(node) {
15163
+ return isAnyImportSyntax(node) || isVariableDeclarationInitializedToBareOrAccessedRequire(node);
15164
+ }
15165
+ ts.isAnyImportOrBareOrAccessedRequire = isAnyImportOrBareOrAccessedRequire;
15162
15166
  function isLateVisibilityPaintedStatement(node) {
15163
15167
  switch (node.kind) {
15164
15168
  case 266 /* ImportDeclaration */:
@@ -16519,17 +16523,13 @@ var ts;
16519
16523
  if (isPropertyNameLiteral(name) && isPropertyNameLiteral(initializer)) {
16520
16524
  return getTextOfIdentifierOrLiteral(name) === getTextOfIdentifierOrLiteral(initializer);
16521
16525
  }
16522
- if (ts.isIdentifier(name) && isLiteralLikeAccess(initializer) &&
16526
+ if (ts.isMemberName(name) && isLiteralLikeAccess(initializer) &&
16523
16527
  (initializer.expression.kind === 108 /* ThisKeyword */ ||
16524
16528
  ts.isIdentifier(initializer.expression) &&
16525
16529
  (initializer.expression.escapedText === "window" ||
16526
16530
  initializer.expression.escapedText === "self" ||
16527
16531
  initializer.expression.escapedText === "global"))) {
16528
- var nameOrArgument = getNameOrArgument(initializer);
16529
- if (ts.isPrivateIdentifier(nameOrArgument)) {
16530
- ts.Debug.fail("Unexpected PrivateIdentifier in name expression with literal-like access.");
16531
- }
16532
- return isSameEntityName(name, nameOrArgument);
16532
+ return isSameEntityName(name, getNameOrArgument(initializer));
16533
16533
  }
16534
16534
  if (isLiteralLikeAccess(name) && isLiteralLikeAccess(initializer)) {
16535
16535
  return getElementOrPropertyAccessName(name) === getElementOrPropertyAccessName(initializer)
@@ -16737,14 +16737,14 @@ var ts;
16737
16737
  }
16738
16738
  ts.isFunctionSymbol = isFunctionSymbol;
16739
16739
  function tryGetModuleSpecifierFromDeclaration(node) {
16740
- var _a, _b, _c;
16740
+ var _a, _b;
16741
16741
  switch (node.kind) {
16742
16742
  case 254 /* VariableDeclaration */:
16743
- 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];
16744
16744
  case 266 /* ImportDeclaration */:
16745
- return (_a = ts.tryCast(node.moduleSpecifier, ts.isStringLiteralLike)) === null || _a === void 0 ? void 0 : _a.text;
16745
+ return ts.tryCast(node.moduleSpecifier, ts.isStringLiteralLike);
16746
16746
  case 265 /* ImportEqualsDeclaration */:
16747
- 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);
16748
16748
  default:
16749
16749
  ts.Debug.assertNever(node);
16750
16750
  }
@@ -17259,7 +17259,10 @@ var ts;
17259
17259
  return parent.propertyName === node;
17260
17260
  case 275 /* ExportSpecifier */:
17261
17261
  case 285 /* JsxAttribute */:
17262
- // 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
17263
17266
  return true;
17264
17267
  }
17265
17268
  return false;
@@ -17275,21 +17278,28 @@ var ts;
17275
17278
  // export = <EntityNameExpression>
17276
17279
  // export default <EntityNameExpression>
17277
17280
  // module.exports = <EntityNameExpression>
17278
- // {<Identifier>}
17279
- // {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
17280
17286
  function isAliasSymbolDeclaration(node) {
17281
- return node.kind === 265 /* ImportEqualsDeclaration */ ||
17287
+ if (node.kind === 265 /* ImportEqualsDeclaration */ ||
17282
17288
  node.kind === 264 /* NamespaceExportDeclaration */ ||
17283
17289
  node.kind === 267 /* ImportClause */ && !!node.name ||
17284
17290
  node.kind === 268 /* NamespaceImport */ ||
17285
17291
  node.kind === 274 /* NamespaceExport */ ||
17286
17292
  node.kind === 270 /* ImportSpecifier */ ||
17287
17293
  node.kind === 275 /* ExportSpecifier */ ||
17288
- node.kind === 271 /* ExportAssignment */ && exportAssignmentIsAlias(node) ||
17289
- ts.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 /* ModuleExports */ && exportAssignmentIsAlias(node) ||
17290
- ts.isPropertyAccessExpression(node) && ts.isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 63 /* EqualsToken */ && isAliasableExpression(node.parent.right) ||
17291
- node.kind === 297 /* ShorthandPropertyAssignment */ ||
17292
- 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));
17293
17303
  }
17294
17304
  ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration;
17295
17305
  function getAliasDeclarationFromName(node) {
@@ -17300,6 +17310,7 @@ var ts;
17300
17310
  case 275 /* ExportSpecifier */:
17301
17311
  case 271 /* ExportAssignment */:
17302
17312
  case 265 /* ImportEqualsDeclaration */:
17313
+ case 274 /* NamespaceExport */:
17303
17314
  return node.parent;
17304
17315
  case 161 /* QualifiedName */:
17305
17316
  do {
@@ -19126,6 +19137,11 @@ var ts;
19126
19137
  (node.parent.kind === 206 /* PropertyAccessExpression */ && node.parent.name === node);
19127
19138
  }
19128
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;
19129
19145
  function isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName(node) {
19130
19146
  return ts.isQualifiedName(node.parent) && node.parent.right === node
19131
19147
  || ts.isPropertyAccessExpression(node.parent) && node.parent.name === node
@@ -19777,6 +19793,41 @@ var ts;
19777
19793
  return expr;
19778
19794
  }
19779
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;
19780
19831
  function getLeftmostExpression(node, stopAtCallExpressions) {
19781
19832
  while (true) {
19782
19833
  switch (node.kind) {
@@ -20724,6 +20775,7 @@ var ts;
20724
20775
  ts.supportedJSExtensionsFlat = ts.flatten(ts.supportedJSExtensions);
20725
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 */]];
20726
20777
  var allSupportedExtensionsWithJson = __spreadArray(__spreadArray([], allSupportedExtensions, true), [[".json" /* Json */]], false);
20778
+ ts.supportedDeclarationExtensions = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */];
20727
20779
  function getSupportedExtensions(options, extraFileExtensions) {
20728
20780
  var needJsExtensions = options && getAllowJSCompilerOption(options);
20729
20781
  if (!extraFileExtensions || extraFileExtensions.length === 0) {
@@ -21412,6 +21464,11 @@ var ts;
21412
21464
  return state > 1 /* NodeModules */ ? { topLevelNodeModulesIndex: topLevelNodeModulesIndex, topLevelPackageNameIndex: topLevelPackageNameIndex, packageRootIndex: packageRootIndex, fileNameIndex: fileNameIndex } : undefined;
21413
21465
  }
21414
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;
21415
21472
  })(ts || (ts = {}));
21416
21473
  /* @internal */
21417
21474
  var ts;
@@ -35565,34 +35622,10 @@ var ts;
35565
35622
  case 20 /* OpenParenToken */: // foo<x>(
35566
35623
  case 14 /* NoSubstitutionTemplateLiteral */: // foo<T> `...`
35567
35624
  case 15 /* TemplateHead */: // foo<T> `...${100}...`
35568
- // These tokens can't follow in a call expression, nor can they start an
35569
- // expression. So, consider the type argument list part of an instantiation
35570
- // expression.
35571
- // falls through
35572
- case 27 /* CommaToken */: // foo<x>,
35573
- case 24 /* DotToken */: // foo<x>.
35574
- case 28 /* QuestionDotToken */: // foo<x>?.
35575
- case 21 /* CloseParenToken */: // foo<x>)
35576
- case 23 /* CloseBracketToken */: // foo<x>]
35577
- case 58 /* ColonToken */: // foo<x>:
35578
- case 26 /* SemicolonToken */: // foo<x>;
35579
- case 57 /* QuestionToken */: // foo<x>?
35580
- case 34 /* EqualsEqualsToken */: // foo<x> ==
35581
- case 36 /* EqualsEqualsEqualsToken */: // foo<x> ===
35582
- case 35 /* ExclamationEqualsToken */: // foo<x> !=
35583
- case 37 /* ExclamationEqualsEqualsToken */: // foo<x> !==
35584
- case 55 /* AmpersandAmpersandToken */: // foo<x> &&
35585
- case 56 /* BarBarToken */: // foo<x> ||
35586
- case 60 /* QuestionQuestionToken */: // foo<x> ??
35587
- case 52 /* CaretToken */: // foo<x> ^
35588
- case 50 /* AmpersandToken */: // foo<x> &
35589
- case 51 /* BarToken */: // foo<x> |
35590
- case 19 /* CloseBraceToken */: // foo<x> }
35591
- case 1 /* EndOfFileToken */: // foo<x>
35592
35625
  return true;
35593
35626
  }
35594
- // Treat anything else as an expression.
35595
- return false;
35627
+ // Consider something a type argument list only if the following token can't start an expression.
35628
+ return !isStartOfExpression();
35596
35629
  }
35597
35630
  function parsePrimaryExpression() {
35598
35631
  switch (token()) {
@@ -38810,7 +38843,7 @@ var ts;
38810
38843
  })(IncrementalParser || (IncrementalParser = {}));
38811
38844
  /** @internal */
38812
38845
  function isDeclarationFileName(fileName) {
38813
- return ts.fileExtensionIsOneOf(fileName, [".d.ts" /* Dts */, ".d.mts" /* Dmts */, ".d.cts" /* Dcts */]);
38846
+ return ts.fileExtensionIsOneOf(fileName, ts.supportedDeclarationExtensions);
38814
38847
  }
38815
38848
  ts.isDeclarationFileName = isDeclarationFileName;
38816
38849
  function parseResolutionMode(mode, pos, end, reportDiagnostic) {
@@ -42318,7 +42351,8 @@ var ts;
42318
42351
  Extensions[Extensions["JavaScript"] = 1] = "JavaScript";
42319
42352
  Extensions[Extensions["Json"] = 2] = "Json";
42320
42353
  Extensions[Extensions["TSConfig"] = 3] = "TSConfig";
42321
- Extensions[Extensions["DtsOnly"] = 4] = "DtsOnly"; /** Only '.d.ts' */
42354
+ Extensions[Extensions["DtsOnly"] = 4] = "DtsOnly";
42355
+ Extensions[Extensions["TsOnly"] = 5] = "TsOnly";
42322
42356
  })(Extensions || (Extensions = {}));
42323
42357
  /** Used with `Extensions.DtsOnly` to extract the path from TypeScript results. */
42324
42358
  function resolvedTypeScriptOnly(resolved) {
@@ -43263,7 +43297,21 @@ var ts;
43263
43297
  return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, initialDir, { moduleResolution: ts.ModuleResolutionKind.NodeJs, allowJs: true }, host, /*cache*/ undefined, jsOnlyExtensions, /*redirectedReferences*/ undefined);
43264
43298
  }
43265
43299
  function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, lookupConfig) {
43266
- 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);
43267
43315
  }
43268
43316
  ts.nodeModuleNameResolver = nodeModuleNameResolver;
43269
43317
  function nodeModuleNameResolverWorker(features, moduleName, containingDirectory, compilerOptions, host, cache, extensions, redirectedReference) {
@@ -43272,6 +43320,10 @@ var ts;
43272
43320
  var failedLookupLocations = [];
43273
43321
  // conditions are only used by the node12/nodenext resolver - there's no priority order in the list,
43274
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
+ }
43275
43327
  var state = {
43276
43328
  compilerOptions: compilerOptions,
43277
43329
  host: host,
@@ -43279,7 +43331,7 @@ var ts;
43279
43331
  failedLookupLocations: failedLookupLocations,
43280
43332
  packageJsonInfoCache: cache,
43281
43333
  features: features,
43282
- conditions: features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"]
43334
+ conditions: conditions,
43283
43335
  };
43284
43336
  var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); });
43285
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);
@@ -43455,9 +43507,9 @@ var ts;
43455
43507
  }
43456
43508
  }
43457
43509
  function loadJSOrExactTSFileName(extensions, candidate, onlyRecordFailures, state) {
43458
- 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)) {
43459
43511
  var result = tryFile(candidate, onlyRecordFailures, state);
43460
- 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;
43461
43513
  }
43462
43514
  return loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state);
43463
43515
  }
@@ -43487,20 +43539,22 @@ var ts;
43487
43539
  default: return tryExtension(".d.ts" /* Dts */);
43488
43540
  }
43489
43541
  case Extensions.TypeScript:
43542
+ case Extensions.TsOnly:
43543
+ var useDts = extensions === Extensions.TypeScript;
43490
43544
  switch (originalExtension) {
43491
43545
  case ".mjs" /* Mjs */:
43492
43546
  case ".mts" /* Mts */:
43493
43547
  case ".d.mts" /* Dmts */:
43494
- return tryExtension(".mts" /* Mts */) || tryExtension(".d.mts" /* Dmts */);
43548
+ return tryExtension(".mts" /* Mts */) || (useDts ? tryExtension(".d.mts" /* Dmts */) : undefined);
43495
43549
  case ".cjs" /* Cjs */:
43496
43550
  case ".cts" /* Cts */:
43497
43551
  case ".d.cts" /* Dcts */:
43498
- return tryExtension(".cts" /* Cts */) || tryExtension(".d.cts" /* Dcts */);
43552
+ return tryExtension(".cts" /* Cts */) || (useDts ? tryExtension(".d.cts" /* Dcts */) : undefined);
43499
43553
  case ".json" /* Json */:
43500
43554
  candidate += ".json" /* Json */;
43501
- return tryExtension(".d.ts" /* Dts */);
43555
+ return useDts ? tryExtension(".d.ts" /* Dts */) : undefined;
43502
43556
  default:
43503
- 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);
43504
43558
  }
43505
43559
  case Extensions.JavaScript:
43506
43560
  switch (originalExtension) {
@@ -43727,6 +43781,7 @@ var ts;
43727
43781
  switch (extensions) {
43728
43782
  case Extensions.JavaScript:
43729
43783
  case Extensions.Json:
43784
+ case Extensions.TsOnly:
43730
43785
  packageFile = readPackageJsonMainField(jsonContent, candidate, state);
43731
43786
  break;
43732
43787
  case Extensions.TypeScript:
@@ -43799,14 +43854,16 @@ var ts;
43799
43854
  function extensionIsOk(extensions, extension) {
43800
43855
  switch (extensions) {
43801
43856
  case Extensions.JavaScript:
43802
- return extension === ".js" /* Js */ || extension === ".jsx" /* Jsx */;
43857
+ return extension === ".js" /* Js */ || extension === ".jsx" /* Jsx */ || extension === ".mjs" /* Mjs */ || extension === ".cjs" /* Cjs */;
43803
43858
  case Extensions.TSConfig:
43804
43859
  case Extensions.Json:
43805
43860
  return extension === ".json" /* Json */;
43806
43861
  case Extensions.TypeScript:
43807
- 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 */;
43808
43865
  case Extensions.DtsOnly:
43809
- return extension === ".d.ts" /* Dts */;
43866
+ return extension === ".d.ts" /* Dts */ || extension === ".d.mts" /* Dmts */ || extension === ".d.cts" /* Dcts */;
43810
43867
  }
43811
43868
  }
43812
43869
  /* @internal */
@@ -45966,6 +46023,7 @@ var ts;
45966
46023
  case 261 /* ModuleDeclaration */:
45967
46024
  case 259 /* TypeAliasDeclaration */:
45968
46025
  case 195 /* MappedType */:
46026
+ case 176 /* IndexSignature */:
45969
46027
  return 1 /* IsContainer */ | 32 /* HasLocals */;
45970
46028
  case 305 /* SourceFile */:
45971
46029
  return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */;
@@ -45984,7 +46042,6 @@ var ts;
45984
46042
  case 317 /* JSDocFunctionType */:
45985
46043
  case 179 /* FunctionType */:
45986
46044
  case 175 /* ConstructSignature */:
45987
- case 176 /* IndexSignature */:
45988
46045
  case 180 /* ConstructorType */:
45989
46046
  case 170 /* ClassStaticBlockDeclaration */:
45990
46047
  return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */;
@@ -50562,27 +50619,27 @@ var ts;
50562
50619
  function resolveAlias(symbol) {
50563
50620
  ts.Debug.assert((symbol.flags & 2097152 /* Alias */) !== 0, "Should only get Alias here.");
50564
50621
  var links = getSymbolLinks(symbol);
50565
- if (!links.target) {
50566
- links.target = resolvingSymbol;
50622
+ if (!links.aliasTarget) {
50623
+ links.aliasTarget = resolvingSymbol;
50567
50624
  var node = getDeclarationOfAliasSymbol(symbol);
50568
50625
  if (!node)
50569
50626
  return ts.Debug.fail();
50570
50627
  var target = getTargetOfAliasDeclaration(node);
50571
- if (links.target === resolvingSymbol) {
50572
- links.target = target || unknownSymbol;
50628
+ if (links.aliasTarget === resolvingSymbol) {
50629
+ links.aliasTarget = target || unknownSymbol;
50573
50630
  }
50574
50631
  else {
50575
50632
  error(node, ts.Diagnostics.Circular_definition_of_import_alias_0, symbolToString(symbol));
50576
50633
  }
50577
50634
  }
50578
- else if (links.target === resolvingSymbol) {
50579
- links.target = unknownSymbol;
50635
+ else if (links.aliasTarget === resolvingSymbol) {
50636
+ links.aliasTarget = unknownSymbol;
50580
50637
  }
50581
- return links.target;
50638
+ return links.aliasTarget;
50582
50639
  }
50583
50640
  function tryResolveAlias(symbol) {
50584
50641
  var links = getSymbolLinks(symbol);
50585
- if (links.target !== resolvingSymbol) {
50642
+ if (links.aliasTarget !== resolvingSymbol) {
50586
50643
  return resolveAlias(symbol);
50587
50644
  }
50588
50645
  return undefined;
@@ -52379,13 +52436,37 @@ var ts;
52379
52436
  return ts.Debug.fail("Should be unreachable.");
52380
52437
  function conditionalTypeToTypeNode(type) {
52381
52438
  var checkTypeNode = typeToTypeNodeHelper(type.checkType, context);
52439
+ context.approximateLength += 15;
52440
+ if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && type.root.isDistributive && !(type.checkType.flags & 262144 /* TypeParameter */)) {
52441
+ var newParam = createTypeParameter(createSymbol(262144 /* TypeParameter */, "T"));
52442
+ var name = typeParameterToName(newParam, context);
52443
+ var newTypeVariable = ts.factory.createTypeReferenceNode(name);
52444
+ context.approximateLength += 37; // 15 each for two added conditionals, 7 for an added infer type
52445
+ var newMapper = prependTypeMapping(type.root.checkType, newParam, type.combinedMapper || type.mapper);
52446
+ var saveInferTypeParameters_1 = context.inferTypeParameters;
52447
+ context.inferTypeParameters = type.root.inferTypeParameters;
52448
+ var extendsTypeNode_1 = typeToTypeNodeHelper(instantiateType(type.root.extendsType, newMapper), context);
52449
+ context.inferTypeParameters = saveInferTypeParameters_1;
52450
+ var trueTypeNode_1 = typeToTypeNodeOrCircularityElision(instantiateType(getTypeFromTypeNode(type.root.node.trueType), newMapper));
52451
+ var falseTypeNode_1 = typeToTypeNodeOrCircularityElision(instantiateType(getTypeFromTypeNode(type.root.node.falseType), newMapper));
52452
+ // outermost conditional makes `T` a type parameter, allowing the inner conditionals to be distributive
52453
+ // second conditional makes `T` have `T & checkType` substitution, so it is correctly usable as the checkType
52454
+ // inner conditional runs the check the user provided on the check type (distributively) and returns the result
52455
+ // checkType extends infer T ? T extends checkType ? T extends extendsType<T> ? trueType<T> : falseType<T> : never : never;
52456
+ // this is potentially simplifiable to
52457
+ // checkType extends infer T ? T extends checkType & extendsType<T> ? trueType<T> : falseType<T> : never;
52458
+ // but that may confuse users who read the output more.
52459
+ // On the other hand,
52460
+ // checkType extends infer T extends checkType ? T extends extendsType<T> ? trueType<T> : falseType<T> : never;
52461
+ // may also work with `infer ... extends ...` in, but would produce declarations only compatible with the latest TS.
52462
+ return ts.factory.createConditionalTypeNode(checkTypeNode, ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName))), ts.factory.createConditionalTypeNode(ts.factory.createTypeReferenceNode(ts.factory.cloneNode(name)), typeToTypeNodeHelper(type.checkType, context), ts.factory.createConditionalTypeNode(newTypeVariable, extendsTypeNode_1, trueTypeNode_1, falseTypeNode_1), ts.factory.createKeywordTypeNode(143 /* NeverKeyword */)), ts.factory.createKeywordTypeNode(143 /* NeverKeyword */));
52463
+ }
52382
52464
  var saveInferTypeParameters = context.inferTypeParameters;
52383
52465
  context.inferTypeParameters = type.root.inferTypeParameters;
52384
52466
  var extendsTypeNode = typeToTypeNodeHelper(type.extendsType, context);
52385
52467
  context.inferTypeParameters = saveInferTypeParameters;
52386
52468
  var trueTypeNode = typeToTypeNodeOrCircularityElision(getTrueTypeFromConditionalType(type));
52387
52469
  var falseTypeNode = typeToTypeNodeOrCircularityElision(getFalseTypeFromConditionalType(type));
52388
- context.approximateLength += 15;
52389
52470
  return ts.factory.createConditionalTypeNode(checkTypeNode, extendsTypeNode, trueTypeNode, falseTypeNode);
52390
52471
  }
52391
52472
  function typeToTypeNodeOrCircularityElision(type) {
@@ -53084,9 +53165,6 @@ var ts;
53084
53165
  if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) {
53085
53166
  parameterType = getOptionalType(parameterType);
53086
53167
  }
53087
- if ((context.flags & 1073741824 /* NoUndefinedOptionalParameterType */) && parameterDeclaration && !ts.isJSDocParameterTag(parameterDeclaration) && isOptionalUninitializedParameter(parameterDeclaration)) {
53088
- parameterType = getTypeWithFacts(parameterType, 524288 /* NEUndefined */);
53089
- }
53090
53168
  var parameterTypeNode = serializeTypeForDeclaration(context, parameterType, parameterSymbol, context.enclosingDeclaration, privateSymbolVisitor, bundledImports);
53091
53169
  var modifiers = !(context.flags & 8192 /* OmitParameterModifiers */) && preserveModifierFlags && parameterDeclaration && parameterDeclaration.modifiers ? parameterDeclaration.modifiers.map(ts.factory.cloneNode) : undefined;
53092
53170
  var isRest = parameterDeclaration && ts.isRestParameter(parameterDeclaration) || ts.getCheckFlags(parameterSymbol) & 32768 /* RestParameter */;
@@ -53645,7 +53723,7 @@ var ts;
53645
53723
  if (declWithExistingAnnotation && !ts.isFunctionLikeDeclaration(declWithExistingAnnotation) && !ts.isGetAccessorDeclaration(declWithExistingAnnotation)) {
53646
53724
  // try to reuse the existing annotation
53647
53725
  var existing = ts.getEffectiveTypeAnnotationNode(declWithExistingAnnotation);
53648
- if (getTypeFromTypeNode(existing) === type && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
53726
+ if (typeNodeIsEquivalentToType(existing, declWithExistingAnnotation, type) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
53649
53727
  var result_6 = serializeExistingTypeNode(context, existing, includePrivateSymbol, bundled);
53650
53728
  if (result_6) {
53651
53729
  return result_6;
@@ -53662,6 +53740,16 @@ var ts;
53662
53740
  context.flags = oldFlags;
53663
53741
  return result;
53664
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
+ }
53665
53753
  function serializeReturnTypeForSignature(context, type, signature, includePrivateSymbol, bundled) {
53666
53754
  if (!isErrorType(type) && context.enclosingDeclaration) {
53667
53755
  var annotation = signature.declaration && ts.getEffectiveReturnTypeNode(signature.declaration);
@@ -55933,7 +56021,7 @@ var ts;
55933
56021
  }
55934
56022
  }
55935
56023
  var sourceTypes = ts.some(constructorTypes, function (t) { return !!(t.flags & ~98304 /* Nullable */); }) ? constructorTypes : types; // TODO: GH#18217
55936
- type = getUnionType(sourceTypes, 2 /* Subtype */);
56024
+ type = getUnionType(sourceTypes);
55937
56025
  }
55938
56026
  }
55939
56027
  var widened = getWidenedType(addOptionality(type, /*isProperty*/ false, definedInMethod && !definedInConstructor));
@@ -58682,8 +58770,9 @@ var ts;
58682
58770
  // levels of nesting, we are presumably exploring a repeating pattern with a long cycle that hasn't
58683
58771
  // yet triggered the deeply nested limiter. We have no test cases that actually get to 50 levels of
58684
58772
  // nesting, so it is effectively just a safety stop.
58685
- if (stack.length < 10 || stack.length < 50 && !isDeeplyNestedType(t, stack, stack.length)) {
58686
- 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);
58687
58776
  result = computeBaseConstraint(getSimplifiedType(t, /*writing*/ false));
58688
58777
  stack.pop();
58689
58778
  }
@@ -66881,12 +66970,12 @@ var ts;
66881
66970
  function isDeeplyNestedType(type, stack, depth, maxDepth) {
66882
66971
  if (maxDepth === void 0) { maxDepth = 3; }
66883
66972
  if (depth >= maxDepth) {
66884
- var identity_1 = getRecursionIdentity(type);
66973
+ var identity_2 = getRecursionIdentity(type);
66885
66974
  var count = 0;
66886
66975
  var lastTypeId = 0;
66887
66976
  for (var i = 0; i < depth; i++) {
66888
66977
  var t = stack[i];
66889
- if (getRecursionIdentity(t) === identity_1) {
66978
+ if (getRecursionIdentity(t) === identity_2) {
66890
66979
  // We only count occurrences with a higher type id than the previous occurrence, since higher
66891
66980
  // type ids are an indicator of newer instantiations caused by recursion.
66892
66981
  if (t.id >= lastTypeId) {
@@ -76888,7 +76977,7 @@ var ts;
76888
76977
  var newSymbol = createSymbol(2097152 /* Alias */, "default" /* Default */);
76889
76978
  newSymbol.parent = originalSymbol;
76890
76979
  newSymbol.nameType = getStringLiteralType("default");
76891
- newSymbol.target = resolveSymbol(symbol);
76980
+ newSymbol.aliasTarget = resolveSymbol(symbol);
76892
76981
  memberTable.set("default" /* Default */, newSymbol);
76893
76982
  return createAnonymousType(anonymousSymbol, memberTable, ts.emptyArray, ts.emptyArray, ts.emptyArray);
76894
76983
  }
@@ -79700,19 +79789,28 @@ var ts;
79700
79789
  if (constraintType && defaultType) {
79701
79790
  checkTypeAssignableTo(defaultType, getTypeWithThisArgument(instantiateType(constraintType, makeUnaryTypeMapper(typeParameter, defaultType)), defaultType), node.default, ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1);
79702
79791
  }
79703
- 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));
79704
79798
  var modifiers = getVarianceModifiers(typeParameter);
79705
- if (modifiers === 32768 /* In */ || modifiers === 65536 /* Out */) {
79799
+ if (modifiers) {
79706
79800
  var symbol = getSymbolOfNode(node.parent);
79707
- var source = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSubType : markerSuperType);
79708
- var target = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSuperType : markerSubType);
79709
- var saveVarianceTypeParameter = typeParameter;
79710
- varianceTypeParameter = typeParameter;
79711
- checkTypeAssignableTo(source, target, node, ts.Diagnostics.Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation);
79712
- varianceTypeParameter = saveVarianceTypeParameter;
79801
+ if (ts.isTypeAliasDeclaration(node.parent) && !(ts.getObjectFlags(getDeclaredTypeOfSymbol(symbol)) & (16 /* Anonymous */ | 32 /* Mapped */))) {
79802
+ error(node, ts.Diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types);
79803
+ }
79804
+ else if (modifiers === 32768 /* In */ || modifiers === 65536 /* Out */) {
79805
+ var source = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSubType : markerSuperType);
79806
+ var target = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSuperType : markerSubType);
79807
+ var saveVarianceTypeParameter = typeParameter;
79808
+ varianceTypeParameter = typeParameter;
79809
+ checkTypeAssignableTo(source, target, node, ts.Diagnostics.Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation);
79810
+ varianceTypeParameter = saveVarianceTypeParameter;
79811
+ }
79713
79812
  }
79714
79813
  }
79715
- addLazyDiagnostic(function () { return checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0); });
79716
79814
  }
79717
79815
  function checkParameter(node) {
79718
79816
  // Grammar checking
@@ -80202,7 +80300,7 @@ var ts;
80202
80300
  superCallStatement = statement;
80203
80301
  break;
80204
80302
  }
80205
- if (!ts.isPrologueDirective(statement) && nodeImmediatelyReferencesSuperOrThis(statement)) {
80303
+ if (nodeImmediatelyReferencesSuperOrThis(statement)) {
80206
80304
  break;
80207
80305
  }
80208
80306
  }
@@ -85555,6 +85653,9 @@ var ts;
85555
85653
  case 226 /* ClassExpression */:
85556
85654
  checkClassExpressionDeferred(node);
85557
85655
  break;
85656
+ case 163 /* TypeParameter */:
85657
+ checkTypeParameterDeferred(node);
85658
+ break;
85558
85659
  case 279 /* JsxSelfClosingElement */:
85559
85660
  checkJsxSelfClosingElementDeferred(node);
85560
85661
  break;
@@ -86369,11 +86470,11 @@ var ts;
86369
86470
  var _a = symbol, leftSpread = _a.leftSpread, rightSpread = _a.rightSpread, syntheticOrigin = _a.syntheticOrigin;
86370
86471
  return leftSpread ? [leftSpread, rightSpread]
86371
86472
  : syntheticOrigin ? [syntheticOrigin]
86372
- : ts.singleElementArray(tryGetAliasTarget(symbol));
86473
+ : ts.singleElementArray(tryGetTarget(symbol));
86373
86474
  }
86374
86475
  return undefined;
86375
86476
  }
86376
- function tryGetAliasTarget(symbol) {
86477
+ function tryGetTarget(symbol) {
86377
86478
  var target;
86378
86479
  var next = symbol;
86379
86480
  while (next = getSymbolLinks(next).target) {
@@ -86603,7 +86704,7 @@ var ts;
86603
86704
  if (links === null || links === void 0 ? void 0 : links.referenced) {
86604
86705
  return true;
86605
86706
  }
86606
- var target = getSymbolLinks(symbol).target; // TODO: GH#18217
86707
+ var target = getSymbolLinks(symbol).aliasTarget; // TODO: GH#18217
86607
86708
  if (target && ts.getEffectiveModifierFlags(node) & 1 /* Export */ &&
86608
86709
  target.flags & 111551 /* Value */ &&
86609
86710
  (ts.shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target))) {
@@ -86651,11 +86752,6 @@ var ts;
86651
86752
  !parameter.initializer &&
86652
86753
  ts.hasSyntacticModifier(parameter, 16476 /* ParameterPropertyModifier */);
86653
86754
  }
86654
- function isOptionalUninitializedParameter(parameter) {
86655
- return !!strictNullChecks &&
86656
- isOptionalParameter(parameter) &&
86657
- !parameter.initializer;
86658
- }
86659
86755
  function isExpandoFunctionDeclaration(node) {
86660
86756
  var declaration = ts.getParseTreeNode(node, ts.isFunctionDeclaration);
86661
86757
  if (!declaration) {
@@ -87572,8 +87668,7 @@ var ts;
87572
87668
  case 144 /* OutKeyword */:
87573
87669
  var inOutFlag = modifier.kind === 101 /* InKeyword */ ? 32768 /* In */ : 65536 /* Out */;
87574
87670
  var inOutText = modifier.kind === 101 /* InKeyword */ ? "in" : "out";
87575
- if (node.kind !== 163 /* TypeParameter */ || (node.parent.kind !== 258 /* InterfaceDeclaration */ &&
87576
- 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))) {
87577
87672
  return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias, inOutText);
87578
87673
  }
87579
87674
  if (flags & inOutFlag) {
@@ -92807,11 +92902,11 @@ var ts;
92807
92902
  }
92808
92903
  var statements = [];
92809
92904
  resumeLexicalEnvironment();
92810
- var indexAfterLastPrologueStatement = factory.copyPrologue(body.statements, statements, /*ensureUseStrict*/ false, visitor);
92811
- 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);
92812
92907
  // If there was a super call, visit existing statements up to and including it
92813
92908
  if (superStatementIndex >= 0) {
92814
- 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));
92815
92910
  }
92816
92911
  // Transform parameters into property assignments. Transforms this:
92817
92912
  //
@@ -92830,12 +92925,12 @@ var ts;
92830
92925
  if (superStatementIndex >= 0) {
92831
92926
  ts.addRange(statements, parameterPropertyAssignments);
92832
92927
  }
92833
- // 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
92834
92929
  else {
92835
- statements = ts.addRange(parameterPropertyAssignments, statements);
92930
+ statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, prologueStatementCount), true), parameterPropertyAssignments, true), statements.slice(prologueStatementCount), true);
92836
92931
  }
92837
- // Add remaining statements from the body, skipping the super() call if it was found
92838
- 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));
92839
92934
  // End the lexical environment.
92840
92935
  statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment());
92841
92936
  var block = factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), body.statements), /*multiLine*/ true);
@@ -108599,6 +108694,10 @@ var ts;
108599
108694
  return factory.updateModifiers(statement, modifiers);
108600
108695
  }
108601
108696
  function transformTopLevelDeclaration(input) {
108697
+ if (lateMarkedStatements) {
108698
+ while (ts.orderedRemoveItem(lateMarkedStatements, input))
108699
+ ;
108700
+ }
108602
108701
  if (shouldStripInternal(input))
108603
108702
  return;
108604
108703
  switch (input.kind) {
@@ -109730,7 +109829,7 @@ var ts;
109730
109829
  addOutput(buildInfoPath);
109731
109830
  }
109732
109831
  function getOwnOutputFileNames(configFile, inputFileName, ignoreCase, addOutput, getCommonSourceDirectory) {
109733
- if (ts.fileExtensionIs(inputFileName, ".d.ts" /* Dts */))
109832
+ if (ts.isDeclarationFileName(inputFileName))
109734
109833
  return;
109735
109834
  var js = getOutputJSFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory);
109736
109835
  addOutput(js);
@@ -109775,7 +109874,7 @@ var ts;
109775
109874
  /*@internal*/
109776
109875
  function getCommonSourceDirectoryOfConfig(_a, ignoreCase) {
109777
109876
  var options = _a.options, fileNames = _a.fileNames;
109778
- 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));
109779
109878
  }
109780
109879
  ts.getCommonSourceDirectoryOfConfig = getCommonSourceDirectoryOfConfig;
109781
109880
  /*@internal*/
@@ -109817,7 +109916,7 @@ var ts;
109817
109916
  var getCommonSourceDirectory = ts.memoize(function () { return getCommonSourceDirectoryOfConfig(configFile, ignoreCase); });
109818
109917
  for (var _a = 0, _b = configFile.fileNames; _a < _b.length; _a++) {
109819
109918
  var inputFileName = _b[_a];
109820
- if (ts.fileExtensionIs(inputFileName, ".d.ts" /* Dts */))
109919
+ if (ts.isDeclarationFileName(inputFileName))
109821
109920
  continue;
109822
109921
  var jsFilePath = getOutputJSFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory);
109823
109922
  if (jsFilePath)
@@ -115167,7 +115266,7 @@ var ts;
115167
115266
  if (ts.outFile(options) || options.outDir)
115168
115267
  return false;
115169
115268
  // File if emitted next to input needs to be ignored
115170
- if (ts.fileExtensionIs(fileOrDirectoryPath, ".d.ts" /* Dts */)) {
115269
+ if (ts.isDeclarationFileName(fileOrDirectoryPath)) {
115171
115270
  // If its declaration directory: its not ignored if not excluded by config
115172
115271
  if (options.declarationDir)
115173
115272
  return false;
@@ -116340,7 +116439,7 @@ var ts;
116340
116439
  var getCommonSourceDirectory_2 = ts.memoize(function () { return ts.getCommonSourceDirectoryOfConfig(parsedRef.commandLine, !host.useCaseSensitiveFileNames()); });
116341
116440
  for (var _b = 0, _c = parsedRef.commandLine.fileNames; _b < _c.length; _b++) {
116342
116441
  var fileName = _c[_b];
116343
- if (!ts.fileExtensionIs(fileName, ".d.ts" /* Dts */) && !ts.fileExtensionIs(fileName, ".json" /* Json */)) {
116442
+ if (!ts.isDeclarationFileName(fileName) && !ts.fileExtensionIs(fileName, ".json" /* Json */)) {
116344
116443
  processProjectReferenceFile(ts.getOutputDeclarationFileName(fileName, parsedRef.commandLine, !host.useCaseSensitiveFileNames(), getCommonSourceDirectory_2), { kind: ts.FileIncludeKind.OutputFromProjectReference, index: index });
116345
116444
  }
116346
116445
  }
@@ -116531,7 +116630,7 @@ var ts;
116531
116630
  }
116532
116631
  function getRedirectReferenceForResolution(file) {
116533
116632
  var redirect = getResolvedProjectReferenceToRedirect(file.originalFileName);
116534
- if (redirect || !ts.fileExtensionIsOneOf(file.originalFileName, [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */]))
116633
+ if (redirect || !ts.isDeclarationFileName(file.originalFileName))
116535
116634
  return redirect;
116536
116635
  // The originalFileName could not be actual source file name if file found was d.ts from referecned project
116537
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
@@ -117922,7 +118021,7 @@ var ts;
117922
118021
  }
117923
118022
  function getProjectReferenceRedirectProject(fileName) {
117924
118023
  // Ignore dts or any json files
117925
- 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 */)) {
117926
118025
  return undefined;
117927
118026
  }
117928
118027
  // If this file is produced by a referenced project, we need to rewrite it to
@@ -117971,7 +118070,7 @@ var ts;
117971
118070
  else {
117972
118071
  var getCommonSourceDirectory_3 = ts.memoize(function () { return ts.getCommonSourceDirectoryOfConfig(resolvedRef.commandLine, !host.useCaseSensitiveFileNames()); });
117973
118072
  ts.forEach(resolvedRef.commandLine.fileNames, function (fileName) {
117974
- if (!ts.fileExtensionIs(fileName, ".d.ts" /* Dts */) && !ts.fileExtensionIs(fileName, ".json" /* Json */)) {
118073
+ if (!ts.isDeclarationFileName(fileName) && !ts.fileExtensionIs(fileName, ".json" /* Json */)) {
117975
118074
  var outputDts = ts.getOutputDeclarationFileName(fileName, resolvedRef.commandLine, !host.useCaseSensitiveFileNames(), getCommonSourceDirectory_3);
117976
118075
  mapFromToProjectReferenceRedirectSource.set(toPath(outputDts), fileName);
117977
118076
  }
@@ -118772,7 +118871,7 @@ var ts;
118772
118871
  if (options.outDir) {
118773
118872
  return ts.containsPath(options.outDir, filePath, currentDirectory, !host.useCaseSensitiveFileNames());
118774
118873
  }
118775
- if (ts.fileExtensionIsOneOf(filePath, ts.supportedJSExtensionsFlat) || ts.fileExtensionIs(filePath, ".d.ts" /* Dts */)) {
118874
+ if (ts.fileExtensionIsOneOf(filePath, ts.supportedJSExtensionsFlat) || ts.isDeclarationFileName(filePath)) {
118776
118875
  // Otherwise just check if sourceFile with the name exists
118777
118876
  var filePathWithoutExtension = ts.removeFileExtension(filePath);
118778
118877
  return !!getSourceFileByPath((filePathWithoutExtension + ".ts" /* Ts */)) ||
@@ -119105,13 +119204,9 @@ var ts;
119105
119204
  ts.getFileEmitOutput = getFileEmitOutput;
119106
119205
  var BuilderState;
119107
119206
  (function (BuilderState) {
119108
- var manyToManyPathMapCount = 0;
119109
119207
  function createManyToManyPathMap() {
119110
119208
  function create(forward, reverse, deleted) {
119111
- var version = 0;
119112
119209
  var map = {
119113
- id: manyToManyPathMapCount++,
119114
- version: function () { return version; },
119115
119210
  clone: function () { return create(new ts.Map(forward), new ts.Map(reverse), deleted && new ts.Set(deleted)); },
119116
119211
  forEach: function (fn) { return forward.forEach(fn); },
119117
119212
  getKeys: function (v) { return reverse.get(v); },
@@ -119127,30 +119222,29 @@ var ts;
119127
119222
  }
119128
119223
  set.forEach(function (v) { return deleteFromMultimap(reverse, v, k); });
119129
119224
  forward.delete(k);
119130
- version++;
119131
119225
  return true;
119132
119226
  },
119133
119227
  set: function (k, vSet) {
119134
- var changed = !!(deleted === null || deleted === void 0 ? void 0 : deleted.delete(k));
119228
+ deleted === null || deleted === void 0 ? void 0 : deleted.delete(k);
119135
119229
  var existingVSet = forward.get(k);
119136
119230
  forward.set(k, vSet);
119137
119231
  existingVSet === null || existingVSet === void 0 ? void 0 : existingVSet.forEach(function (v) {
119138
119232
  if (!vSet.has(v)) {
119139
- changed = true;
119140
119233
  deleteFromMultimap(reverse, v, k);
119141
119234
  }
119142
119235
  });
119143
119236
  vSet.forEach(function (v) {
119144
119237
  if (!(existingVSet === null || existingVSet === void 0 ? void 0 : existingVSet.has(v))) {
119145
- changed = true;
119146
119238
  addToMultimap(reverse, v, k);
119147
119239
  }
119148
119240
  });
119149
- if (changed) {
119150
- version++;
119151
- }
119152
119241
  return map;
119153
119242
  },
119243
+ clear: function () {
119244
+ forward.clear();
119245
+ reverse.clear();
119246
+ deleted === null || deleted === void 0 ? void 0 : deleted.clear();
119247
+ }
119154
119248
  };
119155
119249
  return map;
119156
119250
  }
@@ -119165,11 +119259,10 @@ var ts;
119165
119259
  }
119166
119260
  set.add(v);
119167
119261
  }
119168
- function deleteFromMultimap(map, k, v, removeEmpty) {
119169
- if (removeEmpty === void 0) { removeEmpty = true; }
119262
+ function deleteFromMultimap(map, k, v) {
119170
119263
  var set = map.get(k);
119171
119264
  if (set === null || set === void 0 ? void 0 : set.delete(v)) {
119172
- if (removeEmpty && !set.size) {
119265
+ if (!set.size) {
119173
119266
  map.delete(k);
119174
119267
  }
119175
119268
  return true;
@@ -119398,7 +119491,7 @@ var ts;
119398
119491
  /*forceDtsEmit*/ true);
119399
119492
  var firstDts_1 = ts.firstOrUndefined(emitOutput_1.outputFiles);
119400
119493
  if (firstDts_1) {
119401
- 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; })); });
119402
119495
  latestSignature = (computeHash || ts.generateDjb2Hash)(firstDts_1.text);
119403
119496
  if (exportedModulesMapCache && latestSignature !== prevSignature) {
119404
119497
  updateExportedModules(sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
@@ -119456,20 +119549,6 @@ var ts;
119456
119549
  var _a;
119457
119550
  if (exportedModulesMapCache) {
119458
119551
  ts.Debug.assert(!!state.exportedModulesMap);
119459
- var cacheId = exportedModulesMapCache.id;
119460
- var cacheVersion = exportedModulesMapCache.version();
119461
- if (state.previousCache) {
119462
- if (state.previousCache.id === cacheId && state.previousCache.version === cacheVersion) {
119463
- // If this is the same cache at the same version as last time this BuilderState
119464
- // was updated, there's no need to update again
119465
- return;
119466
- }
119467
- state.previousCache.id = cacheId;
119468
- state.previousCache.version = cacheVersion;
119469
- }
119470
- else {
119471
- state.previousCache = { id: cacheId, version: cacheVersion };
119472
- }
119473
119552
  (_a = exportedModulesMapCache.deletedKeys()) === null || _a === void 0 ? void 0 : _a.forEach(function (path) { return state.exportedModulesMap.deleteKey(path); });
119474
119553
  exportedModulesMapCache.forEach(function (exportedModules, path) { return state.exportedModulesMap.set(path, exportedModules); });
119475
119554
  }
@@ -119803,7 +119882,8 @@ var ts;
119803
119882
  * This is to allow the callers to be able to actually remove affected file only when the operation is complete
119804
119883
  * eg. if during diagnostics check cancellation token ends up cancelling the request, the affected file should be retained
119805
119884
  */
119806
- function getNextAffectedFile(state, cancellationToken, computeHash) {
119885
+ function getNextAffectedFile(state, cancellationToken, computeHash, host) {
119886
+ var _a;
119807
119887
  while (true) {
119808
119888
  var affectedFiles = state.affectedFiles;
119809
119889
  if (affectedFiles) {
@@ -119814,7 +119894,7 @@ var ts;
119814
119894
  if (!seenAffectedFiles.has(affectedFile.resolvedPath)) {
119815
119895
  // Set the next affected file as seen and remove the cached semantic diagnostics
119816
119896
  state.affectedFilesIndex = affectedFilesIndex;
119817
- handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash);
119897
+ handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
119818
119898
  return affectedFile;
119819
119899
  }
119820
119900
  affectedFilesIndex++;
@@ -119826,6 +119906,7 @@ var ts;
119826
119906
  ts.BuilderState.updateSignaturesFromCache(state, state.currentAffectedFilesSignatures);
119827
119907
  state.currentAffectedFilesSignatures.clear();
119828
119908
  ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
119909
+ (_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clear();
119829
119910
  state.affectedFiles = undefined;
119830
119911
  }
119831
119912
  // Get next changed file
@@ -119855,6 +119936,11 @@ var ts;
119855
119936
  state.seenAffectedFiles = new ts.Set();
119856
119937
  }
119857
119938
  }
119939
+ function clearAffectedFilesPendingEmit(state) {
119940
+ state.affectedFilesPendingEmit = undefined;
119941
+ state.affectedFilesPendingEmitKind = undefined;
119942
+ state.affectedFilesPendingEmitIndex = undefined;
119943
+ }
119858
119944
  /**
119859
119945
  * Returns next file to be emitted from files that retrieved semantic diagnostics but did not emit yet
119860
119946
  */
@@ -119874,9 +119960,7 @@ var ts;
119874
119960
  }
119875
119961
  }
119876
119962
  }
119877
- state.affectedFilesPendingEmit = undefined;
119878
- state.affectedFilesPendingEmitKind = undefined;
119879
- state.affectedFilesPendingEmitIndex = undefined;
119963
+ clearAffectedFilesPendingEmit(state);
119880
119964
  }
119881
119965
  return undefined;
119882
119966
  }
@@ -119884,7 +119968,7 @@ var ts;
119884
119968
  * Handles semantic diagnostics and dts emit for affectedFile and files, that are referencing modules that export entities from affected file
119885
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
119886
119970
  */
119887
- function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash) {
119971
+ function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
119888
119972
  var _a;
119889
119973
  removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
119890
119974
  // If affected files is everything except default library, then nothing more to do
@@ -119909,14 +119993,14 @@ var ts;
119909
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);
119910
119994
  }
119911
119995
  if (!state.compilerOptions.assumeChangesOnlyAffectDirectDependencies) {
119912
- 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); });
119913
119997
  }
119914
119998
  }
119915
119999
  /**
119916
120000
  * Handle the dts may change, so they need to be added to pending emit if dts emit is enabled,
119917
120001
  * Also we need to make sure signature is updated for these files
119918
120002
  */
119919
- function handleDtsMayChangeOf(state, path, cancellationToken, computeHash) {
120003
+ function handleDtsMayChangeOf(state, path, cancellationToken, computeHash, host) {
119920
120004
  removeSemanticDiagnosticsOf(state, path);
119921
120005
  if (!state.changedFilesSet.has(path)) {
119922
120006
  var program = ts.Debug.checkDefined(state.program);
@@ -119927,8 +120011,7 @@ var ts;
119927
120011
  // This ensures that we dont later during incremental builds considering wrong signature.
119928
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
119929
120013
  // But we avoid expensive full shape computation, as using file version as shape is enough for correctness.
119930
- ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap,
119931
- /* useFileVersionAsSignature */ true);
120014
+ ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap, !host.disableUseFileVersionAsSignature);
119932
120015
  // If not dts emit, nothing more to do
119933
120016
  if (ts.getEmitDeclarations(state.compilerOptions)) {
119934
120017
  addToAffectedFilesPendingEmit(state, path, 0 /* DtsOnly */);
@@ -120125,13 +120208,18 @@ var ts;
120125
120208
  var signature = state.currentAffectedFilesSignatures && state.currentAffectedFilesSignatures.get(key);
120126
120209
  var actualSignature = signature !== null && signature !== void 0 ? signature : value.signature;
120127
120210
  return value.version === actualSignature ?
120128
- value.affectsGlobalScope ?
120129
- { 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
120130
120215
  value.version :
120131
- actualSignature !== undefined ?
120216
+ actualSignature !== undefined ? // If signature is not same as version, encode signature in the fileInfo
120132
120217
  signature === undefined ?
120218
+ // If we havent computed signature, use fileInfo as is
120133
120219
  value :
120220
+ // Serialize fileInfo with new updated signature
120134
120221
  { version: value.version, signature: signature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
120222
+ // Signature of the FileInfo is undefined, serialize it as false
120135
120223
  { version: value.version, signature: false, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat };
120136
120224
  });
120137
120225
  var referencedMap;
@@ -120376,7 +120464,7 @@ var ts;
120376
120464
  * in that order would be used to write the files
120377
120465
  */
120378
120466
  function emitNextAffectedFile(writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
120379
- var affected = getNextAffectedFile(state, cancellationToken, computeHash);
120467
+ var affected = getNextAffectedFile(state, cancellationToken, computeHash, host);
120380
120468
  var emitKind = 1 /* Full */;
120381
120469
  var isPendingEmitFile = false;
120382
120470
  if (!affected) {
@@ -120421,54 +120509,48 @@ var ts;
120421
120509
  * in that order would be used to write the files
120422
120510
  */
120423
120511
  function emit(targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
120424
- var restorePendingEmitOnHandlingNoEmitSuccess = false;
120425
- var savedAffectedFilesPendingEmit;
120426
- var savedAffectedFilesPendingEmitKind;
120427
- var savedAffectedFilesPendingEmitIndex;
120428
- // 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
120429
- // This ensures pending files to emit is updated in tsbuildinfo
120430
- // 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)
120431
- if (kind !== BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram &&
120432
- !targetSourceFile &&
120433
- !ts.outFile(state.compilerOptions) &&
120434
- !state.compilerOptions.noEmit &&
120435
- state.compilerOptions.noEmitOnError) {
120436
- restorePendingEmitOnHandlingNoEmitSuccess = true;
120437
- savedAffectedFilesPendingEmit = state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice();
120438
- savedAffectedFilesPendingEmitKind = state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind);
120439
- savedAffectedFilesPendingEmitIndex = state.affectedFilesPendingEmitIndex;
120440
- }
120512
+ var _a;
120441
120513
  if (kind === BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram) {
120442
120514
  assertSourceFileOkWithoutNextAffectedCall(state, targetSourceFile);
120443
120515
  }
120444
120516
  var result = ts.handleNoEmitOptions(builderProgram, targetSourceFile, writeFile, cancellationToken);
120445
120517
  if (result)
120446
120518
  return result;
120447
- if (restorePendingEmitOnHandlingNoEmitSuccess) {
120448
- state.affectedFilesPendingEmit = savedAffectedFilesPendingEmit;
120449
- state.affectedFilesPendingEmitKind = savedAffectedFilesPendingEmitKind;
120450
- state.affectedFilesPendingEmitIndex = savedAffectedFilesPendingEmitIndex;
120451
- }
120452
120519
  // Emit only affected files if using builder for emit
120453
- if (!targetSourceFile && kind === BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram) {
120454
- // Emit and report any errors we ran into.
120455
- var sourceMaps = [];
120456
- var emitSkipped = false;
120457
- var diagnostics = void 0;
120458
- var emittedFiles = [];
120459
- var affectedEmitResult = void 0;
120460
- while (affectedEmitResult = emitNextAffectedFile(writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers)) {
120461
- emitSkipped = emitSkipped || affectedEmitResult.result.emitSkipped;
120462
- diagnostics = ts.addRange(diagnostics, affectedEmitResult.result.diagnostics);
120463
- emittedFiles = ts.addRange(emittedFiles, affectedEmitResult.result.emittedFiles);
120464
- 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
+ }
120465
120553
  }
120466
- return {
120467
- emitSkipped: emitSkipped,
120468
- diagnostics: diagnostics || ts.emptyArray,
120469
- emittedFiles: emittedFiles,
120470
- sourceMaps: sourceMaps
120471
- };
120472
120554
  }
120473
120555
  return ts.Debug.checkDefined(state.program).emit(targetSourceFile, writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
120474
120556
  }
@@ -120478,7 +120560,7 @@ var ts;
120478
120560
  */
120479
120561
  function getSemanticDiagnosticsOfNextAffectedFile(cancellationToken, ignoreSourceFile) {
120480
120562
  while (true) {
120481
- var affected = getNextAffectedFile(state, cancellationToken, computeHash);
120563
+ var affected = getNextAffectedFile(state, cancellationToken, computeHash, host);
120482
120564
  if (!affected) {
120483
120565
  // Done
120484
120566
  return undefined;
@@ -123598,9 +123680,6 @@ var ts;
123598
123680
  function newer(date1, date2) {
123599
123681
  return date2 > date1 ? date2 : date1;
123600
123682
  }
123601
- function isDeclarationFile(fileName) {
123602
- return ts.fileExtensionIs(fileName, ".d.ts" /* Dts */);
123603
- }
123604
123683
  /*@internal*/
123605
123684
  function isCircularBuildOrder(buildOrder) {
123606
123685
  return !!buildOrder && !!buildOrder.buildOrder;
@@ -124163,7 +124242,7 @@ var ts;
124163
124242
  outputFiles.forEach(function (_a) {
124164
124243
  var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
124165
124244
  var priorChangeTime;
124166
- if (!anyDtsChanged && isDeclarationFile(name)) {
124245
+ if (!anyDtsChanged && ts.isDeclarationFileName(name)) {
124167
124246
  // Check for unchanged .d.ts files
124168
124247
  if (host.fileExists(name) && state.readFileWithCache(name) === text) {
124169
124248
  priorChangeTime = host.getModifiedTime(name);
@@ -124504,7 +124583,7 @@ var ts;
124504
124583
  // In addition to file timestamps, we also keep track of when a .d.ts file
124505
124584
  // had its file touched but not had its contents changed - this allows us
124506
124585
  // to skip a downstream typecheck
124507
- if (isDeclarationFile(output)) {
124586
+ if (ts.isDeclarationFileName(output)) {
124508
124587
  var outputModifiedTime = ts.getModifiedTime(host, output);
124509
124588
  newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, outputModifiedTime);
124510
124589
  }
@@ -124658,7 +124737,7 @@ var ts;
124658
124737
  reportVerbose = false;
124659
124738
  reportStatus(state, verboseMessage, proj.options.configFilePath);
124660
124739
  }
124661
- if (isDeclarationFile(file)) {
124740
+ if (ts.isDeclarationFileName(file)) {
124662
124741
  priorNewestUpdateTime = newer(priorNewestUpdateTime, ts.getModifiedTime(host, file));
124663
124742
  }
124664
124743
  host.setModifiedTime(file, now);
@@ -131970,17 +132049,13 @@ var ts;
131970
132049
  }
131971
132050
  }
131972
132051
  if (origin && originIsObjectLiteralMethod(origin)) {
131973
- var importAdder = void 0;
131974
- (insertText = origin.insertText, isSnippet = origin.isSnippet, importAdder = origin.importAdder, labelDetails = origin.labelDetails);
132052
+ (insertText = origin.insertText, isSnippet = origin.isSnippet, labelDetails = origin.labelDetails);
131975
132053
  if (!preferences.useLabelDetailsInCompletionEntries) {
131976
132054
  name = name + labelDetails.detail;
131977
132055
  labelDetails = undefined;
131978
132056
  }
131979
132057
  source = CompletionSource.ObjectLiteralMethodSnippet;
131980
132058
  sortText = Completions.SortText.SortBelow(sortText);
131981
- if (importAdder.hasFixes()) {
131982
- hasAction = true;
131983
- }
131984
132059
  }
131985
132060
  if (isJsxIdentifierExpected && !isRightOfOpenTag && preferences.includeCompletionsWithSnippetText && preferences.jsxAttributeCompletionStyle && preferences.jsxAttributeCompletionStyle !== "none") {
131986
132061
  var useBraces_1 = preferences.jsxAttributeCompletionStyle === "braces";
@@ -132203,8 +132278,7 @@ var ts;
132203
132278
  var isSnippet = preferences.includeCompletionsWithSnippetText || undefined;
132204
132279
  var insertText = name;
132205
132280
  var sourceFile = enclosingDeclaration.getSourceFile();
132206
- var importAdder = ts.codefix.createImportAdder(sourceFile, program, preferences, host);
132207
- var method = createObjectLiteralMethod(symbol, enclosingDeclaration, sourceFile, program, host, preferences, importAdder);
132281
+ var method = createObjectLiteralMethod(symbol, enclosingDeclaration, sourceFile, program, host, preferences);
132208
132282
  if (!method) {
132209
132283
  return undefined;
132210
132284
  }
@@ -132233,16 +132307,15 @@ var ts;
132233
132307
  /*modifiers*/ undefined,
132234
132308
  /*name*/ "", method.questionToken, method.typeParameters, method.parameters, method.type);
132235
132309
  var labelDetails = { detail: signaturePrinter.printNode(4 /* Unspecified */, methodSignature, sourceFile) };
132236
- return { isSnippet: isSnippet, insertText: insertText, importAdder: importAdder, labelDetails: labelDetails };
132310
+ return { isSnippet: isSnippet, insertText: insertText, labelDetails: labelDetails };
132237
132311
  }
132238
132312
  ;
132239
- function createObjectLiteralMethod(symbol, enclosingDeclaration, sourceFile, program, host, preferences, importAdder) {
132313
+ function createObjectLiteralMethod(symbol, enclosingDeclaration, sourceFile, program, host, preferences) {
132240
132314
  var declarations = symbol.getDeclarations();
132241
132315
  if (!(declarations && declarations.length)) {
132242
132316
  return undefined;
132243
132317
  }
132244
132318
  var checker = program.getTypeChecker();
132245
- var scriptTarget = ts.getEmitScriptTarget(program.getCompilerOptions());
132246
132319
  var declaration = declarations[0];
132247
132320
  var name = ts.getSynthesizedDeepClone(ts.getNameOfDeclaration(declaration), /*includeTrivia*/ false);
132248
132321
  var type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration));
@@ -132275,11 +132348,6 @@ var ts;
132275
132348
  if (!typeNode || !ts.isFunctionTypeNode(typeNode)) {
132276
132349
  return undefined;
132277
132350
  }
132278
- var importableReference = ts.codefix.tryGetAutoImportableReferenceFromTypeNode(typeNode, scriptTarget);
132279
- if (importableReference) {
132280
- typeNode = importableReference.typeNode;
132281
- ts.codefix.importSymbols(importAdder, importableReference.symbols);
132282
- }
132283
132351
  var body = void 0;
132284
132352
  if (preferences.includeCompletionsWithSnippetText) {
132285
132353
  var emptyStmt = ts.factory.createEmptyStatement();
@@ -132289,11 +132357,19 @@ var ts;
132289
132357
  else {
132290
132358
  body = ts.factory.createBlock([], /* multiline */ true);
132291
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
+ });
132292
132366
  return ts.factory.createMethodDeclaration(
132293
132367
  /*decorators*/ undefined,
132294
132368
  /*modifiers*/ undefined,
132295
132369
  /*asteriskToken*/ undefined, name,
132296
- /*questionToken*/ undefined, typeNode.typeParameters, typeNode.parameters, typeNode.type, body);
132370
+ /*questionToken*/ undefined,
132371
+ /*typeParameters*/ undefined, parameters,
132372
+ /*type*/ undefined, body);
132297
132373
  }
132298
132374
  default:
132299
132375
  return undefined;
@@ -132656,20 +132732,6 @@ var ts;
132656
132732
  };
132657
132733
  }
132658
132734
  }
132659
- if (source === CompletionSource.ObjectLiteralMethodSnippet) {
132660
- var enclosingDeclaration = tryGetObjectLikeCompletionContainer(contextToken);
132661
- var importAdder = getEntryForObjectLiteralMethodCompletion(symbol, name, enclosingDeclaration, program, host, compilerOptions, preferences, formatContext).importAdder;
132662
- if (importAdder.hasFixes()) {
132663
- var changes = ts.textChanges.ChangeTracker.with({ host: host, formatContext: formatContext, preferences: preferences }, importAdder.writeFixes);
132664
- return {
132665
- sourceDisplay: undefined,
132666
- codeActions: [{
132667
- changes: changes,
132668
- description: ts.diagnosticToString([ts.Diagnostics.Includes_imports_of_types_referenced_by_0, name]),
132669
- }],
132670
- };
132671
- }
132672
- }
132673
132735
  if (originIsTypeOnlyAlias(origin)) {
132674
132736
  var codeAction_1 = ts.codefix.getPromoteTypeOnlyCompletionAction(sourceFile, origin.declaration.name, program, host, formatContext, preferences);
132675
132737
  ts.Debug.assertIsDefined(codeAction_1, "Expected to have a code action for promoting type-only alias");
@@ -135490,7 +135552,7 @@ var ts;
135490
135552
  // It is fairly suspicious to have one path in two buckets - you'd expect dependencies to have similar configurations.
135491
135553
  // If this occurs unexpectedly, the fix is likely to synchronize the project settings.
135492
135554
  // Skip .d.ts files to reduce noise (should also cover most of node_modules).
135493
- var otherBucketKey = !ts.fileExtensionIs(path, ".d.ts" /* Dts */) &&
135555
+ var otherBucketKey = !ts.isDeclarationFileName(path) &&
135494
135556
  ts.forEachEntry(buckets, function (bucket, bucketKey) { return bucketKey !== key && bucket.has(path) && bucketKey; });
135495
135557
  if (otherBucketKey) {
135496
135558
  ts.tracing.instant("session" /* Session */, "documentRegistryBucketOverlap", { path: path, key1: otherBucketKey, key2: key });
@@ -137430,6 +137492,30 @@ var ts;
137430
137492
  }
137431
137493
  }
137432
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;
137433
137519
  function someSignatureUsage(signature, sourceFiles, checker, cb) {
137434
137520
  if (!signature.name || !ts.isIdentifier(signature.name))
137435
137521
  return false;
@@ -139066,7 +139152,9 @@ var ts;
139066
139152
  (function (ts) {
139067
139153
  var GoToDefinition;
139068
139154
  (function (GoToDefinition) {
139069
- function getDefinitionAtPosition(program, sourceFile, position) {
139155
+ function getDefinitionAtPosition(program, sourceFile, position, searchOtherFilesOnly) {
139156
+ var _a;
139157
+ var _b;
139070
139158
  var resolvedRef = getReferenceAtPosition(sourceFile, position, program);
139071
139159
  var fileReferenceDefinition = resolvedRef && [getDefinitionInfoForFileReference(resolvedRef.reference.fileName, resolvedRef.fileName, resolvedRef.unverified)] || ts.emptyArray;
139072
139160
  if (resolvedRef === null || resolvedRef === void 0 ? void 0 : resolvedRef.file) {
@@ -139089,33 +139177,63 @@ var ts;
139089
139177
  }
139090
139178
  if (ts.isStaticModifier(node) && ts.isClassStaticBlockDeclaration(node.parent)) {
139091
139179
  var classDecl = node.parent.parent;
139092
- var symbol_1 = getSymbol(classDecl, typeChecker);
139180
+ var _c = getSymbol(classDecl, typeChecker), symbol_1 = _c.symbol, failedAliasResolution_1 = _c.failedAliasResolution;
139093
139181
  var staticBlocks = ts.filter(classDecl.members, ts.isClassStaticBlockDeclaration);
139094
139182
  var containerName_1 = symbol_1 ? typeChecker.symbolToString(symbol_1, classDecl) : "";
139095
139183
  var sourceFile_1 = node.getSourceFile();
139096
139184
  return ts.map(staticBlocks, function (staticBlock) {
139097
139185
  var pos = ts.moveRangePastModifiers(staticBlock).pos;
139098
139186
  pos = ts.skipTrivia(sourceFile_1.text, pos);
139099
- 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 });
139100
139188
  });
139101
139189
  }
139102
- 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
+ }
139103
139219
  // Could not find a symbol e.g. node is string or number keyword,
139104
139220
  // or the symbol was an internal symbol and does not have a declaration e.g. undefined symbol
139105
139221
  if (!symbol) {
139106
139222
  return ts.concatenate(fileReferenceDefinition, getDefinitionInfoForIndexSignatures(node, typeChecker));
139107
139223
  }
139224
+ if (searchOtherFilesOnly && ts.every(symbol.declarations, function (d) { return d.getSourceFile().fileName === sourceFile.fileName; }))
139225
+ return undefined;
139108
139226
  var calledDeclaration = tryGetSignatureDeclaration(typeChecker, node);
139109
139227
  // Don't go to the component constructor definition for a JSX element, just go to the component definition.
139110
139228
  if (calledDeclaration && !(ts.isJsxOpeningLikeElement(node.parent) && isConstructorLike(calledDeclaration))) {
139111
- var sigInfo = createDefinitionFromSignatureDeclaration(typeChecker, calledDeclaration);
139229
+ var sigInfo = createDefinitionFromSignatureDeclaration(typeChecker, calledDeclaration, failedAliasResolution);
139112
139230
  // For a function, if this is the original function definition, return just sigInfo.
139113
139231
  // If this is the original constructor definition, parent is the class.
139114
139232
  if (typeChecker.getRootSymbols(symbol).some(function (s) { return symbolMatchesSignature(s, calledDeclaration); })) {
139115
139233
  return [sigInfo];
139116
139234
  }
139117
139235
  else {
139118
- var defs = getDefinitionFromSymbol(typeChecker, symbol, node, calledDeclaration) || ts.emptyArray;
139236
+ var defs = getDefinitionFromSymbol(typeChecker, symbol, node, failedAliasResolution, calledDeclaration) || ts.emptyArray;
139119
139237
  // For a 'super()' call, put the signature first, else put the variable first.
139120
139238
  return node.kind === 106 /* SuperKeyword */ ? __spreadArray([sigInfo], defs, true) : __spreadArray(__spreadArray([], defs, true), [sigInfo], false);
139121
139239
  }
@@ -139127,7 +139245,7 @@ var ts;
139127
139245
  // assignment. This case and others are handled by the following code.
139128
139246
  if (node.parent.kind === 297 /* ShorthandPropertyAssignment */) {
139129
139247
  var shorthandSymbol_1 = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration);
139130
- 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;
139131
139249
  return ts.concatenate(definitions, getDefinitionFromObjectLiteralElement(typeChecker, node) || ts.emptyArray);
139132
139250
  }
139133
139251
  // If the node is the name of a BindingElement within an ObjectBindingPattern instead of just returning the
@@ -139150,7 +139268,7 @@ var ts;
139150
139268
  return prop && getDefinitionFromSymbol(typeChecker, prop, node);
139151
139269
  });
139152
139270
  }
139153
- return ts.concatenate(fileReferenceDefinition, getDefinitionFromObjectLiteralElement(typeChecker, node) || getDefinitionFromSymbol(typeChecker, symbol, node));
139271
+ return ts.concatenate(fileReferenceDefinition, getDefinitionFromObjectLiteralElement(typeChecker, node) || getDefinitionFromSymbol(typeChecker, symbol, node, failedAliasResolution));
139154
139272
  }
139155
139273
  GoToDefinition.getDefinitionAtPosition = getDefinitionAtPosition;
139156
139274
  /**
@@ -139248,24 +139366,24 @@ var ts;
139248
139366
  return undefined;
139249
139367
  }
139250
139368
  if (ts.isImportMeta(node.parent) && node.parent.name === node) {
139251
- return definitionFromType(typeChecker.getTypeAtLocation(node.parent), typeChecker, node.parent);
139369
+ return definitionFromType(typeChecker.getTypeAtLocation(node.parent), typeChecker, node.parent, /*failedAliasResolution*/ false);
139252
139370
  }
139253
- var symbol = getSymbol(node, typeChecker);
139371
+ var _a = getSymbol(node, typeChecker), symbol = _a.symbol, failedAliasResolution = _a.failedAliasResolution;
139254
139372
  if (!symbol)
139255
139373
  return undefined;
139256
139374
  var typeAtLocation = typeChecker.getTypeOfSymbolAtLocation(symbol, node);
139257
139375
  var returnType = tryGetReturnTypeOfFunction(symbol, typeAtLocation, typeChecker);
139258
- var fromReturnType = returnType && definitionFromType(returnType, typeChecker, node);
139376
+ var fromReturnType = returnType && definitionFromType(returnType, typeChecker, node, failedAliasResolution);
139259
139377
  // If a function returns 'void' or some other type with no definition, just return the function definition.
139260
- var typeDefinitions = fromReturnType && fromReturnType.length !== 0 ? fromReturnType : definitionFromType(typeAtLocation, typeChecker, node);
139378
+ var typeDefinitions = fromReturnType && fromReturnType.length !== 0 ? fromReturnType : definitionFromType(typeAtLocation, typeChecker, node, failedAliasResolution);
139261
139379
  return typeDefinitions.length ? typeDefinitions
139262
- : !(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)
139263
139381
  : undefined;
139264
139382
  }
139265
139383
  GoToDefinition.getTypeDefinitionAtPosition = getTypeDefinitionAtPosition;
139266
- function definitionFromType(type, checker, node) {
139384
+ function definitionFromType(type, checker, node, failedAliasResolution) {
139267
139385
  return ts.flatMap(type.isUnion() && !(type.flags & 32 /* Enum */) ? type.types : [type], function (t) {
139268
- return t.symbol && getDefinitionFromSymbol(checker, t.symbol, node);
139386
+ return t.symbol && getDefinitionFromSymbol(checker, t.symbol, node, failedAliasResolution);
139269
139387
  });
139270
139388
  }
139271
139389
  function tryGetReturnTypeOfFunction(symbol, type, checker) {
@@ -139307,13 +139425,17 @@ var ts;
139307
139425
  // get the aliased symbol instead. This allows for goto def on an import e.g.
139308
139426
  // import {A, B} from "mod";
139309
139427
  // to jump to the implementation directly.
139428
+ var failedAliasResolution = false;
139310
139429
  if ((symbol === null || symbol === void 0 ? void 0 : symbol.declarations) && symbol.flags & 2097152 /* Alias */ && shouldSkipAlias(node, symbol.declarations[0])) {
139311
139430
  var aliased = checker.getAliasedSymbol(symbol);
139312
139431
  if (aliased.declarations) {
139313
- return aliased;
139432
+ return { symbol: aliased };
139433
+ }
139434
+ else {
139435
+ failedAliasResolution = true;
139314
139436
  }
139315
139437
  }
139316
- return symbol;
139438
+ return { symbol: symbol, failedAliasResolution: failedAliasResolution };
139317
139439
  }
139318
139440
  // Go to the original declaration for cases:
139319
139441
  //
@@ -139327,26 +139449,45 @@ var ts;
139327
139449
  if (node.parent === declaration) {
139328
139450
  return true;
139329
139451
  }
139330
- switch (declaration.kind) {
139331
- case 267 /* ImportClause */:
139332
- case 265 /* ImportEqualsDeclaration */:
139333
- return true;
139334
- case 270 /* ImportSpecifier */:
139335
- return declaration.parent.kind === 269 /* NamedImports */;
139336
- case 203 /* BindingElement */:
139337
- case 254 /* VariableDeclaration */:
139338
- return ts.isInJSFile(declaration) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(declaration);
139339
- default:
139340
- return false;
139452
+ if (declaration.kind === 268 /* NamespaceImport */) {
139453
+ return false;
139341
139454
  }
139455
+ return true;
139342
139456
  }
139343
- function getDefinitionFromSymbol(typeChecker, symbol, node, declarationNode) {
139344
- // There are cases when you extend a function by adding properties to it afterwards,
139345
- // we want to strip those extra properties.
139346
- // For deduping purposes, we also want to exclude any declarationNodes if provided.
139347
- var filteredDeclarations = ts.filter(symbol.declarations, function (d) { return d !== declarationNode && (!ts.isAssignmentDeclaration(d) || d === symbol.valueDeclaration); })
139348
- || undefined;
139349
- 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); });
139350
139491
  function getConstructSignatureDefinition() {
139351
139492
  // Applicable only if we are in a new expression, or we are on a constructor declaration
139352
139493
  // and in either case the symbol has a construct signature definition, i.e. class
@@ -139370,26 +139511,27 @@ var ts;
139370
139511
  return declarations.length
139371
139512
  ? declarationsWithBody.length !== 0
139372
139513
  ? declarationsWithBody.map(function (x) { return createDefinitionInfo(x, typeChecker, symbol, node); })
139373
- : [createDefinitionInfo(ts.last(declarations), typeChecker, symbol, node)]
139514
+ : [createDefinitionInfo(ts.last(declarations), typeChecker, symbol, node, /*unverified*/ false, failedAliasResolution)]
139374
139515
  : undefined;
139375
139516
  }
139376
139517
  }
139377
139518
  /** Creates a DefinitionInfo from a Declaration, using the declaration's name if possible. */
139378
- function createDefinitionInfo(declaration, checker, symbol, node) {
139519
+ function createDefinitionInfo(declaration, checker, symbol, node, unverified, failedAliasResolution) {
139379
139520
  var symbolName = checker.symbolToString(symbol); // Do not get scoped name, just the name of the symbol
139380
139521
  var symbolKind = ts.SymbolDisplay.getSymbolKind(checker, symbol, node);
139381
139522
  var containerName = symbol.parent ? checker.symbolToString(symbol.parent, node) : "";
139382
- return createDefinitionInfoFromName(checker, declaration, symbolKind, symbolName, containerName);
139523
+ return createDefinitionInfoFromName(checker, declaration, symbolKind, symbolName, containerName, unverified, failedAliasResolution);
139383
139524
  }
139525
+ GoToDefinition.createDefinitionInfo = createDefinitionInfo;
139384
139526
  /** Creates a DefinitionInfo directly from the name of a declaration. */
139385
- function createDefinitionInfoFromName(checker, declaration, symbolKind, symbolName, containerName, textSpan) {
139527
+ function createDefinitionInfoFromName(checker, declaration, symbolKind, symbolName, containerName, unverified, failedAliasResolution, textSpan) {
139386
139528
  var sourceFile = declaration.getSourceFile();
139387
139529
  if (!textSpan) {
139388
139530
  var name = ts.getNameOfDeclaration(declaration) || declaration;
139389
139531
  textSpan = ts.createTextSpanFromNode(name, sourceFile);
139390
139532
  }
139391
139533
  return __assign(__assign({ fileName: sourceFile.fileName, textSpan: textSpan, kind: symbolKind, name: symbolName, containerKind: undefined, // TODO: GH#18217
139392
- 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 });
139393
139535
  }
139394
139536
  function isDefinitionVisible(checker, declaration) {
139395
139537
  if (checker.isDeclarationVisible(declaration))
@@ -139422,8 +139564,8 @@ var ts;
139422
139564
  return false;
139423
139565
  }
139424
139566
  }
139425
- function createDefinitionFromSignatureDeclaration(typeChecker, decl) {
139426
- return createDefinitionInfo(decl, typeChecker, decl.symbol, decl);
139567
+ function createDefinitionFromSignatureDeclaration(typeChecker, decl, failedAliasResolution) {
139568
+ return createDefinitionInfo(decl, typeChecker, decl.symbol, decl, /*unverified*/ false, failedAliasResolution);
139427
139569
  }
139428
139570
  function findReferenceInPosition(refs, pos) {
139429
139571
  return ts.find(refs, function (ref) { return ts.textRangeContainsPositionInclusive(ref, pos); });
@@ -152538,9 +152680,10 @@ var ts;
152538
152680
  // 2. add "member3" to the second import statement's import list
152539
152681
  // and it is up to the user to decide which one fits best.
152540
152682
  return ts.firstDefined(existingImports, function (_a) {
152683
+ var _b;
152541
152684
  var declaration = _a.declaration;
152542
152685
  var namespacePrefix = getNamespaceLikeImportText(declaration);
152543
- var moduleSpecifier = ts.tryGetModuleSpecifierFromDeclaration(declaration);
152686
+ var moduleSpecifier = (_b = ts.tryGetModuleSpecifierFromDeclaration(declaration)) === null || _b === void 0 ? void 0 : _b.text;
152544
152687
  if (namespacePrefix && moduleSpecifier) {
152545
152688
  var moduleSymbol = getTargetModuleFromNamespaceLikeImport(declaration, checker);
152546
152689
  if (moduleSymbol && moduleSymbol.exports.has(ts.escapeLeadingUnderscores(symbolName))) {
@@ -152716,8 +152859,9 @@ var ts;
152716
152859
  return existingDeclaration ? [existingDeclaration] : getNewImportFixes(program, sourceFile, position, isValidTypeOnlyUseSite, useRequire, exportInfos, host, preferences).fixes;
152717
152860
  }
152718
152861
  function newImportInfoFromExistingSpecifier(_a, isValidTypeOnlyUseSite, useRequire, checker, compilerOptions) {
152862
+ var _b;
152719
152863
  var declaration = _a.declaration, importKind = _a.importKind, symbol = _a.symbol, targetFlags = _a.targetFlags;
152720
- var moduleSpecifier = ts.tryGetModuleSpecifierFromDeclaration(declaration);
152864
+ var moduleSpecifier = (_b = ts.tryGetModuleSpecifierFromDeclaration(declaration)) === null || _b === void 0 ? void 0 : _b.text;
152721
152865
  if (moduleSpecifier) {
152722
152866
  var addAsTypeOnly = useRequire
152723
152867
  ? 4 /* NotAllowed */
@@ -157075,7 +157219,6 @@ var ts;
157075
157219
  var checker = program.getTypeChecker();
157076
157220
  var scriptTarget = ts.getEmitScriptTarget(program.getCompilerOptions());
157077
157221
  var flags = 1 /* NoTruncation */
157078
- | 1073741824 /* NoUndefinedOptionalParameterType */
157079
157222
  | 256 /* SuppressAnyReturnType */
157080
157223
  | 524288 /* AllowEmptyTuple */
157081
157224
  | (quotePreference === 0 /* Single */ ? 268435456 /* UseSingleQuotesForStringLiteralType */ : 0 /* None */);
@@ -159454,6 +159597,7 @@ var ts;
159454
159597
  Messages.cannotAccessVariablesFromNestedScopes = createMessage("Cannot access variables from nested scopes");
159455
159598
  Messages.cannotExtractToJSClass = createMessage("Cannot extract constant to a class scope in JS");
159456
159599
  Messages.cannotExtractToExpressionArrowFunction = createMessage("Cannot extract constant to an arrow function without a block");
159600
+ Messages.cannotExtractFunctionsContainingThisToMethod = createMessage("Cannot extract functions containing this to method");
159457
159601
  })(Messages = extractSymbol.Messages || (extractSymbol.Messages = {}));
159458
159602
  var RangeFacts;
159459
159603
  (function (RangeFacts) {
@@ -159462,10 +159606,11 @@ var ts;
159462
159606
  RangeFacts[RangeFacts["IsGenerator"] = 2] = "IsGenerator";
159463
159607
  RangeFacts[RangeFacts["IsAsyncFunction"] = 4] = "IsAsyncFunction";
159464
159608
  RangeFacts[RangeFacts["UsesThis"] = 8] = "UsesThis";
159609
+ RangeFacts[RangeFacts["UsesThisInFunction"] = 16] = "UsesThisInFunction";
159465
159610
  /**
159466
159611
  * The range is in a function which needs the 'static' modifier in a class
159467
159612
  */
159468
- RangeFacts[RangeFacts["InStaticRegion"] = 16] = "InStaticRegion";
159613
+ RangeFacts[RangeFacts["InStaticRegion"] = 32] = "InStaticRegion";
159469
159614
  })(RangeFacts || (RangeFacts = {}));
159470
159615
  /**
159471
159616
  * getRangeToExtract takes a span inside a text file and returns either an expression or an array
@@ -159496,6 +159641,7 @@ var ts;
159496
159641
  // We'll modify these flags as we walk the tree to collect data
159497
159642
  // about what things need to be done as part of the extraction.
159498
159643
  var rangeFacts = RangeFacts.None;
159644
+ var thisNode;
159499
159645
  if (!start || !end) {
159500
159646
  // cannot find either start or end node
159501
159647
  return { errors: [ts.createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractRange)] };
@@ -159534,7 +159680,7 @@ var ts;
159534
159680
  // the expression.
159535
159681
  return { errors: [ts.createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractRange)] };
159536
159682
  }
159537
- return { targetRange: { range: statements, facts: rangeFacts, declarations: declarations } };
159683
+ return { targetRange: { range: statements, facts: rangeFacts, declarations: declarations, thisNode: thisNode } };
159538
159684
  }
159539
159685
  if (ts.isReturnStatement(start) && !start.expression) {
159540
159686
  // Makes no sense to extract an expression-less return statement.
@@ -159546,7 +159692,7 @@ var ts;
159546
159692
  if (errors) {
159547
159693
  return { errors: errors };
159548
159694
  }
159549
- return { targetRange: { range: getStatementOrExpressionRange(node), facts: rangeFacts, declarations: declarations } }; // TODO: GH#18217
159695
+ return { targetRange: { range: getStatementOrExpressionRange(node), facts: rangeFacts, declarations: declarations, thisNode: thisNode } }; // TODO: GH#18217
159550
159696
  /**
159551
159697
  * Attempt to refine the extraction node (generally, by shrinking it) to produce better results.
159552
159698
  * @param node The unrefined extraction node.
@@ -159638,6 +159784,14 @@ var ts;
159638
159784
  var permittedJumps = 4 /* Return */;
159639
159785
  var seenLabels;
159640
159786
  visit(nodeToCheck);
159787
+ if (rangeFacts & RangeFacts.UsesThis) {
159788
+ var container = ts.getThisContainer(nodeToCheck, /** includeArrowFunctions */ false);
159789
+ if (container.kind === 256 /* FunctionDeclaration */ ||
159790
+ (container.kind === 169 /* MethodDeclaration */ && container.parent.kind === 205 /* ObjectLiteralExpression */) ||
159791
+ container.kind === 213 /* FunctionExpression */) {
159792
+ rangeFacts |= RangeFacts.UsesThisInFunction;
159793
+ }
159794
+ }
159641
159795
  return errors;
159642
159796
  function visit(node) {
159643
159797
  if (errors) {
@@ -159676,6 +159830,7 @@ var ts;
159676
159830
  }
159677
159831
  else {
159678
159832
  rangeFacts |= RangeFacts.UsesThis;
159833
+ thisNode = node;
159679
159834
  }
159680
159835
  break;
159681
159836
  case 214 /* ArrowFunction */:
@@ -159683,6 +159838,7 @@ var ts;
159683
159838
  ts.forEachChild(node, function check(n) {
159684
159839
  if (ts.isThis(n)) {
159685
159840
  rangeFacts |= RangeFacts.UsesThis;
159841
+ thisNode = node;
159686
159842
  }
159687
159843
  else if (ts.isClassLike(n) || (ts.isFunctionLike(n) && !ts.isArrowFunction(n))) {
159688
159844
  return false;
@@ -159739,6 +159895,7 @@ var ts;
159739
159895
  case 192 /* ThisType */:
159740
159896
  case 108 /* ThisKeyword */:
159741
159897
  rangeFacts |= RangeFacts.UsesThis;
159898
+ thisNode = node;
159742
159899
  break;
159743
159900
  case 250 /* LabeledStatement */: {
159744
159901
  var label = node.label;
@@ -159826,7 +159983,7 @@ var ts;
159826
159983
  */
159827
159984
  function collectEnclosingScopes(range) {
159828
159985
  var current = isReadonlyArray(range.range) ? ts.first(range.range) : range.range;
159829
- if (range.facts & RangeFacts.UsesThis) {
159986
+ if (range.facts & RangeFacts.UsesThis && !(range.facts & RangeFacts.UsesThisInFunction)) {
159830
159987
  // if range uses this as keyword or as type inside the class then it can only be extracted to a method of the containing class
159831
159988
  var containingClass = ts.getContainingClass(current);
159832
159989
  if (containingClass) {
@@ -160032,6 +160189,7 @@ var ts;
160032
160189
  var _b = transformFunctionBody(node, exposedVariableDeclarations, writes, substitutions, !!(range.facts & RangeFacts.HasReturn)), body = _b.body, returnValueProperty = _b.returnValueProperty;
160033
160190
  ts.suppressLeadingAndTrailingTrivia(body);
160034
160191
  var newFunction;
160192
+ var callThis = !!(range.facts & RangeFacts.UsesThisInFunction);
160035
160193
  if (ts.isClassLike(scope)) {
160036
160194
  // always create private method in TypeScript files
160037
160195
  var modifiers = isJS ? [] : [ts.factory.createModifier(121 /* PrivateKeyword */)];
@@ -160046,6 +160204,15 @@ var ts;
160046
160204
  /*questionToken*/ undefined, typeParameters, parameters, returnType, body);
160047
160205
  }
160048
160206
  else {
160207
+ if (callThis) {
160208
+ parameters.unshift(ts.factory.createParameterDeclaration(
160209
+ /*decorators*/ undefined,
160210
+ /*modifiers*/ undefined,
160211
+ /*dotDotDotToken*/ undefined,
160212
+ /*name*/ "this",
160213
+ /*questionToken*/ undefined, checker.typeToTypeNode(checker.getTypeAtLocation(range.thisNode), scope, 1 /* NoTruncation */),
160214
+ /*initializer*/ undefined));
160215
+ }
160049
160216
  newFunction = ts.factory.createFunctionDeclaration(
160050
160217
  /*decorators*/ undefined, range.facts & RangeFacts.IsAsyncFunction ? [ts.factory.createToken(131 /* AsyncKeyword */)] : undefined, range.facts & RangeFacts.IsGenerator ? ts.factory.createToken(41 /* AsteriskToken */) : undefined, functionName, typeParameters, parameters, returnType, body);
160051
160218
  }
@@ -160062,7 +160229,10 @@ var ts;
160062
160229
  var newNodes = [];
160063
160230
  // replace range with function call
160064
160231
  var called = getCalledExpression(scope, range, functionNameText);
160065
- var call = ts.factory.createCallExpression(called, callTypeArguments, // Note that no attempt is made to take advantage of type argument inference
160232
+ if (callThis) {
160233
+ callArguments.unshift(ts.factory.createIdentifier("this"));
160234
+ }
160235
+ var call = ts.factory.createCallExpression(callThis ? ts.factory.createPropertyAccessExpression(called, "call") : called, callTypeArguments, // Note that no attempt is made to take advantage of type argument inference
160066
160236
  callArguments);
160067
160237
  if (range.facts & RangeFacts.IsGenerator) {
160068
160238
  call = ts.factory.createYieldExpression(ts.factory.createToken(41 /* AsteriskToken */), call);
@@ -160673,6 +160843,9 @@ var ts;
160673
160843
  var errorNode = isReadonlyArray(targetRange.range) ? targetRange.range[0] : targetRange.range;
160674
160844
  constantErrorsPerScope[i].push(ts.createDiagnosticForNode(errorNode, Messages.cannotAccessVariablesFromNestedScopes));
160675
160845
  }
160846
+ if (targetRange.facts & RangeFacts.UsesThisInFunction && ts.isClassLike(scopes[i])) {
160847
+ functionErrorsPerScope[i].push(ts.createDiagnosticForNode(targetRange.thisNode, Messages.cannotExtractFunctionsContainingThisToMethod));
160848
+ }
160676
160849
  var hasWrite = false;
160677
160850
  var readonlyClassPropertyWrite;
160678
160851
  usagesPerScope[i].usages.forEach(function (value) {
@@ -164626,9 +164799,9 @@ var ts;
164626
164799
  }
164627
164800
  }
164628
164801
  /// Goto definition
164629
- function getDefinitionAtPosition(fileName, position) {
164802
+ function getDefinitionAtPosition(fileName, position, searchOtherFilesOnly) {
164630
164803
  synchronizeHostData();
164631
- return ts.GoToDefinition.getDefinitionAtPosition(program, getValidSourceFile(fileName), position);
164804
+ return ts.GoToDefinition.getDefinitionAtPosition(program, getValidSourceFile(fileName), position, searchOtherFilesOnly);
164632
164805
  }
164633
164806
  function getDefinitionAndBoundSpan(fileName, position) {
164634
164807
  synchronizeHostData();