typescript 4.5.0-dev.20211005 → 4.5.0-dev.20211009

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsserver.js CHANGED
@@ -100,7 +100,7 @@ var ts;
100
100
  // The following is baselined as a literal template type without intervention
101
101
  /** The version of the TypeScript compiler release */
102
102
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
103
- ts.version = ts.versionMajorMinor + ".0-dev.20211005";
103
+ ts.version = ts.versionMajorMinor + ".0-dev.20211009";
104
104
  /* @internal */
105
105
  var Comparison;
106
106
  (function (Comparison) {
@@ -8674,6 +8674,7 @@ var ts;
8674
8674
  Type_0_is_not_assignable_to_type_1_Did_you_mean_2: diag(2820, ts.DiagnosticCategory.Error, "Type_0_is_not_assignable_to_type_1_Did_you_mean_2_2820", "Type '{0}' is not assignable to type '{1}'. Did you mean '{2}'?"),
8675
8675
  Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext: diag(2821, ts.DiagnosticCategory.Error, "Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_2821", "Import assertions are only supported when the '--module' option is set to 'esnext'."),
8676
8676
  Import_assertions_cannot_be_used_with_type_only_imports_or_exports: diag(2822, ts.DiagnosticCategory.Error, "Import_assertions_cannot_be_used_with_type_only_imports_or_exports_2822", "Import assertions cannot be used with type-only imports or exports."),
8677
+ Cannot_find_namespace_0_Did_you_mean_1: diag(2833, ts.DiagnosticCategory.Error, "Cannot_find_namespace_0_Did_you_mean_1_2833", "Cannot find namespace '{0}'. Did you mean '{1}'?"),
8677
8678
  Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
8678
8679
  Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
8679
8680
  Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
@@ -20113,10 +20114,14 @@ var ts;
20113
20114
  var ext = fileName.substr(fileName.lastIndexOf("."));
20114
20115
  switch (ext.toLowerCase()) {
20115
20116
  case ".js" /* Js */:
20117
+ case ".cjs" /* Cjs */:
20118
+ case ".mjs" /* Mjs */:
20116
20119
  return 1 /* JS */;
20117
20120
  case ".jsx" /* Jsx */:
20118
20121
  return 2 /* JSX */;
20119
20122
  case ".ts" /* Ts */:
20123
+ case ".cts" /* Cts */:
20124
+ case ".mts" /* Mts */:
20120
20125
  return 3 /* TS */;
20121
20126
  case ".tsx" /* Tsx */:
20122
20127
  return 4 /* TSX */;
@@ -38691,6 +38696,8 @@ var ts;
38691
38696
  type: new ts.Map(ts.getEntries({
38692
38697
  node: ts.ModuleResolutionKind.NodeJs,
38693
38698
  classic: ts.ModuleResolutionKind.Classic,
38699
+ node12: ts.ModuleResolutionKind.Node12,
38700
+ nodenext: ts.ModuleResolutionKind.NodeNext,
38694
38701
  })),
38695
38702
  affectsModuleResolution: true,
38696
38703
  paramType: ts.Diagnostics.STRATEGY,
@@ -42493,11 +42500,15 @@ var ts;
42493
42500
  if (!scope || !scope.packageJsonContent.exports) {
42494
42501
  return undefined;
42495
42502
  }
42503
+ if (typeof scope.packageJsonContent.name !== "string") {
42504
+ return undefined;
42505
+ }
42496
42506
  var parts = ts.getPathComponents(moduleName); // unrooted paths should have `""` as their 0th entry
42497
- if (scope.packageJsonContent.name !== parts[1]) {
42507
+ var nameParts = ts.getPathComponents(scope.packageJsonContent.name);
42508
+ if (!ts.every(nameParts, function (p, i) { return parts[i] === p; })) {
42498
42509
  return undefined;
42499
42510
  }
42500
- var trailingParts = parts.slice(2);
42511
+ var trailingParts = parts.slice(nameParts.length);
42501
42512
  return loadModuleFromExports(scope, extensions, !ts.length(trailingParts) ? "." : "." + ts.directorySeparator + trailingParts.join(ts.directorySeparator), state, cache, redirectedReference);
42502
42513
  }
42503
42514
  function loadModuleFromExports(scope, extensions, subpath, state, cache, redirectedReference) {
@@ -47975,11 +47986,11 @@ var ts;
47975
47986
  *
47976
47987
  * @param isUse If true, this will count towards --noUnusedLocals / --noUnusedParameters.
47977
47988
  */
47978
- function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, issueSuggestions) {
47989
+ function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals) {
47979
47990
  if (excludeGlobals === void 0) { excludeGlobals = false; }
47980
- return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSymbol, issueSuggestions);
47991
+ return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSymbol);
47981
47992
  }
47982
- function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, lookup, issueSuggestions) {
47993
+ function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, lookup) {
47983
47994
  var _a, _b, _c;
47984
47995
  var originalLocation = location; // needed for did-you-mean error reporting, which gathers candidates starting from the original location
47985
47996
  var result;
@@ -48306,7 +48317,7 @@ var ts;
48306
48317
  !checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) &&
