@typescript-deploys/pr-build 4.6.0-pr-47550-2 → 4.6.0-pr-47607-13

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/typescript.js CHANGED
@@ -294,7 +294,7 @@ var ts;
294
294
  // The following is baselined as a literal template type without intervention
295
295
  /** The version of the TypeScript compiler release */
296
296
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
297
- ts.version = ts.versionMajorMinor + ".0-insiders.20220121";
297
+ ts.version = ts.versionMajorMinor + ".0-insiders.20220127";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -305,13 +305,18 @@ var ts;
305
305
  /* @internal */
306
306
  var NativeCollections;
307
307
  (function (NativeCollections) {
308
+ var globals = typeof globalThis !== "undefined" ? globalThis :
309
+ typeof global !== "undefined" ? global :
310
+ typeof self !== "undefined" ? self :
311
+ undefined;
308
312
  /**
309
313
  * Returns the native Map implementation if it is available and compatible (i.e. supports iteration).
310
314
  */
311
315
  function tryGetNativeMap() {
312
316
  // Internet Explorer's Map doesn't support iteration, so don't use it.
317
+ var gMap = globals === null || globals === void 0 ? void 0 : globals.Map;
313
318
  // eslint-disable-next-line no-in-operator
314
- return typeof Map !== "undefined" && "entries" in Map.prototype && new Map([[0, 0]]).size === 1 ? Map : undefined;
319
+ return typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined;
315
320
  }
316
321
  NativeCollections.tryGetNativeMap = tryGetNativeMap;
317
322
  /**
@@ -319,8 +324,9 @@ var ts;
319
324
  */
320
325
  function tryGetNativeSet() {
321
326
  // Internet Explorer's Set doesn't support iteration, so don't use it.
327
+ var gSet = globals === null || globals === void 0 ? void 0 : globals.Set;
322
328
  // eslint-disable-next-line no-in-operator
323
- return typeof Set !== "undefined" && "entries" in Set.prototype && new Set([0]).size === 1 ? Set : undefined;
329
+ return typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined;
324
330
  }
325
331
  NativeCollections.tryGetNativeSet = tryGetNativeSet;
326
332
  })(NativeCollections || (NativeCollections = {}));
@@ -5106,13 +5112,14 @@ var ts;
5106
5112
  // Flags that require TypeFlags.Object
5107
5113
  ObjectFlags[ObjectFlags["ContainsSpread"] = 4194304] = "ContainsSpread";
5108
5114
  ObjectFlags[ObjectFlags["ObjectRestType"] = 8388608] = "ObjectRestType";
5115
+ ObjectFlags[ObjectFlags["InstantiationExpressionType"] = 16777216] = "InstantiationExpressionType";
5109
5116
  /* @internal */
5110
- ObjectFlags[ObjectFlags["IsClassInstanceClone"] = 16777216] = "IsClassInstanceClone";
5117
+ ObjectFlags[ObjectFlags["IsClassInstanceClone"] = 33554432] = "IsClassInstanceClone";
5111
5118
  // Flags that require TypeFlags.Object and ObjectFlags.Reference
5112
5119
  /* @internal */
5113
- ObjectFlags[ObjectFlags["IdenticalBaseTypeCalculated"] = 33554432] = "IdenticalBaseTypeCalculated";
5120
+ ObjectFlags[ObjectFlags["IdenticalBaseTypeCalculated"] = 67108864] = "IdenticalBaseTypeCalculated";
5114
5121
  /* @internal */
5115
- ObjectFlags[ObjectFlags["IdenticalBaseTypeExists"] = 67108864] = "IdenticalBaseTypeExists";
5122
+ ObjectFlags[ObjectFlags["IdenticalBaseTypeExists"] = 134217728] = "IdenticalBaseTypeExists";
5116
5123
  // Flags that require TypeFlags.UnionOrIntersection or TypeFlags.Substitution
5117
5124
  /* @internal */
5118
5125
  ObjectFlags[ObjectFlags["IsGenericTypeComputed"] = 4194304] = "IsGenericTypeComputed";
@@ -8718,6 +8725,7 @@ var ts;
8718
8725
  Cannot_assign_to_0_because_it_is_an_import: diag(2632, ts.DiagnosticCategory.Error, "Cannot_assign_to_0_because_it_is_an_import_2632", "Cannot assign to '{0}' because it is an import."),
8719
8726
  JSX_property_access_expressions_cannot_include_JSX_namespace_names: diag(2633, ts.DiagnosticCategory.Error, "JSX_property_access_expressions_cannot_include_JSX_namespace_names_2633", "JSX property access expressions cannot include JSX namespace names"),
8720
8727
  _0_index_signatures_are_incompatible: diag(2634, ts.DiagnosticCategory.Error, "_0_index_signatures_are_incompatible_2634", "'{0}' index signatures are incompatible."),
8728
+ Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable: diag(2635, ts.DiagnosticCategory.Error, "Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable_2635", "Type '{0}' has no signatures for which the type argument list is applicable."),
8721
8729
  Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: diag(2649, ts.DiagnosticCategory.Error, "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", "Cannot augment module '{0}' with value exports because it resolves to a non-module entity."),
8722
8730
  A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: diag(2651, ts.DiagnosticCategory.Error, "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums."),
8723
8731
  Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: diag(2652, ts.DiagnosticCategory.Error, "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead."),
@@ -9661,6 +9669,8 @@ var ts;
9661
9669
  Remove_unused_declarations_for_Colon_0: diag(90041, ts.DiagnosticCategory.Message, "Remove_unused_declarations_for_Colon_0_90041", "Remove unused declarations for: '{0}'"),
9662
9670
  Declare_a_private_field_named_0: diag(90053, ts.DiagnosticCategory.Message, "Declare_a_private_field_named_0_90053", "Declare a private field named '{0}'."),
9663
9671
  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}'"),
9672
+ 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}\""),
9673
+ 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}\""),
9664
9674
  Convert_function_to_an_ES2015_class: diag(95001, ts.DiagnosticCategory.Message, "Convert_function_to_an_ES2015_class_95001", "Convert function to an ES2015 class"),
9665
9675
  Convert_0_to_1_in_0: diag(95003, ts.DiagnosticCategory.Message, "Convert_0_to_1_in_0_95003", "Convert '{0}' to '{1} in {0}'"),
9666
9676
  Extract_to_0_in_1: diag(95004, ts.DiagnosticCategory.Message, "Extract_to_0_in_1_95004", "Extract to {0} in {1}"),
@@ -13601,6 +13611,7 @@ var ts;
13601
13611
  case 110 /* TrueKeyword */:
13602
13612
  case 106 /* SuperKeyword */:
13603
13613
  case 229 /* NonNullExpression */:
13614
+ case 227 /* ExpressionWithTypeArguments */:
13604
13615
  case 230 /* MetaProperty */:
13605
13616
  case 100 /* ImportKeyword */: // technically this is only an Expression if it's in a CallExpression
13606
13617
  return true;
@@ -14251,10 +14262,13 @@ var ts;
14251
14262
  function packageIdIsEqual(a, b) {
14252
14263
  return a === b || !!a && !!b && a.name === b.name && a.subModuleName === b.subModuleName && a.version === b.version;
14253
14264
  }
14254
- function packageIdToString(_a) {
14255
- var name = _a.name, subModuleName = _a.subModuleName, version = _a.version;
14256
- var fullName = subModuleName ? name + "/" + subModuleName : name;
14257
- return fullName + "@" + version;
14265
+ function packageIdToPackageName(_a) {
14266
+ var name = _a.name, subModuleName = _a.subModuleName;
14267
+ return subModuleName ? name + "/" + subModuleName : name;
14268
+ }
14269
+ ts.packageIdToPackageName = packageIdToPackageName;
14270
+ function packageIdToString(packageId) {
14271
+ return packageIdToPackageName(packageId) + "@" + packageId.version;
14258
14272
  }
14259
14273
  ts.packageIdToString = packageIdToString;
14260
14274
  function typeDirectiveIsEqualTo(oldResolution, newResolution) {
@@ -15087,6 +15101,15 @@ var ts;
15087
15101
  };
15088
15102
  }
15089
15103
  ts.createDiagnosticForFileFromMessageChain = createDiagnosticForFileFromMessageChain;
15104
+ function createDiagnosticMessageChainFromDiagnostic(diagnostic) {
15105
+ return typeof diagnostic.messageText === "string" ? {
15106
+ code: diagnostic.code,
15107
+ category: diagnostic.category,
15108
+ messageText: diagnostic.messageText,
15109
+ next: diagnostic.next,
15110
+ } : diagnostic.messageText;
15111
+ }
15112
+ ts.createDiagnosticMessageChainFromDiagnostic = createDiagnosticMessageChainFromDiagnostic;
15090
15113
  function createDiagnosticForRange(sourceFile, range, message) {
15091
15114
  return {
15092
15115
  file: sourceFile,
@@ -15255,7 +15278,8 @@ var ts;
15255
15278
  node.kind === 212 /* FunctionExpression */ ||
15256
15279
  node.kind === 213 /* ArrowFunction */ ||
15257
15280
  node.kind === 211 /* ParenthesizedExpression */ ||
15258
- node.kind === 253 /* VariableDeclaration */) ?
15281
+ node.kind === 253 /* VariableDeclaration */ ||
15282
+ node.kind === 274 /* ExportSpecifier */) ?
15259
15283
  ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) :
15260
15284
  ts.getLeadingCommentRanges(text, node.pos);
15261
15285
  // True if the comment starts with '/**' but not if it is '/**/'
@@ -15289,7 +15313,7 @@ var ts;
15289
15313
  case 114 /* VoidKeyword */:
15290
15314
  return node.parent.kind !== 216 /* VoidExpression */;
15291
15315
  case 227 /* ExpressionWithTypeArguments */:
15292
- return !isExpressionWithTypeArgumentsInClassExtendsClause(node);
15316
+ return ts.isHeritageClause(node.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(node);
15293
15317
  case 162 /* TypeParameter */:
15294
15318
  return node.parent.kind === 194 /* MappedType */ || node.parent.kind === 189 /* InferType */;
15295
15319
  // Identifiers and qualified names may be type nodes, depending on their context. Climb
@@ -15326,7 +15350,7 @@ var ts;
15326
15350
  }
15327
15351
  switch (parent.kind) {
15328
15352
  case 227 /* ExpressionWithTypeArguments */:
15329
- return !isExpressionWithTypeArgumentsInClassExtendsClause(parent);
15353
+ return ts.isHeritageClause(parent.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(parent);
15330
15354
  case 162 /* TypeParameter */:
15331
15355
  return node === parent.constraint;
15332
15356
  case 342 /* JSDocTemplateTag */:
@@ -16029,7 +16053,7 @@ var ts;
16029
16053
  case 296 /* SpreadAssignment */:
16030
16054
  return true;
16031
16055
  case 227 /* ExpressionWithTypeArguments */:
16032
- return parent.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent);
16056
+ return parent.expression === node && !isPartOfTypeNode(parent);
16033
16057
  case 295 /* ShorthandPropertyAssignment */:
16034
16058
  return parent.objectAssignmentInitializer === node;
16035
16059
  default:
@@ -22963,16 +22987,18 @@ var ts;
22963
22987
  return updateConstructorTypeNode1(node, node.modifiers, typeParameters, parameters, type);
22964
22988
  }
22965
22989
  // @api
22966
- function createTypeQueryNode(exprName) {
22990
+ function createTypeQueryNode(exprName, typeArguments) {
22967
22991
  var node = createBaseNode(180 /* TypeQuery */);
22968
22992
  node.exprName = exprName;
22993
+ node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments);
22969
22994
  node.transformFlags = 1 /* ContainsTypeScript */;
22970
22995
  return node;
22971
22996
  }
22972
22997
  // @api
22973
- function updateTypeQueryNode(node, exprName) {
22998
+ function updateTypeQueryNode(node, exprName, typeArguments) {
22974
22999
  return node.exprName !== exprName
22975
- ? update(createTypeQueryNode(exprName), node)
23000
+ || node.typeArguments !== typeArguments
23001
+ ? update(createTypeQueryNode(exprName, typeArguments), node)
22976
23002
  : node;
22977
23003
  }
22978
23004
  // @api
@@ -30088,7 +30114,8 @@ var ts;
30088
30114
  visitNode(cbNode, node.parameterName) ||
30089
30115
  visitNode(cbNode, node.type);
30090
30116
  case 180 /* TypeQuery */:
30091
- return visitNode(cbNode, node.exprName);
30117
+ return visitNode(cbNode, node.exprName) ||
30118
+ visitNodes(cbNode, cbNodes, node.typeArguments);
30092
30119
  case 181 /* TypeLiteral */:
30093
30120
  return visitNodes(cbNode, cbNodes, node.members);
30094
30121
  case 182 /* ArrayType */:
@@ -32621,7 +32648,9 @@ var ts;
32621
32648
  function parseTypeQuery() {
32622
32649
  var pos = getNodePos();
32623
32650
  parseExpected(112 /* TypeOfKeyword */);
32624
- return finishNode(factory.createTypeQueryNode(parseEntityName(/*allowReservedWords*/ true)), pos);
32651
+ var entityName = parseEntityName(/*allowReservedWords*/ true);
32652
+ var typeArguments = tryParseTypeArguments();
32653
+ return finishNode(factory.createTypeQueryNode(entityName, typeArguments), pos);
32625
32654
  }
32626
32655
  function parseTypeParameter() {
32627
32656
  var pos = getNodePos();
@@ -33560,7 +33589,7 @@ var ts;
33560
33589
  function parseInitializer() {
33561
33590
  return parseOptional(63 /* EqualsToken */) ? parseAssignmentExpressionOrHigher() : undefined;
33562
33591
  }
33563
- function parseAssignmentExpressionOrHigher(parsingConditionalTrueSide) {
33592
+ function parseAssignmentExpressionOrHigher() {
33564
33593
  // AssignmentExpression[in,yield]:
33565
33594
  // 1) ConditionalExpression[?in,?yield]
33566
33595
  // 2) LeftHandSideExpression = AssignmentExpression[?in,?yield]
@@ -33586,7 +33615,7 @@ var ts;
33586
33615
  // If we do successfully parse arrow-function, we must *not* recurse for productions 1, 2 or 3. An ArrowFunction is
33587
33616
  // not a LeftHandSideExpression, nor does it start a ConditionalExpression. So we are done
33588
33617
  // with AssignmentExpression if we see one.
33589
- var arrowExpression = tryParseParenthesizedArrowFunctionExpression(parsingConditionalTrueSide) || tryParseAsyncSimpleArrowFunctionExpression();
33618
+ var arrowExpression = tryParseParenthesizedArrowFunctionExpression() || tryParseAsyncSimpleArrowFunctionExpression();
33590
33619
  if (arrowExpression) {
33591
33620
  return arrowExpression;
33592
33621
  }
@@ -33605,7 +33634,7 @@ var ts;
33605
33634
  // parameter ('x => ...') above. We handle it here by checking if the parsed expression was a single
33606
33635
  // identifier and the current token is an arrow.
33607
33636
  if (expr.kind === 79 /* Identifier */ && token() === 38 /* EqualsGreaterThanToken */) {
33608
- return parseSimpleArrowFunctionExpression(pos, expr, /*asyncModifier*/ undefined, parsingConditionalTrueSide);
33637
+ return parseSimpleArrowFunctionExpression(pos, expr, /*asyncModifier*/ undefined);
33609
33638
  }
33610
33639
  // Now see if we might be in cases '2' or '3'.
33611
33640
  // If the expression was a LHS expression, and we have an assignment operator, then
@@ -33665,7 +33694,7 @@ var ts;
33665
33694
  return finishNode(factory.createYieldExpression(/*asteriskToken*/ undefined, /*expression*/ undefined), pos);
33666
33695
  }
33667
33696
  }
33668
- function parseSimpleArrowFunctionExpression(pos, identifier, asyncModifier, parsingConditionalTrueSide) {
33697
+ function parseSimpleArrowFunctionExpression(pos, identifier, asyncModifier) {
33669
33698
  ts.Debug.assert(token() === 38 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>");
33670
33699
  var parameter = factory.createParameterDeclaration(
33671
33700
  /*decorators*/ undefined,
@@ -33677,11 +33706,11 @@ var ts;
33677
33706
  finishNode(parameter, identifier.pos);
33678
33707
  var parameters = createNodeArray([parameter], parameter.pos, parameter.end);
33679
33708
  var equalsGreaterThanToken = parseExpectedToken(38 /* EqualsGreaterThanToken */);
33680
- var body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier, parsingConditionalTrueSide);
33709
+ var body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier);
33681
33710
  var node = factory.createArrowFunction(asyncModifier, /*typeParameters*/ undefined, parameters, /*type*/ undefined, equalsGreaterThanToken, body);
33682
33711
  return addJSDocComment(finishNode(node, pos));
33683
33712
  }
33684
- function tryParseParenthesizedArrowFunctionExpression(parsingConditionalTrueSide) {
33713
+ function tryParseParenthesizedArrowFunctionExpression() {
33685
33714
  var triState = isParenthesizedArrowFunctionExpression();
33686
33715
  if (triState === 0 /* False */) {
33687
33716
  // It's definitely not a parenthesized arrow function expression.
@@ -33692,8 +33721,8 @@ var ts;
33692
33721
  // it out, but don't allow any ambiguity, and return 'undefined' if this could be an
33693
33722
  // expression instead.
33694
33723
  return triState === 1 /* True */ ?
33695
- parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true, parsingConditionalTrueSide) :
33696
- tryParse(function () { return parsePossibleParenthesizedArrowFunctionExpression(parsingConditionalTrueSide); });
33724
+ parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true) :
33725
+ tryParse(parsePossibleParenthesizedArrowFunctionExpression);
33697
33726
  }
33698
33727
  // True -> We definitely expect a parenthesized arrow function here.
33699
33728
  // False -> There *cannot* be a parenthesized arrow function here.
@@ -33823,25 +33852,25 @@ var ts;
33823
33852
  return 2 /* Unknown */;
33824
33853
  }
33825
33854
  }
33826
- function parsePossibleParenthesizedArrowFunctionExpression(parsingConditionalTrueSide) {
33855
+ function parsePossibleParenthesizedArrowFunctionExpression() {
33827
33856
  var tokenPos = scanner.getTokenPos();
33828
33857
  if (notParenthesizedArrow === null || notParenthesizedArrow === void 0 ? void 0 : notParenthesizedArrow.has(tokenPos)) {
33829
33858
  return undefined;
33830
33859
  }
33831
- var result = parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ false, parsingConditionalTrueSide);
33860
+ var result = parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ false);
33832
33861
  if (!result) {
33833
33862
  (notParenthesizedArrow || (notParenthesizedArrow = new ts.Set())).add(tokenPos);
33834
33863
  }
33835
33864
  return result;
33836
33865
  }
