typescript 4.6.0-dev.20220123 → 4.6.0-dev.20220127

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.20220123";
103
+ ts.version = ts.versionMajorMinor + ".0-dev.20220127";
104
104
  /* @internal */
105
105
  var Comparison;
106
106
  (function (Comparison) {
@@ -111,13 +111,18 @@ var ts;
111
111
  /* @internal */
112
112
  var NativeCollections;
113
113
  (function (NativeCollections) {
114
+ var globals = typeof globalThis !== "undefined" ? globalThis :
115
+ typeof global !== "undefined" ? global :
116
+ typeof self !== "undefined" ? self :
117
+ undefined;
114
118
  /**
115
119
  * Returns the native Map implementation if it is available and compatible (i.e. supports iteration).
116
120
  */
117
121
  function tryGetNativeMap() {
118
122
  // Internet Explorer's Map doesn't support iteration, so don't use it.
123
+ var gMap = globals === null || globals === void 0 ? void 0 : globals.Map;
119
124
  // eslint-disable-next-line no-in-operator
120
- return typeof Map !== "undefined" && "entries" in Map.prototype && new Map([[0, 0]]).size === 1 ? Map : undefined;
125
+ return typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined;
121
126
  }
122
127
  NativeCollections.tryGetNativeMap = tryGetNativeMap;
123
128
  /**
@@ -125,8 +130,9 @@ var ts;
125
130
  */
126
131
  function tryGetNativeSet() {
127
132
  // Internet Explorer's Set doesn't support iteration, so don't use it.
133
+ var gSet = globals === null || globals === void 0 ? void 0 : globals.Set;
128
134
  // eslint-disable-next-line no-in-operator
129
- return typeof Set !== "undefined" && "entries" in Set.prototype && new Set([0]).size === 1 ? Set : undefined;
135
+ return typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined;
130
136
  }
131
137
  NativeCollections.tryGetNativeSet = tryGetNativeSet;
132
138
  })(NativeCollections || (NativeCollections = {}));
@@ -9467,6 +9473,8 @@ var ts;
9467
9473
  Remove_unused_declarations_for_Colon_0: diag(90041, ts.DiagnosticCategory.Message, "Remove_unused_declarations_for_Colon_0_90041", "Remove unused declarations for: '{0}'"),
9468
9474
  Declare_a_private_field_named_0: diag(90053, ts.DiagnosticCategory.Message, "Declare_a_private_field_named_0_90053", "Declare a private field named '{0}'."),
9469
9475
  Includes_imports_of_types_referenced_by_0: diag(90054, ts.DiagnosticCategory.Message, "Includes_imports_of_types_referenced_by_0_90054", "Includes imports of types referenced by '{0}'"),
9476
+ Remove_type_from_import_declaration_from_0: diag(90055, ts.DiagnosticCategory.Message, "Remove_type_from_import_declaration_from_0_90055", "Remove 'type' from import declaration from \"{0}\""),
9477
+ Remove_type_from_import_of_0_from_1: diag(90056, ts.DiagnosticCategory.Message, "Remove_type_from_import_of_0_from_1_90056", "Remove 'type' from import of '{0}' from \"{1}\""),
9470
9478
  Convert_function_to_an_ES2015_class: diag(95001, ts.DiagnosticCategory.Message, "Convert_function_to_an_ES2015_class_95001", "Convert function to an ES2015 class"),
9471
9479
  Convert_0_to_1_in_0: diag(95003, ts.DiagnosticCategory.Message, "Convert_0_to_1_in_0_95003", "Convert '{0}' to '{1} in {0}'"),
9472
9480
  Extract_to_0_in_1: diag(95004, ts.DiagnosticCategory.Message, "Extract_to_0_in_1_95004", "Extract to {0} in {1}"),
@@ -14057,10 +14065,13 @@ var ts;
14057
14065
  function packageIdIsEqual(a, b) {
14058
14066
  return a === b || !!a && !!b && a.name === b.name && a.subModuleName === b.subModuleName && a.version === b.version;
14059
14067
  }
14060
- function packageIdToString(_a) {
14061
- var name = _a.name, subModuleName = _a.subModuleName, version = _a.version;
14062
- var fullName = subModuleName ? name + "/" + subModuleName : name;
14063
- return fullName + "@" + version;
14068
+ function packageIdToPackageName(_a) {
14069
+ var name = _a.name, subModuleName = _a.subModuleName;
14070
+ return subModuleName ? name + "/" + subModuleName : name;
14071
+ }
14072
+ ts.packageIdToPackageName = packageIdToPackageName;
14073
+ function packageIdToString(packageId) {
14074
+ return packageIdToPackageName(packageId) + "@" + packageId.version;
14064
14075
  }
14065
14076
  ts.packageIdToString = packageIdToString;
14066
14077
  function typeDirectiveIsEqualTo(oldResolution, newResolution) {
@@ -14893,6 +14904,15 @@ var ts;
14893
14904
  };
14894
14905
  }
14895
14906
  ts.createDiagnosticForFileFromMessageChain = createDiagnosticForFileFromMessageChain;
14907
+ function createDiagnosticMessageChainFromDiagnostic(diagnostic) {
14908
+ return typeof diagnostic.messageText === "string" ? {
14909
+ code: diagnostic.code,
14910
+ category: diagnostic.category,
14911
+ messageText: diagnostic.messageText,
14912
+ next: diagnostic.next,
14913
+ } : diagnostic.messageText;
14914
+ }
14915
+ ts.createDiagnosticMessageChainFromDiagnostic = createDiagnosticMessageChainFromDiagnostic;
14896
14916
  function createDiagnosticForRange(sourceFile, range, message) {
14897
14917
  return {
14898
14918
  file: sourceFile,
@@ -15061,7 +15081,8 @@ var ts;
15061
15081
  node.kind === 212 /* FunctionExpression */ ||
15062
15082
  node.kind === 213 /* ArrowFunction */ ||
15063
15083
  node.kind === 211 /* ParenthesizedExpression */ ||
15064
- node.kind === 253 /* VariableDeclaration */) ?
15084
+ node.kind === 253 /* VariableDeclaration */ ||
15085
+ node.kind === 274 /* ExportSpecifier */) ?
15065
15086
  ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) :
15066
15087
  ts.getLeadingCommentRanges(text, node.pos);
15067
15088
  // True if the comment starts with '/**' but not if it is '/**/'
@@ -36212,7 +36233,8 @@ var ts;
36212
36233
  return finishNode(node, pos);
36213
36234
  }
36214
36235
  function parseExportSpecifier() {
36215
- return parseImportOrExportSpecifier(274 /* ExportSpecifier */);
36236
+ var hasJSDoc = hasPrecedingJSDocComment();
36237
+ return withJSDoc(parseImportOrExportSpecifier(274 /* ExportSpecifier */), hasJSDoc);
36216
36238
  }
36217
36239
  function parseImportSpecifier() {
36218
36240
  return parseImportOrExportSpecifier(269 /* ImportSpecifier */);
@@ -43417,14 +43439,12 @@ var ts;
43417
43439
  }
43418
43440
  var binder = createBinder();
43419
43441
  function bindSourceFile(file, options) {
43420
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("bind" /* Bind */, "bindSourceFile", { path: file.path }, /*separateBeginAndEnd*/ true);
43421
43442
  ts.performance.mark("beforeBind");
43422
43443
  ts.perfLogger.logStartBindFile("" + file.fileName);
43423
43444
  binder(file, options);
43424
43445
  ts.perfLogger.logStopBindFile();
43425
43446
  ts.performance.mark("afterBind");
43426
43447
  ts.performance.measure("Bind", "beforeBind", "afterBind");
43427
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
43428
43448
  }
43429
43449
  ts.bindSourceFile = bindSourceFile;
43430
43450
  function createBinder() {
@@ -43484,7 +43504,9 @@ var ts;
43484
43504
  ts.Debug.attachFlowNodeDebugInfo(unreachableFlow);
43485
43505
  ts.Debug.attachFlowNodeDebugInfo(reportedUnreachableFlow);
43486
43506
  if (!file.locals) {
43507
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("bind" /* Bind */, "bindSourceFile", { path: file.path }, /*separateBeginAndEnd*/ true);
43487
43508
  bind(file);
43509
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
43488
43510
  file.symbolCount = symbolCount;
43489
43511
  file.classifiableNames = classifiableNames;
43490
43512
  delayedBindJSDocTypedefTag();
@@ -47751,6 +47773,9 @@ var ts;
47751
47773
  suggestionDiagnostics.add(diagnostic);
47752
47774
  return diagnostic;
47753
47775
  }
47776
+ function isDeprecatedSymbol(symbol) {
47777
+ return !!(getDeclarationNodeFlagsFromSymbol(symbol) & 134217728 /* Deprecated */);
47778
+ }
47754
47779
  function addDeprecatedSuggestion(location, declarations, deprecatedEntity) {
47755
47780
  var diagnostic = ts.createDiagnosticForNode(location, ts.Diagnostics._0_is_deprecated, deprecatedEntity);
47756
47781
  return addDeprecatedSuggestionWorker(declarations, diagnostic);
@@ -52521,7 +52546,8 @@ var ts;
52521
52546
  includePrivateSymbol === null || includePrivateSymbol === void 0 ? void 0 : includePrivateSymbol(sym);
52522
52547
  }
52523
52548
  if (ts.isIdentifier(node)) {
52524
- var name = sym.flags & 262144 /* TypeParameter */ ? typeParameterToName(getDeclaredTypeOfSymbol(sym), context) : ts.factory.cloneNode(node);
52549
+ var type = getDeclaredTypeOfSymbol(sym);
52550
+ var name = sym.flags & 262144 /* TypeParameter */ && !isTypeSymbolAccessible(type.symbol, context.enclosingDeclaration) ? typeParameterToName(type, context) : ts.factory.cloneNode(node);
52525
52551
  name.symbol = sym; // for quickinfo, which uses identifier symbol information
52526
52552
  return { introducesError: introducesError, node: ts.setEmitFlags(ts.setOriginalNode(name, node), 16777216 /* NoAsciiEscaping */) };
52527
52553
  }
@@ -60537,7 +60563,7 @@ var ts;
60537
60563
  }