48307
48318
  !checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning)) {
48308
48319
  var suggestion = void 0;
48309
- if (issueSuggestions && suggestionCount < maximumSuggestionCount) {
48320
+ if (suggestionCount < maximumSuggestionCount) {
48310
48321
  suggestion = getSuggestedSymbolForNonexistentSymbol(originalLocation, name, meaning);
48311
48322
  var isGlobalScopeAugmentationDeclaration = (suggestion === null || suggestion === void 0 ? void 0 : suggestion.valueDeclaration) && ts.isAmbientModule(suggestion.valueDeclaration) && ts.isGlobalScopeAugmentation(suggestion.valueDeclaration);
48312
48323
  if (isGlobalScopeAugmentationDeclaration) {
@@ -48315,7 +48326,9 @@ var ts;
48315
48326
  if (suggestion) {
48316
48327
  var suggestionName = symbolToString(suggestion);
48317
48328
  var isUncheckedJS = isUncheckedJSSuggestion(originalLocation, suggestion, /*excludeClasses*/ false);
48318
- var message = isUncheckedJS ? ts.Diagnostics.Could_not_find_name_0_Did_you_mean_1 : ts.Diagnostics.Cannot_find_name_0_Did_you_mean_1;
48329
+ var message = meaning === 1920 /* Namespace */ || nameArg && typeof nameArg !== "string" && ts.nodeIsSynthesized(nameArg) ? ts.Diagnostics.Cannot_find_namespace_0_Did_you_mean_1
48330
+ : isUncheckedJS ? ts.Diagnostics.Could_not_find_name_0_Did_you_mean_1
48331
+ : ts.Diagnostics.Cannot_find_name_0_Did_you_mean_1;
48319
48332
  var diagnostic = createError(errorLocation, message, diagnosticName(nameArg), suggestionName);
48320
48333
  addErrorOrSuggestion(!isUncheckedJS, diagnostic);
48321
48334
  if (suggestion.valueDeclaration) {
@@ -49309,7 +49322,7 @@ var ts;
49309
49322
  if (name.kind === 79 /* Identifier */) {
49310
49323
  var message = meaning === namespaceMeaning || ts.nodeIsSynthesized(name) ? ts.Diagnostics.Cannot_find_namespace_0 : getCannotFindNameDiagnosticForName(ts.getFirstIdentifier(name));
49311
49324
  var symbolFromJSPrototype = ts.isInJSFile(name) && !ts.nodeIsSynthesized(name) ? resolveEntityNameFromAssignmentDeclaration(name, meaning) : undefined;
49312
- symbol = getMergedSymbol(resolveName(location || name, name.escapedText, meaning, ignoreErrors || symbolFromJSPrototype ? undefined : message, name, /*isUse*/ true));
49325
+ symbol = getMergedSymbol(resolveName(location || name, name.escapedText, meaning, ignoreErrors || symbolFromJSPrototype ? undefined : message, name, /*isUse*/ true, false));
49313
49326
  if (!symbol) {
49314
49327
  return getMergedSymbol(symbolFromJSPrototype);
49315
49328
  }
@@ -67087,8 +67100,7 @@ var ts;
67087
67100
  if (!links.resolvedSymbol) {
67088
67101
  links.resolvedSymbol = !ts.nodeIsMissing(node) &&
67089
67102
  resolveName(node, node.escapedText, 111551 /* Value */ | 1048576 /* ExportValue */, getCannotFindNameDiagnosticForName(node), node, !ts.isWriteOnlyAccess(node),
67090
- /*excludeGlobals*/ false,
67091
- /*issueSuggestions*/ true) || unknownSymbol;
67103
+ /*excludeGlobals*/ false) || unknownSymbol;
67092
67104
  }
67093
67105
  return links.resolvedSymbol;
67094
67106
  }
@@ -72579,7 +72591,7 @@ var ts;
72579
72591
  if (relatedInfo) {
72580
72592
  ts.addRelatedInfo(resultDiagnostic, relatedInfo);
72581
72593
  }
72582
- addErrorOrSuggestion(!isUncheckedJS, resultDiagnostic);
72594
+ addErrorOrSuggestion(!isUncheckedJS || errorInfo.code !== ts.Diagnostics.Property_0_may_not_exist_on_type_1_Did_you_mean_2.code, resultDiagnostic);
72583
72595
  }
72584
72596
  function containerSeemsToBeEmptyDomElement(containingType) {
72585
72597
  return (compilerOptions.lib && !compilerOptions.lib.includes("dom")) &&
@@ -72652,7 +72664,19 @@ var ts;
72652
72664
  // Sometimes the symbol is found when location is a return type of a function: `typeof x` and `x` is declared in the body of the function
72653
72665
  // So the table *contains* `x` but `x` isn't actually in scope.
72654
72666
  // However, resolveNameHelper will continue and call this callback again, so we'll eventually get a correct suggestion.
72655
- return symbol || getSpellingSuggestionForName(ts.unescapeLeadingUnderscores(name), ts.arrayFrom(symbols.values()), meaning);
72667
+ if (symbol)
72668
+ return symbol;
72669
+ var candidates;
72670
+ if (symbols === globals) {
72671
+ var primitives = ts.mapDefined(["string", "number", "boolean", "object", "bigint", "symbol"], function (s) { return symbols.has((s.charAt(0).toUpperCase() + s.slice(1)))
72672
+ ? createSymbol(524288 /* TypeAlias */, s)
72673
+ : undefined; });
72674
+ candidates = primitives.concat(ts.arrayFrom(symbols.values()));
72675
+ }
72676
+ else {
72677
+ candidates = ts.arrayFrom(symbols.values());
72678
+ }
72679
+ return getSpellingSuggestionForName(ts.unescapeLeadingUnderscores(name), candidates, meaning);
72656
72680
  });
72657
72681
  return result;
72658
72682
  }
@@ -121094,11 +121118,11 @@ var ts;
121094
121118
  (_b = state.typeReferenceDirectiveResolutionCache) === null || _b === void 0 ? void 0 : _b.update(config.options);
121095
121119
  // Create program
121096
121120
  program = host.createProgram(config.fileNames, config.options, compilerHost, getOldProgram(state, projectPath, config), ts.getConfigFileParsingDiagnostics(config), config.projectReferences);
121097
- state.lastCachedPackageJsonLookups.set(projectPath, state.moduleResolutionCache && ts.map(state.moduleResolutionCache.getPackageJsonInfoCache().entries(), function (_a) {
121098
- var path = _a[0], data = _a[1];
121099
- return [state.host.realpath ? toPath(state, state.host.realpath(path)) : path, data];
121100
- }));
121101
121121
  if (state.watch) {
121122
+ state.lastCachedPackageJsonLookups.set(projectPath, state.moduleResolutionCache && ts.map(state.moduleResolutionCache.getPackageJsonInfoCache().entries(), function (_a) {
121123
+ var path = _a[0], data = _a[1];
121124
+ return [state.host.realpath && data ? toPath(state, state.host.realpath(path)) : path, data];
121125
+ }));
121102
121126
  state.builderPrograms.set(projectPath, program);
121103
121127
  }
121104
121128
  step++;
@@ -123490,28 +123514,85 @@ var ts;
123490
123514
  /** Get the token whose text contains the position */
123491
123515
  function getTokenAtPositionWorker(sourceFile, position, allowPositionInLeadingTrivia, includePrecedingTokenAtEndPosition, includeEndPosition) {
123492
123516
  var current = sourceFile;
123493
- outer: while (true) {
123517
+ var foundToken;
123518
+ var _loop_1 = function () {
123494
123519
  // find the child that contains 'position'
123495
- for (var _i = 0, _a = current.getChildren(sourceFile); _i < _a.length; _i++) {
123496
- var child = _a[_i];
123497
- var start = allowPositionInLeadingTrivia ? child.getFullStart() : child.getStart(sourceFile, /*includeJsDoc*/ true);
123520
+ var children = current.getChildren(sourceFile);
123521
+ var i = ts.binarySearchKey(children, position, function (_, i) { return i; }, function (middle, _) {
123522
+ // This last callback is more of a selector than a comparator -
123523
+ // `EqualTo` causes the `middle` result to be returned
123524
+ // `GreaterThan` causes recursion on the left of the middle
123525
+ // `LessThan` causes recursion on the right of the middle
123526
+ // Let's say you have 3 nodes, spanning positons
123527
+ // pos: 1, end: 3
123528
+ // pos: 3, end: 3
123529
+ // pos: 3, end: 5
123530
+ // and you're looking for the token at positon 3 - all 3 of these nodes are overlapping with position 3.
123531
+ // In fact, there's a _good argument_ that node 2 shouldn't even be allowed to exist - depending on if
123532
+ // the start or end of the ranges are considered inclusive, it's either wholly subsumed by the first or the last node.
123533
+ // Unfortunately, such nodes do exist. :( - See fourslash/completionsImport_tsx.tsx - empty jsx attributes create
123534
+ // a zero-length node.
123535
+ // What also you may not expect is that which node we return depends on the includePrecedingTokenAtEndPosition flag.
123536
+ // Specifically, if includePrecedingTokenAtEndPosition is set, we return the 1-3 node, while if it's unset, we
123537
+ // return the 3-5 node. (The zero length node is never correct.) This is because the includePrecedingTokenAtEndPosition
123538
+ // flag causes us to return the first node whose end position matches the position and which produces and acceptable token
123539
+ // kind. Meanwhile, if includePrecedingTokenAtEndPosition is unset, we look for the first node whose start is <= the
123540
+ // position and whose end is greater than the position.
123541
+ var start = allowPositionInLeadingTrivia ? children[middle].getFullStart() : children[middle].getStart(sourceFile, /*includeJsDoc*/ true);
123498
123542
  if (start > position) {
123499
- // If this child begins after position, then all subsequent children will as well.
123500
- break;
123501
- }
123502
- var end = child.getEnd();
123503
- if (position < end || (position === end && (child.kind === 1 /* EndOfFileToken */ || includeEndPosition))) {
123504
- current = child;
123505
- continue outer;
123543
+ return 1 /* GreaterThan */;
123506
123544
  }
123507
- else if (includePrecedingTokenAtEndPosition && end === position) {
123508
- var previousToken = findPrecedingToken(position, sourceFile, child);
123509
- if (previousToken && includePrecedingTokenAtEndPosition(previousToken)) {
123510
- return previousToken;
123545
+ // first element whose start position is before the input and whose end position is after or equal to the input
123546
+ if (nodeContainsPosition(children[middle])) {
123547
+ if (children[middle - 1]) {
123548
+ // we want the _first_ element that contains the position, so left-recur if the prior node also contains the position
123549
+ if (nodeContainsPosition(children[middle - 1])) {
123550
+ return 1 /* GreaterThan */;
123551
+ }
123511
123552
  }
123553
+ return 0 /* EqualTo */;
123554
+ }
123555
+ // this complex condition makes us left-recur around a zero-length node when includePrecedingTokenAtEndPosition is set, rather than right-recur on it
123556
+ if (includePrecedingTokenAtEndPosition && start === position && children[middle - 1] && children[middle - 1].getEnd() === position && nodeContainsPosition(children[middle - 1])) {
123557
+ return 1 /* GreaterThan */;
123512
123558
  }
123559
+ return -1 /* LessThan */;
123560
+ });
123561
+ if (foundToken) {
123562
+ return { value: foundToken };
123513
123563
  }
123514
- return current;
123564
+ if (i >= 0 && children[i]) {
123565
+ current = children[i];
123566
+ return "continue-outer";
123567
+ }
123568
+ return { value: current };
123569
+ };
123570
+ outer: while (true) {
123571
+ var state_1 = _loop_1();
123572
+ if (typeof state_1 === "object")
123573
+ return state_1.value;
123574
+ switch (state_1) {
123575
+ case "continue-outer": continue outer;
123576
+ }
123577
+ }
123578
+ function nodeContainsPosition(node) {
123579
+ var start = allowPositionInLeadingTrivia ? node.getFullStart() : node.getStart(sourceFile, /*includeJsDoc*/ true);
123580
+ if (start > position) {
123581
+ // If this child begins after position, then all subsequent children will as well.
123582
+ return false;
123583
+ }
123584
+ var end = node.getEnd();
123585
+ if (position < end || (position === end && (node.kind === 1 /* EndOfFileToken */ || includeEndPosition))) {
123586
+ return true;
123587
+ }
123588
+ else if (includePrecedingTokenAtEndPosition && end === position) {
123589
+ var previousToken = findPrecedingToken(position, sourceFile, node);
123590
+ if (previousToken && includePrecedingTokenAtEndPosition(previousToken)) {
123591
+ foundToken = previousToken;
123592
+ return true;
123593
+ }
123594
+ }
123595
+ return false;
123515
123596
  }
123516
123597
  }
123517
123598
  /**
@@ -125500,11 +125581,12 @@ var ts;
125500
125581
  : ts.getNameForExportedSymbol(namedSymbol, scriptTarget);
125501
125582
  var moduleName = ts.stripQuotes(moduleSymbol.name);
125502
125583
  var id = exportInfoId++;
125584
+ var target = ts.skipAlias(symbol, checker);
125503
125585
  var storedSymbol = symbol.flags & 33554432 /* Transient */ ? undefined : symbol;
125504
125586
  var storedModuleSymbol = moduleSymbol.flags & 33554432 /* Transient */ ? undefined : moduleSymbol;
125505
125587
  if (!storedSymbol || !storedModuleSymbol)
125506
125588
  symbols.set(id, [symbol, moduleSymbol]);
125507
- exportInfo.add(key(importedName, symbol, moduleName, checker), {
125589
+ exportInfo.add(key(importedName, symbol, ts.isExternalModuleNameRelative(moduleName) ? undefined : moduleName, checker), {
125508
125590
  id: id,
125509
125591
  symbolTableKey: symbolTableKey,
125510
125592
  symbolName: importedName,
@@ -125512,16 +125594,16 @@ var ts;
125512
125594
  moduleFile: moduleFile,
125513
125595
  moduleFileName: moduleFile === null || moduleFile === void 0 ? void 0 : moduleFile.fileName,
125514
125596
  exportKind: exportKind,
125515
- targetFlags: ts.skipAlias(symbol, checker).flags,
125597
+ targetFlags: target.flags,
125516
125598
  isFromPackageJson: isFromPackageJson,
125517
125599
  symbol: storedSymbol,
125518
125600
  moduleSymbol: storedModuleSymbol,
125519
125601
  });
125520
125602
  },
125521
- get: function (importingFile, importedName, symbol, moduleName, checker) {
125603
+ get: function (importingFile, key) {
125522
125604
  if (importingFile !== usableByFileName)
125523
125605
  return;
125524
- var result = exportInfo.get(key(importedName, symbol, moduleName, checker));
125606
+ var result = exportInfo.get(key);
125525
125607
  return result === null || result === void 0 ? void 0 : result.map(rehydrateCachedInfo);
125526
125608
  },
125527
125609
  forEach: function (importingFile, action) {
@@ -125529,7 +125611,7 @@ var ts;
125529
125611
  return;
125530
125612
  exportInfo.forEach(function (info, key) {
125531
125613
  var _a = parseKey(key), symbolName = _a.symbolName, ambientModuleName = _a.ambientModuleName;
125532
- action(info.map(rehydrateCachedInfo), symbolName, !!ambientModuleName);
125614
+ action(info.map(rehydrateCachedInfo), symbolName, !!ambientModuleName, key);
125533
125615
  });
125534
125616
  },
125535
125617
  releaseSymbols: function () {
@@ -125594,26 +125676,16 @@ var ts;
125594
125676
  isFromPackageJson: isFromPackageJson,
125595
125677
  };
125596
125678
  }
125597
- function key(importedName, symbol, moduleName, checker) {
125598
- var unquoted = ts.stripQuotes(moduleName);
125599
- var moduleKey = ts.isExternalModuleNameRelative(unquoted) ? "/" : unquoted;
125600
- var target = ts.skipAlias(symbol, checker);
125601
- return importedName + "|" + createSymbolKey(target) + "|" + moduleKey;
125679
+ function key(importedName, symbol, ambientModuleName, checker) {
125680
+ var moduleKey = ambientModuleName || "";
125681
+ return importedName + "|" + ts.getSymbolId(ts.skipAlias(symbol, checker)) + "|" + moduleKey;
125602
125682
  }
125603
125683
  function parseKey(key) {
125604
125684
  var symbolName = key.substring(0, key.indexOf("|"));
125605
125685
  var moduleKey = key.substring(key.lastIndexOf("|") + 1);
125606
- var ambientModuleName = moduleKey === "/" ? undefined : moduleKey;
125686
+ var ambientModuleName = moduleKey === "" ? undefined : moduleKey;
125607
125687
  return { symbolName: symbolName, ambientModuleName: ambientModuleName };
125608
125688
  }
125609
- function createSymbolKey(symbol) {
125610
- var key = symbol.name;
125611
- while (symbol.parent) {
125612
- key += "," + symbol.parent.name;
125613
- symbol = symbol.parent;
125614
- }
125615
- return key;
125616
- }
125617
125689
  function fileIsGlobalOnly(file) {
125618
125690
  return !file.commonJsModuleIndicator && !file.externalModuleIndicator && !file.moduleAugmentations && !file.ambientModuleNames;
125619
125691
  }
@@ -125623,7 +125695,7 @@ var ts;
125623
125695
  }
125624
125696
  var oldFileStatementIndex = -1;
125625
125697
  var newFileStatementIndex = -1;
125626
- var _loop_1 = function (ambientModuleName) {
125698
+ var _loop_2 = function (ambientModuleName) {
125627
125699
  var isMatchingModuleDeclaration = function (node) { return ts.isNonGlobalAmbientModule(node) && node.name.text === ambientModuleName; };
125628
125700
  oldFileStatementIndex = ts.findIndex(oldSourceFile.statements, isMatchingModuleDeclaration, oldFileStatementIndex + 1);
125629
125701
  newFileStatementIndex = ts.findIndex(newSourceFile.statements, isMatchingModuleDeclaration, newFileStatementIndex + 1);
@@ -125633,9 +125705,9 @@ var ts;
125633
125705
  };
125634
125706
  for (var _i = 0, _a = newSourceFile.ambientModuleNames; _i < _a.length; _i++) {
125635
125707
  var ambientModuleName = _a[_i];
125636
- var state_1 = _loop_1(ambientModuleName);
125637
- if (typeof state_1 === "object")
125638
- return state_1.value;
125708
+ var state_2 = _loop_2(ambientModuleName);
125709
+ if (typeof state_2 === "object")
125710
+ return state_2.value;
125639
125711
  }
125640
125712
  return true;
125641
125713
  }
@@ -127477,7 +127549,7 @@ var ts;
127477
127549
  continue;
127478
127550
  var patterns = paths[path];
127479
127551
  if (patterns) {
127480
- var _loop_2 = function (name, kind, extension) {
127552
+ var _loop_3 = function (name, kind, extension) {
127481
127553
  // Path mappings may provide a duplicate way to get to something we've already added, so don't add again.
127482
127554
  if (!result.some(function (entry) { return entry.name === name; })) {
127483
127555
  result.push(nameAndKind(name, kind, extension));
@@ -127485,7 +127557,7 @@ var ts;
127485
127557
  };
127486
127558
  for (var _i = 0, _a = getCompletionsForPathMapping(path, patterns, fragment, baseDirectory, fileExtensions, host); _i < _a.length; _i++) {
127487
127559
  var _b = _a[_i], name = _b.name, kind = _b.kind, extension = _b.extension;
127488
- _loop_2(name, kind, extension);
127560
+ _loop_3(name, kind, extension);
127489
127561
  }
127490
127562
  }
127491
127563
  }
@@ -127520,7 +127592,7 @@ var ts;
127520
127592
  // (But do if we didn't find anything, e.g. 'package.json' missing.)
127521
127593
  var foundGlobal = false;
127522
127594
  if (fragmentDirectory === undefined) {
127523
- var _loop_3 = function (moduleName) {
127595
+ var _loop_4 = function (moduleName) {
127524
127596
  if (!result.some(function (entry) { return entry.name === moduleName; })) {
127525
127597
  foundGlobal = true;
127526
127598
  result.push(nameAndKind(moduleName, "external module name" /* externalModuleName */, /*extension*/ undefined));
@@ -127528,7 +127600,7 @@ var ts;
127528
127600
  };
127529
127601
  for (var _b = 0, _c = enumerateNodeModulesVisibleToScript(host, scriptPath); _b < _c.length; _b++) {
127530
127602
  var moduleName = _c[_b];
127531
- _loop_3(moduleName);
127603
+ _loop_4(moduleName);
127532
127604
  }
127533
127605
  }
127534
127606
  if (!foundGlobal) {
@@ -127958,20 +128030,19 @@ var ts;
127958
128030
  }
127959
128031
  }
127960
128032
  Completions.getCompletionsAtPosition = getCompletionsAtPosition;
128033
+ function completionEntryDataIsResolved(data) {
128034
+ return !!(data === null || data === void 0 ? void 0 : data.moduleSpecifier);
128035
+ }
127961
128036
  function continuePreviousIncompleteResponse(cache, file, location, program, host, preferences, cancellationToken) {
127962
- var _a;
127963
128037
  var previousResponse = cache.get();
127964
128038
  if (!previousResponse)
127965
128039
  return undefined;
127966
128040
  var lowerCaseTokenText = location.text.toLowerCase();
127967
128041
  var exportMap = ts.getExportInfoMap(file, host, program, cancellationToken);
127968
- var checker = program.getTypeChecker();
127969
- var autoImportProvider = (_a = host.getPackageJsonAutoImportProvider) === null || _a === void 0 ? void 0 : _a.call(host);
127970
- var autoImportProviderChecker = autoImportProvider === null || autoImportProvider === void 0 ? void 0 : autoImportProvider.getTypeChecker();
127971
128042
  var newEntries = resolvingModuleSpecifiers("continuePreviousIncompleteResponse", host, program, file, preferences,
127972
128043
  /*isForImportStatementCompletion*/ false, function (context) {
127973
128044
  var entries = ts.mapDefined(previousResponse.entries, function (entry) {
127974
- if (!entry.hasAction || !entry.source || !entry.data || entry.data.moduleSpecifier) {
128045
+ if (!entry.hasAction || !entry.source || !entry.data || completionEntryDataIsResolved(entry.data)) {
127975
128046
  // Not an auto import or already resolved; keep as is
127976
128047
  return entry;
127977
128048
  }
@@ -127979,8 +128050,8 @@ var ts;
127979
128050
  // No longer matches typed characters; filter out
127980
128051
  return undefined;
127981
128052
  }
127982
- var _a = ts.Debug.checkDefined(getAutoImportSymbolFromCompletionEntryData(entry.name, entry.data, program, host)), symbol = _a.symbol, origin = _a.origin;
127983
- var info = exportMap.get(file.path, entry.name, symbol, origin.moduleSymbol.name, origin.isFromPackageJson ? autoImportProviderChecker : checker);
128053
+ var origin = ts.Debug.checkDefined(getAutoImportSymbolFromCompletionEntryData(entry.name, entry.data, program, host)).origin;
128054
+ var info = exportMap.get(file.path, entry.data.exportMapKey);
127984
128055
  var result = info && context.tryResolve(info, !ts.isExternalModuleNameRelative(ts.stripQuotes(origin.moduleSymbol.name)));
127985
128056
  if (!result)
127986
128057
  return entry;
@@ -128281,13 +128352,54 @@ var ts;
128281
128352
  return text.replace(/\$/gm, "\\$");
128282
128353
  }
128283
128354
  function originToCompletionEntryData(origin) {
128284
- return {
128355
+ var ambientModuleName = origin.fileName ? undefined : ts.stripQuotes(origin.moduleSymbol.name);
128356
+ var isPackageJsonImport = origin.isFromPackageJson ? true : undefined;
128357
+ if (originIsResolvedExport(origin)) {
128358
+ var resolvedData = {
128359
+ exportName: origin.exportName,
128360
+ moduleSpecifier: origin.moduleSpecifier,
128361
+ ambientModuleName: ambientModuleName,
128362
+ fileName: origin.fileName,
128363
+ isPackageJsonImport: isPackageJsonImport,
128364
+ };
128365
+ return resolvedData;
128366
+ }
128367
+ var unresolvedData = {
128285
128368
  exportName: origin.exportName,
128369
+ exportMapKey: origin.exportMapKey,
128286
128370
  fileName: origin.fileName,
128287
128371
  ambientModuleName: origin.fileName ? undefined : ts.stripQuotes(origin.moduleSymbol.name),
128288
128372
  isPackageJsonImport: origin.isFromPackageJson ? true : undefined,
128289
- moduleSpecifier: originIsResolvedExport(origin) ? origin.moduleSpecifier : undefined,
128290
128373
  };
128374
+ return unresolvedData;
128375
+ }
128376
+ function completionEntryDataToSymbolOriginInfo(data, completionName, moduleSymbol) {
128377
+ var isDefaultExport = data.exportName === "default" /* Default */;
128378
+ var isFromPackageJson = !!data.isPackageJsonImport;
128379
+ if (completionEntryDataIsResolved(data)) {
128380
+ var resolvedOrigin = {
128381
+ kind: 32 /* ResolvedExport */,
128382
+ exportName: data.exportName,
128383
+ moduleSpecifier: data.moduleSpecifier,
128384
+ symbolName: completionName,
128385
+ fileName: data.fileName,
128386
+ moduleSymbol: moduleSymbol,
128387
+ isDefaultExport: isDefaultExport,
128388
+ isFromPackageJson: isFromPackageJson,
128389
+ };
128390
+ return resolvedOrigin;
128391
+ }
128392
+ var unresolvedOrigin = {
128393
+ kind: 4 /* Export */,
128394
+ exportName: data.exportName,
128395
+ exportMapKey: data.exportMapKey,
128396
+ symbolName: completionName,
128397
+ fileName: data.fileName,
128398
+ moduleSymbol: moduleSymbol,
128399
+ isDefaultExport: isDefaultExport,
128400
+ isFromPackageJson: isFromPackageJson,
128401
+ };
128402
+ return unresolvedOrigin;
128291
128403
  }
128292
128404
  function getInsertTextAndReplacementSpanForImportCompletion(name, importCompletionNode, contextToken, origin, useSemicolons, options, preferences) {
128293
128405
  var _a, _b, _c;
@@ -129063,6 +129175,7 @@ var ts;
129063
129175
  }
129064
129176
  }
129065
129177
  function addPropertySymbol(symbol, insertAwait, insertQuestionDot) {
129178
+ var _a;
129066
129179
  // For a computed property with an accessible name like `Symbol.iterator`,
129067
129180
  // we'll add a completion for the *name* `Symbol` instead of for the property.
129068
129181
  // If this is e.g. [Symbol.iterator], add a completion for `Symbol`.
@@ -129076,19 +129189,33 @@ var ts;
129076
129189
  var index = symbols.length;
129077
129190
  symbols.push(firstAccessibleSymbol);
129078
129191
  var moduleSymbol = firstAccessibleSymbol.parent;
129079
- if (!moduleSymbol || !ts.isExternalModuleSymbol(moduleSymbol)) {
129192
+ if (!moduleSymbol ||
129193
+ !ts.isExternalModuleSymbol(moduleSymbol) ||
129194
+ typeChecker.tryGetMemberInModuleExportsAndProperties(firstAccessibleSymbol.name, moduleSymbol) !== firstAccessibleSymbol) {
129080
129195
  symbolToOriginInfoMap[index] = { kind: getNullableSymbolOriginInfoKind(2 /* SymbolMemberNoExport */) };
129081
129196
  }
129082
129197
  else {
129083
- var origin = {
129084
- kind: getNullableSymbolOriginInfoKind(6 /* SymbolMemberExport */),
129085
- moduleSymbol: moduleSymbol,
129086
- isDefaultExport: false,
129087
- symbolName: firstAccessibleSymbol.name,
129088
- exportName: firstAccessibleSymbol.name,
129089
- fileName: ts.isExternalModuleNameRelative(ts.stripQuotes(moduleSymbol.name)) ? ts.cast(moduleSymbol.valueDeclaration, ts.isSourceFile).fileName : undefined,
129090
- };
129091
- symbolToOriginInfoMap[index] = origin;
129198
+ var fileName = ts.isExternalModuleNameRelative(ts.stripQuotes(moduleSymbol.name)) ? (_a = ts.getSourceFileOfModule(moduleSymbol)) === null || _a === void 0 ? void 0 : _a.fileName : undefined;
129199
+ var moduleSpecifier = (ts.codefix.getModuleSpecifierForBestExportInfo([{
129200
+ exportKind: 0 /* Named */,
129201
+ moduleFileName: fileName,
129202
+ isFromPackageJson: false,
129203
+ moduleSymbol: moduleSymbol,
129204
+ symbol: firstAccessibleSymbol,
129205
+ targetFlags: ts.skipAlias(firstAccessibleSymbol, typeChecker).flags,
129206
+ }], sourceFile, program, host, preferences) || {}).moduleSpecifier;
129207
+ if (moduleSpecifier) {
129208
+ var origin = {
129209
+ kind: getNullableSymbolOriginInfoKind(6 /* SymbolMemberExport */),
129210
+ moduleSymbol: moduleSymbol,
129211
+ isDefaultExport: false,
129212
+ symbolName: firstAccessibleSymbol.name,
129213
+ exportName: firstAccessibleSymbol.name,
129214
+ fileName: fileName,
129215
+ moduleSpecifier: moduleSpecifier,
129216
+ };
129217
+ symbolToOriginInfoMap[index] = origin;
129218
+ }
129092
129219
  }
129093
129220
  }
129094
129221
  else if (preferences.includeCompletionsWithInsertText) {
@@ -129324,7 +129451,7 @@ var ts;
129324
129451
  var packageJsonAutoImportProvider = (_b = host.getPackageJsonAutoImportProvider) === null || _b === void 0 ? void 0 : _b.call(host);
129325
129452
  var packageJsonFilter = detailsEntryId ? undefined : ts.createPackageJsonImportFilter(sourceFile, preferences, host);
129326
129453
  resolvingModuleSpecifiers("collectAutoImports", host, program, sourceFile, preferences, !!importCompletionNode, function (context) {
129327
- exportInfo.forEach(sourceFile.path, function (info, symbolName, isFromAmbientModule) {
129454
+ exportInfo.forEach(sourceFile.path, function (info, symbolName, isFromAmbientModule, exportMapKey) {
129328
129455
  if (!ts.isIdentifierText(symbolName, ts.getEmitScriptTarget(host.getCompilationSettings())))
129329
129456
  return;
129330
129457
  if (!detailsEntryId && ts.isStringANonContextualKeyword(symbolName))
@@ -129349,6 +129476,7 @@ var ts;
129349
129476
  kind: moduleSpecifier ? 32 /* ResolvedExport */ : 4 /* Export */,
129350
129477
  moduleSpecifier: moduleSpecifier,
129351
129478
  symbolName: symbolName,
129479
+ exportMapKey: exportMapKey,
129352
129480
  exportName: exportInfo_1.exportKind === 2 /* ExportEquals */ ? "export=" /* ExportEquals */ : exportInfo_1.symbol.name,
129353
129481
  fileName: exportInfo_1.moduleFileName,
129354
129482
  isDefaultExport: isDefaultExport,
@@ -130172,18 +130300,7 @@ var ts;
130172
130300
  return undefined;
130173
130301
  var isDefaultExport = data.exportName === "default" /* Default */;
130174
130302
  symbol = isDefaultExport && ts.getLocalSymbolForExportDefault(symbol) || symbol;
130175
- return {
130176
- symbol: symbol,
130177
- origin: {
130178
- kind: data.moduleSpecifier ? 32 /* ResolvedExport */ : 4 /* Export */,
130179
- moduleSymbol: moduleSymbol,
130180
- symbolName: name,
130181
- isDefaultExport: isDefaultExport,
130182
- exportName: data.exportName,
130183
- fileName: data.fileName,
130184
- isFromPackageJson: !!data.isPackageJsonImport,
130185
- }
130186
- };
130303
+ return { symbol: symbol, origin: completionEntryDataToSymbolOriginInfo(data, name, moduleSymbol) };
130187
130304
  }
130188
130305
  function getCompletionEntryDisplayNameForSymbol(symbol, target, origin, kind, jsxIdentifierExpected) {
130189
130306
  var name = originIncludesSymbolName(origin) ? origin.symbolName : symbol.name;
@@ -132564,7 +132681,7 @@ var ts;
132564
132681
  result = references;
132565
132682
  continue;
132566
132683
  }
132567
- var _loop_4 = function (entry) {
132684
+ var _loop_5 = function (entry) {
132568
132685
  if (!entry.definition || entry.definition.type !== 0 /* Symbol */) {
132569
132686
  result.push(entry);
132570
132687
  return "continue";
@@ -132596,7 +132713,7 @@ var ts;
132596
132713
  };
132597
132714
  for (var _b = 0, references_2 = references; _b < references_2.length; _b++) {
132598
132715
  var entry = references_2[_b];
132599
- _loop_4(entry);
132716
+ _loop_5(entry);
132600
132717
  }
132601
132718
  }
132602
132719
  return result;
@@ -134574,7 +134691,7 @@ var ts;
134574
134691
  }
134575
134692
  function updateImports(program, changeTracker, oldToNew, newToOld, host, getCanonicalFileName) {
134576
134693
  var allFiles = program.getSourceFiles();
134577
- var _loop_5 = function (sourceFile) {
134694
+ var _loop_6 = function (sourceFile) {
134578
134695
  var newFromOld = oldToNew(sourceFile.fileName);
134579
134696
  var newImportFromPath = newFromOld !== null && newFromOld !== void 0 ? newFromOld : sourceFile.fileName;
134580
134697
  var newImportFromDirectory = ts.getDirectoryPath(newImportFromPath);
@@ -134606,7 +134723,7 @@ var ts;
134606
134723
  };
134607
134724
  for (var _i = 0, allFiles_1 = allFiles; _i < allFiles_1.length; _i++) {
134608
134725
  var sourceFile = allFiles_1[_i];
134609
- _loop_5(sourceFile);
134726
+ _loop_6(sourceFile);
134610
134727
  }
134611
134728
  }
134612
134729
  function combineNormal(pathA, pathB) {
@@ -135543,7 +135660,7 @@ var ts;
135543
135660
  if (!patternMatcher)
135544
135661
  return ts.emptyArray;
135545
135662
  var rawItems = [];
135546
- var _loop_6 = function (sourceFile) {
135663
+ var _loop_7 = function (sourceFile) {
135547
135664
  cancellationToken.throwIfCancellationRequested();
135548
135665
  if (excludeDtsFiles && sourceFile.isDeclarationFile) {
135549
135666
  return "continue";
@@ -135555,7 +135672,7 @@ var ts;
135555
135672
  // Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[]
135556
135673
  for (var _i = 0, sourceFiles_4 = sourceFiles; _i < sourceFiles_4.length; _i++) {
135557
135674
  var sourceFile = sourceFiles_4[_i];
135558
- _loop_6(sourceFile);
135675
+ _loop_7(sourceFile);
135559
135676
  }
135560
135677
  rawItems.sort(compareNavigateToItems);
135561
135678
  return (maxResultCount === undefined ? rawItems : rawItems.slice(0, maxResultCount)).map(createNavigateToItem);
@@ -137559,15 +137676,15 @@ var ts;
137559
137676
  // Assumes 'value' is already lowercase.
137560
137677
  function indexOfIgnoringCase(str, value) {
137561
137678
  var n = str.length - value.length;
137562
- var _loop_7 = function (start) {
137679
+ var _loop_8 = function (start) {
137563
137680
  if (every(value, function (valueChar, i) { return toLowerCase(str.charCodeAt(i + start)) === valueChar; })) {
137564
137681
  return { value: start };
137565
137682
  }
137566
137683
  };
137567
137684
  for (var start = 0; start <= n; start++) {
137568
- var state_2 = _loop_7(start);
137569
- if (typeof state_2 === "object")
137570
- return state_2.value;
137685
+ var state_3 = _loop_8(start);
137686
+ if (typeof state_3 === "object")
137687
+ return state_3.value;
137571
137688
  }
137572
137689
  return -1;
137573
137690
  }
@@ -138946,7 +139063,7 @@ var ts;
138946
139063
  return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart);
138947
139064
  }
138948
139065
  function getContainingArgumentInfo(node, position, sourceFile, checker, isManuallyInvoked) {
138949
- var _loop_8 = function (n) {
139066
+ var _loop_9 = function (n) {
138950
139067
  // If the node is not a subspan of its parent, this is a big problem.
138951
139068
  // There have been crashes that might be caused by this violation.
138952
139069
  ts.Debug.assert(ts.rangeContainsRange(n.parent, n), "Not a subspan", function () { return "Child: " + ts.Debug.formatSyntaxKind(n.kind) + ", parent: " + ts.Debug.formatSyntaxKind(n.parent.kind); });
@@ -138956,9 +139073,9 @@ var ts;
138956
139073
  }
138957
139074
  };
138958
139075
  for (var n = node; !ts.isSourceFile(n) && (isManuallyInvoked || !ts.isBlock(n)); n = n.parent) {
138959
- var state_3 = _loop_8(n);
138960
- if (typeof state_3 === "object")
138961
- return state_3.value;
139076
+ var state_4 = _loop_9(n);
139077
+ if (typeof state_4 === "object")
139078
+ return state_4.value;
138962
139079
  }
138963
139080
  return undefined;
138964
139081
  }
@@ -140529,7 +140646,7 @@ var ts;
140529
140646
  commandLineOptionsStringToEnum = commandLineOptionsStringToEnum ||
140530
140647
  ts.filter(ts.optionDeclarations, function (o) { return typeof o.type === "object" && !ts.forEachEntry(o.type, function (v) { return typeof v !== "number"; }); });
140531
140648
  options = ts.cloneCompilerOptions(options);
140532
- var _loop_9 = function (opt) {
140649
+ var _loop_10 = function (opt) {
140533
140650
  if (!ts.hasProperty(options, opt.name)) {
140534
140651
  return "continue";
140535
140652
  }
@@ -140548,7 +140665,7 @@ var ts;
140548
140665
  };
140549
140666
  for (var _i = 0, commandLineOptionsStringToEnum_1 = commandLineOptionsStringToEnum; _i < commandLineOptionsStringToEnum_1.length; _i++) {
140550
140667
  var opt = commandLineOptionsStringToEnum_1[_i];
140551
- _loop_9(opt);
140668
+ _loop_10(opt);
140552
140669
  }
140553
140670
  return options;
140554
140671
  }
@@ -144216,7 +144333,7 @@ var ts;
144216
144333
  ChangeTracker.prototype.finishDeleteDeclarations = function () {
144217
144334
  var _this = this;
144218
144335
  var deletedNodesInLists = new ts.Set(); // Stores nodes in lists that we already deleted. Used to avoid deleting `, ` twice in `a, b`.
144219
- var _loop_10 = function (sourceFile, node) {
144336
+ var _loop_11 = function (sourceFile, node) {
144220
144337
  if (!this_1.deletedNodes.some(function (d) { return d.sourceFile === sourceFile && ts.rangeContainsRangeExclusive(d.node, node); })) {
144221
144338
  if (ts.isArray(node)) {
144222
144339
  this_1.deleteRange(sourceFile, ts.rangeOfTypeParameters(sourceFile, node));
@@ -144229,7 +144346,7 @@ var ts;
144229
144346
  var this_1 = this;
144230
144347
  for (var _i = 0, _a = this.deletedNodes; _i < _a.length; _i++) {
144231
144348
  var _b = _a[_i], sourceFile = _b.sourceFile, node = _b.node;
144232
- _loop_10(sourceFile, node);
144349
+ _loop_11(sourceFile, node);
144233
144350
  }
144234
144351
  deletedNodesInLists.forEach(function (node) {
144235
144352
  var sourceFile = node.getSourceFile();
@@ -144288,14 +144405,14 @@ var ts;
144288
144405
  // order changes by start position
144289
144406
  // If the start position is the same, put the shorter range first, since an empty range (x, x) may precede (x, y) but not vice-versa.
144290
144407
  var normalized = ts.stableSort(changesInFile, function (a, b) { return (a.range.pos - b.range.pos) || (a.range.end - b.range.end); });
144291
- var _loop_11 = function (i) {
144408
+ var _loop_12 = function (i) {
144292
144409
  ts.Debug.assert(normalized[i].range.end <= normalized[i + 1].range.pos, "Changes overlap", function () {
144293
144410
  return JSON.stringify(normalized[i].range) + " and " + JSON.stringify(normalized[i + 1].range);
144294
144411
  });
144295
144412
  };
144296
144413
  // verify that change intervals do not overlap, except possibly at end points.
144297
144414
  for (var i = 0; i < normalized.length - 1; i++) {
144298
- _loop_11(i);
144415
+ _loop_12(i);
144299
144416
  }
144300
144417
  var textChanges = ts.mapDefined(normalized, function (c) {
144301
144418
  var span = ts.createTextSpanFromRange(c.range);
@@ -145199,7 +145316,7 @@ var ts;
145199
145316
  }
145200
145317
  var isCompleteFix = identifiers.isCompleteFix;
145201
145318
  var initializers;
145202
- var _loop_12 = function (identifier) {
145319
+ var _loop_13 = function (identifier) {
145203
145320
  var symbol = checker.getSymbolAtLocation(identifier);
145204
145321
  if (!symbol) {
145205
145322
  return "continue";
@@ -145232,7 +145349,7 @@ var ts;
145232
145349
  };
145233
145350
  for (var _i = 0, _a = identifiers.identifiers; _i < _a.length; _i++) {
145234
145351
  var identifier = _a[_i];
145235
- _loop_12(identifier);
145352
+ _loop_13(identifier);
145236
145353
  }
145237
145354
  return initializers && {
145238
145355
  initializers: initializers,
@@ -146115,7 +146232,7 @@ var ts;
146115
146232
  functionToConvert.getStart(sourceFile);
146116
146233
  var options = functionToConvert.modifiers ? { prefix: " " } : { suffix: " " };
146117
146234
  changes.insertModifierAt(sourceFile, pos, 131 /* AsyncKeyword */, options);
146118
- var _loop_13 = function (returnStatement) {
146235
+ var _loop_14 = function (returnStatement) {
146119
146236
  ts.forEachChild(returnStatement, function visit(node) {
146120
146237
  if (ts.isCallExpression(node)) {
146121
146238
  var newNodes = transformExpression(node, node, transformer, /*hasContinuation*/ false);
@@ -146137,9 +146254,9 @@ var ts;
146137
146254
  };
146138
146255
  for (var _i = 0, returnStatements_1 = returnStatements; _i < returnStatements_1.length; _i++) {
146139
146256
  var returnStatement = returnStatements_1[_i];
146140
- var state_4 = _loop_13(returnStatement);
146141
- if (typeof state_4 === "object")
146142
- return state_4.value;
146257
+ var state_5 = _loop_14(returnStatement);
146258
+ if (typeof state_5 === "object")
146259
+ return state_5.value;
146143
146260
  }
146144
146261
  }
146145
146262
  function getReturnStatementsWithPromiseHandlers(body, checker) {
@@ -148763,6 +148880,7 @@ var ts;
148763
148880
  ts.Diagnostics.Property_0_may_not_exist_on_type_1_Did_you_mean_2.code,
148764
148881
  ts.Diagnostics.Cannot_find_name_0_Did_you_mean_1.code,
148765
148882
  ts.Diagnostics.Could_not_find_name_0_Did_you_mean_1.code,
148883
+ ts.Diagnostics.Cannot_find_namespace_0_Did_you_mean_1.code,
148766
148884
  ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code,
148767
148885
  ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0.code,
148768
148886
  ts.Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2.code,
@@ -149181,7 +149299,7 @@ var ts;
149181
149299
  });
149182
149300
  typeDeclToMembers.forEach(function (infos, classDeclaration) {
149183
149301
  var supers = codefix.getAllSupers(classDeclaration, checker);
149184
- var _loop_14 = function (info) {
149302
+ var _loop_15 = function (info) {
149185
149303
  // If some superclass added this property, don't add it again.
149186
149304
  if (supers.some(function (superClassOrInterface) {
149187
149305
  var superInfos = typeDeclToMembers.get(superClassOrInterface);
@@ -149208,7 +149326,7 @@ var ts;
149208
149326
  };
149209
149327
  for (var _i = 0, infos_1 = infos; _i < infos_1.length; _i++) {
149210
149328
  var info = infos_1[_i];
149211
- _loop_14(info);
149329
+ _loop_15(info);
149212
149330
  }
149213
149331
  });
149214
149332
  }));
@@ -151815,7 +151933,7 @@ var ts;
151815
151933
  function getSignatureFromCalls(calls) {
151816
151934
  var parameters = [];
151817
151935
  var length = Math.max.apply(Math, calls.map(function (c) { return c.argumentTypes.length; }));
151818
- var _loop_15 = function (i) {
151936
+ var _loop_16 = function (i) {
151819
151937
  var symbol = checker.createSymbol(1 /* FunctionScopedVariable */, ts.escapeLeadingUnderscores("arg" + i));
151820
151938
  symbol.type = combineTypes(calls.map(function (call) { return call.argumentTypes[i] || checker.getUndefinedType(); }));
151821
151939
  if (calls.some(function (call) { return call.argumentTypes[i] === undefined; })) {
@@ -151824,7 +151942,7 @@ var ts;
151824
151942
  parameters.push(symbol);
151825
151943
  };
151826
151944
  for (var i = 0; i < length; i++) {
151827
- _loop_15(i);
151945
+ _loop_16(i);
151828
151946
  }
151829
151947
  var returnType = combineFromUsage(combineUsages(calls.map(function (call) { return call.return_; })));
151830
151948
  return checker.createSignature(/*declaration*/ undefined, /*typeParameters*/ undefined, /*thisParameter*/ undefined, parameters, returnType, /*typePredicate*/ undefined, length, 0 /* None */);
@@ -153741,7 +153859,7 @@ var ts;
153741
153859
  // Imports that need to be kept as named imports in the refactored code, to avoid changing the semantics.
153742
153860
  // More specifically, those are named imports that appear in named exports in the original code, e.g. `a` in `import { a } from "m"; export { a }`.
153743
153861
  var neededNamedImports = new ts.Set();
153744
- var _loop_16 = function (element) {
153862
+ var _loop_17 = function (element) {
153745
153863
  var propertyName = (element.propertyName || element.name).text;
153746
153864
  ts.FindAllReferences.Core.eachSymbolReferenceInFile(element.name, checker, sourceFile, function (id) {
153747
153865
  var access = ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier(namespaceImportName), propertyName);
@@ -153758,7 +153876,7 @@ var ts;
153758
153876
  };
153759
153877
  for (var _i = 0, _a = toConvert.elements; _i < _a.length; _i++) {
153760
153878
  var element = _a[_i];
153761
- _loop_16(element);
153879
+ _loop_17(element);
153762
153880
  }
153763
153881
  changes.replaceNode(sourceFile, toConvert, ts.factory.createNamespaceImport(ts.factory.createIdentifier(namespaceImportName)));
153764
153882
  if (neededNamedImports.size) {
@@ -155613,7 +155731,7 @@ var ts;
155613
155731
  : ts.getEnclosingBlockScopeContainer(scopes[0]);
155614
155732
  ts.forEachChild(containingLexicalScopeOfExtraction, checkForUsedDeclarations);
155615
155733
  }
155616
- var _loop_17 = function (i) {
155734
+ var _loop_18 = function (i) {
155617
155735
  var scopeUsages = usagesPerScope[i];
155618
155736
  // Special case: in the innermost scope, all usages are available.
155619
155737
  // (The computed value reflects the value at the top-level of the scope, but the
@@ -155653,7 +155771,7 @@ var ts;
155653
155771
  }
155654
155772
  };
155655
155773
  for (var i = 0; i < scopes.length; i++) {
155656
- _loop_17(i);
155774
+ _loop_18(i);
155657
155775
  }
155658
155776
  return { target: target, usagesPerScope: usagesPerScope, functionErrorsPerScope: functionErrorsPerScope, constantErrorsPerScope: constantErrorsPerScope, exposedVariableDeclarations: exposedVariableDeclarations };
155659
155777
  function isInGenericContext(node) {
@@ -156342,10 +156460,10 @@ var ts;
156342
156460
  }
156343
156461
  function updateImportsInOtherFiles(changes, program, oldFile, movedSymbols, newModuleName) {
156344
156462
  var checker = program.getTypeChecker();
156345
- var _loop_18 = function (sourceFile) {
156463
+ var _loop_19 = function (sourceFile) {
156346
156464
  if (sourceFile === oldFile)
156347
156465
  return "continue";
156348
- var _loop_19 = function (statement) {
156466
+ var _loop_20 = function (statement) {
156349
156467
  forEachImportInStatement(statement, function (importNode) {
156350
156468
  if (checker.getSymbolAtLocation(moduleSpecifierFromImport(importNode)) !== oldFile.symbol)
156351
156469
  return;
@@ -156367,12 +156485,12 @@ var ts;
156367
156485
  };
156368
156486
  for (var _b = 0, _c = sourceFile.statements; _b < _c.length; _b++) {
156369
156487
  var statement = _c[_b];
156370
- _loop_19(statement);
156488
+ _loop_20(statement);
156371
156489
  }
156372
156490
  };
156373
156491
  for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) {
156374
156492
  var sourceFile = _a[_i];
156375
- _loop_18(sourceFile);
156493
+ _loop_19(sourceFile);
156376
156494
  }
156377
156495
  }
156378
156496
  function getNamespaceLikeImport(node) {
@@ -157736,7 +157854,7 @@ var ts;
157736
157854
  var templateSpans = [];
157737
157855
  var templateHead = ts.factory.createTemplateHead(headText, rawHeadText);
157738
157856
  copyCommentFromStringLiterals(headIndexes, templateHead);
157739
- var _loop_20 = function (i) {
157857
+ var _loop_21 = function (i) {
157740
157858
  var currentNode = getExpressionFromParenthesesOrExpression(nodes[i]);
157741
157859
  copyOperatorComments(i, currentNode);
157742
157860
  var _c = concatConsecutiveString(i + 1, nodes), newIndex = _c[0], subsequentText = _c[1], rawSubsequentText = _c[2], stringIndexes = _c[3];
@@ -157765,7 +157883,7 @@ var ts;
157765
157883
  };
157766
157884
  var out_i_1;
157767
157885
  for (var i = begin; i < nodes.length; i++) {
157768
- _loop_20(i);
157886
+ _loop_21(i);
157769
157887
  i = out_i_1;
157770
157888
  }
157771
157889
  return ts.factory.createTemplateExpression(templateHead, templateSpans);