33837
- function tryParseAsyncSimpleArrowFunctionExpression(parsingConditionalTrueSide) {
33866
+ function tryParseAsyncSimpleArrowFunctionExpression() {
33838
33867
  // We do a check here so that we won't be doing unnecessarily call to "lookAhead"
33839
33868
  if (token() === 131 /* AsyncKeyword */) {
33840
33869
  if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* True */) {
33841
33870
  var pos = getNodePos();
33842
33871
  var asyncModifier = parseModifiersForArrowFunction();
33843
33872
  var expr = parseBinaryExpressionOrHigher(0 /* Lowest */);
33844
- return parseSimpleArrowFunctionExpression(pos, expr, asyncModifier, parsingConditionalTrueSide);
33873
+ return parseSimpleArrowFunctionExpression(pos, expr, asyncModifier);
33845
33874
  }
33846
33875
  }
33847
33876
  return undefined;
@@ -33865,7 +33894,7 @@ var ts;
33865
33894
  }
33866
33895
  return 0 /* False */;
33867
33896
  }
33868
- function parseParenthesizedArrowFunctionExpression(allowAmbiguity, parsingConditionalTrueSide) {
33897
+ function parseParenthesizedArrowFunctionExpression(allowAmbiguity) {
33869
33898
  var pos = getNodePos();
33870
33899
  var hasJSDoc = hasPrecedingJSDocComment();
33871
33900
  var modifiers = parseModifiersForArrowFunction();
@@ -33891,18 +33920,6 @@ var ts;
33891
33920
  return undefined;
33892
33921
  }
33893
33922
  }
33894
- // Given:
33895
- // x ? y => ({ y }) : z => ({ z })
33896
- // We try to parse the body of the first arrow function by looking at:
33897
- // ({ y }) : z => ({ z })
33898
- // This is a valid arrow function with "z" as the return type.
33899
- //
33900
- // But, if we're in the true side of a conditional expression, this colon
33901
- // terminates the true side, so cannot be the return type.
33902
- if (parsingConditionalTrueSide && token() === 58 /* ColonToken */) {
33903
- ts.Debug.assert(!allowAmbiguity);
33904
- return undefined;
33905
- }
33906
33923
  var type = parseReturnType(58 /* ColonToken */, /*isType*/ false);
33907
33924
  if (type && !allowAmbiguity && typeHasArrowFunctionBlockingParseError(type)) {
33908
33925
  return undefined;
@@ -33936,7 +33953,7 @@ var ts;
33936
33953
  var node = factory.createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body);
33937
33954
  return withJSDoc(finishNode(node, pos), hasJSDoc);
33938
33955
  }
33939
- function parseArrowFunctionExpressionBody(isAsync, parsingConditionalTrueSide) {
33956
+ function parseArrowFunctionExpressionBody(isAsync) {
33940
33957
  if (token() === 18 /* OpenBraceToken */) {
33941
33958
  return parseFunctionBlock(isAsync ? 2 /* Await */ : 0 /* None */);
33942
33959
  }
@@ -33964,8 +33981,8 @@ var ts;
33964
33981
  var savedTopLevel = topLevel;
33965
33982
  topLevel = false;
33966
33983
  var node = isAsync
33967
- ? doInAwaitContext(function () { return parseAssignmentExpressionOrHigher(parsingConditionalTrueSide); })
33968
- : doOutsideOfAwaitContext(function () { return parseAssignmentExpressionOrHigher(parsingConditionalTrueSide); });
33984
+ ? doInAwaitContext(parseAssignmentExpressionOrHigher)
33985
+ : doOutsideOfAwaitContext(parseAssignmentExpressionOrHigher);
33969
33986
  topLevel = savedTopLevel;
33970
33987
  return node;
33971
33988
  }
@@ -33978,8 +33995,8 @@ var ts;
33978
33995
  // Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and
33979
33996
  // we do not that for the 'whenFalse' part.
33980
33997
  var colonToken;
33981
- return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, function () { return parseAssignmentExpressionOrHigher(/*parsingConditionalTrueSide*/ true); }), colonToken = parseExpectedToken(58 /* ColonToken */), ts.nodeIsPresent(colonToken)
33982
- ? parseAssignmentExpressionOrHigher(/*parsingConditionalTrueSide*/ false)
33998
+ return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher), colonToken = parseExpectedToken(58 /* ColonToken */), ts.nodeIsPresent(colonToken)
33999
+ ? parseAssignmentExpressionOrHigher()
33983
34000
  : createMissingNode(79 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(58 /* ColonToken */))), pos);
33984
34001
  }
33985
34002
  function parseBinaryExpressionOrHigher(precedence) {
@@ -34750,12 +34767,16 @@ var ts;
34750
34767
  expression = parseTaggedTemplateRest(pos, expression, questionDotToken, typeArguments);
34751
34768
  continue;
34752
34769
  }
34753
- var argumentList = parseArgumentList();
34754
- var callExpr = questionDotToken || tryReparseOptionalChain(expression) ?
34755
- factory.createCallChain(expression, questionDotToken, typeArguments, argumentList) :
34756
- factory.createCallExpression(expression, typeArguments, argumentList);
34757
- expression = finishNode(callExpr, pos);
34758
- continue;
34770
+ if (questionDotToken || token() === 20 /* OpenParenToken */) {
34771
+ var argumentList = parseArgumentList();
34772
+ var callExpr = questionDotToken || tryReparseOptionalChain(expression) ?
34773
+ factory.createCallChain(expression, questionDotToken, typeArguments, argumentList) :
34774
+ factory.createCallExpression(expression, typeArguments, argumentList);
34775
+ expression = finishNode(callExpr, pos);
34776
+ continue;
34777
+ }
34778
+ expression = finishNode(factory.createExpressionWithTypeArguments(expression, typeArguments), pos);
34779
+ break;
34759
34780
  }
34760
34781
  }
34761
34782
  else if (token() === 20 /* OpenParenToken */) {
@@ -34795,20 +34816,23 @@ var ts;
34795
34816
  // If it doesn't have the closing `>` then it's definitely not an type argument list.
34796
34817
  return undefined;
34797
34818
  }
34798
- // If we have a '<', then only parse this as a argument list if the type arguments
34799
- // are complete and we have an open paren. if we don't, rewind and return nothing.
34800
- return typeArguments && canFollowTypeArgumentsInExpression()
34801
- ? typeArguments
34802
- : undefined;
34819
+ // We successfully parsed a type argument list. The next token determines whether we want to
34820
+ // treat it as such. If the type argument list is followed by `(` or a template literal, as in
34821
+ // `f<number>(42)`, we favor the type argument interpretation even though JavaScript would view
34822
+ // it as a relational expression.
34823
+ return typeArguments && canFollowTypeArgumentsInExpression() ? typeArguments : undefined;
34803
34824
  }
34804
34825
  function canFollowTypeArgumentsInExpression() {
34805
34826
  switch (token()) {
34827
+ // These tokens can follow a type argument list in a call expression.
34806
34828
  case 20 /* OpenParenToken */: // foo<x>(
34807
34829
  case 14 /* NoSubstitutionTemplateLiteral */: // foo<T> `...`
34808
34830
  case 15 /* TemplateHead */: // foo<T> `...${100}...`
34809
- // these are the only tokens can legally follow a type argument
34810
- // list. So we definitely want to treat them as type arg lists.
34831
+ // These tokens can't follow in a call expression, nor can they start an
34832
+ // expression. So, consider the type argument list part of an instantiation
34833
+ // expression.
34811
34834
  // falls through
34835
+ case 27 /* CommaToken */: // foo<x>,
34812
34836
  case 24 /* DotToken */: // foo<x>.
34813
34837
  case 21 /* CloseParenToken */: // foo<x>)
34814
34838
  case 23 /* CloseBracketToken */: // foo<x>]
@@ -34827,20 +34851,10 @@ var ts;
34827
34851
  case 51 /* BarToken */: // foo<x> |
34828
34852
  case 19 /* CloseBraceToken */: // foo<x> }
34829
34853
  case 1 /* EndOfFileToken */: // foo<x>
34830
- // these cases can't legally follow a type arg list. However, they're not legal
34831
- // expressions either. The user is probably in the middle of a generic type. So
34832
- // treat it as such.
34833
34854
  return true;
34834
- case 27 /* CommaToken */: // foo<x>,
34835
- case 18 /* OpenBraceToken */: // foo<x> {
34836
- // We don't want to treat these as type arguments. Otherwise we'll parse this
34837
- // as an invocation expression. Instead, we want to parse out the expression
34838
- // in isolation from the type arguments.
34839
- // falls through
34840
- default:
34841
- // Anything else treat as an expression.
34842
- return false;
34843
34855
  }
34856
+ // Treat anything else as an expression.
34857
+ return false;
34844
34858
  }