60538
60564
  var prop = getPropertyOfType(objectType, propName);
60539
60565
  if (prop) {
60540
- if (accessFlags & 64 /* ReportDeprecated */ && accessNode && prop.declarations && getDeclarationNodeFlagsFromSymbol(prop) & 134217728 /* Deprecated */ && isUncalledFunctionReference(accessNode, prop)) {
60566
+ if (accessFlags & 64 /* ReportDeprecated */ && accessNode && prop.declarations && isDeprecatedSymbol(prop) && isUncalledFunctionReference(accessNode, prop)) {
60541
60567
  var deprecatedNode = (_a = accessExpression === null || accessExpression === void 0 ? void 0 : accessExpression.argumentExpression) !== null && _a !== void 0 ? _a : (ts.isIndexedAccessTypeNode(accessNode) ? accessNode.indexType : accessNode);
60542
60568
  addDeprecatedSuggestion(deprecatedNode, prop.declarations, propName);
60543
60569
  }
@@ -69940,9 +69966,9 @@ var ts;
69940
69966
  markAliasReferenced(symbol, node);
69941
69967
  }
69942
69968
  var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
69943
- var sourceSymbol = localOrExportSymbol.flags & 2097152 /* Alias */ ? resolveAlias(localOrExportSymbol) : localOrExportSymbol;
69944
- if (sourceSymbol.declarations && getDeclarationNodeFlagsFromSymbol(sourceSymbol) & 134217728 /* Deprecated */ && isUncalledFunctionReference(node, sourceSymbol)) {
69945
- addDeprecatedSuggestion(node, sourceSymbol.declarations, node.escapedText);
69969
+ var targetSymbol = checkDeprecatedAliasedSymbol(localOrExportSymbol, node);
69970
+ if (isDeprecatedSymbol(targetSymbol) && isUncalledFunctionReference(node, targetSymbol) && targetSymbol.declarations) {
69971
+ addDeprecatedSuggestion(node, targetSymbol.declarations, node.escapedText);
69946
69972
  }
69947
69973
  var declaration = localOrExportSymbol.valueDeclaration;
69948
69974
  if (declaration && localOrExportSymbol.flags & 32 /* Class */) {
@@ -72954,7 +72980,7 @@ var ts;
72954
72980
  }
72955
72981
  }
72956
72982
  else {
72957
- if (prop.declarations && getDeclarationNodeFlagsFromSymbol(prop) & 134217728 /* Deprecated */ && isUncalledFunctionReference(node, prop)) {
72983
+ if (isDeprecatedSymbol(prop) && isUncalledFunctionReference(node, prop) && prop.declarations) {
72958
72984
  addDeprecatedSuggestion(right, prop.declarations, right.escapedText);
72959
72985
  }
72960
72986
  checkPropertyNotUsedBeforeDeclaration(prop, node, right);
@@ -74413,7 +74439,7 @@ var ts;
74413
74439
  }
74414
74440
  var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
74415
74441
  ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
74416
- var chain = ts.chainDiagnosticMessages(ts.map(diags_3, function (d) { return typeof d.messageText === "string" ? d : d.messageText; }), ts.Diagnostics.No_overload_matches_this_call);
74442
+ var chain = ts.chainDiagnosticMessages(ts.map(diags_3, ts.createDiagnosticMessageChainFromDiagnostic), ts.Diagnostics.No_overload_matches_this_call);
74417
74443
  // The below is a spread to guarantee we get a new (mutable) array - our `flatMap` helper tries to do "smart" optimizations where it reuses input
74418
74444
  // arrays and the emptyArray singleton where possible, which is decidedly not what we want while we're still constructing this diagnostic
74419
74445
  var related = __spreadArray([], ts.flatMap(diags_3, function (d) { return d.relatedInformation; }), true);
@@ -82792,16 +82818,15 @@ var ts;
82792
82818
  return ts.nodeIsMissing(expr) ? 0 : evaluateEnumMember(expr, getSymbolOfNode(member.parent), identifier.escapedText);
82793
82819
  case 206 /* ElementAccessExpression */:
82794
82820
  case 205 /* PropertyAccessExpression */:
82795
- var ex = expr;
82796
- if (isConstantMemberAccess(ex)) {
82797
- var type = getTypeOfExpression(ex.expression);
82821
+ if (isConstantMemberAccess(expr)) {
82822
+ var type = getTypeOfExpression(expr.expression);
82798
82823
  if (type.symbol && type.symbol.flags & 384 /* Enum */) {
82799
82824
  var name = void 0;
82800
- if (ex.kind === 205 /* PropertyAccessExpression */) {
82801
- name = ex.name.escapedText;
82825
+ if (expr.kind === 205 /* PropertyAccessExpression */) {
82826
+ name = expr.name.escapedText;
82802
82827
  }
82803
82828
  else {
82804
- name = ts.escapeLeadingUnderscores(ts.cast(ex.argumentExpression, ts.isLiteralExpression).text);
82829
+ name = ts.escapeLeadingUnderscores(ts.cast(expr.argumentExpression, ts.isLiteralExpression).text);
82805
82830
  }
82806
82831
  return evaluateEnumMember(expr, type.symbol, name);
82807
82832
  }
@@ -82829,6 +82854,10 @@ var ts;
82829
82854
  }
82830
82855
  }
82831
82856
  function isConstantMemberAccess(node) {
82857
+ var type = getTypeOfExpression(node);
82858
+ if (type === errorType) {
82859
+ return false;
82860
+ }
82832
82861
  return node.kind === 79 /* Identifier */ ||
82833
82862
  node.kind === 205 /* PropertyAccessExpression */ && isConstantMemberAccess(node.expression) ||
82834
82863
  node.kind === 206 /* ElementAccessExpression */ && isConstantMemberAccess(node.expression) &&
@@ -83123,7 +83152,6 @@ var ts;
83123
83152
  return true;
83124
83153
  }
83125
83154
  function checkAliasSymbol(node) {
83126
- var _a;
83127
83155
  var symbol = getSymbolOfNode(node);
83128
83156
  var target = resolveAlias(symbol);
83129
83157
  if (target !== unknownSymbol) {
@@ -83179,10 +83207,45 @@ var ts;
83179
83207
  }
83180
83208
  }
83181
83209
  }
83182
- if (ts.isImportSpecifier(node) && ((_a = target.declarations) === null || _a === void 0 ? void 0 : _a.every(function (d) { return !!(ts.getCombinedNodeFlags(d) & 134217728 /* Deprecated */); }))) {
83183
- addDeprecatedSuggestion(node.name, target.declarations, symbol.escapedName);
83210
+ if (ts.isImportSpecifier(node)) {
83211
+ var targetSymbol = checkDeprecatedAliasedSymbol(symbol, node);
83212
+ if (isDeprecatedAliasedSymbol(targetSymbol) && targetSymbol.declarations) {
83213
+ addDeprecatedSuggestion(node, targetSymbol.declarations, targetSymbol.escapedName);
83214
+ }
83215
+ }
83216
+ }
83217
+ }
83218
+ function isDeprecatedAliasedSymbol(symbol) {
83219
+ return !!symbol.declarations && ts.every(symbol.declarations, function (d) { return !!(ts.getCombinedNodeFlags(d) & 134217728 /* Deprecated */); });
83220
+ }
83221
+ function checkDeprecatedAliasedSymbol(symbol, location) {
83222
+ if (!(symbol.flags & 2097152 /* Alias */))
83223
+ return symbol;
83224
+ var targetSymbol = resolveAlias(symbol);
83225
+ if (targetSymbol === unknownSymbol)
83226
+ return targetSymbol;
83227
+ while (symbol.flags & 2097152 /* Alias */) {
83228
+ var target = getImmediateAliasedSymbol(symbol);
83229
+ if (target) {
83230
+ if (target === targetSymbol)
83231
+ break;
83232
+ if (target.declarations && ts.length(target.declarations)) {
83233
+ if (isDeprecatedAliasedSymbol(target)) {
83234
+ addDeprecatedSuggestion(location, target.declarations, target.escapedName);
83235
+ break;
83236
+ }
83237
+ else {
83238
+ if (symbol === targetSymbol)
83239
+ break;
83240
+ symbol = target;
83241
+ }
83242
+ }
83243
+ }
83244
+ else {
83245
+ break;
83184
83246
  }
83185
83247
  }
83248
+ return targetSymbol;
83186
83249
  }
83187
83250
  function checkImportBinding(node) {
83188
83251
  checkCollisionsForDeclarationName(node, node.name);
@@ -115841,14 +115904,14 @@ var ts;
115841
115904
  redirectTargetsMap.add(fileFromPackageId.path, fileName);
115842
115905
  addFileToFilesByName(dupFile, path, redirectedPath);
115843
115906
  addFileIncludeReason(dupFile, reason);
115844
- sourceFileToPackageName.set(path, packageId.name);
115907
+ sourceFileToPackageName.set(path, ts.packageIdToPackageName(packageId));
115845
115908
  processingOtherFiles.push(dupFile);
115846
115909
  return dupFile;
115847
115910
  }
115848
115911
  else if (file) {
115849
115912
  // This is the first source file to have this packageId.
115850
115913
  packageIdToSourceFile.set(packageIdKey, file);
115851
- sourceFileToPackageName.set(path, packageId.name);
115914
+ sourceFileToPackageName.set(path, ts.packageIdToPackageName(packageId));
115852
115915
  }
115853
115916
  }
115854
115917
  addFileToFilesByName(file, path, redirectedPath);
@@ -126508,11 +126571,11 @@ var ts;
126508
126571
  return ts.isArray(valueOrArray) ? ts.first(valueOrArray) : valueOrArray;
126509
126572
  }
126510
126573
  ts.firstOrOnly = firstOrOnly;