34845
34859
  function parsePrimaryExpression() {
34846
34860
  switch (token()) {
@@ -35021,17 +35035,12 @@ var ts;
35021
35035
  return finishNode(factory.createMetaProperty(103 /* NewKeyword */, name), pos);
35022
35036
  }
35023
35037
  var expressionPos = getNodePos();
35024
- var expression = parsePrimaryExpression();
35025
- var typeArguments;
35026
- while (true) {
35027
- expression = parseMemberExpressionRest(expressionPos, expression, /*allowOptionalChain*/ false);
35028
- typeArguments = tryParse(parseTypeArgumentsInExpression);
35029
- if (isTemplateStartOfTaggedTemplate()) {
35030
- ts.Debug.assert(!!typeArguments, "Expected a type argument list; all plain tagged template starts should be consumed in 'parseMemberExpressionRest'");
35031
- expression = parseTaggedTemplateRest(expressionPos, expression, /*optionalChain*/ undefined, typeArguments);
35032
- typeArguments = undefined;
35033
- }
35034
- break;
35038
+ var expression = parseMemberExpressionRest(expressionPos, parsePrimaryExpression(), /*allowOptionalChain*/ false);
35039
+ var typeArguments = tryParse(parseTypeArgumentsInExpression);
35040
+ if (isTemplateStartOfTaggedTemplate()) {
35041
+ ts.Debug.assert(!!typeArguments, "Expected a type argument list; all plain tagged template starts should be consumed in 'parseMemberExpressionRest'");
35042
+ expression = parseTaggedTemplateRest(expressionPos, expression, /*optionalChain*/ undefined, typeArguments);
35043
+ typeArguments = undefined;
35035
35044
  }
35036
35045
  var argumentsArray;
35037
35046
  if (token() === 20 /* OpenParenToken */) {
@@ -36128,6 +36137,9 @@ var ts;
36128
36137
  function parseExpressionWithTypeArguments() {
36129
36138
  var pos = getNodePos();
36130
36139
  var expression = parseLeftHandSideExpressionOrHigher();
36140
+ if (expression.kind === 227 /* ExpressionWithTypeArguments */) {
36141
+ return expression;
36142
+ }
36131
36143
  var typeArguments = tryParseTypeArguments();
36132
36144
  return finishNode(factory.createExpressionWithTypeArguments(expression, typeArguments), pos);
36133
36145
  }
@@ -36418,7 +36430,8 @@ var ts;
36418
36430
  return finishNode(node, pos);
36419
36431
  }
36420
36432
  function parseExportSpecifier() {
36421
- return parseImportOrExportSpecifier(274 /* ExportSpecifier */);
36433
+ var hasJSDoc = hasPrecedingJSDocComment();
36434
+ return withJSDoc(parseImportOrExportSpecifier(274 /* ExportSpecifier */), hasJSDoc);
36422
36435
  }
36423
36436
  function parseImportSpecifier() {
36424
36437
  return parseImportOrExportSpecifier(269 /* ImportSpecifier */);
@@ -43623,14 +43636,12 @@ var ts;
43623
43636
  }
43624
43637
  var binder = createBinder();
43625
43638
  function bindSourceFile(file, options) {
43626
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("bind" /* Bind */, "bindSourceFile", { path: file.path }, /*separateBeginAndEnd*/ true);
43627
43639
  ts.performance.mark("beforeBind");
43628
43640
  ts.perfLogger.logStartBindFile("" + file.fileName);
43629
43641
  binder(file, options);
43630
43642
  ts.perfLogger.logStopBindFile();
43631
43643
  ts.performance.mark("afterBind");
43632
43644
  ts.performance.measure("Bind", "beforeBind", "afterBind");
43633
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
43634
43645
  }
43635
43646
  ts.bindSourceFile = bindSourceFile;
43636
43647
  function createBinder() {
@@ -43690,7 +43701,9 @@ var ts;
43690
43701
  ts.Debug.attachFlowNodeDebugInfo(unreachableFlow);
43691
43702
  ts.Debug.attachFlowNodeDebugInfo(reportedUnreachableFlow);
43692
43703
  if (!file.locals) {
43704
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("bind" /* Bind */, "bindSourceFile", { path: file.path }, /*separateBeginAndEnd*/ true);
43693
43705
  bind(file);
43706
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
43694
43707
  file.symbolCount = symbolCount;
43695
43708
  file.classifiableNames = classifiableNames;
43696
43709
  delayedBindJSDocTypedefTag();
@@ -47957,6 +47970,9 @@ var ts;
47957
47970
  suggestionDiagnostics.add(diagnostic);
47958
47971
  return diagnostic;
47959
47972
  }
47973
+ function isDeprecatedSymbol(symbol) {
47974
+ return !!(getDeclarationNodeFlagsFromSymbol(symbol) & 134217728 /* Deprecated */);
47975
+ }
47960
47976
  function addDeprecatedSuggestion(location, declarations, deprecatedEntity) {
47961
47977
  var diagnostic = ts.createDiagnosticForNode(location, ts.Diagnostics._0_is_deprecated, deprecatedEntity);
47962
47978
  return addDeprecatedSuggestionWorker(declarations, diagnostic);
@@ -51052,7 +51068,7 @@ var ts;
51052
51068
  // get symbol of the first identifier of the entityName
51053
51069
  var meaning;
51054
51070
  if (entityName.parent.kind === 180 /* TypeQuery */ ||
51055
- ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent) ||
51071
+ entityName.parent.kind === 227 /* ExpressionWithTypeArguments */ && !ts.isPartOfTypeNode(entityName.parent) ||
51056
51072
  entityName.parent.kind === 161 /* ComputedPropertyName */) {
51057
51073
  // Typeof value
51058
51074
  meaning = 111551 /* Value */ | 1048576 /* ExportValue */;
@@ -51163,7 +51179,7 @@ var ts;
51163
51179
  return flags & 814775659 /* NodeBuilderFlagsMask */;
51164
51180
  }
51165
51181
  function isClassInstanceSide(type) {
51166
- return !!type.symbol && !!(type.symbol.flags & 32 /* Class */) && (type === getDeclaredTypeOfClassOrInterface(type.symbol) || (!!(type.flags & 524288 /* Object */) && !!(ts.getObjectFlags(type) & 16777216 /* IsClassInstanceClone */)));
51182
+ return !!type.symbol && !!(type.symbol.flags & 32 /* Class */) && (type === getDeclaredTypeOfClassOrInterface(type.symbol) || (!!(type.flags & 524288 /* Object */) && !!(ts.getObjectFlags(type) & 33554432 /* IsClassInstanceClone */)));
51167
51183
  }
51168
51184
  function createNodeBuilder() {
51169
51185
  return {
@@ -52727,7 +52743,8 @@ var ts;
52727
52743
  includePrivateSymbol === null || includePrivateSymbol === void 0 ? void 0 : includePrivateSymbol(sym);
52728
52744
  }
52729
52745
  if (ts.isIdentifier(node)) {
52730
- var name = sym.flags & 262144 /* TypeParameter */ ? typeParameterToName(getDeclaredTypeOfSymbol(sym), context) : ts.factory.cloneNode(node);
52746
+ var type = getDeclaredTypeOfSymbol(sym);
52747
+ var name = sym.flags & 262144 /* TypeParameter */ && !isTypeSymbolAccessible(type.symbol, context.enclosingDeclaration) ? typeParameterToName(type, context) : ts.factory.cloneNode(node);
52731
52748
  name.symbol = sym; // for quickinfo, which uses identifier symbol information
52732
52749
  return { introducesError: introducesError, node: ts.setEmitFlags(ts.setOriginalNode(name, node), 16777216 /* NoAsciiEscaping */) };
52733
52750
  }
@@ -55090,7 +55107,7 @@ var ts;
55090
55107
  members_4, exportedType.callSignatures, exportedType.constructSignatures, exportedType.indexInfos);
55091
55108
  result.objectFlags |= (ts.getObjectFlags(type) & 8192 /* JSLiteral */); // Propagate JSLiteral flag
55092
55109
  if (result.symbol && result.symbol.flags & 32 /* Class */ && type === getDeclaredTypeOfClassOrInterface(result.symbol)) {
55093
- result.objectFlags |= 16777216 /* IsClassInstanceClone */; // Propagate the knowledge that this type is equivalent to the symbol's class instance type
55110
+ result.objectFlags |= 33554432 /* IsClassInstanceClone */; // Propagate the knowledge that this type is equivalent to the symbol's class instance type
55094
55111
  }
55095
55112
  return result;
55096
55113
  }
@@ -57100,87 +57117,87 @@ var ts;
57100
57117
  * Converts an AnonymousType to a ResolvedType.
57101
57118
  */
57102
57119
  function resolveAnonymousTypeMembers(type) {
57103
- var symbol = getMergedSymbol(type.symbol);
57104
57120
  if (type.target) {
57105
57121
  setStructuredTypeMembers(type, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
57106
- var members = createInstantiatedSymbolTable(getPropertiesOfObjectType(type.target), type.mapper, /*mappingThisOnly*/ false);
57122
+ var members_6 = createInstantiatedSymbolTable(getPropertiesOfObjectType(type.target), type.mapper, /*mappingThisOnly*/ false);
57107
57123
  var callSignatures = instantiateSignatures(getSignaturesOfType(type.target, 0 /* Call */), type.mapper);
57108
57124
  var constructSignatures = instantiateSignatures(getSignaturesOfType(type.target, 1 /* Construct */), type.mapper);
57109
- var indexInfos = instantiateIndexInfos(getIndexInfosOfType(type.target), type.mapper);
57110
- setStructuredTypeMembers(type, members, callSignatures, constructSignatures, indexInfos);
57125
+ var indexInfos_1 = instantiateIndexInfos(getIndexInfosOfType(type.target), type.mapper);
57126
+ setStructuredTypeMembers(type, members_6, callSignatures, constructSignatures, indexInfos_1);
57127
+ return;
57111
57128
  }
57112
- else if (symbol.flags & 2048 /* TypeLiteral */) {
57129
+ var symbol = getMergedSymbol(type.symbol);
57130
+ if (symbol.flags & 2048 /* TypeLiteral */) {
57113
57131
  setStructuredTypeMembers(type, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
57114
- var members = getMembersOfSymbol(symbol);
57115
- var callSignatures = getSignaturesOfSymbol(members.get("__call" /* Call */));
57116
- var constructSignatures = getSignaturesOfSymbol(members.get("__new" /* New */));
57117
- var indexInfos = getIndexInfosOfSymbol(symbol);
57118
- setStructuredTypeMembers(type, members, callSignatures, constructSignatures, indexInfos);
57132
+ var members_7 = getMembersOfSymbol(symbol);
57133
+ var callSignatures = getSignaturesOfSymbol(members_7.get("__call" /* Call */));
57134
+ var constructSignatures = getSignaturesOfSymbol(members_7.get("__new" /* New */));
57135
+ var indexInfos_2 = getIndexInfosOfSymbol(symbol);
57136
+ setStructuredTypeMembers(type, members_7, callSignatures, constructSignatures, indexInfos_2);
57137
+ return;
57119
57138
  }
57120
- else {
57121
- // Combinations of function, class, enum and module
57122
- var members = emptySymbols;
57123
- var indexInfos = void 0;
57124
- if (symbol.exports) {
57125
- members = getExportsOfSymbol(symbol);
57126
- if (symbol === globalThisSymbol) {
57127
- var varsOnly_1 = new ts.Map();
57128
- members.forEach(function (p) {
57129
- if (!(p.flags & 418 /* BlockScoped */)) {
57130
- varsOnly_1.set(p.escapedName, p);
57131
- }
57132
- });
57133
- members = varsOnly_1;
57134
- }
57139
+ // Combinations of function, class, enum and module
57140
+ var members = emptySymbols;
57141
+ var indexInfos;
57142
+ if (symbol.exports) {
57143
+ members = getExportsOfSymbol(symbol);
57144
+ if (symbol === globalThisSymbol) {
57145
+ var varsOnly_1 = new ts.Map();
57146
+ members.forEach(function (p) {
57147
+ if (!(p.flags & 418 /* BlockScoped */)) {
57148
+ varsOnly_1.set(p.escapedName, p);
57149
+ }
57150
+ });
57151
+ members = varsOnly_1;
57135
57152
  }
57136
- var baseConstructorIndexInfo = void 0;
57137
- setStructuredTypeMembers(type, members, ts.emptyArray, ts.emptyArray, ts.emptyArray);
57138
- if (symbol.flags & 32 /* Class */) {
57139
- var classType = getDeclaredTypeOfClassOrInterface(symbol);
57140
- var baseConstructorType = getBaseConstructorTypeOfClass(classType);
57141
- if (baseConstructorType.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 8650752 /* TypeVariable */)) {
57142
- members = ts.createSymbolTable(getNamedOrIndexSignatureMembers(members));
57143
- addInheritedMembers(members, getPropertiesOfType(baseConstructorType));
57144
- }
57145
- else if (baseConstructorType === anyType) {
57146
- baseConstructorIndexInfo = createIndexInfo(stringType, anyType, /*isReadonly*/ false);
57147
- }
57153
+ }
57154
+ var baseConstructorIndexInfo;
57155
+ setStructuredTypeMembers(type, members, ts.emptyArray, ts.emptyArray, ts.emptyArray);
57156
+ if (symbol.flags & 32 /* Class */) {
57157
+ var classType = getDeclaredTypeOfClassOrInterface(symbol);
57158
+ var baseConstructorType = getBaseConstructorTypeOfClass(classType);
57159
+ if (baseConstructorType.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 8650752 /* TypeVariable */)) {
57160
+ members = ts.createSymbolTable(getNamedOrIndexSignatureMembers(members));
57161
+ addInheritedMembers(members, getPropertiesOfType(baseConstructorType));
57148
57162
  }
57149
- var indexSymbol = getIndexSymbolFromSymbolTable(members);
57150
- if (indexSymbol) {
57151
- indexInfos = getIndexInfosOfIndexSymbol(indexSymbol);
57163
+ else if (baseConstructorType === anyType) {
57164
+ baseConstructorIndexInfo = createIndexInfo(stringType, anyType, /*isReadonly*/ false);
57152
57165
  }
57153
- else {
57154
- if (baseConstructorIndexInfo) {
57155
- indexInfos = ts.append(indexInfos, baseConstructorIndexInfo);
57156
- }
57157
- if (symbol.flags & 384 /* Enum */ && (getDeclaredTypeOfSymbol(symbol).flags & 32 /* Enum */ ||
57158
- ts.some(type.properties, function (prop) { return !!(getTypeOfSymbol(prop).flags & 296 /* NumberLike */); }))) {
57159
- indexInfos = ts.append(indexInfos, enumNumberIndexInfo);
57160
- }
57166
+ }
57167
+ var indexSymbol = getIndexSymbolFromSymbolTable(members);
57168
+ if (indexSymbol) {
57169
+ indexInfos = getIndexInfosOfIndexSymbol(indexSymbol);
57170
+ }
57171
+ else {
57172
+ if (baseConstructorIndexInfo) {
57173
+ indexInfos = ts.append(indexInfos, baseConstructorIndexInfo);
57161
57174
  }
57162
- setStructuredTypeMembers(type, members, ts.emptyArray, ts.emptyArray, indexInfos || ts.emptyArray);
57163
- // We resolve the members before computing the signatures because a signature may use
57164
- // typeof with a qualified name expression that circularly references the type we are
57165
- // in the process of resolving (see issue #6072). The temporarily empty signature list
57166
- // will never be observed because a qualified name can't reference signatures.
57167
- if (symbol.flags & (16 /* Function */ | 8192 /* Method */)) {
57168
- type.callSignatures = getSignaturesOfSymbol(symbol);
57175
+ if (symbol.flags & 384 /* Enum */ && (getDeclaredTypeOfSymbol(symbol).flags & 32 /* Enum */ ||
57176
+ ts.some(type.properties, function (prop) { return !!(getTypeOfSymbol(prop).flags & 296 /* NumberLike */); }))) {
57177
+ indexInfos = ts.append(indexInfos, enumNumberIndexInfo);
57169
57178
  }
57170
- // And likewise for construct signatures for classes
57171
- if (symbol.flags & 32 /* Class */) {
57172
- var classType_1 = getDeclaredTypeOfClassOrInterface(symbol);
57173
- var constructSignatures = symbol.members ? getSignaturesOfSymbol(symbol.members.get("__constructor" /* Constructor */)) : ts.emptyArray;
57174
- if (symbol.flags & 16 /* Function */) {
57175
- constructSignatures = ts.addRange(constructSignatures.slice(), ts.mapDefined(type.callSignatures, function (sig) { return isJSConstructor(sig.declaration) ?
57176
- createSignature(sig.declaration, sig.typeParameters, sig.thisParameter, sig.parameters, classType_1, /*resolvedTypePredicate*/ undefined, sig.minArgumentCount, sig.flags & 39 /* PropagatingFlags */) :
57177
- undefined; }));
57178
- }
57179
- if (!constructSignatures.length) {
57180
- constructSignatures = getDefaultConstructSignatures(classType_1);
57181
- }
57182
- type.constructSignatures = constructSignatures;
57179
+ }
57180
+ setStructuredTypeMembers(type, members, ts.emptyArray, ts.emptyArray, indexInfos || ts.emptyArray);
57181
+ // We resolve the members before computing the signatures because a signature may use
57182
+ // typeof with a qualified name expression that circularly references the type we are
57183
+ // in the process of resolving (see issue #6072). The temporarily empty signature list
57184
+ // will never be observed because a qualified name can't reference signatures.
57185
+ if (symbol.flags & (16 /* Function */ | 8192 /* Method */)) {
57186
+ type.callSignatures = getSignaturesOfSymbol(symbol);
57187
+ }
57188
+ // And likewise for construct signatures for classes
57189
+ if (symbol.flags & 32 /* Class */) {
57190
+ var classType_1 = getDeclaredTypeOfClassOrInterface(symbol);
57191
+ var constructSignatures = symbol.members ? getSignaturesOfSymbol(symbol.members.get("__constructor" /* Constructor */)) : ts.emptyArray;
57192
+ if (symbol.flags & 16 /* Function */) {
57193
+ constructSignatures = ts.addRange(constructSignatures.slice(), ts.mapDefined(type.callSignatures, function (sig) { return isJSConstructor(sig.declaration) ?
57194
+ createSignature(sig.declaration, sig.typeParameters, sig.thisParameter, sig.parameters, classType_1, /*resolvedTypePredicate*/ undefined, sig.minArgumentCount, sig.flags & 39 /* PropagatingFlags */) :
57195
+ undefined; }));
57196
+ }
57197
+ if (!constructSignatures.length) {
57198
+ constructSignatures = getDefaultConstructSignatures(classType_1);
57183
57199
  }
57200
+ type.constructSignatures = constructSignatures;
57184
57201
  }
57185
57202
  }
57186
57203
  function replaceIndexedAccess(instantiable, type, replacement) {
@@ -58172,8 +58189,8 @@ var ts;
58172
58189
  var stringIndexInfo;
58173
58190
  var applicableInfo;
58174
58191
  var applicableInfos;
58175
- for (var _i = 0, indexInfos_1 = indexInfos; _i < indexInfos_1.length; _i++) {
58176
- var info = indexInfos_1[_i];
58192
+ for (var _i = 0, indexInfos_3 = indexInfos; _i < indexInfos_3.length; _i++) {
58193
+ var info = indexInfos_3[_i];
58177
58194
  if (info.keyType === stringType) {
58178
58195
  stringIndexInfo = info;
58179
58196
  }
@@ -58737,14 +58754,14 @@ var ts;
58737
58754
  }
58738
58755
  function getIndexInfosOfIndexSymbol(indexSymbol) {
58739
58756
  if (indexSymbol.declarations) {
58740
- var indexInfos_2 = [];
58757
+ var indexInfos_4 = [];
58741
58758
  var _loop_14 = function (declaration) {
58742
58759
  if (declaration.parameters.length === 1) {
58743
58760
  var parameter = declaration.parameters[0];
58744
58761
  if (parameter.type) {
58745
58762
  forEachType(getTypeFromTypeNode(parameter.type), function (keyType) {
58746
- if (isValidIndexKeyType(keyType) && !findIndexInfo(indexInfos_2, keyType)) {
58747
- indexInfos_2.push(createIndexInfo(keyType, declaration.type ? getTypeFromTypeNode(declaration.type) : anyType, ts.hasEffectiveModifier(declaration, 64 /* Readonly */), declaration));
58763
+ if (isValidIndexKeyType(keyType) && !findIndexInfo(indexInfos_4, keyType)) {
58764
+ indexInfos_4.push(createIndexInfo(keyType, declaration.type ? getTypeFromTypeNode(declaration.type) : anyType, ts.hasEffectiveModifier(declaration, 64 /* Readonly */), declaration));
58748
58765
  }
58749
58766
  });
58750
58767
  }
@@ -58754,7 +58771,7 @@ var ts;
58754
58771
  var declaration = _a[_i];
58755
58772
  _loop_14(declaration);
58756
58773
  }
58757
- return indexInfos_2;
58774
+ return indexInfos_4;
58758
58775
  }
58759
58776
  return ts.emptyArray;
58760
58777
  }
@@ -59302,7 +59319,7 @@ var ts;
59302
59319
  // The expression is processed as an identifier expression (section 4.3)
59303
59320
  // or property access expression(section 4.10),
59304
59321
  // the widened type(section 3.9) of which becomes the result.
59305
- var type = ts.isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName);
59322
+ var type = checkExpressionWithTypeArguments(node);
59306
59323
  links.resolvedType = getRegularTypeOfLiteralType(getWidenedType(type));
59307
59324
  }
59308
59325
  return links.resolvedType;
@@ -60743,7 +60760,7 @@ var ts;
60743
60760
  }
60744
60761
  var prop = getPropertyOfType(objectType, propName);
60745
60762
  if (prop) {
60746
- if (accessFlags & 64 /* ReportDeprecated */ && accessNode && prop.declarations && getDeclarationNodeFlagsFromSymbol(prop) & 134217728 /* Deprecated */ && isUncalledFunctionReference(accessNode, prop)) {
60763
+ if (accessFlags & 64 /* ReportDeprecated */ && accessNode && prop.declarations && isDeprecatedSymbol(prop) && isUncalledFunctionReference(accessNode, prop)) {
60747
60764
  var deprecatedNode = (_a = accessExpression === null || accessExpression === void 0 ? void 0 : accessExpression.argumentExpression) !== null && _a !== void 0 ? _a : (ts.isIndexedAccessTypeNode(accessNode) ? accessNode.indexType : accessNode);
60748
60765
  addDeprecatedSuggestion(deprecatedNode, prop.declarations, propName);
60749
60766
  }
@@ -62006,7 +62023,9 @@ var ts;
62006
62023
  return result;
62007
62024
  }
62008
62025
  function getObjectTypeInstantiation(type, mapper, aliasSymbol, aliasTypeArguments) {
62009
- var declaration = type.objectFlags & 4 /* Reference */ ? type.node : type.symbol.declarations[0];
62026
+ var declaration = type.objectFlags & 4 /* Reference */ ? type.node :
62027
+ type.objectFlags & 16777216 /* InstantiationExpressionType */ ? type.node :
62028
+ type.symbol.declarations[0];
62010
62029
  var links = getNodeLinks(declaration);
62011
62030
  var target = type.objectFlags & 4 /* Reference */ ? links.resolvedType :
62012
62031
  type.objectFlags & 64 /* Instantiated */ ? type.target : type;
@@ -62022,8 +62041,8 @@ var ts;
62022
62041
  outerTypeParameters = ts.addRange(outerTypeParameters, templateTagParameters);
62023
62042
  }
62024
62043
  typeParameters = outerTypeParameters || ts.emptyArray;
62025
- var allDeclarations_1 = type.objectFlags & 4 /* Reference */ ? [declaration] : type.symbol.declarations;
62026
- typeParameters = (target.objectFlags & 4 /* Reference */ || target.symbol.flags & 8192 /* Method */ || target.symbol.flags & 2048 /* TypeLiteral */) && !target.aliasTypeArguments ?
62044
+ var allDeclarations_1 = type.objectFlags & (4 /* Reference */ | 16777216 /* InstantiationExpressionType */) ? [declaration] : type.symbol.declarations;
62045
+ typeParameters = (target.objectFlags & (4 /* Reference */ | 16777216 /* InstantiationExpressionType */) || target.symbol.flags & 8192 /* Method */ || target.symbol.flags & 2048 /* TypeLiteral */) && !target.aliasTypeArguments ?
62027
62046
  ts.filter(typeParameters, function (tp) { return ts.some(allDeclarations_1, function (d) { return isTypeParameterPossiblyReferenced(tp, d); }); }) :
62028
62047
  typeParameters;
62029
62048
  links.outerTypeParameters = typeParameters;
@@ -62195,6 +62214,9 @@ var ts;
62195
62214
  mapper = combineTypeMappers(makeUnaryTypeMapper(origTypeParameter, freshTypeParameter), mapper);
62196
62215
  freshTypeParameter.mapper = mapper;
62197
62216
  }
62217
+ if (type.objectFlags & 16777216 /* InstantiationExpressionType */) {
62218
+ result.node = type.node;
62219
+ }
62198
62220
  result.target = type;
62199
62221
  result.mapper = mapper;
62200
62222
  result.aliasSymbol = aliasSymbol || type.aliasSymbol;
@@ -65369,8 +65391,8 @@ var ts;
65369
65391
  var indexInfos = getIndexInfosOfType(target);
65370
65392
  var targetHasStringIndex = ts.some(indexInfos, function (info) { return info.keyType === stringType; });
65371
65393
  var result = -1 /* True */;
65372
- for (var _i = 0, indexInfos_3 = indexInfos; _i < indexInfos_3.length; _i++) {
65373
- var targetInfo = indexInfos_3[_i];
65394
+ for (var _i = 0, indexInfos_5 = indexInfos; _i < indexInfos_5.length; _i++) {
65395
+ var targetInfo = indexInfos_5[_i];
65374
65396
  var related = !sourceIsPrimitive && targetHasStringIndex && targetInfo.type.flags & 1 /* Any */ ? -1 /* True */ :
65375
65397
  isGenericMappedType(source) && targetHasStringIndex ? isRelatedTo(getTemplateTypeFromMappedType(source), targetInfo.type, 3 /* Both */, reportErrors) :
65376
65398
  typeRelatedToIndexInfo(source, targetInfo, reportErrors, intersectionState);
@@ -65977,10 +65999,10 @@ var ts;
65977
65999
  if (!(ts.getObjectFlags(type) & 4 /* Reference */) || !(ts.getObjectFlags(type.target) & 3 /* ClassOrInterface */)) {
65978
66000
  return undefined;
65979
66001
  }
65980
- if (ts.getObjectFlags(type) & 33554432 /* IdenticalBaseTypeCalculated */) {
65981
- return ts.getObjectFlags(type) & 67108864 /* IdenticalBaseTypeExists */ ? type.cachedEquivalentBaseType : undefined;
66002
+ if (ts.getObjectFlags(type) & 67108864 /* IdenticalBaseTypeCalculated */) {
66003
+ return ts.getObjectFlags(type) & 134217728 /* IdenticalBaseTypeExists */ ? type.cachedEquivalentBaseType : undefined;
65982
66004
  }
65983
- type.objectFlags |= 33554432 /* IdenticalBaseTypeCalculated */;
66005
+ type.objectFlags |= 67108864 /* IdenticalBaseTypeCalculated */;
65984
66006
  var target = type.target;
65985
66007
  if (ts.getObjectFlags(target) & 1 /* Class */) {
65986
66008
  var baseTypeNode = getBaseTypeNodeOfClass(target);
@@ -66001,7 +66023,7 @@ var ts;
66001
66023
  if (ts.length(getTypeArguments(type)) > ts.length(target.typeParameters)) {
66002
66024
  instantiatedBase = getTypeWithThisArgument(instantiatedBase, ts.last(getTypeArguments(type)));
66003
66025
  }
66004
- type.objectFlags |= 67108864 /* IdenticalBaseTypeExists */;
66026
+ type.objectFlags |= 134217728 /* IdenticalBaseTypeExists */;
66005
66027
  return type.cachedEquivalentBaseType = instantiatedBase;
66006
66028
  }
66007
66029
  function isEmptyLiteralType(type) {
@@ -66665,7 +66687,7 @@ var ts;
66665
66687
  var result = !!(type.flags & 465829888 /* Instantiable */ ||
66666
66688
  type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || ts.forEach(getTypeArguments(type), couldContainTypeVariables)) ||
66667
66689
  objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations ||
66668
- objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 8388608 /* ObjectRestType */)) ||
66690
+ objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 8388608 /* ObjectRestType */ | 16777216 /* InstantiationExpressionType */)) ||
66669
66691
  type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && ts.some(type.types, couldContainTypeVariables));
66670
66692
  if (type.flags & 3899393 /* ObjectFlagsType */) {
66671
66693
  type.objectFlags |= 1048576 /* CouldContainTypeVariablesComputed */ | (result ? 2097152 /* CouldContainTypeVariables */ : 0);
@@ -67582,8 +67604,8 @@ var ts;
67582
67604
  var priority = (ts.getObjectFlags(source) & ts.getObjectFlags(target) & 32 /* Mapped */) ? 8 /* HomomorphicMappedType */ : 0;
67583
67605
  var indexInfos = getIndexInfosOfType(target);
67584
67606
  if (isObjectTypeWithInferableIndex(source)) {
67585
- for (var _i = 0, indexInfos_4 = indexInfos; _i < indexInfos_4.length; _i++) {
67586
- var targetInfo = indexInfos_4[_i];
67607
+ for (var _i = 0, indexInfos_6 = indexInfos; _i < indexInfos_6.length; _i++) {
67608
+ var targetInfo = indexInfos_6[_i];
67587
67609
  var propTypes = [];
67588
67610
  for (var _a = 0, _b = getPropertiesOfType(source); _a < _b.length; _a++) {
67589
67611
  var prop = _b[_a];
@@ -67603,8 +67625,8 @@ var ts;
67603
67625
  }
67604
67626
  }
67605
67627
  }
67606
- for (var _e = 0, indexInfos_5 = indexInfos; _e < indexInfos_5.length; _e++) {
67607
- var targetInfo = indexInfos_5[_e];
67628
+ for (var _e = 0, indexInfos_7 = indexInfos; _e < indexInfos_7.length; _e++) {
67629
+ var targetInfo = indexInfos_7[_e];
67608
67630
  var sourceInfo = getApplicableIndexInfo(source, targetInfo.keyType);
67609
67631
  if (sourceInfo) {
67610
67632
  inferWithPriority(sourceInfo.type, targetInfo.type, priority);
@@ -70146,9 +70168,9 @@ var ts;
70146
70168
  markAliasReferenced(symbol, node);
70147
70169
  }
70148
70170
  var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
70149
- var sourceSymbol = localOrExportSymbol.flags & 2097152 /* Alias */ ? resolveAlias(localOrExportSymbol) : localOrExportSymbol;
70150
- if (sourceSymbol.declarations && getDeclarationNodeFlagsFromSymbol(sourceSymbol) & 134217728 /* Deprecated */ && isUncalledFunctionReference(node, sourceSymbol)) {
70151
- addDeprecatedSuggestion(node, sourceSymbol.declarations, node.escapedText);
70171
+ var targetSymbol = checkDeprecatedAliasedSymbol(localOrExportSymbol, node);
70172
+ if (isDeprecatedSymbol(targetSymbol) && isUncalledFunctionReference(node, targetSymbol) && targetSymbol.declarations) {
70173
+ addDeprecatedSuggestion(node, targetSymbol.declarations, node.escapedText);
70152
70174
  }
70153
70175
  var declaration = localOrExportSymbol.valueDeclaration;
70154
70176
  if (declaration && localOrExportSymbol.flags & 32 /* Class */) {
@@ -73160,7 +73182,7 @@ var ts;
73160
73182
  }
73161
73183
  }
73162
73184
  else {
73163
- if (prop.declarations && getDeclarationNodeFlagsFromSymbol(prop) & 134217728 /* Deprecated */ && isUncalledFunctionReference(node, prop)) {
73185
+ if (isDeprecatedSymbol(prop) && isUncalledFunctionReference(node, prop) && prop.declarations) {
73164
73186
  addDeprecatedSuggestion(right, prop.declarations, right.escapedText);
73165
73187
  }
73166
73188
  checkPropertyNotUsedBeforeDeclaration(prop, node, right);
@@ -74619,7 +74641,7 @@ var ts;
74619
74641
  }
74620
74642
  var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
74621
74643
  ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
74622
- 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);
74644
+ var chain = ts.chainDiagnosticMessages(ts.map(diags_3, ts.createDiagnosticMessageChainFromDiagnostic), ts.Diagnostics.No_overload_matches_this_call);
74623
74645
  // 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
74624
74646
  // arrays and the emptyArray singleton where possible, which is decidedly not what we want while we're still constructing this diagnostic
74625
74647
  var related = __spreadArray([], ts.flatMap(diags_3, function (d) { return d.relatedInformation; }), true);
@@ -75774,6 +75796,66 @@ var ts;
75774
75796
  return node.flags & 32 /* OptionalChain */ ? checkNonNullChain(node) :
75775
75797
  getNonNullableType(checkExpression(node.expression));
75776
75798
  }
75799
+ function checkExpressionWithTypeArguments(node) {
75800
+ checkGrammarExpressionWithTypeArguments(node);
75801
+ var exprType = node.kind === 227 /* ExpressionWithTypeArguments */ ? checkExpression(node.expression) :
75802
+ ts.isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) :
75803
+ checkExpression(node.exprName);
75804
+ var typeArguments = node.typeArguments;
75805
+ if (!ts.some(typeArguments)) {
75806
+ return exprType;
75807
+ }
75808
+ var funcType = getApparentType(exprType);
75809
+ if (funcType === silentNeverType || isErrorType(funcType)) {
75810
+ return funcType;
75811
+ }
75812
+ var hasSomeApplicableSignature = false;
75813
+ var nonApplicableType;
75814
+ var hasSignatures;
75815
+ var hasApplicableSignature;
75816
+ var result = mapType(funcType, getInstantiatedType);
75817
+ var errorType = hasSomeApplicableSignature ? nonApplicableType : funcType;
75818
+ if (errorType) {
75819
+ diagnostics.add(ts.createDiagnosticForNodeArray(ts.getSourceFileOfNode(node), typeArguments, ts.Diagnostics.Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable, typeToString(errorType)));
75820
+ }
75821
+ return result;
75822
+ function getInstantiatedType(type) {
75823
+ hasSignatures = false;
75824
+ hasApplicableSignature = false;
75825
+ var result = getInstantiatedTypeWorker(type);
75826
+ hasSomeApplicableSignature || (hasSomeApplicableSignature = hasApplicableSignature);
75827
+ if (hasSignatures && !hasApplicableSignature) {
75828
+ nonApplicableType !== null && nonApplicableType !== void 0 ? nonApplicableType : (nonApplicableType = type);
75829
+ }
75830
+ return result;
75831
+ }
75832
+ function getInstantiatedTypeWorker(type) {
75833
+ if (type.flags & 524288 /* Object */) {
75834
+ var resolved = resolveStructuredTypeMembers(type);
75835
+ var callSignatures = getInstantiatedSignatures(resolved.callSignatures);
75836
+ var constructSignatures = getInstantiatedSignatures(resolved.constructSignatures);
75837
+ hasSignatures || (hasSignatures = resolved.callSignatures.length !== 0 || resolved.constructSignatures.length !== 0);
75838
+ hasApplicableSignature || (hasApplicableSignature = callSignatures.length !== 0 || constructSignatures.length !== 0);
75839
+ if (callSignatures !== resolved.callSignatures || constructSignatures !== resolved.constructSignatures) {
75840
+ var result_11 = createAnonymousType(undefined, resolved.members, callSignatures, constructSignatures, resolved.indexInfos);
75841
+ result_11.objectFlags |= 16777216 /* InstantiationExpressionType */;
75842
+ result_11.node = node;
75843
+ return result_11;
75844
+ }
75845
+ }
75846
+ else if (type.flags & 2097152 /* Intersection */) {
75847
+ return getIntersectionType(ts.sameMap(type.types, getInstantiatedTypeWorker));
75848
+ }
75849
+ return type;
75850
+ }
75851
+ function getInstantiatedSignatures(signatures) {
75852
+ var applicableSignatures = ts.filter(signatures, function (sig) { return !!sig.typeParameters && hasCorrectTypeArgumentArity(sig, typeArguments); });
75853
+ return ts.sameMap(applicableSignatures, function (sig) {
75854
+ var typeArgumentTypes = checkTypeArguments(sig, typeArguments, /*reportErrors*/ true);
75855
+ return typeArgumentTypes ? getSignatureInstantiation(sig, typeArgumentTypes, ts.isInJSFile(sig.declaration)) : sig;
75856
+ });
75857
+ }
75858
+ }
75777
75859
  function checkMetaProperty(node) {
75778
75860
  checkGrammarMetaProperty(node);
75779
75861
  if (node.keywordToken === 103 /* NewKeyword */) {
@@ -78283,6 +78365,8 @@ var ts;
78283
78365
  return checkAssertion(node);
78284
78366
  case 229 /* NonNullExpression */:
78285
78367
  return checkNonNullAssertion(node);
78368
+ case 227 /* ExpressionWithTypeArguments */:
78369
+ return checkExpressionWithTypeArguments(node);
78286
78370
  case 230 /* MetaProperty */:
78287
78371
  return checkMetaProperty(node);
78288
78372
  case 214 /* DeleteExpression */:
@@ -79488,12 +79572,12 @@ var ts;
79488
79572
  case 264 /* ImportEqualsDeclaration */:
79489
79573
  case 267 /* NamespaceImport */:
79490
79574
  case 266 /* ImportClause */:
79491
- var result_11 = 0 /* None */;
79575
+ var result_12 = 0 /* None */;
79492
79576
  var target = resolveAlias(getSymbolOfNode(d));
79493
79577
  ts.forEach(target.declarations, function (d) {
79494
- result_11 |= getDeclarationSpaces(d);
79578
+ result_12 |= getDeclarationSpaces(d);
79495
79579
  });
79496
- return result_11;
79580
+ return result_12;
79497
79581
  case 253 /* VariableDeclaration */:
79498
79582
  case 202 /* BindingElement */:
79499
79583
  case 255 /* FunctionDeclaration */:
@@ -82080,8 +82164,8 @@ var ts;
82080
82164
  }
82081
82165
  }
82082
82166
  if (indexInfos.length > 1) {
82083
- for (var _d = 0, indexInfos_6 = indexInfos; _d < indexInfos_6.length; _d++) {
82084
- var info = indexInfos_6[_d];
82167
+ for (var _d = 0, indexInfos_8 = indexInfos; _d < indexInfos_8.length; _d++) {
82168
+ var info = indexInfos_8[_d];
82085
82169
  checkIndexConstraintForIndexSignature(type, info);
82086
82170
  }
82087
82171
  }
@@ -82107,8 +82191,8 @@ var ts;
82107
82191
  error(errorNode, ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_2_index_type_3, symbolToString(prop), typeToString(propType), typeToString(info.keyType), typeToString(info.type));
82108
82192
  }
82109
82193
  };
82110
- for (var _i = 0, indexInfos_7 = indexInfos; _i < indexInfos_7.length; _i++) {
82111
- var info = indexInfos_7[_i];
82194
+ for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
82195
+ var info = indexInfos_9[_i];
82112
82196
  _loop_27(info);
82113
82197
  }
82114
82198
  }
@@ -82130,8 +82214,8 @@ var ts;
82130
82214
  error(errorNode, ts.Diagnostics._0_index_type_1_is_not_assignable_to_2_index_type_3, typeToString(checkInfo.keyType), typeToString(checkInfo.type), typeToString(info.keyType), typeToString(info.type));
82131
82215
  }
82132
82216
  };
82133
- for (var _i = 0, indexInfos_8 = indexInfos; _i < indexInfos_8.length; _i++) {
82134
- var info = indexInfos_8[_i];
82217
+ for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
82218
+ var info = indexInfos_10[_i];
82135
82219
  _loop_28(info);
82136
82220
  }
82137
82221
  }
@@ -82998,16 +83082,15 @@ var ts;
82998
83082
  return ts.nodeIsMissing(expr) ? 0 : evaluateEnumMember(expr, getSymbolOfNode(member.parent), identifier.escapedText);
82999
83083
  case 206 /* ElementAccessExpression */:
83000
83084
  case 205 /* PropertyAccessExpression */:
83001
- var ex = expr;
83002
- if (isConstantMemberAccess(ex)) {
83003
- var type = getTypeOfExpression(ex.expression);
83085
+ if (isConstantMemberAccess(expr)) {
83086
+ var type = getTypeOfExpression(expr.expression);
83004
83087
  if (type.symbol && type.symbol.flags & 384 /* Enum */) {
83005
83088
  var name = void 0;
83006
- if (ex.kind === 205 /* PropertyAccessExpression */) {
83007
- name = ex.name.escapedText;
83089
+ if (expr.kind === 205 /* PropertyAccessExpression */) {
83090
+ name = expr.name.escapedText;
83008
83091
  }
83009
83092
  else {
83010
- name = ts.escapeLeadingUnderscores(ts.cast(ex.argumentExpression, ts.isLiteralExpression).text);
83093
+ name = ts.escapeLeadingUnderscores(ts.cast(expr.argumentExpression, ts.isLiteralExpression).text);
83011
83094
  }
83012
83095
  return evaluateEnumMember(expr, type.symbol, name);
83013
83096
  }
@@ -83035,6 +83118,10 @@ var ts;
83035
83118
  }
83036
83119
  }
83037
83120
  function isConstantMemberAccess(node) {
83121
+ var type = getTypeOfExpression(node);
83122
+ if (type === errorType) {
83123
+ return false;
83124
+ }
83038
83125
  return node.kind === 79 /* Identifier */ ||
83039
83126
  node.kind === 205 /* PropertyAccessExpression */ && isConstantMemberAccess(node.expression) ||
83040
83127
  node.kind === 206 /* ElementAccessExpression */ && isConstantMemberAccess(node.expression) &&
@@ -83329,7 +83416,6 @@ var ts;
83329
83416
  return true;
83330
83417
  }
83331
83418
  function checkAliasSymbol(node) {
83332
- var _a;
83333
83419
  var symbol = getSymbolOfNode(node);
83334
83420
  var target = resolveAlias(symbol);
83335
83421
  if (target !== unknownSymbol) {
@@ -83385,11 +83471,46 @@ var ts;
83385
83471
  }
83386
83472
  }
83387
83473
  }
83388
- if (ts.isImportSpecifier(node) && ((_a = target.declarations) === null || _a === void 0 ? void 0 : _a.every(function (d) { return !!(ts.getCombinedNodeFlags(d) & 134217728 /* Deprecated */); }))) {
83389
- addDeprecatedSuggestion(node.name, target.declarations, symbol.escapedName);
83474
+ if (ts.isImportSpecifier(node)) {
83475
+ var targetSymbol = checkDeprecatedAliasedSymbol(symbol, node);
83476
+ if (isDeprecatedAliasedSymbol(targetSymbol) && targetSymbol.declarations) {
83477
+ addDeprecatedSuggestion(node, targetSymbol.declarations, targetSymbol.escapedName);
83478
+ }
83390
83479
  }
83391
83480
  }
83392
83481
  }
83482
+ function isDeprecatedAliasedSymbol(symbol) {
83483
+ return !!symbol.declarations && ts.every(symbol.declarations, function (d) { return !!(ts.getCombinedNodeFlags(d) & 134217728 /* Deprecated */); });
83484
+ }
83485
+ function checkDeprecatedAliasedSymbol(symbol, location) {
83486
+ if (!(symbol.flags & 2097152 /* Alias */))
83487
+ return symbol;
83488
+ var targetSymbol = resolveAlias(symbol);
83489
+ if (targetSymbol === unknownSymbol)
83490
+ return targetSymbol;
83491
+ while (symbol.flags & 2097152 /* Alias */) {
83492
+ var target = getImmediateAliasedSymbol(symbol);
83493
+ if (target) {
83494
+ if (target === targetSymbol)
83495
+ break;
83496
+ if (target.declarations && ts.length(target.declarations)) {
83497
+ if (isDeprecatedAliasedSymbol(target)) {
83498
+ addDeprecatedSuggestion(location, target.declarations, target.escapedName);
83499
+ break;
83500
+ }
83501
+ else {
83502
+ if (symbol === targetSymbol)
83503
+ break;
83504
+ symbol = target;
83505
+ }
83506
+ }
83507
+ }
83508
+ else {
83509
+ break;
83510
+ }
83511
+ }
83512
+ return targetSymbol;
83513
+ }
83393
83514
  function checkImportBinding(node) {
83394
83515
  checkCollisionsForDeclarationName(node, node.name);
83395
83516
  checkAliasSymbol(node);
@@ -87690,7 +87811,7 @@ var ts;
87690
87811
  return factory.updateConstructorTypeNode(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode));
87691
87812
  case 180 /* TypeQuery */:
87692
87813
  ts.Debug.type(node);
87693
- return factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName));
87814
+ return factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode));
87694
87815
  case 181 /* TypeLiteral */:
87695
87816
  ts.Debug.type(node);
87696
87817
  return factory.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor, ts.isTypeElement));