126511
- function getNameForExportedSymbol(symbol, scriptTarget) {
126574
+ function getNameForExportedSymbol(symbol, scriptTarget, preferCapitalized) {
126512
126575
  if (!(symbol.flags & 33554432 /* Transient */) && (symbol.escapedName === "export=" /* ExportEquals */ || symbol.escapedName === "default" /* Default */)) {
126513
126576
  // Name of "export default foo;" is "foo". Name of "export default 0" is the filename converted to camelCase.
126514
126577
  return ts.firstDefined(symbol.declarations, function (d) { var _a; return ts.isExportAssignment(d) ? (_a = ts.tryCast(ts.skipOuterExpressions(d.expression), ts.isIdentifier)) === null || _a === void 0 ? void 0 : _a.text : undefined; })
126515
- || ts.codefix.moduleSymbolToValidIdentifier(getSymbolParentOrFail(symbol), scriptTarget);
126578
+ || ts.codefix.moduleSymbolToValidIdentifier(getSymbolParentOrFail(symbol), scriptTarget, !!preferCapitalized);
126516
126579
  }
126517
126580
  return symbol.name;
126518
126581
  }
@@ -126640,7 +126703,7 @@ var ts;
126640
126703
  symbols.clear();
126641
126704
  usableByFileName = undefined;
126642
126705
  },
126643
- add: function (importingFile, symbol, symbolTableKey, moduleSymbol, moduleFile, exportKind, isFromPackageJson, scriptTarget, checker) {
126706
+ add: function (importingFile, symbol, symbolTableKey, moduleSymbol, moduleFile, exportKind, isFromPackageJson, checker) {
126644
126707
  if (importingFile !== usableByFileName) {
126645
126708
  cache.clear();
126646
126709
  usableByFileName = importingFile;
@@ -126656,7 +126719,7 @@ var ts;
126656
126719
  // get a better name.
126657
126720
  var importedName = exportKind === 0 /* Named */ || ts.isExternalModuleSymbol(namedSymbol)
126658
126721
  ? ts.unescapeLeadingUnderscores(symbolTableKey)
126659
- : ts.getNameForExportedSymbol(namedSymbol, scriptTarget);
126722
+ : ts.getNameForExportedSymbol(namedSymbol, /*scriptTarget*/ undefined);
126660
126723
  var moduleName = ts.stripQuotes(moduleSymbol.name);
126661
126724
  var id = exportInfoId++;
126662
126725
  var target = ts.skipAlias(symbol, checker);
@@ -126689,7 +126752,14 @@ var ts;
126689
126752
  return;
126690
126753
  exportInfo.forEach(function (info, key) {
126691
126754
  var _a = parseKey(key), symbolName = _a.symbolName, ambientModuleName = _a.ambientModuleName;
126692
- action(info.map(rehydrateCachedInfo), symbolName, !!ambientModuleName, key);
126755
+ var rehydrated = info.map(rehydrateCachedInfo);
126756
+ action(rehydrated, function (preferCapitalized) {
126757
+ var _a = rehydrated[0], symbol = _a.symbol, exportKind = _a.exportKind;
126758
+ var namedSymbol = exportKind === 1 /* Default */ && ts.getLocalSymbolForExportDefault(symbol) || symbol;
126759
+ return preferCapitalized
126760
+ ? ts.getNameForExportedSymbol(namedSymbol, /*scriptTarget*/ undefined, /*preferCapitalized*/ true)
126761
+ : symbolName;
126762
+ }, !!ambientModuleName, key);
126693
126763
  });
126694
126764
  },
126695
126765
  releaseSymbols: function () {
@@ -126871,7 +126941,6 @@ var ts;
126871
126941
  }
126872
126942
  (_d = host.log) === null || _d === void 0 ? void 0 : _d.call(host, "getExportInfoMap: cache miss or empty; calculating new results");
126873
126943
  var compilerOptions = program.getCompilerOptions();
126874
- var scriptTarget = ts.getEmitScriptTarget(compilerOptions);
126875
126944
  var moduleCount = 0;
126876
126945
  forEachExternalModuleToImportFrom(program, host, /*useAutoImportProvider*/ true, function (moduleSymbol, moduleFile, program, isFromPackageJson) {
126877
126946
  if (++moduleCount % 100 === 0)
@@ -126882,11 +126951,11 @@ var ts;
126882
126951
  // Note: I think we shouldn't actually see resolved module symbols here, but weird merges
126883
126952
  // can cause it to happen: see 'completionsImport_mergedReExport.ts'
126884
126953
  if (defaultInfo && isImportableSymbol(defaultInfo.symbol, checker)) {
126885
- cache.add(importingFile.path, defaultInfo.symbol, defaultInfo.exportKind === 1 /* Default */ ? "default" /* Default */ : "export=" /* ExportEquals */, moduleSymbol, moduleFile, defaultInfo.exportKind, isFromPackageJson, scriptTarget, checker);
126954
+ cache.add(importingFile.path, defaultInfo.symbol, defaultInfo.exportKind === 1 /* Default */ ? "default" /* Default */ : "export=" /* ExportEquals */, moduleSymbol, moduleFile, defaultInfo.exportKind, isFromPackageJson, checker);
126886
126955
  }
126887
126956
  checker.forEachExportAndPropertyOfModule(moduleSymbol, function (exported, key) {
126888
126957
  if (exported !== (defaultInfo === null || defaultInfo === void 0 ? void 0 : defaultInfo.symbol) && isImportableSymbol(exported, checker) && ts.addToSeen(seenExports, key)) {
126889
- cache.add(importingFile.path, exported, key, moduleSymbol, moduleFile, 0 /* Named */, isFromPackageJson, scriptTarget, checker);
126958
+ cache.add(importingFile.path, exported, key, moduleSymbol, moduleFile, 0 /* Named */, isFromPackageJson, checker);
126890
126959
  }
126891
126960
  });
126892
126961
  });
@@ -128960,6 +129029,8 @@ var ts;
128960
129029
  CompletionSource["ThisProperty"] = "ThisProperty/";
128961
129030
  /** Auto-import that comes attached to a class member snippet */
128962
129031
  CompletionSource["ClassMemberSnippet"] = "ClassMemberSnippet/";
129032
+ /** A type-only import that needs to be promoted in order to be used at the completion location */
129033
+ CompletionSource["TypeOnlyAlias"] = "TypeOnlyAlias/";
128963
129034
  })(CompletionSource = Completions.CompletionSource || (Completions.CompletionSource = {}));
128964
129035
  var SymbolOriginInfoKind;
128965
129036
  (function (SymbolOriginInfoKind) {
@@ -128969,6 +129040,7 @@ var ts;
128969
129040
  SymbolOriginInfoKind[SymbolOriginInfoKind["Promise"] = 8] = "Promise";
128970
129041
  SymbolOriginInfoKind[SymbolOriginInfoKind["Nullable"] = 16] = "Nullable";
128971
129042
  SymbolOriginInfoKind[SymbolOriginInfoKind["ResolvedExport"] = 32] = "ResolvedExport";
129043
+ SymbolOriginInfoKind[SymbolOriginInfoKind["TypeOnlyAlias"] = 64] = "TypeOnlyAlias";
128972
129044
  SymbolOriginInfoKind[SymbolOriginInfoKind["SymbolMemberNoExport"] = 2] = "SymbolMemberNoExport";
128973
129045
  SymbolOriginInfoKind[SymbolOriginInfoKind["SymbolMemberExport"] = 6] = "SymbolMemberExport";
128974
129046
  })(SymbolOriginInfoKind || (SymbolOriginInfoKind = {}));
@@ -128996,6 +129068,9 @@ var ts;
128996
129068
  function originIsNullableMember(origin) {
128997
129069
  return !!(origin.kind & 16 /* Nullable */);
128998
129070
  }
129071
+ function originIsTypeOnlyAlias(origin) {
129072
+ return !!(origin && origin.kind & 64 /* TypeOnlyAlias */);
129073
+ }
128999
129074
  var KeywordCompletionFilters;
129000
129075
  (function (KeywordCompletionFilters) {
129001
129076
  KeywordCompletionFilters[KeywordCompletionFilters["None"] = 0] = "None";
@@ -129400,6 +129475,9 @@ var ts;
129400
129475
  isSnippet = preferences.includeCompletionsWithSnippetText ? true : undefined;
129401
129476
  }
129402
129477
  }
129478
+ if ((origin === null || origin === void 0 ? void 0 : origin.kind) === 64 /* TypeOnlyAlias */) {
129479
+ hasAction = true;
129480
+ }
129403
129481
  if (preferences.includeCompletionsWithClassMemberSnippets &&
129404
129482
  preferences.includeCompletionsWithInsertText &&
129405
129483
  completionKind === 3 /* MemberLike */ &&
@@ -129744,6 +129822,9 @@ var ts;
129744
129822
  if ((origin === null || origin === void 0 ? void 0 : origin.kind) === 1 /* ThisType */) {
129745
129823
  return CompletionSource.ThisProperty;
129746
129824
  }
129825
+ if ((origin === null || origin === void 0 ? void 0 : origin.kind) === 64 /* TypeOnlyAlias */) {
129826
+ return CompletionSource.TypeOnlyAlias;
129827
+ }
129747
129828
  }
129748
129829
  function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextIdMap, isJsxIdentifierExpected, isRightOfOpenTag) {
129749
129830
  var _a;
@@ -129771,7 +129852,7 @@ var ts;
129771
129852
  continue;
129772
129853
  }
129773
129854
  /** True for locals; false for globals, module exports from other files, `this.` completions. */
129774
- var shouldShadowLaterSymbols = !origin && !(symbol.parent === undefined && !ts.some(symbol.declarations, function (d) { return d.getSourceFile() === location.getSourceFile(); }));
129855
+ var shouldShadowLaterSymbols = (!origin || originIsTypeOnlyAlias(origin)) && !(symbol.parent === undefined && !ts.some(symbol.declarations, function (d) { return d.getSourceFile() === location.getSourceFile(); }));
129775
129856
  uniques.set(name, shouldShadowLaterSymbols);
129776
129857
  ts.insertSorted(entries, entry, compareCompletionEntries, /*allowDuplicates*/ true);
129777
129858
  }
@@ -129784,6 +129865,7 @@ var ts;
129784
129865
  add: function (name) { return uniques.set(name, true); },
129785
129866
  };
129786
129867
  function shouldIncludeSymbol(symbol, symbolToSortTextIdMap) {
129868
+ var allFlags = symbol.flags;
129787
129869
  if (!ts.isSourceFile(location)) {
129788
129870
  // export = /**/ here we want to get all meanings, so any symbol is ok
129789
129871
  if (ts.isExportAssignment(location.parent)) {
@@ -129809,11 +129891,10 @@ var ts;
129809
129891
  || symbolToSortTextIdMap[ts.getSymbolId(symbolOrigin)] === 11 /* LocationPriority */)) {
129810
129892
  return false;
129811
129893
  }
129812
- // Continue with origin symbol
129813
- symbol = symbolOrigin;
129894
+ allFlags |= ts.getCombinedLocalAndExportSymbolFlags(symbolOrigin);
129814
129895
  // import m = /**/ <-- It can only access namespace (if typing import = x. this would get member symbols and not namespace)
129815
129896
  if (ts.isInRightSideOfInternalImportEqualsDeclaration(location)) {
129816
- return !!(symbol.flags & 1920 /* Namespace */);
129897
+ return !!(allFlags & 1920 /* Namespace */);
129817
129898
  }
129818
129899
  if (isTypeOnlyLocation) {
129819
129900
  // It's a type, but you can reach it by namespace.type as well
@@ -129821,7 +129902,7 @@ var ts;
129821
129902
  }
129822
129903
  }
129823
129904
  // expressions are value space (which includes the value namespaces)
129824
- return !!(ts.getCombinedLocalAndExportSymbolFlags(symbol) & 111551 /* Value */);
129905
+ return !!(allFlags & 111551 /* Value */);
129825
129906
  }
129826
129907
  }
129827
129908
  Completions.getCompletionEntriesFromSymbols = getCompletionEntriesFromSymbols;
@@ -129955,8 +130036,7 @@ var ts;
129955
130036
  Completions.createCompletionDetails = createCompletionDetails;
129956
130037
  function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source) {
129957
130038
  if (data === null || data === void 0 ? void 0 : data.moduleSpecifier) {
129958
- var _a = getRelevantTokens(position, sourceFile), contextToken_3 = _a.contextToken, previousToken_2 = _a.previousToken;
129959
- if (previousToken_2 && getImportStatementCompletionInfo(contextToken_3 || previousToken_2).replacementNode) {
130039
+ if (previousToken && getImportStatementCompletionInfo(contextToken || previousToken).replacementNode) {
129960
130040
  // Import statement completion: 'import c|'
129961
130041
  return { codeActions: undefined, sourceDisplay: [ts.textPart(data.moduleSpecifier)] };
129962
130042
  }
@@ -129974,13 +130054,19 @@ var ts;
129974
130054
  };
129975
130055
  }
129976
130056
  }
130057
+ if (originIsTypeOnlyAlias(origin)) {
130058
+ var codeAction_1 = ts.codefix.getPromoteTypeOnlyCompletionAction(sourceFile, origin.declaration.name, program, host, formatContext, preferences);
130059
+ ts.Debug.assertIsDefined(codeAction_1, "Expected to have a code action for promoting type-only alias");
130060
+ return { codeActions: [codeAction_1], sourceDisplay: undefined };
130061
+ }
129977
130062
  if (!origin || !(originIsExport(origin) || originIsResolvedExport(origin))) {
129978
130063
  return { codeActions: undefined, sourceDisplay: undefined };
129979
130064
  }
129980
130065
  var checker = origin.isFromPackageJson ? host.getPackageJsonAutoImportProvider().getTypeChecker() : program.getTypeChecker();
129981
130066
  var moduleSymbol = origin.moduleSymbol;
129982
130067
  var targetSymbol = checker.getMergedSymbol(ts.skipAlias(symbol.exportSymbol || symbol, checker));
129983
- var _b = ts.codefix.getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, ts.getNameForExportedSymbol(symbol, ts.getEmitScriptTarget(compilerOptions)), host, program, formatContext, previousToken && ts.isIdentifier(previousToken) ? previousToken.getStart(sourceFile) : position, preferences), moduleSpecifier = _b.moduleSpecifier, codeAction = _b.codeAction;
130068
+ var isJsxOpeningTagName = (contextToken === null || contextToken === void 0 ? void 0 : contextToken.kind) === 29 /* LessThanToken */ && ts.isJsxOpeningLikeElement(contextToken.parent);
130069
+ var _a = ts.codefix.getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, ts.getNameForExportedSymbol(symbol, ts.getEmitScriptTarget(compilerOptions), isJsxOpeningTagName), isJsxOpeningTagName, host, program, formatContext, previousToken && ts.isIdentifier(previousToken) ? previousToken.getStart(sourceFile) : position, preferences), moduleSpecifier = _a.moduleSpecifier, codeAction = _a.codeAction;
129984
130070
  ts.Debug.assert(!(data === null || data === void 0 ? void 0 : data.moduleSpecifier) || moduleSpecifier === data.moduleSpecifier);
129985
130071
  return { sourceDisplay: [ts.textPart(moduleSpecifier)], codeActions: [codeAction] };
129986
130072
  }
@@ -130650,21 +130736,29 @@ var ts;
130650
130736
  var scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile) || sourceFile;
130651
130737
  isInSnippetScope = isSnippetScope(scopeNode);
130652
130738
  var symbolMeanings = (isTypeOnlyLocation ? 0 /* None */ : 111551 /* Value */) | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */;
130739
+ var typeOnlyAliasNeedsPromotion = previousToken && !ts.isValidTypeOnlyAliasUseSite(previousToken);
130653
130740
  symbols = ts.concatenate(symbols, typeChecker.getSymbolsInScope(scopeNode, symbolMeanings));
130654
130741
  ts.Debug.assertEachIsDefined(symbols, "getSymbolsInScope() should all be defined");