@@ -90582,8 +90703,8 @@ var ts;
90582
90703
  function generateClassElementDecorationExpressions(node, isStatic) {
90583
90704
  var members = getDecoratedClassElements(node, isStatic);
90584
90705
  var expressions;
90585
- for (var _i = 0, members_6 = members; _i < members_6.length; _i++) {
90586
- var member = members_6[_i];
90706
+ for (var _i = 0, members_8 = members; _i < members_8.length; _i++) {
90707
+ var member = members_8[_i];
90587
90708
  var expression = generateClassElementDecorationExpression(node, member);
90588
90709
  if (expression) {
90589
90710
  if (!expressions) {
@@ -95784,8 +95905,8 @@ var ts;
95784
95905
  function convertJsxChildrenToChildrenPropAssignment(children) {
95785
95906
  var nonWhitespaceChildren = ts.getSemanticJsxChildren(children);
95786
95907
  if (ts.length(nonWhitespaceChildren) === 1 && !nonWhitespaceChildren[0].dotDotDotToken) {
95787
- var result_12 = transformJsxChildToExpression(nonWhitespaceChildren[0]);
95788
- return result_12 && factory.createPropertyAssignment("children", result_12);
95908
+ var result_13 = transformJsxChildToExpression(nonWhitespaceChildren[0]);
95909
+ return result_13 && factory.createPropertyAssignment("children", result_13);
95789
95910
  }
95790
95911
  var result = ts.mapDefined(children, transformJsxChildToExpression);
95791
95912
  return ts.length(result) ? factory.createPropertyAssignment("children", factory.createArrayLiteralExpression(result)) : undefined;
@@ -109414,6 +109535,8 @@ var ts;
109414
109535
  return emitAsExpression(node);
109415
109536
  case 229 /* NonNullExpression */:
109416
109537
  return emitNonNullExpression(node);
109538
+ case 227 /* ExpressionWithTypeArguments */:
109539
+ return emitExpressionWithTypeArguments(node);
109417
109540
  case 230 /* MetaProperty */:
109418
109541
  return emitMetaProperty(node);
109419
109542
  case 231 /* SyntheticExpression */:
@@ -109858,6 +109981,7 @@ var ts;
109858
109981
  writeKeyword("typeof");
109859
109982
  writeSpace();
109860
109983
  emit(node.exprName);
109984
+ emitTypeArguments(node, node.typeArguments);
109861
109985
  }
109862
109986
  function emitTypeLiteral(node) {
109863
109987
  writePunctuation("{");
@@ -114817,15 +114941,15 @@ var ts;
114817
114941
  // which per above occurred during the current program creation.
114818
114942
  // Since we assume the filesystem does not change during program creation,
114819
114943
  // it is safe to reuse resolutions from the earlier call.
114820
- var result_13 = [];
114944
+ var result_14 = [];
114821
114945
  var i = 0;
114822
114946
  for (var _i = 0, moduleNames_1 = moduleNames; _i < moduleNames_1.length; _i++) {
114823
114947
  var moduleName = moduleNames_1[_i];
114824
114948
  var resolvedModule = file.resolvedModules.get(moduleName, getModeForResolutionAtIndex(file, i));
114825
114949
  i++;
114826
- result_13.push(resolvedModule);
114950
+ result_14.push(resolvedModule);
114827
114951
  }
114828
- return result_13;
114952
+ return result_14;
114829
114953
  }
114830
114954
  // At this point, we know at least one of the following hold:
114831
114955
  // - file has local declarations for ambient modules
@@ -116047,14 +116171,14 @@ var ts;
116047
116171
  redirectTargetsMap.add(fileFromPackageId.path, fileName);
116048
116172
  addFileToFilesByName(dupFile, path, redirectedPath);
116049
116173
  addFileIncludeReason(dupFile, reason);
116050
- sourceFileToPackageName.set(path, packageId.name);
116174
+ sourceFileToPackageName.set(path, ts.packageIdToPackageName(packageId));
116051
116175
  processingOtherFiles.push(dupFile);
116052
116176
  return dupFile;
116053
116177
  }
116054
116178
  else if (file) {
116055
116179
  // This is the first source file to have this packageId.
116056
116180
  packageIdToSourceFile.set(packageIdKey, file);
116057
- sourceFileToPackageName.set(path, packageId.name);
116181
+ sourceFileToPackageName.set(path, ts.packageIdToPackageName(packageId));
116058
116182
  }
116059
116183
  }
116060
116184
  addFileToFilesByName(file, path, redirectedPath);
@@ -119933,9 +120057,9 @@ var ts;
119933
120057
  if (!preferSymlinks) {
119934
120058
  // Symlinks inside ignored paths are already filtered out of the symlink cache,
119935
120059
  // so we only need to remove them from the realpath filenames.
119936
- var result_14 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
119937
- if (result_14)
119938
- return result_14;
120060
+ var result_15 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
120061
+ if (result_15)
120062
+ return result_15;
119939
120063
  }
119940
120064
  var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
119941
120065
  var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
@@ -119955,10 +120079,10 @@ var ts;
119955
120079
  for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
119956
120080
  var symlinkDirectory = symlinkDirectories_1[_i];
119957
120081
  var option = ts.resolvePath(symlinkDirectory, relative);
119958
- var result_15 = cb(option, target === referenceRedirect);
120082
+ var result_16 = cb(option, target === referenceRedirect);
119959
120083
  shouldFilterIgnoredPaths = true; // We found a non-ignored path in symlinks, so we can reject ignored-path realpaths
119960
- if (result_15)
119961
- return result_15;
120084
+ if (result_16)
120085
+ return result_16;
119962
120086
  }
119963
120087
  });