130655
- for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) {
130656
- var symbol = symbols_1[_i];
130742
+ for (var i = 0; i < symbols.length; i++) {
130743
+ var symbol = symbols[i];
130657
130744
  if (!typeChecker.isArgumentsSymbol(symbol) &&
130658
130745
  !ts.some(symbol.declarations, function (d) { return d.getSourceFile() === sourceFile; })) {
130659
130746
  symbolToSortTextIdMap[ts.getSymbolId(symbol)] = 15 /* GlobalsOrKeywords */;
130660
130747
  }
130748
+ if (typeOnlyAliasNeedsPromotion && !(symbol.flags & 111551 /* Value */)) {
130749
+ var typeOnlyAliasDeclaration = symbol.declarations && ts.find(symbol.declarations, ts.isTypeOnlyImportOrExportDeclaration);
130750
+ if (typeOnlyAliasDeclaration) {
130751
+ var origin = { kind: 64 /* TypeOnlyAlias */, declaration: typeOnlyAliasDeclaration };
130752
+ symbolToOriginInfoMap[i] = origin;
130753
+ }
130754
+ }
130661
130755
  }
130662
130756
  // Need to insert 'this.' before properties of `this` type, so only do that if `includeInsertTextCompletions`
130663
130757
  if (preferences.includeCompletionsWithInsertText && scopeNode.kind !== 303 /* SourceFile */) {
130664
130758
  var thisType = typeChecker.tryGetThisTypeAt(scopeNode, /*includeGlobalThis*/ false);
130665
130759
  if (thisType && !isProbablyGlobalType(thisType, sourceFile, typeChecker)) {
130666
- for (var _a = 0, _b = getPropertiesForCompletion(thisType, typeChecker); _a < _b.length; _a++) {
130667
- var symbol = _b[_a];
130760
+ for (var _i = 0, _a = getPropertiesForCompletion(thisType, typeChecker); _i < _a.length; _i++) {
130761
+ var symbol = _a[_i];
130668
130762
  symbolToOriginInfoMap[symbols.length] = { kind: 1 /* ThisType */ };
130669
130763
  symbols.push(symbol);
130670
130764
  symbolToSortTextIdMap[ts.getSymbolId(symbol)] = 14 /* SuggestedClassMembers */;
@@ -130767,7 +130861,8 @@ var ts;
130767
130861
  var packageJsonAutoImportProvider = (_b = host.getPackageJsonAutoImportProvider) === null || _b === void 0 ? void 0 : _b.call(host);
130768
130862
  var packageJsonFilter = detailsEntryId ? undefined : ts.createPackageJsonImportFilter(sourceFile, preferences, host);
130769
130863
  resolvingModuleSpecifiers("collectAutoImports", host, program, sourceFile, preferences, !!importCompletionNode, function (context) {
130770
- exportInfo.forEach(sourceFile.path, function (info, symbolName, isFromAmbientModule, exportMapKey) {
130864
+ exportInfo.forEach(sourceFile.path, function (info, getSymbolName, isFromAmbientModule, exportMapKey) {
130865
+ var symbolName = getSymbolName(/*preferCapitalized*/ isRightOfOpenTag);
130771
130866
  if (!ts.isIdentifierText(symbolName, ts.getEmitScriptTarget(host.getCompilationSettings())))
130772
130867
  return;
130773
130868
  if (!detailsEntryId && ts.isStringANonContextualKeyword(symbolName))
@@ -130777,6 +130872,10 @@ var ts;
130777
130872
  return;
130778
130873
  if (isTypeOnlyLocation && !(info[0].targetFlags & (1536 /* Module */ | 788968 /* Type */)))
130779
130874
  return;
130875
+ // Do not try to auto-import something with a lowercase first letter for a JSX tag
130876
+ var firstChar = symbolName.charCodeAt(0);
130877
+ if (isRightOfOpenTag && (firstChar < 65 /* A */ || firstChar > 90 /* Z */))
130878
+ return;
130780
130879
  var isCompletionDetailsMatch = detailsEntryId && ts.some(info, function (i) { return detailsEntryId.source === ts.stripQuotes(i.moduleSymbol.name); });
130781
130880
  if (isCompletionDetailsMatch || !detailsEntryId && charactersFuzzyMatchInString(symbolName, lowerCaseTokenText)) {
130782
130881
  var defaultExportInfo = ts.find(info, isImportableExportInfo);
@@ -130853,16 +130952,19 @@ var ts;
130853
130952
  return true;
130854
130953
  }
130855
130954
  if (contextToken.kind === 31 /* GreaterThanToken */ && contextToken.parent) {
130955
+ // <Component<string> /**/ />
130956
+ // <Component<string> /**/ ><Component>
130957
+ // - contextToken: GreaterThanToken (before cursor)
130958
+ // - location: JsxSelfClosingElement or JsxOpeningElement
130959
+ // - contextToken.parent === location
130960
+ if (location === contextToken.parent && (location.kind === 279 /* JsxOpeningElement */ || location.kind === 278 /* JsxSelfClosingElement */)) {
130961
+ return false;
130962
+ }
130856
130963
  if (contextToken.parent.kind === 279 /* JsxOpeningElement */) {
130857
- // Two possibilities:
130858
- // 1. <div>/**/
130859
- // - contextToken: GreaterThanToken (before cursor)
130860
- // - location: JSXElement
130861
- // - different parents (JSXOpeningElement, JSXElement)
130862
- // 2. <Component<string> /**/>
130863
- // - contextToken: GreaterThanToken (before cursor)
130864
- // - location: GreaterThanToken (after cursor)
130865
- // - same parent (JSXOpeningElement)
130964
+ // <div>/**/
130965
+ // - contextToken: GreaterThanToken (before cursor)
130966
+ // - location: JSXElement
130967
+ // - different parents (JSXOpeningElement, JSXElement)
130866
130968
  return location.parent.kind !== 279 /* JsxOpeningElement */;
130867
130969
  }
130868
130970
  if (contextToken.parent.kind === 280 /* JsxClosingElement */ || contextToken.parent.kind === 278 /* JsxSelfClosingElement */) {
@@ -132063,10 +132165,14 @@ var ts;
132063
132165
  /** True if symbol is a type or a module containing at least one type. */
132064
132166
  function symbolCanBeReferencedAtTypeLocation(symbol, checker, seenModules) {
132065
132167
  if (seenModules === void 0) { seenModules = new ts.Map(); }
132066
- var sym = ts.skipAlias(symbol.exportSymbol || symbol, checker);
132067
- return !!(sym.flags & 788968 /* Type */) || checker.isUnknownSymbol(sym) ||
132068
- !!(sym.flags & 1536 /* Module */) && ts.addToSeen(seenModules, ts.getSymbolId(sym)) &&
132069
- checker.getExportsOfModule(sym).some(function (e) { return symbolCanBeReferencedAtTypeLocation(e, checker, seenModules); });
132168
+ // Since an alias can be merged with a local declaration, we need to test both the alias and its target.
132169
+ // This code used to just test the result of `skipAlias`, but that would ignore any locally introduced meanings.
132170
+ return nonAliasCanBeReferencedAtTypeLocation(symbol) || nonAliasCanBeReferencedAtTypeLocation(ts.skipAlias(symbol.exportSymbol || symbol, checker));
132171
+ function nonAliasCanBeReferencedAtTypeLocation(symbol) {
132172
+ return !!(symbol.flags & 788968 /* Type */) || checker.isUnknownSymbol(symbol) ||
132173
+ !!(symbol.flags & 1536 /* Module */) && ts.addToSeen(seenModules, ts.getSymbolId(symbol)) &&
132174
+ checker.getExportsOfModule(symbol).some(function (e) { return symbolCanBeReferencedAtTypeLocation(e, checker, seenModules); });
132175
+ }
132070
132176
  }
132071
132177
  function isDeprecated(symbol, checker) {
132072
132178
  var declarations = ts.skipAlias(symbol, checker).declarations;
@@ -134320,8 +134426,8 @@ var ts;
134320
134426
  var sourceId = ts.getNodeId(sourceFile);
134321
134427
  var seenSymbols = this.sourceFileToSeenSymbols[sourceId] || (this.sourceFileToSeenSymbols[sourceId] = new ts.Set());
134322
134428
  var anyNewSymbols = false;
134323
- for (var _i = 0, symbols_2 = symbols; _i < symbols_2.length; _i++) {
134324
- var sym = symbols_2[_i];
134429
+ for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) {
134430
+ var sym = symbols_1[_i];
134325
134431
  anyNewSymbols = ts.tryAddToSet(seenSymbols, ts.getSymbolId(sym)) || anyNewSymbols;
134326
134432
  }
134327
134433
  return anyNewSymbols;
@@ -141281,6 +141387,8 @@ var ts;
141281
141387
  }
141282
141388
  if (flags & 16 /* Function */)
141283
141389
  return isLocalVariableOrFunction(symbol) ? "local function" /* localFunctionElement */ : "function" /* functionElement */;
141390
+ // FIXME: getter and setter use the same symbol. And it is rare to use only setter without getter, so in most cases the symbol always has getter flag.
141391
+ // So, even when the location is just on the declaration of setter, this function returns getter.
141284
141392
  if (flags & 32768 /* GetAccessor */)
141285
141393
  return "getter" /* memberGetAccessorElement */;
141286
141394
  if (flags & 65536 /* SetAccessor */)
@@ -141367,9 +141475,24 @@ var ts;
141367
141475
  }
141368
141476
  // Class at constructor site need to be shown as constructor apart from property,method, vars
141369
141477
  if (symbolKind !== "" /* unknown */ || symbolFlags & 32 /* Class */ || symbolFlags & 2097152 /* Alias */) {
141370
- // If it is accessor they are allowed only if location is at name of the accessor
141478
+ // If symbol is accessor, they are allowed only if location is at declaration identifier of the accessor
141371
141479
  if (symbolKind === "getter" /* memberGetAccessorElement */ || symbolKind === "setter" /* memberSetAccessorElement */) {
141372
- symbolKind = "property" /* memberVariableElement */;
141480
+ var declaration = ts.find(symbol.declarations, function (declaration) { return declaration.name === location; });
141481
+ if (declaration) {
141482
+ switch (declaration.kind) {
141483
+ case 171 /* GetAccessor */:
141484
+ symbolKind = "getter" /* memberGetAccessorElement */;
141485
+ break;
141486
+ case 172 /* SetAccessor */:
141487
+ symbolKind = "setter" /* memberSetAccessorElement */;
141488
+ break;
141489
+ default:
141490
+ ts.Debug.assertNever(declaration);
141491
+ }
141492
+ }
141493
+ else {
141494
+ symbolKind = "property" /* memberVariableElement */;
141495
+ }
141373
141496
  }
141374
141497
  var signature = void 0;
141375
141498
  type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location);
@@ -141683,6 +141806,8 @@ var ts;
141683
141806
  }
141684
141807
  // For properties, variables and local vars: show the type
141685
141808
  if (symbolKind === "property" /* memberVariableElement */ ||
141809
+ symbolKind === "getter" /* memberGetAccessorElement */ ||
141810
+ symbolKind === "setter" /* memberSetAccessorElement */ ||
141686
141811
  symbolKind === "JSX attribute" /* jsxAttribute */ ||
141687
141812
  symbolFlags & 3 /* Variable */ ||
141688
141813
  symbolKind === "local var" /* localVariableElement */ ||
@@ -141753,7 +141878,7 @@ var ts;
141753
141878
  }
141754
141879
  }
141755
141880
  if (tags.length === 0 && !hasMultipleSignatures) {
141756
- tags = symbol.getJsDocTags(typeChecker);
141881
+ tags = symbol.getContextualJsDocTags(enclosingDeclaration, typeChecker);
141757
141882
  }
141758
141883
  if (documentation.length === 0 && documentationFromAlias) {
141759
141884
  documentation = documentationFromAlias;
@@ -145173,6 +145298,7 @@ var ts;
145173
145298
  ChangeTracker.prototype.delete = function (sourceFile, node) {
145174
145299
  this.deletedNodes.push({ sourceFile: sourceFile, node: node });
145175
145300
  };
145301
+ /** Stop! Consider using `delete` instead, which has logic for deleting nodes from delimited lists. */
145176
145302
  ChangeTracker.prototype.deleteNode = function (sourceFile, node, options) {
145177
145303
  if (options === void 0) { options = { leadingTriviaOption: LeadingTriviaOption.IncludeAll }; }
145178
145304
  this.deleteRange(sourceFile, getAdjustedRange(sourceFile, node, node, options));
@@ -145576,6 +145702,15 @@ var ts;
145576
145702
  ChangeTracker.prototype.insertExportModifier = function (sourceFile, node) {
145577
145703
  this.insertText(sourceFile, node.getStart(sourceFile), "export ");
145578
145704
  };
145705
+ ChangeTracker.prototype.insertImportSpecifierAtIndex = function (sourceFile, importSpecifier, namedImports, index) {
145706
+ var prevSpecifier = namedImports.elements[index - 1];
145707
+ if (prevSpecifier) {
145708
+ this.insertNodeInListAfter(sourceFile, prevSpecifier, importSpecifier);
145709
+ }
145710
+ else {
145711
+ this.insertNodeBefore(sourceFile, namedImports.elements[0], importSpecifier, !ts.positionsAreOnSameLine(namedImports.elements[0].getStart(), namedImports.parent.parent.getStart(), sourceFile));
145712
+ }
145713
+ };
145579
145714
  /**
145580
145715
  * This function should be used to insert nodes in lists when nodes don't carry separators as the part of the node range,
145581
145716
  * i.e. arguments in arguments lists, parameters in parameter lists etc.
@@ -149078,7 +149213,8 @@ var ts;
149078
149213
  ts.Diagnostics.Cannot_find_namespace_0.code,
149079
149214
  ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code,
149080
149215
  ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here.code,
149081
- ts.Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer.code
149216
+ ts.Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer.code,
149217
+ ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type.code,
149082
149218
  ];
149083
149219
  codefix.registerCodeFix({
149084
149220
  errorCodes: errorCodes,
@@ -149124,7 +149260,7 @@ var ts;
149124
149260
  var symbolName = ts.getNameForExportedSymbol(exportedSymbol, ts.getEmitScriptTarget(compilerOptions));
149125
149261
  var checker = program.getTypeChecker();
149126
149262
  var symbol = checker.getMergedSymbol(ts.skipAlias(exportedSymbol, checker));
149127
- var exportInfos = getAllReExportingModules(sourceFile, symbol, moduleSymbol, symbolName, host, program, preferences, useAutoImportProvider);
149263
+ var exportInfos = getAllReExportingModules(sourceFile, symbol, moduleSymbol, symbolName, /*isJsxTagName*/ false, host, program, preferences, useAutoImportProvider);
149128
149264
  var useRequire = shouldUseRequire(sourceFile, program);
149129
149265
  var fix = getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, symbolName, program, /*position*/ undefined, !!isValidTypeOnlyUseSite, useRequire, host, preferences);
149130
149266
  if (fix) {
@@ -149183,6 +149319,9 @@ var ts;
149183
149319
  }
149184
149320
  break;
149185
149321
  }
149322
+ case 4 /* PromoteTypeOnly */:
149323
+ // Excluding from fix-all
149324
+ break;
149186
149325
  default:
149187
149326
  ts.Debug.assertNever(fix, "fix wasn't never - got kind " + fix.kind);
149188
149327
  }
@@ -149274,6 +149413,7 @@ var ts;
149274
149413
  ImportFixKind[ImportFixKind["JsdocTypeImport"] = 1] = "JsdocTypeImport";
149275
149414
  ImportFixKind[ImportFixKind["AddToExisting"] = 2] = "AddToExisting";
149276
149415
  ImportFixKind[ImportFixKind["AddNew"] = 3] = "AddNew";
149416
+ ImportFixKind[ImportFixKind["PromoteTypeOnly"] = 4] = "PromoteTypeOnly";
149277
149417
  })(ImportFixKind || (ImportFixKind = {}));
149278
149418
  // These should not be combined as bitflags, but are given powers of 2 values to
149279
149419
  // easily detect conflicts between `NotAllowed` and `Required` by giving them a unique sum.
@@ -149285,11 +149425,11 @@ var ts;
149285
149425
  AddAsTypeOnly[AddAsTypeOnly["Required"] = 2] = "Required";
149286
149426
  AddAsTypeOnly[AddAsTypeOnly["NotAllowed"] = 4] = "NotAllowed";
149287
149427
  })(AddAsTypeOnly || (AddAsTypeOnly = {}));
149288
- function getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, symbolName, host, program, formatContext, position, preferences) {
149428
+ function getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, symbolName, isJsxTagName, host, program, formatContext, position, preferences) {
149289
149429
  var compilerOptions = program.getCompilerOptions();
149290
149430
  var exportInfos = ts.pathIsBareSpecifier(ts.stripQuotes(moduleSymbol.name))
149291
149431
  ? [getSymbolExportInfoForSymbol(targetSymbol, moduleSymbol, program, host)]
149292
- : getAllReExportingModules(sourceFile, targetSymbol, moduleSymbol, symbolName, host, program, preferences, /*useAutoImportProvider*/ true);
149432
+ : getAllReExportingModules(sourceFile, targetSymbol, moduleSymbol, symbolName, isJsxTagName, host, program, preferences, /*useAutoImportProvider*/ true);
149293
149433
  var useRequire = shouldUseRequire(sourceFile, program);
149294
149434
  var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(ts.getTokenAtPosition(sourceFile, position));
149295
149435
  var fix = ts.Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, symbolName, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences));
@@ -149299,6 +149439,13 @@ var ts;
149299
149439
  };
149300
149440
  }
149301
149441
  codefix.getImportCompletionAction = getImportCompletionAction;
149442
+ function getPromoteTypeOnlyCompletionAction(sourceFile, symbolToken, program, host, formatContext, preferences) {
149443
+ var compilerOptions = program.getCompilerOptions();
149444
+ var symbolName = getSymbolName(sourceFile, program.getTypeChecker(), symbolToken, compilerOptions);
149445
+ var fix = getTypeOnlyPromotionFix(sourceFile, symbolToken, symbolName, program);
149446
+ return fix && codeFixActionToCodeAction(codeActionForFix({ host: host, formatContext: formatContext, preferences: preferences }, sourceFile, symbolName, fix, 1 /* Double */, compilerOptions));
149447
+ }
149448
+ codefix.getPromoteTypeOnlyCompletionAction = getPromoteTypeOnlyCompletionAction;
149302
149449
  function getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, symbolName, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences) {
149303
149450
  ts.Debug.assert(exportInfos.some(function (info) { return info.moduleSymbol === moduleSymbol || info.symbol.parent === moduleSymbol; }), "Some exportInfo should match the specified moduleSymbol");
149304
149451
  var packageJsonImportFilter = ts.createPackageJsonImportFilter(sourceFile, preferences, host);
@@ -149328,7 +149475,7 @@ var ts;
149328
149475
  }
149329
149476
  }
149330
149477
  }
149331
- function getAllReExportingModules(importingFile, targetSymbol, exportingModuleSymbol, symbolName, host, program, preferences, useAutoImportProvider) {
149478
+ function getAllReExportingModules(importingFile, targetSymbol, exportingModuleSymbol, symbolName, isJsxTagName, host, program, preferences, useAutoImportProvider) {
149332
149479
  var result = [];
149333
149480
  var compilerOptions = program.getCompilerOptions();
149334
149481
  var getModuleSpecifierResolutionHost = ts.memoizeOne(function (isFromPackageJson) {
@@ -149341,7 +149488,7 @@ var ts;
149341
149488
  return;
149342
149489
  }
149343
149490
  var defaultInfo = ts.getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions);
149344
- if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, ts.getEmitScriptTarget(compilerOptions)) === symbolName) && ts.skipAlias(defaultInfo.symbol, checker) === targetSymbol && isImportable(program, moduleFile, isFromPackageJson)) {
149491
+ if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, ts.getEmitScriptTarget(compilerOptions), isJsxTagName) === symbolName) && ts.skipAlias(defaultInfo.symbol, checker) === targetSymbol && isImportable(program, moduleFile, isFromPackageJson)) {
149345
149492
  result.push({ symbol: defaultInfo.symbol, moduleSymbol: moduleSymbol, moduleFileName: moduleFile === null || moduleFile === void 0 ? void 0 : moduleFile.fileName, exportKind: defaultInfo.exportKind, targetFlags: ts.skipAlias(defaultInfo.symbol, checker).flags, isFromPackageJson: isFromPackageJson });
149346
149493
  }
149347
149494
  for (var _i = 0, _a = checker.getExportsAndPropertiesOfModule(moduleSymbol); _i < _a.length; _i++) {
@@ -149579,9 +149726,21 @@ var ts;
149579
149726
  }
149580
149727
  function getFixesInfo(context, errorCode, pos, useAutoImportProvider) {
149581
149728
  var symbolToken = ts.getTokenAtPosition(context.sourceFile, pos);
149582
- var info = errorCode === ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code
149583
- ? getFixesInfoForUMDImport(context, symbolToken)
149584
- : ts.isIdentifier(symbolToken) ? getFixesInfoForNonUMDImport(context, symbolToken, useAutoImportProvider) : undefined;
149729
+ var info;
149730
+ if (errorCode === ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code) {
149731
+ info = getFixesInfoForUMDImport(context, symbolToken);
149732
+ }
149733
+ else if (!ts.isIdentifier(symbolToken)) {
149734
+ return undefined;
149735
+ }
149736
+ else if (errorCode === ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type.code) {
149737
+ var symbolName_1 = getSymbolName(context.sourceFile, context.program.getTypeChecker(), symbolToken, context.program.getCompilerOptions());
149738
+ var fix = getTypeOnlyPromotionFix(context.sourceFile, symbolToken, symbolName_1, context.program);
149739
+ return fix && { fixes: [fix], symbolName: symbolName_1 };
149740
+ }
149741
+ else {
149742
+ info = getFixesInfoForNonUMDImport(context, symbolToken, useAutoImportProvider);
149743
+ }
149585
149744
  var packageJsonImportFilter = ts.createPackageJsonImportFilter(context.sourceFile, context.preferences, context.host);
149586
149745
  return info && __assign(__assign({}, info), { fixes: sortFixes(info.fixes, context.sourceFile, context.program, packageJsonImportFilter) });
149587
149746
  }
@@ -149698,13 +149857,23 @@ var ts;
149698
149857
  ts.Debug.assert(symbolName !== "default" /* Default */, "'default' isn't a legal identifier and couldn't occur here");
149699
149858
  var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(symbolToken);
149700
149859
  var useRequire = shouldUseRequire(sourceFile, program);
149701
- var exportInfos = getExportInfos(symbolName, ts.getMeaningFromLocation(symbolToken), cancellationToken, sourceFile, program, useAutoImportProvider, host, preferences);
149860
+ var exportInfos = getExportInfos(symbolName, ts.isJSXTagName(symbolToken), ts.getMeaningFromLocation(symbolToken), cancellationToken, sourceFile, program, useAutoImportProvider, host, preferences);
149702
149861
  var fixes = ts.arrayFrom(ts.flatMapIterator(exportInfos.entries(), function (_a) {
149703
149862
  var _ = _a[0], exportInfos = _a[1];
149704
149863
  return getImportFixes(exportInfos, symbolName, symbolToken.getStart(sourceFile), isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences);
149705
149864
  }));
149706
149865
  return { fixes: fixes, symbolName: symbolName };
149707
149866
  }