119964
120088
  });
@@ -124268,7 +124392,7 @@ var ts;
124268
124392
  case 199 /* ImportType */:
124269
124393
  return !node.parent.isTypeOf;
124270
124394
  case 227 /* ExpressionWithTypeArguments */:
124271
- return !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent);
124395
+ return ts.isPartOfTypeNode(node.parent);
124272
124396
  }
124273
124397
  return false;
124274
124398
  }
@@ -127131,11 +127255,11 @@ var ts;
127131
127255
  return ts.isArray(valueOrArray) ? ts.first(valueOrArray) : valueOrArray;
127132
127256
  }
127133
127257
  ts.firstOrOnly = firstOrOnly;
127134
- function getNameForExportedSymbol(symbol, scriptTarget) {
127258
+ function getNameForExportedSymbol(symbol, scriptTarget, preferCapitalized) {
127135
127259
  if (!(symbol.flags & 33554432 /* Transient */) && (symbol.escapedName === "export=" /* ExportEquals */ || symbol.escapedName === "default" /* Default */)) {
127136
127260
  // Name of "export default foo;" is "foo". Name of "export default 0" is the filename converted to camelCase.
127137
127261
  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; })
127138
- || ts.codefix.moduleSymbolToValidIdentifier(getSymbolParentOrFail(symbol), scriptTarget);
127262
+ || ts.codefix.moduleSymbolToValidIdentifier(getSymbolParentOrFail(symbol), scriptTarget, !!preferCapitalized);
127139
127263
  }
127140
127264
  return symbol.name;
127141
127265
  }
@@ -127263,7 +127387,7 @@ var ts;
127263
127387
  symbols.clear();
127264
127388
  usableByFileName = undefined;
127265
127389
  },
127266
- add: function (importingFile, symbol, symbolTableKey, moduleSymbol, moduleFile, exportKind, isFromPackageJson, scriptTarget, checker) {
127390
+ add: function (importingFile, symbol, symbolTableKey, moduleSymbol, moduleFile, exportKind, isFromPackageJson, checker) {
127267
127391
  if (importingFile !== usableByFileName) {
127268
127392
  cache.clear();
127269
127393
  usableByFileName = importingFile;
@@ -127279,7 +127403,7 @@ var ts;
127279
127403
  // get a better name.
127280
127404
  var importedName = exportKind === 0 /* Named */ || ts.isExternalModuleSymbol(namedSymbol)
127281
127405
  ? ts.unescapeLeadingUnderscores(symbolTableKey)
127282
- : ts.getNameForExportedSymbol(namedSymbol, scriptTarget);
127406
+ : ts.getNameForExportedSymbol(namedSymbol, /*scriptTarget*/ undefined);
127283
127407
  var moduleName = ts.stripQuotes(moduleSymbol.name);
127284
127408
  var id = exportInfoId++;
127285
127409
  var target = ts.skipAlias(symbol, checker);
@@ -127312,7 +127436,14 @@ var ts;
127312
127436
  return;
127313
127437
  exportInfo.forEach(function (info, key) {
127314
127438
  var _a = parseKey(key), symbolName = _a.symbolName, ambientModuleName = _a.ambientModuleName;
127315
- action(info.map(rehydrateCachedInfo), symbolName, !!ambientModuleName, key);
127439
+ var rehydrated = info.map(rehydrateCachedInfo);
127440
+ action(rehydrated, function (preferCapitalized) {
127441
+ var _a = rehydrated[0], symbol = _a.symbol, exportKind = _a.exportKind;
127442
+ var namedSymbol = exportKind === 1 /* Default */ && ts.getLocalSymbolForExportDefault(symbol) || symbol;
127443
+ return preferCapitalized
127444
+ ? ts.getNameForExportedSymbol(namedSymbol, /*scriptTarget*/ undefined, /*preferCapitalized*/ true)
127445
+ : symbolName;
127446
+ }, !!ambientModuleName, key);
127316
127447
  });
127317
127448
  },
127318
127449
  releaseSymbols: function () {
@@ -127494,7 +127625,6 @@ var ts;
127494
127625
  }
127495
127626
  (_d = host.log) === null || _d === void 0 ? void 0 : _d.call(host, "getExportInfoMap: cache miss or empty; calculating new results");
127496
127627
  var compilerOptions = program.getCompilerOptions();
127497
- var scriptTarget = ts.getEmitScriptTarget(compilerOptions);
127498
127628
  var moduleCount = 0;
127499
127629
  forEachExternalModuleToImportFrom(program, host, /*useAutoImportProvider*/ true, function (moduleSymbol, moduleFile, program, isFromPackageJson) {
127500
127630
  if (++moduleCount % 100 === 0)
@@ -127505,11 +127635,11 @@ var ts;
127505
127635
  // Note: I think we shouldn't actually see resolved module symbols here, but weird merges
127506
127636
  // can cause it to happen: see 'completionsImport_mergedReExport.ts'
127507
127637
  if (defaultInfo && isImportableSymbol(defaultInfo.symbol, checker)) {
127508
- cache.add(importingFile.path, defaultInfo.symbol, defaultInfo.exportKind === 1 /* Default */ ? "default" /* Default */ : "export=" /* ExportEquals */, moduleSymbol, moduleFile, defaultInfo.exportKind, isFromPackageJson, scriptTarget, checker);
127638
+ cache.add(importingFile.path, defaultInfo.symbol, defaultInfo.exportKind === 1 /* Default */ ? "default" /* Default */ : "export=" /* ExportEquals */, moduleSymbol, moduleFile, defaultInfo.exportKind, isFromPackageJson, checker);
127509
127639
  }
127510
127640
  checker.forEachExportAndPropertyOfModule(moduleSymbol, function (exported, key) {
127511
127641
  if (exported !== (defaultInfo === null || defaultInfo === void 0 ? void 0 : defaultInfo.symbol) && isImportableSymbol(exported, checker) && ts.addToSeen(seenExports, key)) {
127512
- cache.add(importingFile.path, exported, key, moduleSymbol, moduleFile, 0 /* Named */, isFromPackageJson, scriptTarget, checker);
127642
+ cache.add(importingFile.path, exported, key, moduleSymbol, moduleFile, 0 /* Named */, isFromPackageJson, checker);
127513
127643
  }
127514
127644
  });
127515
127645
  });
@@ -129583,6 +129713,8 @@ var ts;
129583
129713
  CompletionSource["ThisProperty"] = "ThisProperty/";
129584
129714
  /** Auto-import that comes attached to a class member snippet */
129585
129715
  CompletionSource["ClassMemberSnippet"] = "ClassMemberSnippet/";
129716
+ /** A type-only import that needs to be promoted in order to be used at the completion location */
129717
+ CompletionSource["TypeOnlyAlias"] = "TypeOnlyAlias/";
129586
129718
  })(CompletionSource = Completions.CompletionSource || (Completions.CompletionSource = {}));
129587
129719
  var SymbolOriginInfoKind;
129588
129720
  (function (SymbolOriginInfoKind) {
@@ -129592,6 +129724,7 @@ var ts;
129592
129724
  SymbolOriginInfoKind[SymbolOriginInfoKind["Promise"] = 8] = "Promise";
129593
129725
  SymbolOriginInfoKind[SymbolOriginInfoKind["Nullable"] = 16] = "Nullable";
129594
129726
  SymbolOriginInfoKind[SymbolOriginInfoKind["ResolvedExport"] = 32] = "ResolvedExport";
129727
+ SymbolOriginInfoKind[SymbolOriginInfoKind["TypeOnlyAlias"] = 64] = "TypeOnlyAlias";
129595
129728
  SymbolOriginInfoKind[SymbolOriginInfoKind["SymbolMemberNoExport"] = 2] = "SymbolMemberNoExport";
129596
129729
  SymbolOriginInfoKind[SymbolOriginInfoKind["SymbolMemberExport"] = 6] = "SymbolMemberExport";
129597
129730
  })(SymbolOriginInfoKind || (SymbolOriginInfoKind = {}));
@@ -129619,6 +129752,9 @@ var ts;
129619
129752
  function originIsNullableMember(origin) {
129620
129753
  return !!(origin.kind & 16 /* Nullable */);
129621
129754
  }
129755
+ function originIsTypeOnlyAlias(origin) {
129756
+ return !!(origin && origin.kind & 64 /* TypeOnlyAlias */);
129757
+ }
129622
129758
  var KeywordCompletionFilters;
129623
129759
  (function (KeywordCompletionFilters) {
129624
129760
  KeywordCompletionFilters[KeywordCompletionFilters["None"] = 0] = "None";
@@ -130023,6 +130159,9 @@ var ts;
130023
130159
  isSnippet = preferences.includeCompletionsWithSnippetText ? true : undefined;
130024
130160
  }
130025
130161
  }
130162
+ if ((origin === null || origin === void 0 ? void 0 : origin.kind) === 64 /* TypeOnlyAlias */) {
130163
+ hasAction = true;
130164
+ }
130026
130165
  if (preferences.includeCompletionsWithClassMemberSnippets &&
130027
130166
  preferences.includeCompletionsWithInsertText &&
130028
130167
  completionKind === 3 /* MemberLike */ &&
@@ -130367,6 +130506,9 @@ var ts;
130367
130506
  if ((origin === null || origin === void 0 ? void 0 : origin.kind) === 1 /* ThisType */) {
130368
130507
  return CompletionSource.ThisProperty;
130369
130508
  }
130509
+ if ((origin === null || origin === void 0 ? void 0 : origin.kind) === 64 /* TypeOnlyAlias */) {
130510
+ return CompletionSource.TypeOnlyAlias;
130511
+ }
130370
130512
  }
130371
130513
  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) {
130372
130514
  var _a;
@@ -130394,7 +130536,7 @@ var ts;
130394
130536
  continue;
130395
130537
  }
130396
130538
  /** True for locals; false for globals, module exports from other files, `this.` completions. */
130397
- var shouldShadowLaterSymbols = !origin && !(symbol.parent === undefined && !ts.some(symbol.declarations, function (d) { return d.getSourceFile() === location.getSourceFile(); }));
130539
+ var shouldShadowLaterSymbols = (!origin || originIsTypeOnlyAlias(origin)) && !(symbol.parent === undefined && !ts.some(symbol.declarations, function (d) { return d.getSourceFile() === location.getSourceFile(); }));
130398
130540
  uniques.set(name, shouldShadowLaterSymbols);
130399
130541
  ts.insertSorted(entries, entry, compareCompletionEntries, /*allowDuplicates*/ true);
130400
130542
  }
@@ -130407,6 +130549,7 @@ var ts;
130407
130549
  add: function (name) { return uniques.set(name, true); },
130408
130550
  };
130409
130551
  function shouldIncludeSymbol(symbol, symbolToSortTextIdMap) {
130552
+ var allFlags = symbol.flags;
130410
130553
  if (!ts.isSourceFile(location)) {
130411
130554
  // export = /**/ here we want to get all meanings, so any symbol is ok
130412
130555
  if (ts.isExportAssignment(location.parent)) {
@@ -130432,11 +130575,10 @@ var ts;
130432
130575
  || symbolToSortTextIdMap[ts.getSymbolId(symbolOrigin)] === 11 /* LocationPriority */)) {
130433
130576
  return false;
130434
130577
  }
130435
- // Continue with origin symbol
130436
- symbol = symbolOrigin;
130578
+ allFlags |= ts.getCombinedLocalAndExportSymbolFlags(symbolOrigin);
130437
130579
  // import m = /**/ <-- It can only access namespace (if typing import = x. this would get member symbols and not namespace)
130438
130580
  if (ts.isInRightSideOfInternalImportEqualsDeclaration(location)) {
130439
- return !!(symbol.flags & 1920 /* Namespace */);
130581
+ return !!(allFlags & 1920 /* Namespace */);
130440
130582
  }
130441
130583
  if (isTypeOnlyLocation) {
130442
130584
  // It's a type, but you can reach it by namespace.type as well
@@ -130444,7 +130586,7 @@ var ts;
130444
130586
  }
130445
130587
  }
130446
130588
  // expressions are value space (which includes the value namespaces)
130447
- return !!(ts.getCombinedLocalAndExportSymbolFlags(symbol) & 111551 /* Value */);
130589
+ return !!(allFlags & 111551 /* Value */);
130448
130590
  }
130449
130591
  }
130450
130592
  Completions.getCompletionEntriesFromSymbols = getCompletionEntriesFromSymbols;
@@ -130578,8 +130720,7 @@ var ts;
130578
130720
  Completions.createCompletionDetails = createCompletionDetails;
130579
130721
  function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source) {
130580
130722
  if (data === null || data === void 0 ? void 0 : data.moduleSpecifier) {
130581
- var _a = getRelevantTokens(position, sourceFile), contextToken_3 = _a.contextToken, previousToken_2 = _a.previousToken;
130582
- if (previousToken_2 && getImportStatementCompletionInfo(contextToken_3 || previousToken_2).replacementNode) {
130723
+ if (previousToken && getImportStatementCompletionInfo(contextToken || previousToken).replacementNode) {
130583
130724
  // Import statement completion: 'import c|'
130584
130725
  return { codeActions: undefined, sourceDisplay: [ts.textPart(data.moduleSpecifier)] };
130585
130726
  }
@@ -130597,13 +130738,19 @@ var ts;
130597
130738
  };
130598
130739
  }
130599
130740
  }
130741
+ if (originIsTypeOnlyAlias(origin)) {
130742
+ var codeAction_1 = ts.codefix.getPromoteTypeOnlyCompletionAction(sourceFile, origin.declaration.name, program, host, formatContext, preferences);
130743
+ ts.Debug.assertIsDefined(codeAction_1, "Expected to have a code action for promoting type-only alias");
130744
+ return { codeActions: [codeAction_1], sourceDisplay: undefined };
130745
+ }
130600
130746
  if (!origin || !(originIsExport(origin) || originIsResolvedExport(origin))) {
130601
130747
  return { codeActions: undefined, sourceDisplay: undefined };
130602
130748
  }
130603
130749
  var checker = origin.isFromPackageJson ? host.getPackageJsonAutoImportProvider().getTypeChecker() : program.getTypeChecker();
130604
130750
  var moduleSymbol = origin.moduleSymbol;
130605
130751
  var targetSymbol = checker.getMergedSymbol(ts.skipAlias(symbol.exportSymbol || symbol, checker));
130606
- 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;
130752
+ var isJsxOpeningTagName = (contextToken === null || contextToken === void 0 ? void 0 : contextToken.kind) === 29 /* LessThanToken */ && ts.isJsxOpeningLikeElement(contextToken.parent);
130753
+ 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;
130607
130754
  ts.Debug.assert(!(data === null || data === void 0 ? void 0 : data.moduleSpecifier) || moduleSpecifier === data.moduleSpecifier);
130608
130755
  return { sourceDisplay: [ts.textPart(moduleSpecifier)], codeActions: [codeAction] };
130609
130756
  }
@@ -131273,21 +131420,29 @@ var ts;
131273
131420
  var scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile) || sourceFile;
131274
131421
  isInSnippetScope = isSnippetScope(scopeNode);
131275
131422
  var symbolMeanings = (isTypeOnlyLocation ? 0 /* None */ : 111551 /* Value */) | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */;
131423
+ var typeOnlyAliasNeedsPromotion = previousToken && !ts.isValidTypeOnlyAliasUseSite(previousToken);
131276
131424
  symbols = ts.concatenate(symbols, typeChecker.getSymbolsInScope(scopeNode, symbolMeanings));
131277
131425
  ts.Debug.assertEachIsDefined(symbols, "getSymbolsInScope() should all be defined");