149867
+ function getTypeOnlyPromotionFix(sourceFile, symbolToken, symbolName, program) {
149868
+ var checker = program.getTypeChecker();
149869
+ var symbol = checker.resolveName(symbolName, symbolToken, 111551 /* Value */, /*excludeGlobals*/ true);
149870
+ if (!symbol)
149871
+ return undefined;
149872
+ var typeOnlyAliasDeclaration = checker.getTypeOnlyAliasDeclaration(symbol);
149873
+ if (!typeOnlyAliasDeclaration || ts.getSourceFileOfNode(typeOnlyAliasDeclaration) !== sourceFile)
149874
+ return undefined;
149875
+ return { kind: 4 /* PromoteTypeOnly */, typeOnlyAliasDeclaration: typeOnlyAliasDeclaration };
149876
+ }
149708
149877
  function jsxModeNeedsExplicitImport(jsx) {
149709
149878
  return jsx === 2 /* React */ || jsx === 3 /* ReactNative */;
149710
149879
  }
@@ -149712,14 +149881,20 @@ var ts;
149712
149881
  var parent = symbolToken.parent;
149713
149882
  if ((ts.isJsxOpeningLikeElement(parent) || ts.isJsxClosingElement(parent)) && parent.tagName === symbolToken && jsxModeNeedsExplicitImport(compilerOptions.jsx)) {
149714
149883
  var jsxNamespace = checker.getJsxNamespace(sourceFile);
149715
- if (ts.isIntrinsicJsxName(symbolToken.text) || !checker.resolveName(jsxNamespace, parent, 111551 /* Value */, /*excludeGlobals*/ true)) {
149884
+ if (needsJsxNamespaceFix(jsxNamespace, symbolToken, checker)) {
149716
149885
  return jsxNamespace;
149717
149886
  }
149718
149887
  }
149719
149888
  return symbolToken.text;
149720
149889
  }
149890
+ function needsJsxNamespaceFix(jsxNamespace, symbolToken, checker) {
149891
+ if (ts.isIntrinsicJsxName(symbolToken.text))
149892
+ return true; // If we were triggered by a matching error code on an intrinsic, the error must have been about missing the JSX factory
149893
+ var namespaceSymbol = checker.resolveName(jsxNamespace, symbolToken, 111551 /* Value */, /*excludeGlobals*/ true);
149894
+ return !namespaceSymbol || ts.some(namespaceSymbol.declarations, ts.isTypeOnlyImportOrExportDeclaration) && !(namespaceSymbol.flags & 111551 /* Value */);
149895
+ }
149721
149896
  // Returns a map from an exported symbol's ID to a list of every way it's (re-)exported.
149722
- function getExportInfos(symbolName, currentTokenMeaning, cancellationToken, fromFile, program, useAutoImportProvider, host, preferences) {
149897
+ function getExportInfos(symbolName, isJsxTagName, currentTokenMeaning, cancellationToken, fromFile, program, useAutoImportProvider, host, preferences) {
149723
149898
  var _a;
149724
149899
  // For each original symbol, keep all re-exports of that symbol together so we can call `getCodeActionsForImport` on the whole group at once.
149725
149900
  // Maps symbol id to info for modules providing that symbol (original export + re-exports).
@@ -149742,7 +149917,7 @@ var ts;
149742
149917
  cancellationToken.throwIfCancellationRequested();
149743
149918
  var compilerOptions = program.getCompilerOptions();
149744
149919
  var defaultInfo = ts.getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions);
149745
- if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, ts.getEmitScriptTarget(compilerOptions)) === symbolName) && symbolHasMeaning(defaultInfo.symbolForMeaning, currentTokenMeaning)) {
149920
+ if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, ts.getEmitScriptTarget(compilerOptions), isJsxTagName) === symbolName) && symbolHasMeaning(defaultInfo.symbolForMeaning, currentTokenMeaning)) {
149746
149921
  addSymbol(moduleSymbol, sourceFile, defaultInfo.symbol, defaultInfo.exportKind, program, isFromPackageJson);
149747
149922
  }
149748
149923
  // check exports with the same name
@@ -149816,10 +149991,80 @@ var ts;
149816
149991
  ts.insertImports(changes, sourceFile, getDeclarations(moduleSpecifier, quotePreference, defaultImport, namedImports, namespaceLikeImport), /*blankLineBetween*/ true);
149817
149992
  return [importKind === 1 /* Default */ ? ts.Diagnostics.Import_default_0_from_module_1 : ts.Diagnostics.Import_0_from_module_1, symbolName, moduleSpecifier];
149818
149993
  }
149994
+ case 4 /* PromoteTypeOnly */: {
149995
+ var typeOnlyAliasDeclaration = fix.typeOnlyAliasDeclaration;
149996
+ var promotedDeclaration = promoteFromTypeOnly(changes, typeOnlyAliasDeclaration, compilerOptions, sourceFile);
149997
+ return promotedDeclaration.kind === 269 /* ImportSpecifier */
149998
+ ? [ts.Diagnostics.Remove_type_from_import_of_0_from_1, symbolName, getModuleSpecifierText(promotedDeclaration.parent.parent)]
149999
+ : [ts.Diagnostics.Remove_type_from_import_declaration_from_0, getModuleSpecifierText(promotedDeclaration)];
150000
+ }
149819
150001
  default:
149820
150002
  return ts.Debug.assertNever(fix, "Unexpected fix kind " + fix.kind);
149821
150003
  }
149822
150004
  }
150005
+ function getModuleSpecifierText(promotedDeclaration) {
150006
+ var _a, _b;
150007
+ return promotedDeclaration.kind === 264 /* ImportEqualsDeclaration */
150008
+ ? ((_b = ts.tryCast((_a = ts.tryCast(promotedDeclaration.moduleReference, ts.isExternalModuleReference)) === null || _a === void 0 ? void 0 : _a.expression, ts.isStringLiteralLike)) === null || _b === void 0 ? void 0 : _b.text) || promotedDeclaration.moduleReference.getText()
150009
+ : ts.cast(promotedDeclaration.parent.moduleSpecifier, ts.isStringLiteral).text;
150010
+ }
150011
+ function promoteFromTypeOnly(changes, aliasDeclaration, compilerOptions, sourceFile) {
150012
+ // See comment in `doAddExistingFix` on constant with the same name.
150013
+ var convertExistingToTypeOnly = compilerOptions.preserveValueImports && compilerOptions.isolatedModules;
150014
+ switch (aliasDeclaration.kind) {
150015
+ case 269 /* ImportSpecifier */:
150016
+ if (aliasDeclaration.isTypeOnly) {
150017
+ if (aliasDeclaration.parent.elements.length > 1 && ts.OrganizeImports.importSpecifiersAreSorted(aliasDeclaration.parent.elements)) {
150018
+ changes.delete(sourceFile, aliasDeclaration);
150019
+ var newSpecifier = ts.factory.updateImportSpecifier(aliasDeclaration, /*isTypeOnly*/ false, aliasDeclaration.propertyName, aliasDeclaration.name);
150020
+ var insertionIndex = ts.OrganizeImports.getImportSpecifierInsertionIndex(aliasDeclaration.parent.elements, newSpecifier);
150021
+ changes.insertImportSpecifierAtIndex(sourceFile, newSpecifier, aliasDeclaration.parent, insertionIndex);
150022
+ }
150023
+ else {
150024
+ changes.deleteRange(sourceFile, aliasDeclaration.getFirstToken());
150025
+ }
150026
+ return aliasDeclaration;
150027
+ }
150028
+ else {
150029
+ ts.Debug.assert(aliasDeclaration.parent.parent.isTypeOnly);
150030
+ promoteImportClause(aliasDeclaration.parent.parent);
150031
+ return aliasDeclaration.parent.parent;
150032
+ }
150033
+ case 266 /* ImportClause */:
150034
+ promoteImportClause(aliasDeclaration);
150035
+ return aliasDeclaration;
150036
+ case 267 /* NamespaceImport */:
150037
+ promoteImportClause(aliasDeclaration.parent);
150038
+ return aliasDeclaration.parent;
150039
+ case 264 /* ImportEqualsDeclaration */:
150040
+ changes.deleteRange(sourceFile, aliasDeclaration.getChildAt(1));
150041
+ return aliasDeclaration;
150042
+ default:
150043
+ ts.Debug.failBadSyntaxKind(aliasDeclaration);
150044
+ }
150045
+ function promoteImportClause(importClause) {
150046
+ changes.delete(sourceFile, ts.getTypeKeywordOfTypeOnlyImport(importClause, sourceFile));
150047
+ if (convertExistingToTypeOnly) {
150048
+ var namedImports = ts.tryCast(importClause.namedBindings, ts.isNamedImports);
150049
+ if (namedImports && namedImports.elements.length > 1) {
150050
+ if (ts.OrganizeImports.importSpecifiersAreSorted(namedImports.elements) &&
150051
+ aliasDeclaration.kind === 269 /* ImportSpecifier */ &&
150052
+ namedImports.elements.indexOf(aliasDeclaration) !== 0) {
150053
+ // The import specifier being promoted will be the only non-type-only,
150054
+ // import in the NamedImports, so it should be moved to the front.
150055
+ changes.delete(sourceFile, aliasDeclaration);
150056
+ changes.insertImportSpecifierAtIndex(sourceFile, aliasDeclaration, namedImports, 0);
150057
+ }
150058
+ for (var _i = 0, _a = namedImports.elements; _i < _a.length; _i++) {
150059
+ var element = _a[_i];
150060
+ if (element !== aliasDeclaration && !element.isTypeOnly) {
150061
+ changes.insertModifierBefore(sourceFile, 151 /* TypeKeyword */, element);
150062
+ }
150063
+ }
150064
+ }
150065
+ }
150066
+ }
150067
+ }
149823
150068
  function doAddExistingFix(changes, sourceFile, clause, defaultImport, namedImports, compilerOptions) {
149824
150069
  var _a;
149825
150070
  if (clause.kind === 200 /* ObjectBindingPattern */) {
@@ -149857,13 +150102,7 @@ var ts;
149857
150102
  var insertionIndex = convertExistingToTypeOnly && !spec.isTypeOnly
149858
150103
  ? 0
149859
150104
  : ts.OrganizeImports.getImportSpecifierInsertionIndex(existingSpecifiers, spec);
149860
- var prevSpecifier = clause.namedBindings.elements[insertionIndex - 1];
149861
- if (prevSpecifier) {
149862
- changes.insertNodeInListAfter(sourceFile, prevSpecifier, spec);
149863
- }
149864
- else {
149865
- changes.insertNodeBefore(sourceFile, existingSpecifiers[0], spec, !ts.positionsAreOnSameLine(existingSpecifiers[0].getStart(), clause.parent.getStart(), sourceFile));
149866
- }
150105
+ changes.insertImportSpecifierAtIndex(sourceFile, spec, clause.namedBindings, insertionIndex);
149867
150106
  }
149868
150107
  }