131278
- for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) {
131279
- var symbol = symbols_1[_i];
131426
+ for (var i = 0; i < symbols.length; i++) {
131427
+ var symbol = symbols[i];
131280
131428
  if (!typeChecker.isArgumentsSymbol(symbol) &&
131281
131429
  !ts.some(symbol.declarations, function (d) { return d.getSourceFile() === sourceFile; })) {
131282
131430
  symbolToSortTextIdMap[ts.getSymbolId(symbol)] = 15 /* GlobalsOrKeywords */;
131283
131431
  }
131432
+ if (typeOnlyAliasNeedsPromotion && !(symbol.flags & 111551 /* Value */)) {
131433
+ var typeOnlyAliasDeclaration = symbol.declarations && ts.find(symbol.declarations, ts.isTypeOnlyImportOrExportDeclaration);
131434
+ if (typeOnlyAliasDeclaration) {
131435
+ var origin = { kind: 64 /* TypeOnlyAlias */, declaration: typeOnlyAliasDeclaration };
131436
+ symbolToOriginInfoMap[i] = origin;
131437
+ }
131438
+ }
131284
131439
  }
131285
131440
  // Need to insert 'this.' before properties of `this` type, so only do that if `includeInsertTextCompletions`
131286
131441
  if (preferences.includeCompletionsWithInsertText && scopeNode.kind !== 303 /* SourceFile */) {
131287
131442
  var thisType = typeChecker.tryGetThisTypeAt(scopeNode, /*includeGlobalThis*/ false);
131288
131443
  if (thisType && !isProbablyGlobalType(thisType, sourceFile, typeChecker)) {
131289
- for (var _a = 0, _b = getPropertiesForCompletion(thisType, typeChecker); _a < _b.length; _a++) {
131290
- var symbol = _b[_a];
131444
+ for (var _i = 0, _a = getPropertiesForCompletion(thisType, typeChecker); _i < _a.length; _i++) {
131445
+ var symbol = _a[_i];
131291
131446
  symbolToOriginInfoMap[symbols.length] = { kind: 1 /* ThisType */ };
131292
131447
  symbols.push(symbol);
131293
131448
  symbolToSortTextIdMap[ts.getSymbolId(symbol)] = 14 /* SuggestedClassMembers */;
@@ -131390,7 +131545,8 @@ var ts;
131390
131545
  var packageJsonAutoImportProvider = (_b = host.getPackageJsonAutoImportProvider) === null || _b === void 0 ? void 0 : _b.call(host);
131391
131546
  var packageJsonFilter = detailsEntryId ? undefined : ts.createPackageJsonImportFilter(sourceFile, preferences, host);
131392
131547
  resolvingModuleSpecifiers("collectAutoImports", host, program, sourceFile, preferences, !!importCompletionNode, function (context) {
131393
- exportInfo.forEach(sourceFile.path, function (info, symbolName, isFromAmbientModule, exportMapKey) {
131548
+ exportInfo.forEach(sourceFile.path, function (info, getSymbolName, isFromAmbientModule, exportMapKey) {
131549
+ var symbolName = getSymbolName(/*preferCapitalized*/ isRightOfOpenTag);
131394
131550
  if (!ts.isIdentifierText(symbolName, ts.getEmitScriptTarget(host.getCompilationSettings())))
131395
131551
  return;
131396
131552
  if (!detailsEntryId && ts.isStringANonContextualKeyword(symbolName))
@@ -131400,6 +131556,10 @@ var ts;
131400
131556
  return;
131401
131557
  if (isTypeOnlyLocation && !(info[0].targetFlags & (1536 /* Module */ | 788968 /* Type */)))
131402
131558
  return;
131559
+ // Do not try to auto-import something with a lowercase first letter for a JSX tag
131560
+ var firstChar = symbolName.charCodeAt(0);
131561
+ if (isRightOfOpenTag && (firstChar < 65 /* A */ || firstChar > 90 /* Z */))
131562
+ return;
131403
131563
  var isCompletionDetailsMatch = detailsEntryId && ts.some(info, function (i) { return detailsEntryId.source === ts.stripQuotes(i.moduleSymbol.name); });
131404
131564
  if (isCompletionDetailsMatch || !detailsEntryId && charactersFuzzyMatchInString(symbolName, lowerCaseTokenText)) {
131405
131565
  var defaultExportInfo = ts.find(info, isImportableExportInfo);
@@ -131476,16 +131636,19 @@ var ts;
131476
131636
  return true;
131477
131637
  }
131478
131638
  if (contextToken.kind === 31 /* GreaterThanToken */ && contextToken.parent) {
131639
+ // <Component<string> /**/ />
131640
+ // <Component<string> /**/ ><Component>
131641
+ // - contextToken: GreaterThanToken (before cursor)
131642
+ // - location: JsxSelfClosingElement or JsxOpeningElement
131643
+ // - contextToken.parent === location
131644
+ if (location === contextToken.parent && (location.kind === 279 /* JsxOpeningElement */ || location.kind === 278 /* JsxSelfClosingElement */)) {
131645
+ return false;
131646
+ }
131479
131647
  if (contextToken.parent.kind === 279 /* JsxOpeningElement */) {
131480
- // Two possibilities:
131481
- // 1. <div>/**/
131482
- // - contextToken: GreaterThanToken (before cursor)
131483
- // - location: JSXElement
131484
- // - different parents (JSXOpeningElement, JSXElement)
131485
- // 2. <Component<string> /**/>
131486
- // - contextToken: GreaterThanToken (before cursor)
131487
- // - location: GreaterThanToken (after cursor)
131488
- // - same parent (JSXOpeningElement)
131648
+ // <div>/**/
131649
+ // - contextToken: GreaterThanToken (before cursor)
131650
+ // - location: JSXElement
131651
+ // - different parents (JSXOpeningElement, JSXElement)
131489
131652
  return location.parent.kind !== 279 /* JsxOpeningElement */;
131490
131653
  }
131491
131654
  if (contextToken.parent.kind === 280 /* JsxClosingElement */ || contextToken.parent.kind === 278 /* JsxSelfClosingElement */) {
@@ -132686,10 +132849,14 @@ var ts;
132686
132849
  /** True if symbol is a type or a module containing at least one type. */
132687
132850
  function symbolCanBeReferencedAtTypeLocation(symbol, checker, seenModules) {
132688
132851
  if (seenModules === void 0) { seenModules = new ts.Map(); }
132689
- var sym = ts.skipAlias(symbol.exportSymbol || symbol, checker);
132690
- return !!(sym.flags & 788968 /* Type */) || checker.isUnknownSymbol(sym) ||
132691
- !!(sym.flags & 1536 /* Module */) && ts.addToSeen(seenModules, ts.getSymbolId(sym)) &&
132692
- checker.getExportsOfModule(sym).some(function (e) { return symbolCanBeReferencedAtTypeLocation(e, checker, seenModules); });
132852
+ // Since an alias can be merged with a local declaration, we need to test both the alias and its target.
132853
+ // This code used to just test the result of `skipAlias`, but that would ignore any locally introduced meanings.
132854
+ return nonAliasCanBeReferencedAtTypeLocation(symbol) || nonAliasCanBeReferencedAtTypeLocation(ts.skipAlias(symbol.exportSymbol || symbol, checker));
132855
+ function nonAliasCanBeReferencedAtTypeLocation(symbol) {
132856
+ return !!(symbol.flags & 788968 /* Type */) || checker.isUnknownSymbol(symbol) ||
132857
+ !!(symbol.flags & 1536 /* Module */) && ts.addToSeen(seenModules, ts.getSymbolId(symbol)) &&
132858
+ checker.getExportsOfModule(symbol).some(function (e) { return symbolCanBeReferencedAtTypeLocation(e, checker, seenModules); });
132859
+ }
132693
132860
  }
132694
132861
  function isDeprecated(symbol, checker) {
132695
132862
  var declarations = ts.skipAlias(symbol, checker).declarations;
@@ -134943,8 +135110,8 @@ var ts;
134943
135110
  var sourceId = ts.getNodeId(sourceFile);
134944
135111
  var seenSymbols = this.sourceFileToSeenSymbols[sourceId] || (this.sourceFileToSeenSymbols[sourceId] = new ts.Set());
134945
135112
  var anyNewSymbols = false;
134946
- for (var _i = 0, symbols_2 = symbols; _i < symbols_2.length; _i++) {
134947
- var sym = symbols_2[_i];
135113
+ for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) {
135114
+ var sym = symbols_1[_i];
134948
135115
  anyNewSymbols = ts.tryAddToSet(seenSymbols, ts.getSymbolId(sym)) || anyNewSymbols;
134949
135116
  }
134950
135117
  return anyNewSymbols;
@@ -141904,6 +142071,8 @@ var ts;
141904
142071
  }
141905
142072
  if (flags & 16 /* Function */)
141906
142073
  return isLocalVariableOrFunction(symbol) ? "local function" /* localFunctionElement */ : "function" /* functionElement */;
142074
+ // 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.
142075
+ // So, even when the location is just on the declaration of setter, this function returns getter.
141907
142076
  if (flags & 32768 /* GetAccessor */)
141908
142077
  return "getter" /* memberGetAccessorElement */;
141909
142078
  if (flags & 65536 /* SetAccessor */)
@@ -141990,9 +142159,24 @@ var ts;
141990
142159
  }
141991
142160
  // Class at constructor site need to be shown as constructor apart from property,method, vars
141992
142161
  if (symbolKind !== "" /* unknown */ || symbolFlags & 32 /* Class */ || symbolFlags & 2097152 /* Alias */) {
141993
- // If it is accessor they are allowed only if location is at name of the accessor
142162
+ // If symbol is accessor, they are allowed only if location is at declaration identifier of the accessor
141994
142163
  if (symbolKind === "getter" /* memberGetAccessorElement */ || symbolKind === "setter" /* memberSetAccessorElement */) {
141995
- symbolKind = "property" /* memberVariableElement */;
142164
+ var declaration = ts.find(symbol.declarations, function (declaration) { return declaration.name === location; });
142165
+ if (declaration) {
142166
+ switch (declaration.kind) {
142167
+ case 171 /* GetAccessor */:
142168
+ symbolKind = "getter" /* memberGetAccessorElement */;
142169
+ break;
142170
+ case 172 /* SetAccessor */:
142171
+ symbolKind = "setter" /* memberSetAccessorElement */;
142172
+ break;
142173
+ default:
142174
+ ts.Debug.assertNever(declaration);
142175
+ }
142176
+ }
142177
+ else {
142178
+ symbolKind = "property" /* memberVariableElement */;
142179
+ }
141996
142180
  }
141997
142181
  var signature = void 0;
141998
142182
  type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location);
@@ -142306,6 +142490,8 @@ var ts;
142306
142490
  }
142307
142491
  // For properties, variables and local vars: show the type
142308
142492
  if (symbolKind === "property" /* memberVariableElement */ ||
142493
+ symbolKind === "getter" /* memberGetAccessorElement */ ||
142494
+ symbolKind === "setter" /* memberSetAccessorElement */ ||
142309
142495
  symbolKind === "JSX attribute" /* jsxAttribute */ ||
142310
142496
  symbolFlags & 3 /* Variable */ ||
142311
142497
  symbolKind === "local var" /* localVariableElement */ ||
@@ -142376,7 +142562,7 @@ var ts;
142376
142562
  }
142377
142563
  }
142378
142564
  if (tags.length === 0 && !hasMultipleSignatures) {
142379
- tags = symbol.getJsDocTags(typeChecker);
142565
+ tags = symbol.getContextualJsDocTags(enclosingDeclaration, typeChecker);
142380
142566
  }
142381
142567
  if (documentation.length === 0 && documentationFromAlias) {
142382
142568
  documentation = documentationFromAlias;
@@ -145796,6 +145982,7 @@ var ts;
145796
145982
  ChangeTracker.prototype.delete = function (sourceFile, node) {
145797
145983
  this.deletedNodes.push({ sourceFile: sourceFile, node: node });
145798
145984
  };
145985
+ /** Stop! Consider using `delete` instead, which has logic for deleting nodes from delimited lists. */
145799
145986
  ChangeTracker.prototype.deleteNode = function (sourceFile, node, options) {
145800
145987
  if (options === void 0) { options = { leadingTriviaOption: LeadingTriviaOption.IncludeAll }; }
145801
145988
  this.deleteRange(sourceFile, getAdjustedRange(sourceFile, node, node, options));
@@ -146199,6 +146386,15 @@ var ts;
146199
146386
  ChangeTracker.prototype.insertExportModifier = function (sourceFile, node) {
146200
146387
  this.insertText(sourceFile, node.getStart(sourceFile), "export ");
146201
146388
  };
146389
+ ChangeTracker.prototype.insertImportSpecifierAtIndex = function (sourceFile, importSpecifier, namedImports, index) {
146390
+ var prevSpecifier = namedImports.elements[index - 1];
146391
+ if (prevSpecifier) {
146392
+ this.insertNodeInListAfter(sourceFile, prevSpecifier, importSpecifier);
146393
+ }
146394
+ else {
146395
+ this.insertNodeBefore(sourceFile, namedImports.elements[0], importSpecifier, !ts.positionsAreOnSameLine(namedImports.elements[0].getStart(), namedImports.parent.parent.getStart(), sourceFile));
146396
+ }
146397
+ };
146202
146398
  /**
146203
146399
  * This function should be used to insert nodes in lists when nodes don't carry separators as the part of the node range,
146204
146400
  * i.e. arguments in arguments lists, parameters in parameter lists etc.
@@ -149701,7 +149897,8 @@ var ts;
149701
149897
  ts.Diagnostics.Cannot_find_namespace_0.code,
149702
149898
  ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code,
149703
149899
  ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here.code,
149704
- ts.Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer.code
149900
+ ts.Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer.code,
149901
+ ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type.code,
149705
149902
  ];
149706
149903
  codefix.registerCodeFix({
149707
149904
  errorCodes: errorCodes,
@@ -149747,7 +149944,7 @@ var ts;
149747
149944
  var symbolName = ts.getNameForExportedSymbol(exportedSymbol, ts.getEmitScriptTarget(compilerOptions));
149748
149945
  var checker = program.getTypeChecker();
149749
149946
  var symbol = checker.getMergedSymbol(ts.skipAlias(exportedSymbol, checker));
149750
- var exportInfos = getAllReExportingModules(sourceFile, symbol, moduleSymbol, symbolName, host, program, preferences, useAutoImportProvider);
149947
+ var exportInfos = getAllReExportingModules(sourceFile, symbol, moduleSymbol, symbolName, /*isJsxTagName*/ false, host, program, preferences, useAutoImportProvider);
149751
149948
  var useRequire = shouldUseRequire(sourceFile, program);
149752
149949
  var fix = getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, symbolName, program, /*position*/ undefined, !!isValidTypeOnlyUseSite, useRequire, host, preferences);
149753
149950
  if (fix) {
@@ -149806,6 +150003,9 @@ var ts;
149806
150003
  }
149807
150004
  break;
149808
150005
  }
150006
+ case 4 /* PromoteTypeOnly */:
150007
+ // Excluding from fix-all
150008
+ break;
149809
150009
  default:
149810
150010
  ts.Debug.assertNever(fix, "fix wasn't never - got kind " + fix.kind);
149811
150011
  }
@@ -149897,6 +150097,7 @@ var ts;
149897
150097
  ImportFixKind[ImportFixKind["JsdocTypeImport"] = 1] = "JsdocTypeImport";
149898
150098
  ImportFixKind[ImportFixKind["AddToExisting"] = 2] = "AddToExisting";
149899
150099
  ImportFixKind[ImportFixKind["AddNew"] = 3] = "AddNew";
150100
+ ImportFixKind[ImportFixKind["PromoteTypeOnly"] = 4] = "PromoteTypeOnly";
149900
150101
  })(ImportFixKind || (ImportFixKind = {}));
149901
150102
  // These should not be combined as bitflags, but are given powers of 2 values to
149902
150103
  // easily detect conflicts between `NotAllowed` and `Required` by giving them a unique sum.
@@ -149908,11 +150109,11 @@ var ts;
149908
150109
  AddAsTypeOnly[AddAsTypeOnly["Required"] = 2] = "Required";
149909
150110
  AddAsTypeOnly[AddAsTypeOnly["NotAllowed"] = 4] = "NotAllowed";
149910
150111
  })(AddAsTypeOnly || (AddAsTypeOnly = {}));
149911
- function getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, symbolName, host, program, formatContext, position, preferences) {
150112
+ function getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, symbolName, isJsxTagName, host, program, formatContext, position, preferences) {
149912
150113
  var compilerOptions = program.getCompilerOptions();
149913
150114
  var exportInfos = ts.pathIsBareSpecifier(ts.stripQuotes(moduleSymbol.name))
149914
150115
  ? [getSymbolExportInfoForSymbol(targetSymbol, moduleSymbol, program, host)]
149915
- : getAllReExportingModules(sourceFile, targetSymbol, moduleSymbol, symbolName, host, program, preferences, /*useAutoImportProvider*/ true);
150116
+ : getAllReExportingModules(sourceFile, targetSymbol, moduleSymbol, symbolName, isJsxTagName, host, program, preferences, /*useAutoImportProvider*/ true);
149916
150117
  var useRequire = shouldUseRequire(sourceFile, program);
149917
150118
  var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(ts.getTokenAtPosition(sourceFile, position));
149918
150119
  var fix = ts.Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, symbolName, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences));
@@ -149922,6 +150123,13 @@ var ts;
149922
150123
  };
149923
150124
  }
149924
150125
  codefix.getImportCompletionAction = getImportCompletionAction;
150126
+ function getPromoteTypeOnlyCompletionAction(sourceFile, symbolToken, program, host, formatContext, preferences) {
150127
+ var compilerOptions = program.getCompilerOptions();
150128
+ var symbolName = getSymbolName(sourceFile, program.getTypeChecker(), symbolToken, compilerOptions);
150129
+ var fix = getTypeOnlyPromotionFix(sourceFile, symbolToken, symbolName, program);
150130
+ return fix && codeFixActionToCodeAction(codeActionForFix({ host: host, formatContext: formatContext, preferences: preferences }, sourceFile, symbolName, fix, 1 /* Double */, compilerOptions));
150131
+ }
150132
+ codefix.getPromoteTypeOnlyCompletionAction = getPromoteTypeOnlyCompletionAction;
149925
150133
  function getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, symbolName, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences) {
149926
150134
  ts.Debug.assert(exportInfos.some(function (info) { return info.moduleSymbol === moduleSymbol || info.symbol.parent === moduleSymbol; }), "Some exportInfo should match the specified moduleSymbol");
149927
150135
  var packageJsonImportFilter = ts.createPackageJsonImportFilter(sourceFile, preferences, host);
@@ -149951,7 +150159,7 @@ var ts;
149951
150159
  }
149952
150160
  }
149953
150161
  }
149954
- function getAllReExportingModules(importingFile, targetSymbol, exportingModuleSymbol, symbolName, host, program, preferences, useAutoImportProvider) {
150162
+ function getAllReExportingModules(importingFile, targetSymbol, exportingModuleSymbol, symbolName, isJsxTagName, host, program, preferences, useAutoImportProvider) {
149955
150163
  var result = [];
149956
150164
  var compilerOptions = program.getCompilerOptions();
149957
150165
  var getModuleSpecifierResolutionHost = ts.memoizeOne(function (isFromPackageJson) {
@@ -149964,7 +150172,7 @@ var ts;
149964
150172
  return;
149965
150173
  }
149966
150174
  var defaultInfo = ts.getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions);
149967
- if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, ts.getEmitScriptTarget(compilerOptions)) === symbolName) && ts.skipAlias(defaultInfo.symbol, checker) === targetSymbol && isImportable(program, moduleFile, isFromPackageJson)) {
150175
+ if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, ts.getEmitScriptTarget(compilerOptions), isJsxTagName) === symbolName) && ts.skipAlias(defaultInfo.symbol, checker) === targetSymbol && isImportable(program, moduleFile, isFromPackageJson)) {
149968
150176
  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 });
149969
150177
  }
149970
150178
  for (var _i = 0, _a = checker.getExportsAndPropertiesOfModule(moduleSymbol); _i < _a.length; _i++) {
@@ -150202,9 +150410,21 @@ var ts;
150202
150410
  }
150203
150411
  function getFixesInfo(context, errorCode, pos, useAutoImportProvider) {
150204
150412
  var symbolToken = ts.getTokenAtPosition(context.sourceFile, pos);
150205
- var info = errorCode === ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code
150206
- ? getFixesInfoForUMDImport(context, symbolToken)
150207
- : ts.isIdentifier(symbolToken) ? getFixesInfoForNonUMDImport(context, symbolToken, useAutoImportProvider) : undefined;
150413
+ var info;
150414
+ if (errorCode === ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code) {
150415
+ info = getFixesInfoForUMDImport(context, symbolToken);
150416
+ }
150417
+ else if (!ts.isIdentifier(symbolToken)) {
150418
+ return undefined;
150419
+ }
150420
+ else if (errorCode === ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type.code) {
150421
+ var symbolName_1 = getSymbolName(context.sourceFile, context.program.getTypeChecker(), symbolToken, context.program.getCompilerOptions());
150422
+ var fix = getTypeOnlyPromotionFix(context.sourceFile, symbolToken, symbolName_1, context.program);
150423
+ return fix && { fixes: [fix], symbolName: symbolName_1 };
150424
+ }
150425
+ else {
150426
+ info = getFixesInfoForNonUMDImport(context, symbolToken, useAutoImportProvider);
150427
+ }
150208
150428
  var packageJsonImportFilter = ts.createPackageJsonImportFilter(context.sourceFile, context.preferences, context.host);
150209
150429
  return info && __assign(__assign({}, info), { fixes: sortFixes(info.fixes, context.sourceFile, context.program, packageJsonImportFilter) });
150210
150430
  }
@@ -150321,13 +150541,23 @@ var ts;
150321
150541
  ts.Debug.assert(symbolName !== "default" /* Default */, "'default' isn't a legal identifier and couldn't occur here");
150322
150542
  var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(symbolToken);
150323
150543
  var useRequire = shouldUseRequire(sourceFile, program);
150324
- var exportInfos = getExportInfos(symbolName, ts.getMeaningFromLocation(symbolToken), cancellationToken, sourceFile, program, useAutoImportProvider, host, preferences);
150544
+ var exportInfos = getExportInfos(symbolName, ts.isJSXTagName(symbolToken), ts.getMeaningFromLocation(symbolToken), cancellationToken, sourceFile, program, useAutoImportProvider, host, preferences);
150325
150545
  var fixes = ts.arrayFrom(ts.flatMapIterator(exportInfos.entries(), function (_a) {
150326
150546
  var _ = _a[0], exportInfos = _a[1];
150327
150547
  return getImportFixes(exportInfos, symbolName, symbolToken.getStart(sourceFile), isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences);
150328
150548
  }));
150329
150549
  return { fixes: fixes, symbolName: symbolName };
150330
150550
  }
150551
+ function getTypeOnlyPromotionFix(sourceFile, symbolToken, symbolName, program) {
150552
+ var checker = program.getTypeChecker();
150553
+ var symbol = checker.resolveName(symbolName, symbolToken, 111551 /* Value */, /*excludeGlobals*/ true);
150554
+ if (!symbol)
150555
+ return undefined;
150556
+ var typeOnlyAliasDeclaration = checker.getTypeOnlyAliasDeclaration(symbol);
150557
+ if (!typeOnlyAliasDeclaration || ts.getSourceFileOfNode(typeOnlyAliasDeclaration) !== sourceFile)
150558
+ return undefined;
150559
+ return { kind: 4 /* PromoteTypeOnly */, typeOnlyAliasDeclaration: typeOnlyAliasDeclaration };
150560
+ }
150331
150561
  function jsxModeNeedsExplicitImport(jsx) {
150332
150562
  return jsx === 2 /* React */ || jsx === 3 /* ReactNative */;
150333
150563
  }
@@ -150335,14 +150565,20 @@ var ts;
150335
150565
  var parent = symbolToken.parent;
150336
150566
  if ((ts.isJsxOpeningLikeElement(parent) || ts.isJsxClosingElement(parent)) && parent.tagName === symbolToken && jsxModeNeedsExplicitImport(compilerOptions.jsx)) {
150337
150567
  var jsxNamespace = checker.getJsxNamespace(sourceFile);
150338
- if (ts.isIntrinsicJsxName(symbolToken.text) || !checker.resolveName(jsxNamespace, parent, 111551 /* Value */, /*excludeGlobals*/ true)) {
150568
+ if (needsJsxNamespaceFix(jsxNamespace, symbolToken, checker)) {
150339
150569
  return jsxNamespace;
150340
150570
  }
150341
150571
  }
150342
150572
  return symbolToken.text;
150343
150573
  }
150574
+ function needsJsxNamespaceFix(jsxNamespace, symbolToken, checker) {
150575
+ if (ts.isIntrinsicJsxName(symbolToken.text))
150576
+ return true; // If we were triggered by a matching error code on an intrinsic, the error must have been about missing the JSX factory
150577
+ var namespaceSymbol = checker.resolveName(jsxNamespace, symbolToken, 111551 /* Value */, /*excludeGlobals*/ true);
150578
+ return !namespaceSymbol || ts.some(namespaceSymbol.declarations, ts.isTypeOnlyImportOrExportDeclaration) && !(namespaceSymbol.flags & 111551 /* Value */);
150579
+ }
150344
150580
  // Returns a map from an exported symbol's ID to a list of every way it's (re-)exported.
150345
- function getExportInfos(symbolName, currentTokenMeaning, cancellationToken, fromFile, program, useAutoImportProvider, host, preferences) {
150581
+ function getExportInfos(symbolName, isJsxTagName, currentTokenMeaning, cancellationToken, fromFile, program, useAutoImportProvider, host, preferences) {
150346
150582
  var _a;
150347
150583
  // For each original symbol, keep all re-exports of that symbol together so we can call `getCodeActionsForImport` on the whole group at once.
150348
150584
  // Maps symbol id to info for modules providing that symbol (original export + re-exports).
@@ -150365,7 +150601,7 @@ var ts;
150365
150601
  cancellationToken.throwIfCancellationRequested();
150366
150602
  var compilerOptions = program.getCompilerOptions();
150367
150603
  var defaultInfo = ts.getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions);
150368
- if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, ts.getEmitScriptTarget(compilerOptions)) === symbolName) && symbolHasMeaning(defaultInfo.symbolForMeaning, currentTokenMeaning)) {
150604
+ if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, ts.getEmitScriptTarget(compilerOptions), isJsxTagName) === symbolName) && symbolHasMeaning(defaultInfo.symbolForMeaning, currentTokenMeaning)) {
150369
150605
  addSymbol(moduleSymbol, sourceFile, defaultInfo.symbol, defaultInfo.exportKind, program, isFromPackageJson);
150370
150606
  }
150371
150607
  // check exports with the same name
@@ -150439,10 +150675,80 @@ var ts;
150439
150675
  ts.insertImports(changes, sourceFile, getDeclarations(moduleSpecifier, quotePreference, defaultImport, namedImports, namespaceLikeImport), /*blankLineBetween*/ true);
150440
150676
  return [importKind === 1 /* Default */ ? ts.Diagnostics.Import_default_0_from_module_1 : ts.Diagnostics.Import_0_from_module_1, symbolName, moduleSpecifier];
150441
150677
  }
150678
+ case 4 /* PromoteTypeOnly */: {
150679
+ var typeOnlyAliasDeclaration = fix.typeOnlyAliasDeclaration;
150680
+ var promotedDeclaration = promoteFromTypeOnly(changes, typeOnlyAliasDeclaration, compilerOptions, sourceFile);
150681
+ return promotedDeclaration.kind === 269 /* ImportSpecifier */
150682
+ ? [ts.Diagnostics.Remove_type_from_import_of_0_from_1, symbolName, getModuleSpecifierText(promotedDeclaration.parent.parent)]
150683
+ : [ts.Diagnostics.Remove_type_from_import_declaration_from_0, getModuleSpecifierText(promotedDeclaration)];
150684
+ }
150442
150685
  default:
150443
150686
  return ts.Debug.assertNever(fix, "Unexpected fix kind " + fix.kind);
150444
150687
  }
150445
150688
  }
150689
+ function getModuleSpecifierText(promotedDeclaration) {
150690
+ var _a, _b;
150691
+ return promotedDeclaration.kind === 264 /* ImportEqualsDeclaration */
150692
+ ? ((_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()
150693
+ : ts.cast(promotedDeclaration.parent.moduleSpecifier, ts.isStringLiteral).text;
150694
+ }
150695
+ function promoteFromTypeOnly(changes, aliasDeclaration, compilerOptions, sourceFile) {
150696
+ // See comment in `doAddExistingFix` on constant with the same name.
150697
+ var convertExistingToTypeOnly = compilerOptions.preserveValueImports && compilerOptions.isolatedModules;
150698
+ switch (aliasDeclaration.kind) {
150699
+ case 269 /* ImportSpecifier */:
150700
+ if (aliasDeclaration.isTypeOnly) {
150701
+ if (aliasDeclaration.parent.elements.length > 1 && ts.OrganizeImports.importSpecifiersAreSorted(aliasDeclaration.parent.elements)) {
150702
+ changes.delete(sourceFile, aliasDeclaration);
150703
+ var newSpecifier = ts.factory.updateImportSpecifier(aliasDeclaration, /*isTypeOnly*/ false, aliasDeclaration.propertyName, aliasDeclaration.name);
150704
+ var insertionIndex = ts.OrganizeImports.getImportSpecifierInsertionIndex(aliasDeclaration.parent.elements, newSpecifier);
150705
+ changes.insertImportSpecifierAtIndex(sourceFile, newSpecifier, aliasDeclaration.parent, insertionIndex);
150706
+ }
150707
+ else {
150708
+ changes.deleteRange(sourceFile, aliasDeclaration.getFirstToken());
150709
+ }
150710
+ return aliasDeclaration;
150711
+ }
150712
+ else {
150713
+ ts.Debug.assert(aliasDeclaration.parent.parent.isTypeOnly);
150714
+ promoteImportClause(aliasDeclaration.parent.parent);
150715
+ return aliasDeclaration.parent.parent;
150716
+ }
150717
+ case 266 /* ImportClause */:
150718
+ promoteImportClause(aliasDeclaration);
150719
+ return aliasDeclaration;
150720
+ case 267 /* NamespaceImport */:
150721
+ promoteImportClause(aliasDeclaration.parent);
150722
+ return aliasDeclaration.parent;
150723
+ case 264 /* ImportEqualsDeclaration */:
150724
+ changes.deleteRange(sourceFile, aliasDeclaration.getChildAt(1));
150725
+ return aliasDeclaration;
150726
+ default:
150727
+ ts.Debug.failBadSyntaxKind(aliasDeclaration);
150728
+ }
150729
+ function promoteImportClause(importClause) {
150730
+ changes.delete(sourceFile, ts.getTypeKeywordOfTypeOnlyImport(importClause, sourceFile));
150731
+ if (convertExistingToTypeOnly) {
150732
+ var namedImports = ts.tryCast(importClause.namedBindings, ts.isNamedImports);
150733
+ if (namedImports && namedImports.elements.length > 1) {
150734
+ if (ts.OrganizeImports.importSpecifiersAreSorted(namedImports.elements) &&
150735
+ aliasDeclaration.kind === 269 /* ImportSpecifier */ &&
150736
+ namedImports.elements.indexOf(aliasDeclaration) !== 0) {
150737
+ // The import specifier being promoted will be the only non-type-only,
150738
+ // import in the NamedImports, so it should be moved to the front.
150739
+ changes.delete(sourceFile, aliasDeclaration);
150740
+ changes.insertImportSpecifierAtIndex(sourceFile, aliasDeclaration, namedImports, 0);
150741
+ }
150742
+ for (var _i = 0, _a = namedImports.elements; _i < _a.length; _i++) {
150743
+ var element = _a[_i];
150744
+ if (element !== aliasDeclaration && !element.isTypeOnly) {
150745
+ changes.insertModifierBefore(sourceFile, 151 /* TypeKeyword */, element);
150746
+ }
150747
+ }
150748
+ }
150749
+ }
150750
+ }
150751
+ }
150446
150752
  function doAddExistingFix(changes, sourceFile, clause, defaultImport, namedImports, compilerOptions) {
150447
150753
  var _a;
150448
150754
  if (clause.kind === 200 /* ObjectBindingPattern */) {
@@ -150480,13 +150786,7 @@ var ts;
150480
150786
  var insertionIndex = convertExistingToTypeOnly && !spec.isTypeOnly
150481
150787
  ? 0
150482
150788
  : ts.OrganizeImports.getImportSpecifierInsertionIndex(existingSpecifiers, spec);
150483
- var prevSpecifier = clause.namedBindings.elements[insertionIndex - 1];
150484
- if (prevSpecifier) {
150485
- changes.insertNodeInListAfter(sourceFile, prevSpecifier, spec);
150486
- }
150487
- else {
150488
- changes.insertNodeBefore(sourceFile, existingSpecifiers[0], spec, !ts.positionsAreOnSameLine(existingSpecifiers[0].getStart(), clause.parent.getStart(), sourceFile));
150489
- }
150789
+ changes.insertImportSpecifierAtIndex(sourceFile, spec, clause.namedBindings, insertionIndex);
150490
150790
  }
150491
150791
  }
150492
150792
  else if (existingSpecifiers === null || existingSpecifiers === void 0 ? void 0 : existingSpecifiers.length) {
@@ -150601,17 +150901,20 @@ var ts;
150601
150901
  var declarations = _a.declarations;
150602
150902
  return ts.some(declarations, function (decl) { return !!(ts.getMeaningFromDeclaration(decl) & meaning); });
150603
150903
  }
150604
- function moduleSymbolToValidIdentifier(moduleSymbol, target) {
150605
- return moduleSpecifierToValidIdentifier(ts.removeFileExtension(ts.stripQuotes(moduleSymbol.name)), target);
150904
+ function moduleSymbolToValidIdentifier(moduleSymbol, target, forceCapitalize) {
150905
+ return moduleSpecifierToValidIdentifier(ts.removeFileExtension(ts.stripQuotes(moduleSymbol.name)), target, forceCapitalize);
150606
150906
  }
150607
150907
  codefix.moduleSymbolToValidIdentifier = moduleSymbolToValidIdentifier;
150608
- function moduleSpecifierToValidIdentifier(moduleSpecifier, target) {
150908
+ function moduleSpecifierToValidIdentifier(moduleSpecifier, target, forceCapitalize) {
150609
150909
  var baseName = ts.getBaseFileName(ts.removeSuffix(moduleSpecifier, "/index"));
150610
150910
  var res = "";
150611
150911
  var lastCharWasValid = true;
150612
150912
  var firstCharCode = baseName.charCodeAt(0);
150613
150913
  if (ts.isIdentifierStart(firstCharCode, target)) {
150614
150914
  res += String.fromCharCode(firstCharCode);
150915
+ if (forceCapitalize) {
150916
+ res = res.toUpperCase();
150917
+ }
150615
150918
  }
150616
150919
  else {
150617
150920
  lastCharWasValid = false;
@@ -160580,13 +160883,11 @@ var ts;
160580
160883
  switch (context === null || context === void 0 ? void 0 : context.kind) {
160581
160884
  case 171 /* GetAccessor */:
160582
160885
  if (!this.contextualGetAccessorDocumentationComment) {
160583
- this.contextualGetAccessorDocumentationComment = ts.emptyArray;
160584
160886
  this.contextualGetAccessorDocumentationComment = getDocumentationComment(ts.filter(this.declarations, ts.isGetAccessor), checker);
160585
160887
  }
160586
160888
  return this.contextualGetAccessorDocumentationComment;
160587
160889
  case 172 /* SetAccessor */:
160588
160890
  if (!this.contextualSetAccessorDocumentationComment) {
160589
- this.contextualSetAccessorDocumentationComment = ts.emptyArray;
160590
160891
  this.contextualSetAccessorDocumentationComment = getDocumentationComment(ts.filter(this.declarations, ts.isSetAccessor), checker);
160591
160892
  }
160592
160893
  return this.contextualSetAccessorDocumentationComment;
@@ -160596,10 +160897,26 @@ var ts;
160596
160897
  };
160597
160898
  SymbolObject.prototype.getJsDocTags = function (checker) {
160598
160899
  if (this.tags === undefined) {
160599
- this.tags = ts.JsDoc.getJsDocTagsFromDeclarations(this.declarations, checker);
160900
+ this.tags = getJsDocTagsOfDeclarations(this.declarations, checker);
160600
160901
  }
160601
160902
  return this.tags;
160602
160903
  };
160904
+ SymbolObject.prototype.getContextualJsDocTags = function (context, checker) {
160905
+ switch (context === null || context === void 0 ? void 0 : context.kind) {
160906
+ case 171 /* GetAccessor */:
160907
+ if (!this.contextualGetAccessorTags) {
160908
+ this.contextualGetAccessorTags = getJsDocTagsOfDeclarations(ts.filter(this.declarations, ts.isGetAccessor), checker);
160909
+ }
160910
+ return this.contextualGetAccessorTags;
160911
+ case 172 /* SetAccessor */:
160912
+ if (!this.contextualSetAccessorTags) {
160913
+ this.contextualSetAccessorTags = getJsDocTagsOfDeclarations(ts.filter(this.declarations, ts.isSetAccessor), checker);
160914
+ }
160915
+ return this.contextualSetAccessorTags;
160916
+ default:
160917
+ return this.getJsDocTags(checker);
160918
+ }
160919
+ };
160603
160920
  return SymbolObject;
160604
160921
  }());
160605
160922
  var TokenObject = /** @class */ (function (_super) {
@@ -160769,10 +161086,7 @@ var ts;
160769
161086
  return this.documentationComment || (this.documentationComment = getDocumentationComment(ts.singleElementArray(this.declaration), this.checker));
160770
161087
  };
160771
161088
  SignatureObject.prototype.getJsDocTags = function () {
160772
- if (this.jsDocTags === undefined) {
160773
- this.jsDocTags = this.declaration ? getJsDocTagsOfSignature(this.declaration, this.checker) : [];
160774
- }
160775
- return this.jsDocTags;
161089
+ return this.jsDocTags || (this.jsDocTags = getJsDocTagsOfDeclarations(ts.singleElementArray(this.declaration), this.checker));
160776
161090
  };
160777
161091
  return SignatureObject;
160778
161092
  }());
@@ -160784,12 +161098,30 @@ var ts;
160784
161098
  function hasJSDocInheritDocTag(node) {
160785
161099
  return ts.getJSDocTags(node).some(function (tag) { return tag.tagName.text === "inheritDoc"; });
160786
161100
  }
160787
- function getJsDocTagsOfSignature(declaration, checker) {
160788
- var tags = ts.JsDoc.getJsDocTagsFromDeclarations([declaration], checker);
160789
- if (tags.length === 0 || hasJSDocInheritDocTag(declaration)) {
160790
- 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; });
160791
- if (inheritedTags) {
160792
- tags = __spreadArray(__spreadArray([], inheritedTags, true), tags, true);
161101
+ function getJsDocTagsOfDeclarations(declarations, checker) {
161102
+ if (!declarations)
161103
+ return ts.emptyArray;
161104
+ var tags = ts.JsDoc.getJsDocTagsFromDeclarations(declarations, checker);
161105
+ if (checker && (tags.length === 0 || declarations.some(hasJSDocInheritDocTag))) {
161106
+ var seenSymbols_1 = new ts.Set();
161107
+ var _loop_22 = function (declaration) {
161108
+ var inheritedTags = findBaseOfDeclaration(checker, declaration, function (symbol) {
161109
+ var _a;
161110
+ if (!seenSymbols_1.has(symbol)) {
161111
+ seenSymbols_1.add(symbol);
161112
+ if (declaration.kind === 171 /* GetAccessor */ || declaration.kind === 172 /* SetAccessor */) {
161113
+ return symbol.getContextualJsDocTags(declaration, checker);
161114
+ }
161115
+ return ((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.length) === 1 ? symbol.getJsDocTags() : undefined;
161116
+ }
161117
+ });
161118
+ if (inheritedTags) {
161119
+ tags = __spreadArray(__spreadArray([], inheritedTags, true), tags, true);
161120
+ }
161121
+ };
161122
+ for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) {
161123
+ var declaration = declarations_6[_i];
161124
+ _loop_22(declaration);
160793
161125
  }
160794
161126
  }
160795
161127
  return tags;
@@ -160799,18 +161131,24 @@ var ts;
160799
161131
  return ts.emptyArray;
160800
161132
  var doc = ts.JsDoc.getJsDocCommentsFromDeclarations(declarations, checker);
160801
161133
  if (checker && (doc.length === 0 || declarations.some(hasJSDocInheritDocTag))) {
160802
- var seenSymbols_1 = new ts.Set();
160803
- for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) {
160804
- var declaration = declarations_6[_i];
161134
+ var seenSymbols_2 = new ts.Set();
161135
+ var _loop_23 = function (declaration) {
160805
161136
  var inheritedDocs = findBaseOfDeclaration(checker, declaration, function (symbol) {
160806
- if (!seenSymbols_1.has(symbol)) {
160807
- seenSymbols_1.add(symbol);
161137
+ if (!seenSymbols_2.has(symbol)) {
161138
+ seenSymbols_2.add(symbol);
161139
+ if (declaration.kind === 171 /* GetAccessor */ || declaration.kind === 172 /* SetAccessor */) {
161140
+ return symbol.getContextualDocumentationComment(declaration, checker);
161141
+ }
160808
161142
  return symbol.getDocumentationComment(checker);
160809
161143
  }
160810
161144
  });
160811
161145
  // TODO: GH#16312 Return a ReadonlyArray, avoid copying inheritedDocs
160812
161146
  if (inheritedDocs)
160813
161147
  doc = doc.length === 0 ? inheritedDocs.slice() : inheritedDocs.concat(ts.lineBreakPart(), doc);
161148
+ };
161149
+ for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) {
161150
+ var declaration = declarations_7[_i];
161151
+ _loop_23(declaration);
160814
161152
  }
160815
161153
  }
160816
161154
  return doc;