149869
150108
  else if (existingSpecifiers === null || existingSpecifiers === void 0 ? void 0 : existingSpecifiers.length) {
@@ -149978,17 +150217,20 @@ var ts;
149978
150217
  var declarations = _a.declarations;
149979
150218
  return ts.some(declarations, function (decl) { return !!(ts.getMeaningFromDeclaration(decl) & meaning); });
149980
150219
  }
149981
- function moduleSymbolToValidIdentifier(moduleSymbol, target) {
149982
- return moduleSpecifierToValidIdentifier(ts.removeFileExtension(ts.stripQuotes(moduleSymbol.name)), target);
150220
+ function moduleSymbolToValidIdentifier(moduleSymbol, target, forceCapitalize) {
150221
+ return moduleSpecifierToValidIdentifier(ts.removeFileExtension(ts.stripQuotes(moduleSymbol.name)), target, forceCapitalize);
149983
150222
  }
149984
150223
  codefix.moduleSymbolToValidIdentifier = moduleSymbolToValidIdentifier;
149985
- function moduleSpecifierToValidIdentifier(moduleSpecifier, target) {
150224
+ function moduleSpecifierToValidIdentifier(moduleSpecifier, target, forceCapitalize) {
149986
150225
  var baseName = ts.getBaseFileName(ts.removeSuffix(moduleSpecifier, "/index"));
149987
150226
  var res = "";
149988
150227
  var lastCharWasValid = true;
149989
150228
  var firstCharCode = baseName.charCodeAt(0);
149990
150229
  if (ts.isIdentifierStart(firstCharCode, target)) {
149991
150230
  res += String.fromCharCode(firstCharCode);
150231
+ if (forceCapitalize) {
150232
+ res = res.toUpperCase();
150233
+ }
149992
150234
  }
149993
150235
  else {
149994
150236
  lastCharWasValid = false;
@@ -159957,13 +160199,11 @@ var ts;
159957
160199
  switch (context === null || context === void 0 ? void 0 : context.kind) {
159958
160200
  case 171 /* GetAccessor */:
159959
160201
  if (!this.contextualGetAccessorDocumentationComment) {
159960
- this.contextualGetAccessorDocumentationComment = ts.emptyArray;
159961
160202
  this.contextualGetAccessorDocumentationComment = getDocumentationComment(ts.filter(this.declarations, ts.isGetAccessor), checker);
159962
160203
  }
159963
160204
  return this.contextualGetAccessorDocumentationComment;
159964
160205
  case 172 /* SetAccessor */:
159965
160206
  if (!this.contextualSetAccessorDocumentationComment) {
159966
- this.contextualSetAccessorDocumentationComment = ts.emptyArray;
159967
160207
  this.contextualSetAccessorDocumentationComment = getDocumentationComment(ts.filter(this.declarations, ts.isSetAccessor), checker);
159968
160208
  }
159969
160209
  return this.contextualSetAccessorDocumentationComment;
@@ -159973,10 +160213,26 @@ var ts;
159973
160213
  };
159974
160214
  SymbolObject.prototype.getJsDocTags = function (checker) {
159975
160215
  if (this.tags === undefined) {
159976
- this.tags = ts.JsDoc.getJsDocTagsFromDeclarations(this.declarations, checker);
160216
+ this.tags = getJsDocTagsOfDeclarations(this.declarations, checker);
159977
160217
  }
159978
160218
  return this.tags;
159979
160219
  };
160220
+ SymbolObject.prototype.getContextualJsDocTags = function (context, checker) {
160221
+ switch (context === null || context === void 0 ? void 0 : context.kind) {
160222
+ case 171 /* GetAccessor */:
160223
+ if (!this.contextualGetAccessorTags) {
160224
+ this.contextualGetAccessorTags = getJsDocTagsOfDeclarations(ts.filter(this.declarations, ts.isGetAccessor), checker);
160225
+ }
160226
+ return this.contextualGetAccessorTags;
160227
+ case 172 /* SetAccessor */:
160228
+ if (!this.contextualSetAccessorTags) {
160229
+ this.contextualSetAccessorTags = getJsDocTagsOfDeclarations(ts.filter(this.declarations, ts.isSetAccessor), checker);
160230
+ }
160231
+ return this.contextualSetAccessorTags;
160232
+ default:
160233
+ return this.getJsDocTags(checker);
160234
+ }
160235
+ };
159980
160236
  return SymbolObject;
159981
160237
  }());
159982
160238
  var TokenObject = /** @class */ (function (_super) {
@@ -160146,10 +160402,7 @@ var ts;
160146
160402
  return this.documentationComment || (this.documentationComment = getDocumentationComment(ts.singleElementArray(this.declaration), this.checker));
160147
160403
  };
160148
160404
  SignatureObject.prototype.getJsDocTags = function () {
160149
- if (this.jsDocTags === undefined) {
160150
- this.jsDocTags = this.declaration ? getJsDocTagsOfSignature(this.declaration, this.checker) : [];
160151
- }
160152
- return this.jsDocTags;
160405
+ return this.jsDocTags || (this.jsDocTags = getJsDocTagsOfDeclarations(ts.singleElementArray(this.declaration), this.checker));
160153
160406
  };
160154
160407
  return SignatureObject;
160155
160408
  }());
@@ -160161,12 +160414,30 @@ var ts;
160161
160414
  function hasJSDocInheritDocTag(node) {
160162
160415
  return ts.getJSDocTags(node).some(function (tag) { return tag.tagName.text === "inheritDoc"; });
160163
160416
  }
160164
- function getJsDocTagsOfSignature(declaration, checker) {
160165
- var tags = ts.JsDoc.getJsDocTagsFromDeclarations([declaration], checker);
160166
- if (tags.length === 0 || hasJSDocInheritDocTag(declaration)) {
160167
- var inheritedTags = findBaseOfDeclaration(checker, declaration, function (symbol) { var _a; return ((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.length) === 1 ? symbol.getJsDocTags() : undefined; });
160168
- if (inheritedTags) {
160169
- tags = __spreadArray(__spreadArray([], inheritedTags, true), tags, true);
160417
+ function getJsDocTagsOfDeclarations(declarations, checker) {
160418
+ if (!declarations)
160419
+ return ts.emptyArray;
160420
+ var tags = ts.JsDoc.getJsDocTagsFromDeclarations(declarations, checker);
160421
+ if (checker && (tags.length === 0 || declarations.some(hasJSDocInheritDocTag))) {
160422
+ var seenSymbols_1 = new ts.Set();
160423
+ var _loop_22 = function (declaration) {
160424
+ var inheritedTags = findBaseOfDeclaration(checker, declaration, function (symbol) {
160425
+ var _a;
160426
+ if (!seenSymbols_1.has(symbol)) {
160427
+ seenSymbols_1.add(symbol);
160428
+ if (declaration.kind === 171 /* GetAccessor */ || declaration.kind === 172 /* SetAccessor */) {
160429
+ return symbol.getContextualJsDocTags(declaration, checker);
160430
+ }
160431
+ return ((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.length) === 1 ? symbol.getJsDocTags() : undefined;
160432
+ }
160433
+ });
160434
+ if (inheritedTags) {
160435
+ tags = __spreadArray(__spreadArray([], inheritedTags, true), tags, true);
160436
+ }
160437
+ };
160438
+ for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) {
160439
+ var declaration = declarations_6[_i];
160440
+ _loop_22(declaration);
160170
160441
  }
160171
160442
  }
160172
160443
  return tags;
@@ -160176,18 +160447,24 @@ var ts;
160176
160447
  return ts.emptyArray;
160177
160448
  var doc = ts.JsDoc.getJsDocCommentsFromDeclarations(declarations, checker);
160178
160449
  if (checker && (doc.length === 0 || declarations.some(hasJSDocInheritDocTag))) {
160179
- var seenSymbols_1 = new ts.Set();
160180
- for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) {
160181
- var declaration = declarations_6[_i];
160450
+ var seenSymbols_2 = new ts.Set();
160451
+ var _loop_23 = function (declaration) {
160182
160452
  var inheritedDocs = findBaseOfDeclaration(checker, declaration, function (symbol) {
160183
- if (!seenSymbols_1.has(symbol)) {
160184
- seenSymbols_1.add(symbol);
160453
+ if (!seenSymbols_2.has(symbol)) {
160454
+ seenSymbols_2.add(symbol);
160455
+ if (declaration.kind === 171 /* GetAccessor */ || declaration.kind === 172 /* SetAccessor */) {
160456
+ return symbol.getContextualDocumentationComment(declaration, checker);
160457
+ }
160185
160458
  return symbol.getDocumentationComment(checker);
160186
160459
  }
160187
160460
  });
160188
160461
  // TODO: GH#16312 Return a ReadonlyArray, avoid copying inheritedDocs
160189
160462
  if (inheritedDocs)
160190
160463
  doc = doc.length === 0 ? inheritedDocs.slice() : inheritedDocs.concat(ts.lineBreakPart(), doc);
160464
+ };
160465
+ for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) {
160466
+ var declaration = declarations_7[_i];
160467
+ _loop_23(declaration);
160191
160468
  }
160192
160469
  }
160193
160470
  return doc;