@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/tsserver.js CHANGED
@@ -100,7 +100,7 @@ var ts;
100
100
  // The following is baselined as a literal template type without intervention
101
101
  /** The version of the TypeScript compiler release */
102
102
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
103
- ts.version = ts.versionMajorMinor + ".0-insiders.20220121";
103
+ ts.version = ts.versionMajorMinor + ".0-insiders.20220127";
104
104
  /* @internal */
105
105
  var Comparison;
106
106
  (function (Comparison) {
@@ -111,13 +111,18 @@ var ts;
111
111
  /* @internal */
112
112
  var NativeCollections;
113
113
  (function (NativeCollections) {
114
+ var globals = typeof globalThis !== "undefined" ? globalThis :
115
+ typeof global !== "undefined" ? global :
116
+ typeof self !== "undefined" ? self :
117
+ undefined;
114
118
  /**
115
119
  * Returns the native Map implementation if it is available and compatible (i.e. supports iteration).
116
120
  */
117
121
  function tryGetNativeMap() {
118
122
  // Internet Explorer's Map doesn't support iteration, so don't use it.
123
+ var gMap = globals === null || globals === void 0 ? void 0 : globals.Map;
119
124
  // eslint-disable-next-line no-in-operator
120
- return typeof Map !== "undefined" && "entries" in Map.prototype && new Map([[0, 0]]).size === 1 ? Map : undefined;
125
+ return typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined;
121
126
  }
122
127
  NativeCollections.tryGetNativeMap = tryGetNativeMap;
123
128
  /**
@@ -125,8 +130,9 @@ var ts;
125
130
  */
126
131
  function tryGetNativeSet() {
127
132
  // Internet Explorer's Set doesn't support iteration, so don't use it.
133
+ var gSet = globals === null || globals === void 0 ? void 0 : globals.Set;
128
134
  // eslint-disable-next-line no-in-operator
129
- return typeof Set !== "undefined" && "entries" in Set.prototype && new Set([0]).size === 1 ? Set : undefined;
135
+ return typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined;
130
136
  }
131
137
  NativeCollections.tryGetNativeSet = tryGetNativeSet;
132
138
  })(NativeCollections || (NativeCollections = {}));
@@ -4912,13 +4918,14 @@ var ts;
4912
4918
  // Flags that require TypeFlags.Object
4913
4919
  ObjectFlags[ObjectFlags["ContainsSpread"] = 4194304] = "ContainsSpread";
4914
4920
  ObjectFlags[ObjectFlags["ObjectRestType"] = 8388608] = "ObjectRestType";
4921
+ ObjectFlags[ObjectFlags["InstantiationExpressionType"] = 16777216] = "InstantiationExpressionType";
4915
4922
  /* @internal */
4916
- ObjectFlags[ObjectFlags["IsClassInstanceClone"] = 16777216] = "IsClassInstanceClone";
4923
+ ObjectFlags[ObjectFlags["IsClassInstanceClone"] = 33554432] = "IsClassInstanceClone";
4917
4924
  // Flags that require TypeFlags.Object and ObjectFlags.Reference
4918
4925
  /* @internal */
4919
- ObjectFlags[ObjectFlags["IdenticalBaseTypeCalculated"] = 33554432] = "IdenticalBaseTypeCalculated";
4926
+ ObjectFlags[ObjectFlags["IdenticalBaseTypeCalculated"] = 67108864] = "IdenticalBaseTypeCalculated";
4920
4927
  /* @internal */
4921
- ObjectFlags[ObjectFlags["IdenticalBaseTypeExists"] = 67108864] = "IdenticalBaseTypeExists";
4928
+ ObjectFlags[ObjectFlags["IdenticalBaseTypeExists"] = 134217728] = "IdenticalBaseTypeExists";
4922
4929
  // Flags that require TypeFlags.UnionOrIntersection or TypeFlags.Substitution
4923
4930
  /* @internal */
4924
4931
  ObjectFlags[ObjectFlags["IsGenericTypeComputed"] = 4194304] = "IsGenericTypeComputed";
@@ -8524,6 +8531,7 @@ var ts;
8524
8531
  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."),
8525
8532
  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"),
8526
8533
  _0_index_signatures_are_incompatible: diag(2634, ts.DiagnosticCategory.Error, "_0_index_signatures_are_incompatible_2634", "'{0}' index signatures are incompatible."),
8534
+ 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."),
8527
8535
  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."),
8528
8536
  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."),
8529
8537
  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."),
@@ -9467,6 +9475,8 @@ var ts;
9467
9475
  Remove_unused_declarations_for_Colon_0: diag(90041, ts.DiagnosticCategory.Message, "Remove_unused_declarations_for_Colon_0_90041", "Remove unused declarations for: '{0}'"),
9468
9476
  Declare_a_private_field_named_0: diag(90053, ts.DiagnosticCategory.Message, "Declare_a_private_field_named_0_90053", "Declare a private field named '{0}'."),
9469
9477
  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}'"),
9478
+ 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}\""),
9479
+ Remove_type_from_import_of_0_from_1: diag(90056, ts.DiagnosticCategory.Message, "Remove_type_from_import_of_0_from_1_90056", "Remove 'type' from import of '{0}' from \"{1}\""),
9470
9480
  Convert_function_to_an_ES2015_class: diag(95001, ts.DiagnosticCategory.Message, "Convert_function_to_an_ES2015_class_95001", "Convert function to an ES2015 class"),
9471
9481
  Convert_0_to_1_in_0: diag(95003, ts.DiagnosticCategory.Message, "Convert_0_to_1_in_0_95003", "Convert '{0}' to '{1} in {0}'"),
9472
9482
  Extract_to_0_in_1: diag(95004, ts.DiagnosticCategory.Message, "Extract_to_0_in_1_95004", "Extract to {0} in {1}"),
@@ -13407,6 +13417,7 @@ var ts;
13407
13417
  case 110 /* TrueKeyword */:
13408
13418
  case 106 /* SuperKeyword */:
13409
13419
  case 229 /* NonNullExpression */:
13420
+ case 227 /* ExpressionWithTypeArguments */:
13410
13421
  case 230 /* MetaProperty */:
13411
13422
  case 100 /* ImportKeyword */: // technically this is only an Expression if it's in a CallExpression
13412
13423
  return true;
@@ -14057,10 +14068,13 @@ var ts;
14057
14068
  function packageIdIsEqual(a, b) {
14058
14069
  return a === b || !!a && !!b && a.name === b.name && a.subModuleName === b.subModuleName && a.version === b.version;
14059
14070
  }
14060
- function packageIdToString(_a) {
14061
- var name = _a.name, subModuleName = _a.subModuleName, version = _a.version;
14062
- var fullName = subModuleName ? name + "/" + subModuleName : name;
14063
- return fullName + "@" + version;
14071
+ function packageIdToPackageName(_a) {
14072
+ var name = _a.name, subModuleName = _a.subModuleName;
14073
+ return subModuleName ? name + "/" + subModuleName : name;
14074
+ }
14075
+ ts.packageIdToPackageName = packageIdToPackageName;
14076
+ function packageIdToString(packageId) {
14077
+ return packageIdToPackageName(packageId) + "@" + packageId.version;
14064
14078
  }
14065
14079
  ts.packageIdToString = packageIdToString;
14066
14080
  function typeDirectiveIsEqualTo(oldResolution, newResolution) {
@@ -14893,6 +14907,15 @@ var ts;
14893
14907
  };
14894
14908
  }
14895
14909
  ts.createDiagnosticForFileFromMessageChain = createDiagnosticForFileFromMessageChain;
14910
+ function createDiagnosticMessageChainFromDiagnostic(diagnostic) {
14911
+ return typeof diagnostic.messageText === "string" ? {
14912
+ code: diagnostic.code,
14913
+ category: diagnostic.category,
14914
+ messageText: diagnostic.messageText,
14915
+ next: diagnostic.next,
14916
+ } : diagnostic.messageText;
14917
+ }
14918
+ ts.createDiagnosticMessageChainFromDiagnostic = createDiagnosticMessageChainFromDiagnostic;
14896
14919
  function createDiagnosticForRange(sourceFile, range, message) {
14897
14920
  return {
14898
14921
  file: sourceFile,
@@ -15061,7 +15084,8 @@ var ts;
15061
15084
  node.kind === 212 /* FunctionExpression */ ||
15062
15085
  node.kind === 213 /* ArrowFunction */ ||
15063
15086
  node.kind === 211 /* ParenthesizedExpression */ ||
15064
- node.kind === 253 /* VariableDeclaration */) ?
15087
+ node.kind === 253 /* VariableDeclaration */ ||
15088
+ node.kind === 274 /* ExportSpecifier */) ?
15065
15089
  ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) :
15066
15090
  ts.getLeadingCommentRanges(text, node.pos);
15067
15091
  // True if the comment starts with '/**' but not if it is '/**/'
@@ -15095,7 +15119,7 @@ var ts;
15095
15119
  case 114 /* VoidKeyword */:
15096
15120
  return node.parent.kind !== 216 /* VoidExpression */;
15097
15121
  case 227 /* ExpressionWithTypeArguments */:
15098
- return !isExpressionWithTypeArgumentsInClassExtendsClause(node);
15122
+ return ts.isHeritageClause(node.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(node);
15099
15123
  case 162 /* TypeParameter */:
15100
15124
  return node.parent.kind === 194 /* MappedType */ || node.parent.kind === 189 /* InferType */;
15101
15125
  // Identifiers and qualified names may be type nodes, depending on their context. Climb
@@ -15132,7 +15156,7 @@ var ts;
15132
15156
  }
15133
15157
  switch (parent.kind) {
15134
15158
  case 227 /* ExpressionWithTypeArguments */:
15135
- return !isExpressionWithTypeArgumentsInClassExtendsClause(parent);
15159
+ return ts.isHeritageClause(parent.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(parent);
15136
15160
  case 162 /* TypeParameter */:
15137
15161
  return node === parent.constraint;
15138
15162
  case 342 /* JSDocTemplateTag */:
@@ -15835,7 +15859,7 @@ var ts;
15835
15859
  case 296 /* SpreadAssignment */:
15836
15860
  return true;
15837
15861
  case 227 /* ExpressionWithTypeArguments */:
15838
- return parent.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent);
15862
+ return parent.expression === node && !isPartOfTypeNode(parent);
15839
15863
  case 295 /* ShorthandPropertyAssignment */:
15840
15864
  return parent.objectAssignmentInitializer === node;
15841
15865
  default:
@@ -22769,16 +22793,18 @@ var ts;
22769
22793
  return updateConstructorTypeNode1(node, node.modifiers, typeParameters, parameters, type);
22770
22794
  }
22771
22795
  // @api
22772
- function createTypeQueryNode(exprName) {
22796
+ function createTypeQueryNode(exprName, typeArguments) {
22773
22797
  var node = createBaseNode(180 /* TypeQuery */);
22774
22798
  node.exprName = exprName;
22799
+ node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments);
22775
22800
  node.transformFlags = 1 /* ContainsTypeScript */;
22776
22801
  return node;
22777
22802
  }
22778
22803
  // @api
22779
- function updateTypeQueryNode(node, exprName) {
22804
+ function updateTypeQueryNode(node, exprName, typeArguments) {
22780
22805
  return node.exprName !== exprName
22781
- ? update(createTypeQueryNode(exprName), node)
22806
+ || node.typeArguments !== typeArguments
22807
+ ? update(createTypeQueryNode(exprName, typeArguments), node)
22782
22808
  : node;
22783
22809
  }
22784
22810
  // @api
@@ -29894,7 +29920,8 @@ var ts;
29894
29920
  visitNode(cbNode, node.parameterName) ||
29895
29921
  visitNode(cbNode, node.type);
29896
29922
  case 180 /* TypeQuery */:
29897
- return visitNode(cbNode, node.exprName);
29923
+ return visitNode(cbNode, node.exprName) ||
29924
+ visitNodes(cbNode, cbNodes, node.typeArguments);
29898
29925
  case 181 /* TypeLiteral */:
29899
29926
  return visitNodes(cbNode, cbNodes, node.members);
29900
29927
  case 182 /* ArrayType */:
@@ -32427,7 +32454,9 @@ var ts;
32427
32454
  function parseTypeQuery() {
32428
32455
  var pos = getNodePos();
32429
32456
  parseExpected(112 /* TypeOfKeyword */);
32430
- return finishNode(factory.createTypeQueryNode(parseEntityName(/*allowReservedWords*/ true)), pos);
32457
+ var entityName = parseEntityName(/*allowReservedWords*/ true);
32458
+ var typeArguments = tryParseTypeArguments();
32459
+ return finishNode(factory.createTypeQueryNode(entityName, typeArguments), pos);
32431
32460
  }
32432
32461
  function parseTypeParameter() {
32433
32462
  var pos = getNodePos();
@@ -33366,7 +33395,7 @@ var ts;
33366
33395
  function parseInitializer() {
33367
33396
  return parseOptional(63 /* EqualsToken */) ? parseAssignmentExpressionOrHigher() : undefined;
33368
33397
  }
33369
- function parseAssignmentExpressionOrHigher(parsingConditionalTrueSide) {
33398
+ function parseAssignmentExpressionOrHigher() {
33370
33399
  // AssignmentExpression[in,yield]:
33371
33400
  // 1) ConditionalExpression[?in,?yield]
33372
33401
  // 2) LeftHandSideExpression = AssignmentExpression[?in,?yield]
@@ -33392,7 +33421,7 @@ var ts;
33392
33421
  // If we do successfully parse arrow-function, we must *not* recurse for productions 1, 2 or 3. An ArrowFunction is
33393
33422
  // not a LeftHandSideExpression, nor does it start a ConditionalExpression. So we are done
33394
33423
  // with AssignmentExpression if we see one.
33395
- var arrowExpression = tryParseParenthesizedArrowFunctionExpression(parsingConditionalTrueSide) || tryParseAsyncSimpleArrowFunctionExpression();
33424
+ var arrowExpression = tryParseParenthesizedArrowFunctionExpression() || tryParseAsyncSimpleArrowFunctionExpression();
33396
33425
  if (arrowExpression) {
33397
33426
  return arrowExpression;
33398
33427
  }
@@ -33411,7 +33440,7 @@ var ts;
33411
33440
  // parameter ('x => ...') above. We handle it here by checking if the parsed expression was a single
33412
33441
  // identifier and the current token is an arrow.
33413
33442
  if (expr.kind === 79 /* Identifier */ && token() === 38 /* EqualsGreaterThanToken */) {
33414
- return parseSimpleArrowFunctionExpression(pos, expr, /*asyncModifier*/ undefined, parsingConditionalTrueSide);
33443
+ return parseSimpleArrowFunctionExpression(pos, expr, /*asyncModifier*/ undefined);
33415
33444
  }
33416
33445
  // Now see if we might be in cases '2' or '3'.
33417
33446
  // If the expression was a LHS expression, and we have an assignment operator, then
@@ -33471,7 +33500,7 @@ var ts;
33471
33500
  return finishNode(factory.createYieldExpression(/*asteriskToken*/ undefined, /*expression*/ undefined), pos);
33472
33501
  }
33473
33502
  }
33474
- function parseSimpleArrowFunctionExpression(pos, identifier, asyncModifier, parsingConditionalTrueSide) {
33503
+ function parseSimpleArrowFunctionExpression(pos, identifier, asyncModifier) {
33475
33504
  ts.Debug.assert(token() === 38 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>");
33476
33505
  var parameter = factory.createParameterDeclaration(
33477
33506
  /*decorators*/ undefined,
@@ -33483,11 +33512,11 @@ var ts;
33483
33512
  finishNode(parameter, identifier.pos);
33484
33513
  var parameters = createNodeArray([parameter], parameter.pos, parameter.end);
33485
33514
  var equalsGreaterThanToken = parseExpectedToken(38 /* EqualsGreaterThanToken */);
33486
- var body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier, parsingConditionalTrueSide);
33515
+ var body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier);
33487
33516
  var node = factory.createArrowFunction(asyncModifier, /*typeParameters*/ undefined, parameters, /*type*/ undefined, equalsGreaterThanToken, body);
33488
33517
  return addJSDocComment(finishNode(node, pos));
33489
33518
  }
33490
- function tryParseParenthesizedArrowFunctionExpression(parsingConditionalTrueSide) {
33519
+ function tryParseParenthesizedArrowFunctionExpression() {
33491
33520
  var triState = isParenthesizedArrowFunctionExpression();
33492
33521
  if (triState === 0 /* False */) {
33493
33522
  // It's definitely not a parenthesized arrow function expression.
@@ -33498,8 +33527,8 @@ var ts;
33498
33527
  // it out, but don't allow any ambiguity, and return 'undefined' if this could be an
33499
33528
  // expression instead.
33500
33529
  return triState === 1 /* True */ ?
33501
- parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true, parsingConditionalTrueSide) :
33502
- tryParse(function () { return parsePossibleParenthesizedArrowFunctionExpression(parsingConditionalTrueSide); });
33530
+ parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true) :
33531
+ tryParse(parsePossibleParenthesizedArrowFunctionExpression);
33503
33532
  }
33504
33533
  // True -> We definitely expect a parenthesized arrow function here.
33505
33534
  // False -> There *cannot* be a parenthesized arrow function here.
@@ -33629,25 +33658,25 @@ var ts;
33629
33658
  return 2 /* Unknown */;
33630
33659
  }
33631
33660
  }
33632
- function parsePossibleParenthesizedArrowFunctionExpression(parsingConditionalTrueSide) {
33661
+ function parsePossibleParenthesizedArrowFunctionExpression() {
33633
33662
  var tokenPos = scanner.getTokenPos();
33634
33663
  if (notParenthesizedArrow === null || notParenthesizedArrow === void 0 ? void 0 : notParenthesizedArrow.has(tokenPos)) {
33635
33664
  return undefined;
33636
33665
  }
33637
- var result = parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ false, parsingConditionalTrueSide);
33666
+ var result = parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ false);
33638
33667
  if (!result) {
33639
33668
  (notParenthesizedArrow || (notParenthesizedArrow = new ts.Set())).add(tokenPos);
33640
33669
  }
33641
33670
  return result;
33642
33671
  }
33643
- function tryParseAsyncSimpleArrowFunctionExpression(parsingConditionalTrueSide) {
33672
+ function tryParseAsyncSimpleArrowFunctionExpression() {
33644
33673
  // We do a check here so that we won't be doing unnecessarily call to "lookAhead"
33645
33674
  if (token() === 131 /* AsyncKeyword */) {
33646
33675
  if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* True */) {
33647
33676
  var pos = getNodePos();
33648
33677
  var asyncModifier = parseModifiersForArrowFunction();
33649
33678
  var expr = parseBinaryExpressionOrHigher(0 /* Lowest */);
33650
- return parseSimpleArrowFunctionExpression(pos, expr, asyncModifier, parsingConditionalTrueSide);
33679
+ return parseSimpleArrowFunctionExpression(pos, expr, asyncModifier);
33651
33680
  }
33652
33681
  }
33653
33682
  return undefined;
@@ -33671,7 +33700,7 @@ var ts;
33671
33700
  }
33672
33701
  return 0 /* False */;
33673
33702
  }
33674
- function parseParenthesizedArrowFunctionExpression(allowAmbiguity, parsingConditionalTrueSide) {
33703
+ function parseParenthesizedArrowFunctionExpression(allowAmbiguity) {
33675
33704
  var pos = getNodePos();
33676
33705
  var hasJSDoc = hasPrecedingJSDocComment();
33677
33706
  var modifiers = parseModifiersForArrowFunction();
@@ -33697,18 +33726,6 @@ var ts;
33697
33726
  return undefined;
33698
33727
  }
33699
33728
  }
33700
- // Given:
33701
- // x ? y => ({ y }) : z => ({ z })
33702
- // We try to parse the body of the first arrow function by looking at:
33703
- // ({ y }) : z => ({ z })
33704
- // This is a valid arrow function with "z" as the return type.
33705
- //
33706
- // But, if we're in the true side of a conditional expression, this colon
33707
- // terminates the true side, so cannot be the return type.
33708
- if (parsingConditionalTrueSide && token() === 58 /* ColonToken */) {
33709
- ts.Debug.assert(!allowAmbiguity);
33710
- return undefined;
33711
- }
33712
33729
  var type = parseReturnType(58 /* ColonToken */, /*isType*/ false);
33713
33730
  if (type && !allowAmbiguity && typeHasArrowFunctionBlockingParseError(type)) {
33714
33731
  return undefined;
@@ -33742,7 +33759,7 @@ var ts;
33742
33759
  var node = factory.createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body);
33743
33760
  return withJSDoc(finishNode(node, pos), hasJSDoc);
33744
33761
  }
33745
- function parseArrowFunctionExpressionBody(isAsync, parsingConditionalTrueSide) {
33762
+ function parseArrowFunctionExpressionBody(isAsync) {
33746
33763
  if (token() === 18 /* OpenBraceToken */) {
33747
33764
  return parseFunctionBlock(isAsync ? 2 /* Await */ : 0 /* None */);
33748
33765
  }
@@ -33770,8 +33787,8 @@ var ts;
33770
33787
  var savedTopLevel = topLevel;
33771
33788
  topLevel = false;
33772
33789
  var node = isAsync
33773
- ? doInAwaitContext(function () { return parseAssignmentExpressionOrHigher(parsingConditionalTrueSide); })
33774
- : doOutsideOfAwaitContext(function () { return parseAssignmentExpressionOrHigher(parsingConditionalTrueSide); });
33790
+ ? doInAwaitContext(parseAssignmentExpressionOrHigher)
33791
+ : doOutsideOfAwaitContext(parseAssignmentExpressionOrHigher);
33775
33792
  topLevel = savedTopLevel;
33776
33793
  return node;
33777
33794
  }
@@ -33784,8 +33801,8 @@ var ts;
33784
33801
  // Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and
33785
33802
  // we do not that for the 'whenFalse' part.
33786
33803
  var colonToken;
33787
- return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, function () { return parseAssignmentExpressionOrHigher(/*parsingConditionalTrueSide*/ true); }), colonToken = parseExpectedToken(58 /* ColonToken */), ts.nodeIsPresent(colonToken)
33788
- ? parseAssignmentExpressionOrHigher(/*parsingConditionalTrueSide*/ false)
33804
+ return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher), colonToken = parseExpectedToken(58 /* ColonToken */), ts.nodeIsPresent(colonToken)
33805
+ ? parseAssignmentExpressionOrHigher()
33789
33806
  : createMissingNode(79 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(58 /* ColonToken */))), pos);
33790
33807
  }
33791
33808
  function parseBinaryExpressionOrHigher(precedence) {
@@ -34556,12 +34573,16 @@ var ts;
34556
34573
  expression = parseTaggedTemplateRest(pos, expression, questionDotToken, typeArguments);
34557
34574
  continue;
34558
34575
  }
34559
- var argumentList = parseArgumentList();
34560
- var callExpr = questionDotToken || tryReparseOptionalChain(expression) ?
34561
- factory.createCallChain(expression, questionDotToken, typeArguments, argumentList) :
34562
- factory.createCallExpression(expression, typeArguments, argumentList);
34563
- expression = finishNode(callExpr, pos);
34564
- continue;
34576
+ if (questionDotToken || token() === 20 /* OpenParenToken */) {
34577
+ var argumentList = parseArgumentList();
34578
+ var callExpr = questionDotToken || tryReparseOptionalChain(expression) ?
34579
+ factory.createCallChain(expression, questionDotToken, typeArguments, argumentList) :
34580
+ factory.createCallExpression(expression, typeArguments, argumentList);
34581
+ expression = finishNode(callExpr, pos);
34582
+ continue;
34583
+ }
34584
+ expression = finishNode(factory.createExpressionWithTypeArguments(expression, typeArguments), pos);
34585
+ break;
34565
34586
  }
34566
34587
  }
34567
34588
  else if (token() === 20 /* OpenParenToken */) {
@@ -34601,20 +34622,23 @@ var ts;
34601
34622
  // If it doesn't have the closing `>` then it's definitely not an type argument list.
34602
34623
  return undefined;
34603
34624
  }
34604
- // If we have a '<', then only parse this as a argument list if the type arguments
34605
- // are complete and we have an open paren. if we don't, rewind and return nothing.
34606
- return typeArguments && canFollowTypeArgumentsInExpression()
34607
- ? typeArguments
34608
- : undefined;
34625
+ // We successfully parsed a type argument list. The next token determines whether we want to
34626
+ // treat it as such. If the type argument list is followed by `(` or a template literal, as in
34627
+ // `f<number>(42)`, we favor the type argument interpretation even though JavaScript would view
34628
+ // it as a relational expression.
34629
+ return typeArguments && canFollowTypeArgumentsInExpression() ? typeArguments : undefined;
34609
34630
  }
34610
34631
  function canFollowTypeArgumentsInExpression() {
34611
34632
  switch (token()) {
34633
+ // These tokens can follow a type argument list in a call expression.
34612
34634
  case 20 /* OpenParenToken */: // foo<x>(
34613
34635
  case 14 /* NoSubstitutionTemplateLiteral */: // foo<T> `...`
34614
34636
  case 15 /* TemplateHead */: // foo<T> `...${100}...`
34615
- // these are the only tokens can legally follow a type argument
34616
- // list. So we definitely want to treat them as type arg lists.
34637
+ // These tokens can't follow in a call expression, nor can they start an
34638
+ // expression. So, consider the type argument list part of an instantiation
34639
+ // expression.
34617
34640
  // falls through
34641
+ case 27 /* CommaToken */: // foo<x>,
34618
34642
  case 24 /* DotToken */: // foo<x>.
34619
34643
  case 21 /* CloseParenToken */: // foo<x>)
34620
34644
  case 23 /* CloseBracketToken */: // foo<x>]
@@ -34633,20 +34657,10 @@ var ts;
34633
34657
  case 51 /* BarToken */: // foo<x> |
34634
34658
  case 19 /* CloseBraceToken */: // foo<x> }
34635
34659
  case 1 /* EndOfFileToken */: // foo<x>
34636
- // these cases can't legally follow a type arg list. However, they're not legal
34637
- // expressions either. The user is probably in the middle of a generic type. So
34638
- // treat it as such.
34639
34660
  return true;
34640
- case 27 /* CommaToken */: // foo<x>,
34641
- case 18 /* OpenBraceToken */: // foo<x> {
34642
- // We don't want to treat these as type arguments. Otherwise we'll parse this
34643
- // as an invocation expression. Instead, we want to parse out the expression
34644
- // in isolation from the type arguments.
34645
- // falls through
34646
- default:
34647
- // Anything else treat as an expression.
34648
- return false;
34649
34661
  }
34662
+ // Treat anything else as an expression.
34663
+ return false;
34650
34664
  }
34651
34665
  function parsePrimaryExpression() {
34652
34666
  switch (token()) {
@@ -34827,17 +34841,12 @@ var ts;
34827
34841
  return finishNode(factory.createMetaProperty(103 /* NewKeyword */, name), pos);
34828
34842
  }
34829
34843
  var expressionPos = getNodePos();
34830
- var expression = parsePrimaryExpression();
34831
- var typeArguments;
34832
- while (true) {
34833
- expression = parseMemberExpressionRest(expressionPos, expression, /*allowOptionalChain*/ false);
34834
- typeArguments = tryParse(parseTypeArgumentsInExpression);
34835
- if (isTemplateStartOfTaggedTemplate()) {
34836
- ts.Debug.assert(!!typeArguments, "Expected a type argument list; all plain tagged template starts should be consumed in 'parseMemberExpressionRest'");
34837
- expression = parseTaggedTemplateRest(expressionPos, expression, /*optionalChain*/ undefined, typeArguments);
34838
- typeArguments = undefined;
34839
- }
34840
- break;
34844
+ var expression = parseMemberExpressionRest(expressionPos, parsePrimaryExpression(), /*allowOptionalChain*/ false);
34845
+ var typeArguments = tryParse(parseTypeArgumentsInExpression);
34846
+ if (isTemplateStartOfTaggedTemplate()) {
34847
+ ts.Debug.assert(!!typeArguments, "Expected a type argument list; all plain tagged template starts should be consumed in 'parseMemberExpressionRest'");
34848
+ expression = parseTaggedTemplateRest(expressionPos, expression, /*optionalChain*/ undefined, typeArguments);
34849
+ typeArguments = undefined;
34841
34850
  }
34842
34851
  var argumentsArray;
34843
34852
  if (token() === 20 /* OpenParenToken */) {
@@ -35934,6 +35943,9 @@ var ts;
35934
35943
  function parseExpressionWithTypeArguments() {
35935
35944
  var pos = getNodePos();
35936
35945
  var expression = parseLeftHandSideExpressionOrHigher();
35946
+ if (expression.kind === 227 /* ExpressionWithTypeArguments */) {
35947
+ return expression;
35948
+ }
35937
35949
  var typeArguments = tryParseTypeArguments();
35938
35950
  return finishNode(factory.createExpressionWithTypeArguments(expression, typeArguments), pos);
35939
35951
  }
@@ -36224,7 +36236,8 @@ var ts;
36224
36236
  return finishNode(node, pos);
36225
36237
  }
36226
36238
  function parseExportSpecifier() {
36227
- return parseImportOrExportSpecifier(274 /* ExportSpecifier */);
36239
+ var hasJSDoc = hasPrecedingJSDocComment();
36240
+ return withJSDoc(parseImportOrExportSpecifier(274 /* ExportSpecifier */), hasJSDoc);
36228
36241
  }
36229
36242
  function parseImportSpecifier() {
36230
36243
  return parseImportOrExportSpecifier(269 /* ImportSpecifier */);
@@ -43429,14 +43442,12 @@ var ts;
43429
43442
  }
43430
43443
  var binder = createBinder();
43431
43444
  function bindSourceFile(file, options) {
43432
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("bind" /* Bind */, "bindSourceFile", { path: file.path }, /*separateBeginAndEnd*/ true);
43433
43445
  ts.performance.mark("beforeBind");
43434
43446
  ts.perfLogger.logStartBindFile("" + file.fileName);
43435
43447
  binder(file, options);
43436
43448
  ts.perfLogger.logStopBindFile();
43437
43449
  ts.performance.mark("afterBind");
43438
43450
  ts.performance.measure("Bind", "beforeBind", "afterBind");
43439
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
43440
43451
  }
43441
43452
  ts.bindSourceFile = bindSourceFile;
43442
43453
  function createBinder() {
@@ -43496,7 +43507,9 @@ var ts;
43496
43507
  ts.Debug.attachFlowNodeDebugInfo(unreachableFlow);
43497
43508
  ts.Debug.attachFlowNodeDebugInfo(reportedUnreachableFlow);
43498
43509
  if (!file.locals) {
43510
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("bind" /* Bind */, "bindSourceFile", { path: file.path }, /*separateBeginAndEnd*/ true);
43499
43511
  bind(file);
43512
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
43500
43513
  file.symbolCount = symbolCount;
43501
43514
  file.classifiableNames = classifiableNames;
43502
43515
  delayedBindJSDocTypedefTag();
@@ -47763,6 +47776,9 @@ var ts;
47763
47776
  suggestionDiagnostics.add(diagnostic);
47764
47777
  return diagnostic;
47765
47778
  }
47779
+ function isDeprecatedSymbol(symbol) {
47780
+ return !!(getDeclarationNodeFlagsFromSymbol(symbol) & 134217728 /* Deprecated */);
47781
+ }
47766
47782
  function addDeprecatedSuggestion(location, declarations, deprecatedEntity) {
47767
47783
  var diagnostic = ts.createDiagnosticForNode(location, ts.Diagnostics._0_is_deprecated, deprecatedEntity);
47768
47784
  return addDeprecatedSuggestionWorker(declarations, diagnostic);
@@ -50858,7 +50874,7 @@ var ts;
50858
50874
  // get symbol of the first identifier of the entityName
50859
50875
  var meaning;
50860
50876
  if (entityName.parent.kind === 180 /* TypeQuery */ ||
50861
- ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent) ||
50877
+ entityName.parent.kind === 227 /* ExpressionWithTypeArguments */ && !ts.isPartOfTypeNode(entityName.parent) ||
50862
50878
  entityName.parent.kind === 161 /* ComputedPropertyName */) {
50863
50879
  // Typeof value
50864
50880
  meaning = 111551 /* Value */ | 1048576 /* ExportValue */;
@@ -50969,7 +50985,7 @@ var ts;
50969
50985
  return flags & 814775659 /* NodeBuilderFlagsMask */;
50970
50986
  }
50971
50987
  function isClassInstanceSide(type) {
50972
- return !!type.symbol && !!(type.symbol.flags & 32 /* Class */) && (type === getDeclaredTypeOfClassOrInterface(type.symbol) || (!!(type.flags & 524288 /* Object */) && !!(ts.getObjectFlags(type) & 16777216 /* IsClassInstanceClone */)));
50988
+ return !!type.symbol && !!(type.symbol.flags & 32 /* Class */) && (type === getDeclaredTypeOfClassOrInterface(type.symbol) || (!!(type.flags & 524288 /* Object */) && !!(ts.getObjectFlags(type) & 33554432 /* IsClassInstanceClone */)));
50973
50989
  }
50974
50990
  function createNodeBuilder() {
50975
50991
  return {
@@ -52533,7 +52549,8 @@ var ts;
52533
52549
  includePrivateSymbol === null || includePrivateSymbol === void 0 ? void 0 : includePrivateSymbol(sym);
52534
52550
  }
52535
52551
  if (ts.isIdentifier(node)) {
52536
- var name = sym.flags & 262144 /* TypeParameter */ ? typeParameterToName(getDeclaredTypeOfSymbol(sym), context) : ts.factory.cloneNode(node);
52552
+ var type = getDeclaredTypeOfSymbol(sym);
52553
+ var name = sym.flags & 262144 /* TypeParameter */ && !isTypeSymbolAccessible(type.symbol, context.enclosingDeclaration) ? typeParameterToName(type, context) : ts.factory.cloneNode(node);
52537
52554
  name.symbol = sym; // for quickinfo, which uses identifier symbol information
52538
52555
  return { introducesError: introducesError, node: ts.setEmitFlags(ts.setOriginalNode(name, node), 16777216 /* NoAsciiEscaping */) };
52539
52556
  }
@@ -54896,7 +54913,7 @@ var ts;
54896
54913
  members_4, exportedType.callSignatures, exportedType.constructSignatures, exportedType.indexInfos);
54897
54914
  result.objectFlags |= (ts.getObjectFlags(type) & 8192 /* JSLiteral */); // Propagate JSLiteral flag
54898
54915
  if (result.symbol && result.symbol.flags & 32 /* Class */ && type === getDeclaredTypeOfClassOrInterface(result.symbol)) {
54899
- result.objectFlags |= 16777216 /* IsClassInstanceClone */; // Propagate the knowledge that this type is equivalent to the symbol's class instance type
54916
+ result.objectFlags |= 33554432 /* IsClassInstanceClone */; // Propagate the knowledge that this type is equivalent to the symbol's class instance type
54900
54917
  }
54901
54918
  return result;
54902
54919
  }
@@ -56906,87 +56923,87 @@ var ts;
56906
56923
  * Converts an AnonymousType to a ResolvedType.
56907
56924
  */
56908
56925
  function resolveAnonymousTypeMembers(type) {
56909
- var symbol = getMergedSymbol(type.symbol);
56910
56926
  if (type.target) {
56911
56927
  setStructuredTypeMembers(type, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
56912
- var members = createInstantiatedSymbolTable(getPropertiesOfObjectType(type.target), type.mapper, /*mappingThisOnly*/ false);
56928
+ var members_6 = createInstantiatedSymbolTable(getPropertiesOfObjectType(type.target), type.mapper, /*mappingThisOnly*/ false);
56913
56929
  var callSignatures = instantiateSignatures(getSignaturesOfType(type.target, 0 /* Call */), type.mapper);
56914
56930
  var constructSignatures = instantiateSignatures(getSignaturesOfType(type.target, 1 /* Construct */), type.mapper);
56915
- var indexInfos = instantiateIndexInfos(getIndexInfosOfType(type.target), type.mapper);
56916
- setStructuredTypeMembers(type, members, callSignatures, constructSignatures, indexInfos);
56931
+ var indexInfos_1 = instantiateIndexInfos(getIndexInfosOfType(type.target), type.mapper);
56932
+ setStructuredTypeMembers(type, members_6, callSignatures, constructSignatures, indexInfos_1);
56933
+ return;
56917
56934
  }
56918
- else if (symbol.flags & 2048 /* TypeLiteral */) {
56935
+ var symbol = getMergedSymbol(type.symbol);
56936
+ if (symbol.flags & 2048 /* TypeLiteral */) {
56919
56937
  setStructuredTypeMembers(type, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
56920
- var members = getMembersOfSymbol(symbol);
56921
- var callSignatures = getSignaturesOfSymbol(members.get("__call" /* Call */));
56922
- var constructSignatures = getSignaturesOfSymbol(members.get("__new" /* New */));
56923
- var indexInfos = getIndexInfosOfSymbol(symbol);
56924
- setStructuredTypeMembers(type, members, callSignatures, constructSignatures, indexInfos);
56938
+ var members_7 = getMembersOfSymbol(symbol);
56939
+ var callSignatures = getSignaturesOfSymbol(members_7.get("__call" /* Call */));
56940
+ var constructSignatures = getSignaturesOfSymbol(members_7.get("__new" /* New */));
56941
+ var indexInfos_2 = getIndexInfosOfSymbol(symbol);
56942
+ setStructuredTypeMembers(type, members_7, callSignatures, constructSignatures, indexInfos_2);
56943
+ return;
56925
56944
  }
56926
- else {
56927
- // Combinations of function, class, enum and module
56928
- var members = emptySymbols;
56929
- var indexInfos = void 0;
56930
- if (symbol.exports) {
56931
- members = getExportsOfSymbol(symbol);
56932
- if (symbol === globalThisSymbol) {
56933
- var varsOnly_1 = new ts.Map();
56934
- members.forEach(function (p) {
56935
- if (!(p.flags & 418 /* BlockScoped */)) {
56936
- varsOnly_1.set(p.escapedName, p);
56937
- }
56938
- });
56939
- members = varsOnly_1;
56940
- }
56945
+ // Combinations of function, class, enum and module
56946
+ var members = emptySymbols;
56947
+ var indexInfos;
56948
+ if (symbol.exports) {
56949
+ members = getExportsOfSymbol(symbol);
56950
+ if (symbol === globalThisSymbol) {
56951
+ var varsOnly_1 = new ts.Map();
56952
+ members.forEach(function (p) {
56953
+ if (!(p.flags & 418 /* BlockScoped */)) {
56954
+ varsOnly_1.set(p.escapedName, p);
56955
+ }
56956
+ });
56957
+ members = varsOnly_1;
56941
56958
  }
56942
- var baseConstructorIndexInfo = void 0;
56943
- setStructuredTypeMembers(type, members, ts.emptyArray, ts.emptyArray, ts.emptyArray);
56944
- if (symbol.flags & 32 /* Class */) {
56945
- var classType = getDeclaredTypeOfClassOrInterface(symbol);
56946
- var baseConstructorType = getBaseConstructorTypeOfClass(classType);
56947
- if (baseConstructorType.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 8650752 /* TypeVariable */)) {
56948
- members = ts.createSymbolTable(getNamedOrIndexSignatureMembers(members));
56949
- addInheritedMembers(members, getPropertiesOfType(baseConstructorType));
56950
- }
56951
- else if (baseConstructorType === anyType) {
56952
- baseConstructorIndexInfo = createIndexInfo(stringType, anyType, /*isReadonly*/ false);
56953
- }
56959
+ }
56960
+ var baseConstructorIndexInfo;
56961
+ setStructuredTypeMembers(type, members, ts.emptyArray, ts.emptyArray, ts.emptyArray);
56962
+ if (symbol.flags & 32 /* Class */) {
56963
+ var classType = getDeclaredTypeOfClassOrInterface(symbol);
56964
+ var baseConstructorType = getBaseConstructorTypeOfClass(classType);
56965
+ if (baseConstructorType.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 8650752 /* TypeVariable */)) {
56966
+ members = ts.createSymbolTable(getNamedOrIndexSignatureMembers(members));
56967
+ addInheritedMembers(members, getPropertiesOfType(baseConstructorType));
56954
56968
  }
56955
- var indexSymbol = getIndexSymbolFromSymbolTable(members);
56956
- if (indexSymbol) {
56957
- indexInfos = getIndexInfosOfIndexSymbol(indexSymbol);
56969
+ else if (baseConstructorType === anyType) {
56970
+ baseConstructorIndexInfo = createIndexInfo(stringType, anyType, /*isReadonly*/ false);
56958
56971
  }
56959
- else {
56960
- if (baseConstructorIndexInfo) {
56961
- indexInfos = ts.append(indexInfos, baseConstructorIndexInfo);
56962
- }
56963
- if (symbol.flags & 384 /* Enum */ && (getDeclaredTypeOfSymbol(symbol).flags & 32 /* Enum */ ||
56964
- ts.some(type.properties, function (prop) { return !!(getTypeOfSymbol(prop).flags & 296 /* NumberLike */); }))) {
56965
- indexInfos = ts.append(indexInfos, enumNumberIndexInfo);
56966
- }
56972
+ }
56973
+ var indexSymbol = getIndexSymbolFromSymbolTable(members);
56974
+ if (indexSymbol) {
56975
+ indexInfos = getIndexInfosOfIndexSymbol(indexSymbol);
56976
+ }
56977
+ else {
56978
+ if (baseConstructorIndexInfo) {
56979
+ indexInfos = ts.append(indexInfos, baseConstructorIndexInfo);
56967
56980
  }
56968
- setStructuredTypeMembers(type, members, ts.emptyArray, ts.emptyArray, indexInfos || ts.emptyArray);
56969
- // We resolve the members before computing the signatures because a signature may use
56970
- // typeof with a qualified name expression that circularly references the type we are
56971
- // in the process of resolving (see issue #6072). The temporarily empty signature list
56972
- // will never be observed because a qualified name can't reference signatures.
56973
- if (symbol.flags & (16 /* Function */ | 8192 /* Method */)) {
56974
- type.callSignatures = getSignaturesOfSymbol(symbol);
56981
+ if (symbol.flags & 384 /* Enum */ && (getDeclaredTypeOfSymbol(symbol).flags & 32 /* Enum */ ||
56982
+ ts.some(type.properties, function (prop) { return !!(getTypeOfSymbol(prop).flags & 296 /* NumberLike */); }))) {
56983
+ indexInfos = ts.append(indexInfos, enumNumberIndexInfo);
56975
56984
  }
56976
- // And likewise for construct signatures for classes
56977
- if (symbol.flags & 32 /* Class */) {
56978
- var classType_1 = getDeclaredTypeOfClassOrInterface(symbol);
56979
- var constructSignatures = symbol.members ? getSignaturesOfSymbol(symbol.members.get("__constructor" /* Constructor */)) : ts.emptyArray;
56980
- if (symbol.flags & 16 /* Function */) {
56981
- constructSignatures = ts.addRange(constructSignatures.slice(), ts.mapDefined(type.callSignatures, function (sig) { return isJSConstructor(sig.declaration) ?
56982
- createSignature(sig.declaration, sig.typeParameters, sig.thisParameter, sig.parameters, classType_1, /*resolvedTypePredicate*/ undefined, sig.minArgumentCount, sig.flags & 39 /* PropagatingFlags */) :
56983
- undefined; }));
56984
- }
56985
- if (!constructSignatures.length) {
56986
- constructSignatures = getDefaultConstructSignatures(classType_1);
56987
- }
56988
- type.constructSignatures = constructSignatures;
56985
+ }
56986
+ setStructuredTypeMembers(type, members, ts.emptyArray, ts.emptyArray, indexInfos || ts.emptyArray);
56987
+ // We resolve the members before computing the signatures because a signature may use
56988
+ // typeof with a qualified name expression that circularly references the type we are
56989
+ // in the process of resolving (see issue #6072). The temporarily empty signature list
56990
+ // will never be observed because a qualified name can't reference signatures.
56991
+ if (symbol.flags & (16 /* Function */ | 8192 /* Method */)) {
56992
+ type.callSignatures = getSignaturesOfSymbol(symbol);
56993
+ }
56994
+ // And likewise for construct signatures for classes
56995
+ if (symbol.flags & 32 /* Class */) {
56996
+ var classType_1 = getDeclaredTypeOfClassOrInterface(symbol);
56997
+ var constructSignatures = symbol.members ? getSignaturesOfSymbol(symbol.members.get("__constructor" /* Constructor */)) : ts.emptyArray;
56998
+ if (symbol.flags & 16 /* Function */) {
56999
+ constructSignatures = ts.addRange(constructSignatures.slice(), ts.mapDefined(type.callSignatures, function (sig) { return isJSConstructor(sig.declaration) ?
57000
+ createSignature(sig.declaration, sig.typeParameters, sig.thisParameter, sig.parameters, classType_1, /*resolvedTypePredicate*/ undefined, sig.minArgumentCount, sig.flags & 39 /* PropagatingFlags */) :
57001
+ undefined; }));
57002
+ }
57003
+ if (!constructSignatures.length) {
57004
+ constructSignatures = getDefaultConstructSignatures(classType_1);
56989
57005
  }
57006
+ type.constructSignatures = constructSignatures;
56990
57007
  }
56991
57008
  }
56992
57009
  function replaceIndexedAccess(instantiable, type, replacement) {
@@ -57978,8 +57995,8 @@ var ts;
57978
57995
  var stringIndexInfo;
57979
57996
  var applicableInfo;
57980
57997
  var applicableInfos;
57981
- for (var _i = 0, indexInfos_1 = indexInfos; _i < indexInfos_1.length; _i++) {
57982
- var info = indexInfos_1[_i];
57998
+ for (var _i = 0, indexInfos_3 = indexInfos; _i < indexInfos_3.length; _i++) {
57999
+ var info = indexInfos_3[_i];
57983
58000
  if (info.keyType === stringType) {
57984
58001
  stringIndexInfo = info;
57985
58002
  }
@@ -58543,14 +58560,14 @@ var ts;
58543
58560
  }
58544
58561
  function getIndexInfosOfIndexSymbol(indexSymbol) {
58545
58562
  if (indexSymbol.declarations) {
58546
- var indexInfos_2 = [];
58563
+ var indexInfos_4 = [];
58547
58564
  var _loop_14 = function (declaration) {
58548
58565
  if (declaration.parameters.length === 1) {
58549
58566
  var parameter = declaration.parameters[0];
58550
58567
  if (parameter.type) {
58551
58568
  forEachType(getTypeFromTypeNode(parameter.type), function (keyType) {
58552
- if (isValidIndexKeyType(keyType) && !findIndexInfo(indexInfos_2, keyType)) {
58553
- indexInfos_2.push(createIndexInfo(keyType, declaration.type ? getTypeFromTypeNode(declaration.type) : anyType, ts.hasEffectiveModifier(declaration, 64 /* Readonly */), declaration));
58569
+ if (isValidIndexKeyType(keyType) && !findIndexInfo(indexInfos_4, keyType)) {
58570
+ indexInfos_4.push(createIndexInfo(keyType, declaration.type ? getTypeFromTypeNode(declaration.type) : anyType, ts.hasEffectiveModifier(declaration, 64 /* Readonly */), declaration));
58554
58571
  }
58555
58572
  });
58556
58573
  }
@@ -58560,7 +58577,7 @@ var ts;
58560
58577
  var declaration = _a[_i];
58561
58578
  _loop_14(declaration);
58562
58579
  }
58563
- return indexInfos_2;
58580
+ return indexInfos_4;
58564
58581
  }
58565
58582
  return ts.emptyArray;
58566
58583
  }
@@ -59108,7 +59125,7 @@ var ts;
59108
59125
  // The expression is processed as an identifier expression (section 4.3)
59109
59126
  // or property access expression(section 4.10),
59110
59127
  // the widened type(section 3.9) of which becomes the result.
59111
- var type = ts.isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName);
59128
+ var type = checkExpressionWithTypeArguments(node);
59112
59129
  links.resolvedType = getRegularTypeOfLiteralType(getWidenedType(type));
59113
59130
  }
59114
59131
  return links.resolvedType;
@@ -60549,7 +60566,7 @@ var ts;
60549
60566
  }
60550
60567
  var prop = getPropertyOfType(objectType, propName);
60551
60568
  if (prop) {
60552
- if (accessFlags & 64 /* ReportDeprecated */ && accessNode && prop.declarations && getDeclarationNodeFlagsFromSymbol(prop) & 134217728 /* Deprecated */ && isUncalledFunctionReference(accessNode, prop)) {
60569
+ if (accessFlags & 64 /* ReportDeprecated */ && accessNode && prop.declarations && isDeprecatedSymbol(prop) && isUncalledFunctionReference(accessNode, prop)) {
60553
60570
  var deprecatedNode = (_a = accessExpression === null || accessExpression === void 0 ? void 0 : accessExpression.argumentExpression) !== null && _a !== void 0 ? _a : (ts.isIndexedAccessTypeNode(accessNode) ? accessNode.indexType : accessNode);
60554
60571
  addDeprecatedSuggestion(deprecatedNode, prop.declarations, propName);
60555
60572
  }
@@ -61812,7 +61829,9 @@ var ts;
61812
61829
  return result;
61813
61830
  }
61814
61831
  function getObjectTypeInstantiation(type, mapper, aliasSymbol, aliasTypeArguments) {
61815
- var declaration = type.objectFlags & 4 /* Reference */ ? type.node : type.symbol.declarations[0];
61832
+ var declaration = type.objectFlags & 4 /* Reference */ ? type.node :
61833
+ type.objectFlags & 16777216 /* InstantiationExpressionType */ ? type.node :
61834
+ type.symbol.declarations[0];
61816
61835
  var links = getNodeLinks(declaration);
61817
61836
  var target = type.objectFlags & 4 /* Reference */ ? links.resolvedType :
61818
61837
  type.objectFlags & 64 /* Instantiated */ ? type.target : type;
@@ -61828,8 +61847,8 @@ var ts;
61828
61847
  outerTypeParameters = ts.addRange(outerTypeParameters, templateTagParameters);
61829
61848
  }
61830
61849
  typeParameters = outerTypeParameters || ts.emptyArray;
61831
- var allDeclarations_1 = type.objectFlags & 4 /* Reference */ ? [declaration] : type.symbol.declarations;
61832
- typeParameters = (target.objectFlags & 4 /* Reference */ || target.symbol.flags & 8192 /* Method */ || target.symbol.flags & 2048 /* TypeLiteral */) && !target.aliasTypeArguments ?
61850
+ var allDeclarations_1 = type.objectFlags & (4 /* Reference */ | 16777216 /* InstantiationExpressionType */) ? [declaration] : type.symbol.declarations;
61851
+ typeParameters = (target.objectFlags & (4 /* Reference */ | 16777216 /* InstantiationExpressionType */) || target.symbol.flags & 8192 /* Method */ || target.symbol.flags & 2048 /* TypeLiteral */) && !target.aliasTypeArguments ?
61833
61852
  ts.filter(typeParameters, function (tp) { return ts.some(allDeclarations_1, function (d) { return isTypeParameterPossiblyReferenced(tp, d); }); }) :
61834
61853
  typeParameters;
61835
61854
  links.outerTypeParameters = typeParameters;
@@ -62001,6 +62020,9 @@ var ts;
62001
62020
  mapper = combineTypeMappers(makeUnaryTypeMapper(origTypeParameter, freshTypeParameter), mapper);
62002
62021
  freshTypeParameter.mapper = mapper;
62003
62022
  }
62023
+ if (type.objectFlags & 16777216 /* InstantiationExpressionType */) {
62024
+ result.node = type.node;
62025
+ }
62004
62026
  result.target = type;
62005
62027
  result.mapper = mapper;
62006
62028
  result.aliasSymbol = aliasSymbol || type.aliasSymbol;
@@ -65175,8 +65197,8 @@ var ts;
65175
65197
  var indexInfos = getIndexInfosOfType(target);
65176
65198
  var targetHasStringIndex = ts.some(indexInfos, function (info) { return info.keyType === stringType; });
65177
65199
  var result = -1 /* True */;
65178
- for (var _i = 0, indexInfos_3 = indexInfos; _i < indexInfos_3.length; _i++) {
65179
- var targetInfo = indexInfos_3[_i];
65200
+ for (var _i = 0, indexInfos_5 = indexInfos; _i < indexInfos_5.length; _i++) {
65201
+ var targetInfo = indexInfos_5[_i];
65180
65202
  var related = !sourceIsPrimitive && targetHasStringIndex && targetInfo.type.flags & 1 /* Any */ ? -1 /* True */ :
65181
65203
  isGenericMappedType(source) && targetHasStringIndex ? isRelatedTo(getTemplateTypeFromMappedType(source), targetInfo.type, 3 /* Both */, reportErrors) :
65182
65204
  typeRelatedToIndexInfo(source, targetInfo, reportErrors, intersectionState);
@@ -65783,10 +65805,10 @@ var ts;
65783
65805
  if (!(ts.getObjectFlags(type) & 4 /* Reference */) || !(ts.getObjectFlags(type.target) & 3 /* ClassOrInterface */)) {
65784
65806
  return undefined;
65785
65807
  }
65786
- if (ts.getObjectFlags(type) & 33554432 /* IdenticalBaseTypeCalculated */) {
65787
- return ts.getObjectFlags(type) & 67108864 /* IdenticalBaseTypeExists */ ? type.cachedEquivalentBaseType : undefined;
65808
+ if (ts.getObjectFlags(type) & 67108864 /* IdenticalBaseTypeCalculated */) {
65809
+ return ts.getObjectFlags(type) & 134217728 /* IdenticalBaseTypeExists */ ? type.cachedEquivalentBaseType : undefined;
65788
65810
  }
65789
- type.objectFlags |= 33554432 /* IdenticalBaseTypeCalculated */;
65811
+ type.objectFlags |= 67108864 /* IdenticalBaseTypeCalculated */;
65790
65812
  var target = type.target;
65791
65813
  if (ts.getObjectFlags(target) & 1 /* Class */) {
65792
65814
  var baseTypeNode = getBaseTypeNodeOfClass(target);
@@ -65807,7 +65829,7 @@ var ts;
65807
65829
  if (ts.length(getTypeArguments(type)) > ts.length(target.typeParameters)) {
65808
65830
  instantiatedBase = getTypeWithThisArgument(instantiatedBase, ts.last(getTypeArguments(type)));
65809
65831
  }
65810
- type.objectFlags |= 67108864 /* IdenticalBaseTypeExists */;
65832
+ type.objectFlags |= 134217728 /* IdenticalBaseTypeExists */;
65811
65833
  return type.cachedEquivalentBaseType = instantiatedBase;
65812
65834
  }
65813
65835
  function isEmptyLiteralType(type) {
@@ -66471,7 +66493,7 @@ var ts;
66471
66493
  var result = !!(type.flags & 465829888 /* Instantiable */ ||
66472
66494
  type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || ts.forEach(getTypeArguments(type), couldContainTypeVariables)) ||
66473
66495
  objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations ||
66474
- objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 8388608 /* ObjectRestType */)) ||
66496
+ objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 8388608 /* ObjectRestType */ | 16777216 /* InstantiationExpressionType */)) ||
66475
66497
  type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && ts.some(type.types, couldContainTypeVariables));
66476
66498
  if (type.flags & 3899393 /* ObjectFlagsType */) {
66477
66499
  type.objectFlags |= 1048576 /* CouldContainTypeVariablesComputed */ | (result ? 2097152 /* CouldContainTypeVariables */ : 0);
@@ -67388,8 +67410,8 @@ var ts;
67388
67410
  var priority = (ts.getObjectFlags(source) & ts.getObjectFlags(target) & 32 /* Mapped */) ? 8 /* HomomorphicMappedType */ : 0;
67389
67411
  var indexInfos = getIndexInfosOfType(target);
67390
67412
  if (isObjectTypeWithInferableIndex(source)) {
67391
- for (var _i = 0, indexInfos_4 = indexInfos; _i < indexInfos_4.length; _i++) {
67392
- var targetInfo = indexInfos_4[_i];
67413
+ for (var _i = 0, indexInfos_6 = indexInfos; _i < indexInfos_6.length; _i++) {
67414
+ var targetInfo = indexInfos_6[_i];
67393
67415
  var propTypes = [];
67394
67416
  for (var _a = 0, _b = getPropertiesOfType(source); _a < _b.length; _a++) {
67395
67417
  var prop = _b[_a];
@@ -67409,8 +67431,8 @@ var ts;
67409
67431
  }
67410
67432
  }
67411
67433
  }
67412
- for (var _e = 0, indexInfos_5 = indexInfos; _e < indexInfos_5.length; _e++) {
67413
- var targetInfo = indexInfos_5[_e];
67434
+ for (var _e = 0, indexInfos_7 = indexInfos; _e < indexInfos_7.length; _e++) {
67435
+ var targetInfo = indexInfos_7[_e];
67414
67436
  var sourceInfo = getApplicableIndexInfo(source, targetInfo.keyType);
67415
67437
  if (sourceInfo) {
67416
67438
  inferWithPriority(sourceInfo.type, targetInfo.type, priority);
@@ -69952,9 +69974,9 @@ var ts;
69952
69974
  markAliasReferenced(symbol, node);
69953
69975
  }
69954
69976
  var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
69955
- var sourceSymbol = localOrExportSymbol.flags & 2097152 /* Alias */ ? resolveAlias(localOrExportSymbol) : localOrExportSymbol;
69956
- if (sourceSymbol.declarations && getDeclarationNodeFlagsFromSymbol(sourceSymbol) & 134217728 /* Deprecated */ && isUncalledFunctionReference(node, sourceSymbol)) {
69957
- addDeprecatedSuggestion(node, sourceSymbol.declarations, node.escapedText);
69977
+ var targetSymbol = checkDeprecatedAliasedSymbol(localOrExportSymbol, node);
69978
+ if (isDeprecatedSymbol(targetSymbol) && isUncalledFunctionReference(node, targetSymbol) && targetSymbol.declarations) {
69979
+ addDeprecatedSuggestion(node, targetSymbol.declarations, node.escapedText);
69958
69980
  }
69959
69981
  var declaration = localOrExportSymbol.valueDeclaration;
69960
69982
  if (declaration && localOrExportSymbol.flags & 32 /* Class */) {
@@ -72966,7 +72988,7 @@ var ts;
72966
72988
  }
72967
72989
  }
72968
72990
  else {
72969
- if (prop.declarations && getDeclarationNodeFlagsFromSymbol(prop) & 134217728 /* Deprecated */ && isUncalledFunctionReference(node, prop)) {
72991
+ if (isDeprecatedSymbol(prop) && isUncalledFunctionReference(node, prop) && prop.declarations) {
72970
72992
  addDeprecatedSuggestion(right, prop.declarations, right.escapedText);
72971
72993
  }
72972
72994
  checkPropertyNotUsedBeforeDeclaration(prop, node, right);
@@ -74425,7 +74447,7 @@ var ts;
74425
74447
  }
74426
74448
  var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
74427
74449
  ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
74428
- 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);
74450
+ var chain = ts.chainDiagnosticMessages(ts.map(diags_3, ts.createDiagnosticMessageChainFromDiagnostic), ts.Diagnostics.No_overload_matches_this_call);
74429
74451
  // 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
74430
74452
  // arrays and the emptyArray singleton where possible, which is decidedly not what we want while we're still constructing this diagnostic
74431
74453
  var related = __spreadArray([], ts.flatMap(diags_3, function (d) { return d.relatedInformation; }), true);
@@ -75580,6 +75602,66 @@ var ts;
75580
75602
  return node.flags & 32 /* OptionalChain */ ? checkNonNullChain(node) :
75581
75603
  getNonNullableType(checkExpression(node.expression));
75582
75604
  }
75605
+ function checkExpressionWithTypeArguments(node) {
75606
+ checkGrammarExpressionWithTypeArguments(node);
75607
+ var exprType = node.kind === 227 /* ExpressionWithTypeArguments */ ? checkExpression(node.expression) :
75608
+ ts.isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) :
75609
+ checkExpression(node.exprName);
75610
+ var typeArguments = node.typeArguments;
75611
+ if (!ts.some(typeArguments)) {
75612
+ return exprType;
75613
+ }
75614
+ var funcType = getApparentType(exprType);
75615
+ if (funcType === silentNeverType || isErrorType(funcType)) {
75616
+ return funcType;
75617
+ }
75618
+ var hasSomeApplicableSignature = false;
75619
+ var nonApplicableType;
75620
+ var hasSignatures;
75621
+ var hasApplicableSignature;
75622
+ var result = mapType(funcType, getInstantiatedType);
75623
+ var errorType = hasSomeApplicableSignature ? nonApplicableType : funcType;
75624
+ if (errorType) {
75625
+ 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)));
75626
+ }
75627
+ return result;
75628
+ function getInstantiatedType(type) {
75629
+ hasSignatures = false;
75630
+ hasApplicableSignature = false;
75631
+ var result = getInstantiatedTypeWorker(type);
75632
+ hasSomeApplicableSignature || (hasSomeApplicableSignature = hasApplicableSignature);
75633
+ if (hasSignatures && !hasApplicableSignature) {
75634
+ nonApplicableType !== null && nonApplicableType !== void 0 ? nonApplicableType : (nonApplicableType = type);
75635
+ }
75636
+ return result;
75637
+ }
75638
+ function getInstantiatedTypeWorker(type) {
75639
+ if (type.flags & 524288 /* Object */) {
75640
+ var resolved = resolveStructuredTypeMembers(type);
75641
+ var callSignatures = getInstantiatedSignatures(resolved.callSignatures);
75642
+ var constructSignatures = getInstantiatedSignatures(resolved.constructSignatures);
75643
+ hasSignatures || (hasSignatures = resolved.callSignatures.length !== 0 || resolved.constructSignatures.length !== 0);
75644
+ hasApplicableSignature || (hasApplicableSignature = callSignatures.length !== 0 || constructSignatures.length !== 0);
75645
+ if (callSignatures !== resolved.callSignatures || constructSignatures !== resolved.constructSignatures) {
75646
+ var result_11 = createAnonymousType(undefined, resolved.members, callSignatures, constructSignatures, resolved.indexInfos);
75647
+ result_11.objectFlags |= 16777216 /* InstantiationExpressionType */;
75648
+ result_11.node = node;
75649
+ return result_11;
75650
+ }
75651
+ }
75652
+ else if (type.flags & 2097152 /* Intersection */) {
75653
+ return getIntersectionType(ts.sameMap(type.types, getInstantiatedTypeWorker));
75654
+ }
75655
+ return type;
75656
+ }
75657
+ function getInstantiatedSignatures(signatures) {
75658
+ var applicableSignatures = ts.filter(signatures, function (sig) { return !!sig.typeParameters && hasCorrectTypeArgumentArity(sig, typeArguments); });
75659
+ return ts.sameMap(applicableSignatures, function (sig) {
75660
+ var typeArgumentTypes = checkTypeArguments(sig, typeArguments, /*reportErrors*/ true);
75661
+ return typeArgumentTypes ? getSignatureInstantiation(sig, typeArgumentTypes, ts.isInJSFile(sig.declaration)) : sig;
75662
+ });
75663
+ }
75664
+ }
75583
75665
  function checkMetaProperty(node) {
75584
75666
  checkGrammarMetaProperty(node);
75585
75667
  if (node.keywordToken === 103 /* NewKeyword */) {
@@ -78089,6 +78171,8 @@ var ts;
78089
78171
  return checkAssertion(node);
78090
78172
  case 229 /* NonNullExpression */:
78091
78173
  return checkNonNullAssertion(node);
78174
+ case 227 /* ExpressionWithTypeArguments */:
78175
+ return checkExpressionWithTypeArguments(node);
78092
78176
  case 230 /* MetaProperty */:
78093
78177
  return checkMetaProperty(node);
78094
78178
  case 214 /* DeleteExpression */:
@@ -79294,12 +79378,12 @@ var ts;
79294
79378
  case 264 /* ImportEqualsDeclaration */:
79295
79379
  case 267 /* NamespaceImport */:
79296
79380
  case 266 /* ImportClause */:
79297
- var result_11 = 0 /* None */;
79381
+ var result_12 = 0 /* None */;
79298
79382
  var target = resolveAlias(getSymbolOfNode(d));
79299
79383
  ts.forEach(target.declarations, function (d) {
79300
- result_11 |= getDeclarationSpaces(d);
79384
+ result_12 |= getDeclarationSpaces(d);
79301
79385
  });
79302
- return result_11;
79386
+ return result_12;
79303
79387
  case 253 /* VariableDeclaration */:
79304
79388
  case 202 /* BindingElement */:
79305
79389
  case 255 /* FunctionDeclaration */:
@@ -81886,8 +81970,8 @@ var ts;
81886
81970
  }
81887
81971
  }
81888
81972
  if (indexInfos.length > 1) {
81889
- for (var _d = 0, indexInfos_6 = indexInfos; _d < indexInfos_6.length; _d++) {
81890
- var info = indexInfos_6[_d];
81973
+ for (var _d = 0, indexInfos_8 = indexInfos; _d < indexInfos_8.length; _d++) {
81974
+ var info = indexInfos_8[_d];
81891
81975
  checkIndexConstraintForIndexSignature(type, info);
81892
81976
  }
81893
81977
  }
@@ -81913,8 +81997,8 @@ var ts;
81913
81997
  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));
81914
81998
  }
81915
81999
  };
81916
- for (var _i = 0, indexInfos_7 = indexInfos; _i < indexInfos_7.length; _i++) {
81917
- var info = indexInfos_7[_i];
82000
+ for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
82001
+ var info = indexInfos_9[_i];
81918
82002
  _loop_27(info);
81919
82003
  }
81920
82004
  }
@@ -81936,8 +82020,8 @@ var ts;
81936
82020
  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));
81937
82021
  }
81938
82022
  };
81939
- for (var _i = 0, indexInfos_8 = indexInfos; _i < indexInfos_8.length; _i++) {
81940
- var info = indexInfos_8[_i];
82023
+ for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
82024
+ var info = indexInfos_10[_i];
81941
82025
  _loop_28(info);
81942
82026
  }
81943
82027
  }
@@ -82804,16 +82888,15 @@ var ts;
82804
82888
  return ts.nodeIsMissing(expr) ? 0 : evaluateEnumMember(expr, getSymbolOfNode(member.parent), identifier.escapedText);
82805
82889
  case 206 /* ElementAccessExpression */:
82806
82890
  case 205 /* PropertyAccessExpression */:
82807
- var ex = expr;
82808
- if (isConstantMemberAccess(ex)) {
82809
- var type = getTypeOfExpression(ex.expression);
82891
+ if (isConstantMemberAccess(expr)) {
82892
+ var type = getTypeOfExpression(expr.expression);
82810
82893
  if (type.symbol && type.symbol.flags & 384 /* Enum */) {
82811
82894
  var name = void 0;
82812
- if (ex.kind === 205 /* PropertyAccessExpression */) {
82813
- name = ex.name.escapedText;
82895
+ if (expr.kind === 205 /* PropertyAccessExpression */) {
82896
+ name = expr.name.escapedText;
82814
82897
  }
82815
82898
  else {
82816
- name = ts.escapeLeadingUnderscores(ts.cast(ex.argumentExpression, ts.isLiteralExpression).text);
82899
+ name = ts.escapeLeadingUnderscores(ts.cast(expr.argumentExpression, ts.isLiteralExpression).text);
82817
82900
  }
82818
82901
  return evaluateEnumMember(expr, type.symbol, name);
82819
82902
  }
@@ -82841,6 +82924,10 @@ var ts;
82841
82924
  }
82842
82925
  }
82843
82926
  function isConstantMemberAccess(node) {
82927
+ var type = getTypeOfExpression(node);
82928
+ if (type === errorType) {
82929
+ return false;
82930
+ }
82844
82931
  return node.kind === 79 /* Identifier */ ||
82845
82932
  node.kind === 205 /* PropertyAccessExpression */ && isConstantMemberAccess(node.expression) ||
82846
82933
  node.kind === 206 /* ElementAccessExpression */ && isConstantMemberAccess(node.expression) &&
@@ -83135,7 +83222,6 @@ var ts;
83135
83222
  return true;
83136
83223
  }
83137
83224
  function checkAliasSymbol(node) {
83138
- var _a;
83139
83225
  var symbol = getSymbolOfNode(node);
83140
83226
  var target = resolveAlias(symbol);
83141
83227
  if (target !== unknownSymbol) {
@@ -83191,10 +83277,45 @@ var ts;
83191
83277
  }
83192
83278
  }
83193
83279
  }
83194
- if (ts.isImportSpecifier(node) && ((_a = target.declarations) === null || _a === void 0 ? void 0 : _a.every(function (d) { return !!(ts.getCombinedNodeFlags(d) & 134217728 /* Deprecated */); }))) {
83195
- addDeprecatedSuggestion(node.name, target.declarations, symbol.escapedName);
83280
+ if (ts.isImportSpecifier(node)) {
83281
+ var targetSymbol = checkDeprecatedAliasedSymbol(symbol, node);
83282
+ if (isDeprecatedAliasedSymbol(targetSymbol) && targetSymbol.declarations) {
83283
+ addDeprecatedSuggestion(node, targetSymbol.declarations, targetSymbol.escapedName);
83284
+ }
83285
+ }
83286
+ }
83287
+ }
83288
+ function isDeprecatedAliasedSymbol(symbol) {
83289
+ return !!symbol.declarations && ts.every(symbol.declarations, function (d) { return !!(ts.getCombinedNodeFlags(d) & 134217728 /* Deprecated */); });
83290
+ }
83291
+ function checkDeprecatedAliasedSymbol(symbol, location) {
83292
+ if (!(symbol.flags & 2097152 /* Alias */))
83293
+ return symbol;
83294
+ var targetSymbol = resolveAlias(symbol);
83295
+ if (targetSymbol === unknownSymbol)
83296
+ return targetSymbol;
83297
+ while (symbol.flags & 2097152 /* Alias */) {
83298
+ var target = getImmediateAliasedSymbol(symbol);
83299
+ if (target) {
83300
+ if (target === targetSymbol)
83301
+ break;
83302
+ if (target.declarations && ts.length(target.declarations)) {
83303
+ if (isDeprecatedAliasedSymbol(target)) {
83304
+ addDeprecatedSuggestion(location, target.declarations, target.escapedName);
83305
+ break;
83306
+ }
83307
+ else {
83308
+ if (symbol === targetSymbol)
83309
+ break;
83310
+ symbol = target;
83311
+ }
83312
+ }
83313
+ }
83314
+ else {
83315
+ break;
83196
83316
  }
83197
83317
  }
83318
+ return targetSymbol;
83198
83319
  }
83199
83320
  function checkImportBinding(node) {
83200
83321
  checkCollisionsForDeclarationName(node, node.name);
@@ -87496,7 +87617,7 @@ var ts;
87496
87617
  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));
87497
87618
  case 180 /* TypeQuery */:
87498
87619
  ts.Debug.type(node);
87499
- return factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName));
87620
+ return factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode));
87500
87621
  case 181 /* TypeLiteral */:
87501
87622
  ts.Debug.type(node);
87502
87623
  return factory.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor, ts.isTypeElement));
@@ -90388,8 +90509,8 @@ var ts;
90388
90509
  function generateClassElementDecorationExpressions(node, isStatic) {
90389
90510
  var members = getDecoratedClassElements(node, isStatic);
90390
90511
  var expressions;
90391
- for (var _i = 0, members_6 = members; _i < members_6.length; _i++) {
90392
- var member = members_6[_i];
90512
+ for (var _i = 0, members_8 = members; _i < members_8.length; _i++) {
90513
+ var member = members_8[_i];
90393
90514
  var expression = generateClassElementDecorationExpression(node, member);
90394
90515
  if (expression) {
90395
90516
  if (!expressions) {
@@ -95590,8 +95711,8 @@ var ts;
95590
95711
  function convertJsxChildrenToChildrenPropAssignment(children) {
95591
95712
  var nonWhitespaceChildren = ts.getSemanticJsxChildren(children);
95592
95713
  if (ts.length(nonWhitespaceChildren) === 1 && !nonWhitespaceChildren[0].dotDotDotToken) {
95593
- var result_12 = transformJsxChildToExpression(nonWhitespaceChildren[0]);
95594
- return result_12 && factory.createPropertyAssignment("children", result_12);
95714
+ var result_13 = transformJsxChildToExpression(nonWhitespaceChildren[0]);
95715
+ return result_13 && factory.createPropertyAssignment("children", result_13);
95595
95716
  }
95596
95717
  var result = ts.mapDefined(children, transformJsxChildToExpression);
95597
95718
  return ts.length(result) ? factory.createPropertyAssignment("children", factory.createArrayLiteralExpression(result)) : undefined;
@@ -109220,6 +109341,8 @@ var ts;
109220
109341
  return emitAsExpression(node);
109221
109342
  case 229 /* NonNullExpression */:
109222
109343
  return emitNonNullExpression(node);
109344
+ case 227 /* ExpressionWithTypeArguments */:
109345
+ return emitExpressionWithTypeArguments(node);
109223
109346
  case 230 /* MetaProperty */:
109224
109347
  return emitMetaProperty(node);
109225
109348
  case 231 /* SyntheticExpression */:
@@ -109664,6 +109787,7 @@ var ts;
109664
109787
  writeKeyword("typeof");
109665
109788
  writeSpace();
109666
109789
  emit(node.exprName);
109790
+ emitTypeArguments(node, node.typeArguments);
109667
109791
  }
109668
109792
  function emitTypeLiteral(node) {
109669
109793
  writePunctuation("{");
@@ -114623,15 +114747,15 @@ var ts;
114623
114747
  // which per above occurred during the current program creation.
114624
114748
  // Since we assume the filesystem does not change during program creation,
114625
114749
  // it is safe to reuse resolutions from the earlier call.
114626
- var result_13 = [];
114750
+ var result_14 = [];
114627
114751
  var i = 0;
114628
114752
  for (var _i = 0, moduleNames_1 = moduleNames; _i < moduleNames_1.length; _i++) {
114629
114753
  var moduleName = moduleNames_1[_i];
114630
114754
  var resolvedModule = file.resolvedModules.get(moduleName, getModeForResolutionAtIndex(file, i));
114631
114755
  i++;
114632
- result_13.push(resolvedModule);
114756
+ result_14.push(resolvedModule);
114633
114757
  }
114634
- return result_13;
114758
+ return result_14;
114635
114759
  }
114636
114760
  // At this point, we know at least one of the following hold:
114637
114761
  // - file has local declarations for ambient modules
@@ -115853,14 +115977,14 @@ var ts;
115853
115977
  redirectTargetsMap.add(fileFromPackageId.path, fileName);
115854
115978
  addFileToFilesByName(dupFile, path, redirectedPath);
115855
115979
  addFileIncludeReason(dupFile, reason);
115856
- sourceFileToPackageName.set(path, packageId.name);
115980
+ sourceFileToPackageName.set(path, ts.packageIdToPackageName(packageId));
115857
115981
  processingOtherFiles.push(dupFile);
115858
115982
  return dupFile;
115859
115983
  }
115860
115984
  else if (file) {
115861
115985
  // This is the first source file to have this packageId.
115862
115986
  packageIdToSourceFile.set(packageIdKey, file);
115863
- sourceFileToPackageName.set(path, packageId.name);
115987
+ sourceFileToPackageName.set(path, ts.packageIdToPackageName(packageId));
115864
115988
  }
115865
115989
  }
115866
115990
  addFileToFilesByName(file, path, redirectedPath);
@@ -119739,9 +119863,9 @@ var ts;
119739
119863
  if (!preferSymlinks) {
119740
119864
  // Symlinks inside ignored paths are already filtered out of the symlink cache,
119741
119865
  // so we only need to remove them from the realpath filenames.
119742
- var result_14 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
119743
- if (result_14)
119744
- return result_14;
119866
+ var result_15 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
119867
+ if (result_15)
119868
+ return result_15;
119745
119869
  }
119746
119870
  var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
119747
119871
  var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
@@ -119761,10 +119885,10 @@ var ts;
119761
119885
  for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
119762
119886
  var symlinkDirectory = symlinkDirectories_1[_i];
119763
119887
  var option = ts.resolvePath(symlinkDirectory, relative);
119764
- var result_15 = cb(option, target === referenceRedirect);
119888
+ var result_16 = cb(option, target === referenceRedirect);
119765
119889
  shouldFilterIgnoredPaths = true; // We found a non-ignored path in symlinks, so we can reject ignored-path realpaths
119766
- if (result_15)
119767
- return result_15;
119890
+ if (result_16)
119891
+ return result_16;
119768
119892
  }
119769
119893
  });
119770
119894
  });
@@ -123657,7 +123781,7 @@ var ts;
123657
123781
  case 199 /* ImportType */:
123658
123782
  return !node.parent.isTypeOf;
123659
123783
  case 227 /* ExpressionWithTypeArguments */:
123660
- return !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent);
123784
+ return ts.isPartOfTypeNode(node.parent);
123661
123785
  }
123662
123786
  return false;
123663
123787
  }
@@ -126520,11 +126644,11 @@ var ts;
126520
126644
  return ts.isArray(valueOrArray) ? ts.first(valueOrArray) : valueOrArray;
126521
126645
  }
126522
126646
  ts.firstOrOnly = firstOrOnly;
126523
- function getNameForExportedSymbol(symbol, scriptTarget) {
126647
+ function getNameForExportedSymbol(symbol, scriptTarget, preferCapitalized) {
126524
126648
  if (!(symbol.flags & 33554432 /* Transient */) && (symbol.escapedName === "export=" /* ExportEquals */ || symbol.escapedName === "default" /* Default */)) {
126525
126649
  // Name of "export default foo;" is "foo". Name of "export default 0" is the filename converted to camelCase.
126526
126650
  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; })
126527
- || ts.codefix.moduleSymbolToValidIdentifier(getSymbolParentOrFail(symbol), scriptTarget);
126651
+ || ts.codefix.moduleSymbolToValidIdentifier(getSymbolParentOrFail(symbol), scriptTarget, !!preferCapitalized);
126528
126652
  }
126529
126653
  return symbol.name;
126530
126654
  }
@@ -126652,7 +126776,7 @@ var ts;
126652
126776
  symbols.clear();
126653
126777
  usableByFileName = undefined;
126654
126778
  },
126655
- add: function (importingFile, symbol, symbolTableKey, moduleSymbol, moduleFile, exportKind, isFromPackageJson, scriptTarget, checker) {
126779
+ add: function (importingFile, symbol, symbolTableKey, moduleSymbol, moduleFile, exportKind, isFromPackageJson, checker) {
126656
126780
  if (importingFile !== usableByFileName) {
126657
126781
  cache.clear();
126658
126782
  usableByFileName = importingFile;
@@ -126668,7 +126792,7 @@ var ts;
126668
126792
  // get a better name.
126669
126793
  var importedName = exportKind === 0 /* Named */ || ts.isExternalModuleSymbol(namedSymbol)
126670
126794
  ? ts.unescapeLeadingUnderscores(symbolTableKey)
126671
- : ts.getNameForExportedSymbol(namedSymbol, scriptTarget);
126795
+ : ts.getNameForExportedSymbol(namedSymbol, /*scriptTarget*/ undefined);
126672
126796
  var moduleName = ts.stripQuotes(moduleSymbol.name);
126673
126797
  var id = exportInfoId++;
126674
126798
  var target = ts.skipAlias(symbol, checker);
@@ -126701,7 +126825,14 @@ var ts;
126701
126825
  return;
126702
126826
  exportInfo.forEach(function (info, key) {
126703
126827
  var _a = parseKey(key), symbolName = _a.symbolName, ambientModuleName = _a.ambientModuleName;
126704
- action(info.map(rehydrateCachedInfo), symbolName, !!ambientModuleName, key);
126828
+ var rehydrated = info.map(rehydrateCachedInfo);
126829
+ action(rehydrated, function (preferCapitalized) {
126830
+ var _a = rehydrated[0], symbol = _a.symbol, exportKind = _a.exportKind;
126831
+ var namedSymbol = exportKind === 1 /* Default */ && ts.getLocalSymbolForExportDefault(symbol) || symbol;
126832
+ return preferCapitalized
126833
+ ? ts.getNameForExportedSymbol(namedSymbol, /*scriptTarget*/ undefined, /*preferCapitalized*/ true)
126834
+ : symbolName;
126835
+ }, !!ambientModuleName, key);
126705
126836
  });
126706
126837
  },
126707
126838
  releaseSymbols: function () {
@@ -126883,7 +127014,6 @@ var ts;
126883
127014
  }
126884
127015
  (_d = host.log) === null || _d === void 0 ? void 0 : _d.call(host, "getExportInfoMap: cache miss or empty; calculating new results");
126885
127016
  var compilerOptions = program.getCompilerOptions();
126886
- var scriptTarget = ts.getEmitScriptTarget(compilerOptions);
126887
127017
  var moduleCount = 0;
126888
127018
  forEachExternalModuleToImportFrom(program, host, /*useAutoImportProvider*/ true, function (moduleSymbol, moduleFile, program, isFromPackageJson) {
126889
127019
  if (++moduleCount % 100 === 0)
@@ -126894,11 +127024,11 @@ var ts;
126894
127024
  // Note: I think we shouldn't actually see resolved module symbols here, but weird merges
126895
127025
  // can cause it to happen: see 'completionsImport_mergedReExport.ts'
126896
127026
  if (defaultInfo && isImportableSymbol(defaultInfo.symbol, checker)) {
126897
- cache.add(importingFile.path, defaultInfo.symbol, defaultInfo.exportKind === 1 /* Default */ ? "default" /* Default */ : "export=" /* ExportEquals */, moduleSymbol, moduleFile, defaultInfo.exportKind, isFromPackageJson, scriptTarget, checker);
127027
+ cache.add(importingFile.path, defaultInfo.symbol, defaultInfo.exportKind === 1 /* Default */ ? "default" /* Default */ : "export=" /* ExportEquals */, moduleSymbol, moduleFile, defaultInfo.exportKind, isFromPackageJson, checker);
126898
127028
  }
126899
127029
  checker.forEachExportAndPropertyOfModule(moduleSymbol, function (exported, key) {
126900
127030
  if (exported !== (defaultInfo === null || defaultInfo === void 0 ? void 0 : defaultInfo.symbol) && isImportableSymbol(exported, checker) && ts.addToSeen(seenExports, key)) {
126901
- cache.add(importingFile.path, exported, key, moduleSymbol, moduleFile, 0 /* Named */, isFromPackageJson, scriptTarget, checker);
127031
+ cache.add(importingFile.path, exported, key, moduleSymbol, moduleFile, 0 /* Named */, isFromPackageJson, checker);
126902
127032
  }
126903
127033
  });
126904
127034
  });
@@ -128972,6 +129102,8 @@ var ts;
128972
129102
  CompletionSource["ThisProperty"] = "ThisProperty/";
128973
129103
  /** Auto-import that comes attached to a class member snippet */
128974
129104
  CompletionSource["ClassMemberSnippet"] = "ClassMemberSnippet/";
129105
+ /** A type-only import that needs to be promoted in order to be used at the completion location */
129106
+ CompletionSource["TypeOnlyAlias"] = "TypeOnlyAlias/";
128975
129107
  })(CompletionSource = Completions.CompletionSource || (Completions.CompletionSource = {}));
128976
129108
  var SymbolOriginInfoKind;
128977
129109
  (function (SymbolOriginInfoKind) {
@@ -128981,6 +129113,7 @@ var ts;
128981
129113
  SymbolOriginInfoKind[SymbolOriginInfoKind["Promise"] = 8] = "Promise";
128982
129114
  SymbolOriginInfoKind[SymbolOriginInfoKind["Nullable"] = 16] = "Nullable";
128983
129115
  SymbolOriginInfoKind[SymbolOriginInfoKind["ResolvedExport"] = 32] = "ResolvedExport";
129116
+ SymbolOriginInfoKind[SymbolOriginInfoKind["TypeOnlyAlias"] = 64] = "TypeOnlyAlias";
128984
129117
  SymbolOriginInfoKind[SymbolOriginInfoKind["SymbolMemberNoExport"] = 2] = "SymbolMemberNoExport";
128985
129118
  SymbolOriginInfoKind[SymbolOriginInfoKind["SymbolMemberExport"] = 6] = "SymbolMemberExport";
128986
129119
  })(SymbolOriginInfoKind || (SymbolOriginInfoKind = {}));
@@ -129008,6 +129141,9 @@ var ts;
129008
129141
  function originIsNullableMember(origin) {
129009
129142
  return !!(origin.kind & 16 /* Nullable */);
129010
129143
  }
129144
+ function originIsTypeOnlyAlias(origin) {
129145
+ return !!(origin && origin.kind & 64 /* TypeOnlyAlias */);
129146
+ }
129011
129147
  var KeywordCompletionFilters;
129012
129148
  (function (KeywordCompletionFilters) {
129013
129149
  KeywordCompletionFilters[KeywordCompletionFilters["None"] = 0] = "None";
@@ -129412,6 +129548,9 @@ var ts;
129412
129548
  isSnippet = preferences.includeCompletionsWithSnippetText ? true : undefined;
129413
129549
  }
129414
129550
  }
129551
+ if ((origin === null || origin === void 0 ? void 0 : origin.kind) === 64 /* TypeOnlyAlias */) {
129552
+ hasAction = true;
129553
+ }
129415
129554
  if (preferences.includeCompletionsWithClassMemberSnippets &&
129416
129555
  preferences.includeCompletionsWithInsertText &&
129417
129556
  completionKind === 3 /* MemberLike */ &&
@@ -129756,6 +129895,9 @@ var ts;
129756
129895
  if ((origin === null || origin === void 0 ? void 0 : origin.kind) === 1 /* ThisType */) {
129757
129896
  return CompletionSource.ThisProperty;
129758
129897
  }
129898
+ if ((origin === null || origin === void 0 ? void 0 : origin.kind) === 64 /* TypeOnlyAlias */) {
129899
+ return CompletionSource.TypeOnlyAlias;
129900
+ }
129759
129901
  }
129760
129902
  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) {
129761
129903
  var _a;
@@ -129783,7 +129925,7 @@ var ts;
129783
129925
  continue;
129784
129926
  }
129785
129927
  /** True for locals; false for globals, module exports from other files, `this.` completions. */
129786
- var shouldShadowLaterSymbols = !origin && !(symbol.parent === undefined && !ts.some(symbol.declarations, function (d) { return d.getSourceFile() === location.getSourceFile(); }));
129928
+ var shouldShadowLaterSymbols = (!origin || originIsTypeOnlyAlias(origin)) && !(symbol.parent === undefined && !ts.some(symbol.declarations, function (d) { return d.getSourceFile() === location.getSourceFile(); }));
129787
129929
  uniques.set(name, shouldShadowLaterSymbols);
129788
129930
  ts.insertSorted(entries, entry, compareCompletionEntries, /*allowDuplicates*/ true);
129789
129931
  }
@@ -129796,6 +129938,7 @@ var ts;
129796
129938
  add: function (name) { return uniques.set(name, true); },
129797
129939
  };
129798
129940
  function shouldIncludeSymbol(symbol, symbolToSortTextIdMap) {
129941
+ var allFlags = symbol.flags;
129799
129942
  if (!ts.isSourceFile(location)) {
129800
129943
  // export = /**/ here we want to get all meanings, so any symbol is ok
129801
129944
  if (ts.isExportAssignment(location.parent)) {
@@ -129821,11 +129964,10 @@ var ts;
129821
129964
  || symbolToSortTextIdMap[ts.getSymbolId(symbolOrigin)] === 11 /* LocationPriority */)) {
129822
129965
  return false;
129823
129966
  }
129824
- // Continue with origin symbol
129825
- symbol = symbolOrigin;
129967
+ allFlags |= ts.getCombinedLocalAndExportSymbolFlags(symbolOrigin);
129826
129968
  // import m = /**/ <-- It can only access namespace (if typing import = x. this would get member symbols and not namespace)
129827
129969
  if (ts.isInRightSideOfInternalImportEqualsDeclaration(location)) {
129828
- return !!(symbol.flags & 1920 /* Namespace */);
129970
+ return !!(allFlags & 1920 /* Namespace */);
129829
129971
  }
129830
129972
  if (isTypeOnlyLocation) {
129831
129973
  // It's a type, but you can reach it by namespace.type as well
@@ -129833,7 +129975,7 @@ var ts;
129833
129975
  }
129834
129976
  }
129835
129977
  // expressions are value space (which includes the value namespaces)
129836
- return !!(ts.getCombinedLocalAndExportSymbolFlags(symbol) & 111551 /* Value */);
129978
+ return !!(allFlags & 111551 /* Value */);
129837
129979
  }
129838
129980
  }
129839
129981
  Completions.getCompletionEntriesFromSymbols = getCompletionEntriesFromSymbols;
@@ -129967,8 +130109,7 @@ var ts;
129967
130109
  Completions.createCompletionDetails = createCompletionDetails;
129968
130110
  function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source) {
129969
130111
  if (data === null || data === void 0 ? void 0 : data.moduleSpecifier) {
129970
- var _a = getRelevantTokens(position, sourceFile), contextToken_3 = _a.contextToken, previousToken_2 = _a.previousToken;
129971
- if (previousToken_2 && getImportStatementCompletionInfo(contextToken_3 || previousToken_2).replacementNode) {
130112
+ if (previousToken && getImportStatementCompletionInfo(contextToken || previousToken).replacementNode) {
129972
130113
  // Import statement completion: 'import c|'
129973
130114
  return { codeActions: undefined, sourceDisplay: [ts.textPart(data.moduleSpecifier)] };
129974
130115
  }
@@ -129986,13 +130127,19 @@ var ts;
129986
130127
  };
129987
130128
  }
129988
130129
  }
130130
+ if (originIsTypeOnlyAlias(origin)) {
130131
+ var codeAction_1 = ts.codefix.getPromoteTypeOnlyCompletionAction(sourceFile, origin.declaration.name, program, host, formatContext, preferences);
130132
+ ts.Debug.assertIsDefined(codeAction_1, "Expected to have a code action for promoting type-only alias");
130133
+ return { codeActions: [codeAction_1], sourceDisplay: undefined };
130134
+ }
129989
130135
  if (!origin || !(originIsExport(origin) || originIsResolvedExport(origin))) {
129990
130136
  return { codeActions: undefined, sourceDisplay: undefined };
129991
130137
  }
129992
130138
  var checker = origin.isFromPackageJson ? host.getPackageJsonAutoImportProvider().getTypeChecker() : program.getTypeChecker();
129993
130139
  var moduleSymbol = origin.moduleSymbol;
129994
130140
  var targetSymbol = checker.getMergedSymbol(ts.skipAlias(symbol.exportSymbol || symbol, checker));
129995
- 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;
130141
+ var isJsxOpeningTagName = (contextToken === null || contextToken === void 0 ? void 0 : contextToken.kind) === 29 /* LessThanToken */ && ts.isJsxOpeningLikeElement(contextToken.parent);
130142
+ 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;
129996
130143
  ts.Debug.assert(!(data === null || data === void 0 ? void 0 : data.moduleSpecifier) || moduleSpecifier === data.moduleSpecifier);
129997
130144
  return { sourceDisplay: [ts.textPart(moduleSpecifier)], codeActions: [codeAction] };
129998
130145
  }
@@ -130662,21 +130809,29 @@ var ts;
130662
130809
  var scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile) || sourceFile;
130663
130810
  isInSnippetScope = isSnippetScope(scopeNode);
130664
130811
  var symbolMeanings = (isTypeOnlyLocation ? 0 /* None */ : 111551 /* Value */) | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */;
130812
+ var typeOnlyAliasNeedsPromotion = previousToken && !ts.isValidTypeOnlyAliasUseSite(previousToken);
130665
130813
  symbols = ts.concatenate(symbols, typeChecker.getSymbolsInScope(scopeNode, symbolMeanings));
130666
130814
  ts.Debug.assertEachIsDefined(symbols, "getSymbolsInScope() should all be defined");
130667
- for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) {
130668
- var symbol = symbols_1[_i];
130815
+ for (var i = 0; i < symbols.length; i++) {
130816
+ var symbol = symbols[i];
130669
130817
  if (!typeChecker.isArgumentsSymbol(symbol) &&
130670
130818
  !ts.some(symbol.declarations, function (d) { return d.getSourceFile() === sourceFile; })) {
130671
130819
  symbolToSortTextIdMap[ts.getSymbolId(symbol)] = 15 /* GlobalsOrKeywords */;
130672
130820
  }
130821
+ if (typeOnlyAliasNeedsPromotion && !(symbol.flags & 111551 /* Value */)) {
130822
+ var typeOnlyAliasDeclaration = symbol.declarations && ts.find(symbol.declarations, ts.isTypeOnlyImportOrExportDeclaration);
130823
+ if (typeOnlyAliasDeclaration) {
130824
+ var origin = { kind: 64 /* TypeOnlyAlias */, declaration: typeOnlyAliasDeclaration };
130825
+ symbolToOriginInfoMap[i] = origin;
130826
+ }
130827
+ }
130673
130828
  }
130674
130829
  // Need to insert 'this.' before properties of `this` type, so only do that if `includeInsertTextCompletions`
130675
130830
  if (preferences.includeCompletionsWithInsertText && scopeNode.kind !== 303 /* SourceFile */) {
130676
130831
  var thisType = typeChecker.tryGetThisTypeAt(scopeNode, /*includeGlobalThis*/ false);
130677
130832
  if (thisType && !isProbablyGlobalType(thisType, sourceFile, typeChecker)) {
130678
- for (var _a = 0, _b = getPropertiesForCompletion(thisType, typeChecker); _a < _b.length; _a++) {
130679
- var symbol = _b[_a];
130833
+ for (var _i = 0, _a = getPropertiesForCompletion(thisType, typeChecker); _i < _a.length; _i++) {
130834
+ var symbol = _a[_i];
130680
130835
  symbolToOriginInfoMap[symbols.length] = { kind: 1 /* ThisType */ };
130681
130836
  symbols.push(symbol);
130682
130837
  symbolToSortTextIdMap[ts.getSymbolId(symbol)] = 14 /* SuggestedClassMembers */;
@@ -130779,7 +130934,8 @@ var ts;
130779
130934
  var packageJsonAutoImportProvider = (_b = host.getPackageJsonAutoImportProvider) === null || _b === void 0 ? void 0 : _b.call(host);
130780
130935
  var packageJsonFilter = detailsEntryId ? undefined : ts.createPackageJsonImportFilter(sourceFile, preferences, host);
130781
130936
  resolvingModuleSpecifiers("collectAutoImports", host, program, sourceFile, preferences, !!importCompletionNode, function (context) {
130782
- exportInfo.forEach(sourceFile.path, function (info, symbolName, isFromAmbientModule, exportMapKey) {
130937
+ exportInfo.forEach(sourceFile.path, function (info, getSymbolName, isFromAmbientModule, exportMapKey) {
130938
+ var symbolName = getSymbolName(/*preferCapitalized*/ isRightOfOpenTag);
130783
130939
  if (!ts.isIdentifierText(symbolName, ts.getEmitScriptTarget(host.getCompilationSettings())))
130784
130940
  return;
130785
130941
  if (!detailsEntryId && ts.isStringANonContextualKeyword(symbolName))
@@ -130789,6 +130945,10 @@ var ts;
130789
130945
  return;
130790
130946
  if (isTypeOnlyLocation && !(info[0].targetFlags & (1536 /* Module */ | 788968 /* Type */)))
130791
130947
  return;
130948
+ // Do not try to auto-import something with a lowercase first letter for a JSX tag
130949
+ var firstChar = symbolName.charCodeAt(0);
130950
+ if (isRightOfOpenTag && (firstChar < 65 /* A */ || firstChar > 90 /* Z */))
130951
+ return;
130792
130952
  var isCompletionDetailsMatch = detailsEntryId && ts.some(info, function (i) { return detailsEntryId.source === ts.stripQuotes(i.moduleSymbol.name); });
130793
130953
  if (isCompletionDetailsMatch || !detailsEntryId && charactersFuzzyMatchInString(symbolName, lowerCaseTokenText)) {
130794
130954
  var defaultExportInfo = ts.find(info, isImportableExportInfo);
@@ -130865,16 +131025,19 @@ var ts;
130865
131025
  return true;
130866
131026
  }
130867
131027
  if (contextToken.kind === 31 /* GreaterThanToken */ && contextToken.parent) {
131028
+ // <Component<string> /**/ />
131029
+ // <Component<string> /**/ ><Component>
131030
+ // - contextToken: GreaterThanToken (before cursor)
131031
+ // - location: JsxSelfClosingElement or JsxOpeningElement
131032
+ // - contextToken.parent === location
131033
+ if (location === contextToken.parent && (location.kind === 279 /* JsxOpeningElement */ || location.kind === 278 /* JsxSelfClosingElement */)) {
131034
+ return false;
131035
+ }
130868
131036
  if (contextToken.parent.kind === 279 /* JsxOpeningElement */) {
130869
- // Two possibilities:
130870
- // 1. <div>/**/
130871
- // - contextToken: GreaterThanToken (before cursor)
130872
- // - location: JSXElement
130873
- // - different parents (JSXOpeningElement, JSXElement)
130874
- // 2. <Component<string> /**/>
130875
- // - contextToken: GreaterThanToken (before cursor)
130876
- // - location: GreaterThanToken (after cursor)
130877
- // - same parent (JSXOpeningElement)
131037
+ // <div>/**/
131038
+ // - contextToken: GreaterThanToken (before cursor)
131039
+ // - location: JSXElement
131040
+ // - different parents (JSXOpeningElement, JSXElement)
130878
131041
  return location.parent.kind !== 279 /* JsxOpeningElement */;
130879
131042
  }
130880
131043
  if (contextToken.parent.kind === 280 /* JsxClosingElement */ || contextToken.parent.kind === 278 /* JsxSelfClosingElement */) {
@@ -132075,10 +132238,14 @@ var ts;
132075
132238
  /** True if symbol is a type or a module containing at least one type. */
132076
132239
  function symbolCanBeReferencedAtTypeLocation(symbol, checker, seenModules) {
132077
132240
  if (seenModules === void 0) { seenModules = new ts.Map(); }
132078
- var sym = ts.skipAlias(symbol.exportSymbol || symbol, checker);
132079
- return !!(sym.flags & 788968 /* Type */) || checker.isUnknownSymbol(sym) ||
132080
- !!(sym.flags & 1536 /* Module */) && ts.addToSeen(seenModules, ts.getSymbolId(sym)) &&
132081
- checker.getExportsOfModule(sym).some(function (e) { return symbolCanBeReferencedAtTypeLocation(e, checker, seenModules); });
132241
+ // Since an alias can be merged with a local declaration, we need to test both the alias and its target.
132242
+ // This code used to just test the result of `skipAlias`, but that would ignore any locally introduced meanings.
132243
+ return nonAliasCanBeReferencedAtTypeLocation(symbol) || nonAliasCanBeReferencedAtTypeLocation(ts.skipAlias(symbol.exportSymbol || symbol, checker));
132244
+ function nonAliasCanBeReferencedAtTypeLocation(symbol) {
132245
+ return !!(symbol.flags & 788968 /* Type */) || checker.isUnknownSymbol(symbol) ||
132246
+ !!(symbol.flags & 1536 /* Module */) && ts.addToSeen(seenModules, ts.getSymbolId(symbol)) &&
132247
+ checker.getExportsOfModule(symbol).some(function (e) { return symbolCanBeReferencedAtTypeLocation(e, checker, seenModules); });
132248
+ }
132082
132249
  }
132083
132250
  function isDeprecated(symbol, checker) {
132084
132251
  var declarations = ts.skipAlias(symbol, checker).declarations;
@@ -134332,8 +134499,8 @@ var ts;
134332
134499
  var sourceId = ts.getNodeId(sourceFile);
134333
134500
  var seenSymbols = this.sourceFileToSeenSymbols[sourceId] || (this.sourceFileToSeenSymbols[sourceId] = new ts.Set());
134334
134501
  var anyNewSymbols = false;
134335
- for (var _i = 0, symbols_2 = symbols; _i < symbols_2.length; _i++) {
134336
- var sym = symbols_2[_i];
134502
+ for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) {
134503
+ var sym = symbols_1[_i];
134337
134504
  anyNewSymbols = ts.tryAddToSet(seenSymbols, ts.getSymbolId(sym)) || anyNewSymbols;
134338
134505
  }
134339
134506
  return anyNewSymbols;
@@ -141293,6 +141460,8 @@ var ts;
141293
141460
  }
141294
141461
  if (flags & 16 /* Function */)
141295
141462
  return isLocalVariableOrFunction(symbol) ? "local function" /* localFunctionElement */ : "function" /* functionElement */;
141463
+ // 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.
141464
+ // So, even when the location is just on the declaration of setter, this function returns getter.
141296
141465
  if (flags & 32768 /* GetAccessor */)
141297
141466
  return "getter" /* memberGetAccessorElement */;
141298
141467
  if (flags & 65536 /* SetAccessor */)
@@ -141379,9 +141548,24 @@ var ts;
141379
141548
  }
141380
141549
  // Class at constructor site need to be shown as constructor apart from property,method, vars
141381
141550
  if (symbolKind !== "" /* unknown */ || symbolFlags & 32 /* Class */ || symbolFlags & 2097152 /* Alias */) {
141382
- // If it is accessor they are allowed only if location is at name of the accessor
141551
+ // If symbol is accessor, they are allowed only if location is at declaration identifier of the accessor
141383
141552
  if (symbolKind === "getter" /* memberGetAccessorElement */ || symbolKind === "setter" /* memberSetAccessorElement */) {
141384
- symbolKind = "property" /* memberVariableElement */;
141553
+ var declaration = ts.find(symbol.declarations, function (declaration) { return declaration.name === location; });
141554
+ if (declaration) {
141555
+ switch (declaration.kind) {
141556
+ case 171 /* GetAccessor */:
141557
+ symbolKind = "getter" /* memberGetAccessorElement */;
141558
+ break;
141559
+ case 172 /* SetAccessor */:
141560
+ symbolKind = "setter" /* memberSetAccessorElement */;
141561
+ break;
141562
+ default:
141563
+ ts.Debug.assertNever(declaration);
141564
+ }
141565
+ }
141566
+ else {
141567
+ symbolKind = "property" /* memberVariableElement */;
141568
+ }
141385
141569
  }
141386
141570
  var signature = void 0;
141387
141571
  type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location);
@@ -141695,6 +141879,8 @@ var ts;
141695
141879
  }
141696
141880
  // For properties, variables and local vars: show the type
141697
141881
  if (symbolKind === "property" /* memberVariableElement */ ||
141882
+ symbolKind === "getter" /* memberGetAccessorElement */ ||
141883
+ symbolKind === "setter" /* memberSetAccessorElement */ ||
141698
141884
  symbolKind === "JSX attribute" /* jsxAttribute */ ||
141699
141885
  symbolFlags & 3 /* Variable */ ||
141700
141886
  symbolKind === "local var" /* localVariableElement */ ||
@@ -141765,7 +141951,7 @@ var ts;
141765
141951
  }
141766
141952
  }
141767
141953
  if (tags.length === 0 && !hasMultipleSignatures) {
141768
- tags = symbol.getJsDocTags(typeChecker);
141954
+ tags = symbol.getContextualJsDocTags(enclosingDeclaration, typeChecker);
141769
141955
  }
141770
141956
  if (documentation.length === 0 && documentationFromAlias) {
141771
141957
  documentation = documentationFromAlias;
@@ -145185,6 +145371,7 @@ var ts;
145185
145371
  ChangeTracker.prototype.delete = function (sourceFile, node) {
145186
145372
  this.deletedNodes.push({ sourceFile: sourceFile, node: node });
145187
145373
  };
145374
+ /** Stop! Consider using `delete` instead, which has logic for deleting nodes from delimited lists. */
145188
145375
  ChangeTracker.prototype.deleteNode = function (sourceFile, node, options) {
145189
145376
  if (options === void 0) { options = { leadingTriviaOption: LeadingTriviaOption.IncludeAll }; }
145190
145377
  this.deleteRange(sourceFile, getAdjustedRange(sourceFile, node, node, options));
@@ -145588,6 +145775,15 @@ var ts;
145588
145775
  ChangeTracker.prototype.insertExportModifier = function (sourceFile, node) {
145589
145776
  this.insertText(sourceFile, node.getStart(sourceFile), "export ");
145590
145777
  };
145778
+ ChangeTracker.prototype.insertImportSpecifierAtIndex = function (sourceFile, importSpecifier, namedImports, index) {
145779
+ var prevSpecifier = namedImports.elements[index - 1];
145780
+ if (prevSpecifier) {
145781
+ this.insertNodeInListAfter(sourceFile, prevSpecifier, importSpecifier);
145782
+ }
145783
+ else {
145784
+ this.insertNodeBefore(sourceFile, namedImports.elements[0], importSpecifier, !ts.positionsAreOnSameLine(namedImports.elements[0].getStart(), namedImports.parent.parent.getStart(), sourceFile));
145785
+ }
145786
+ };
145591
145787
  /**
145592
145788
  * This function should be used to insert nodes in lists when nodes don't carry separators as the part of the node range,
145593
145789
  * i.e. arguments in arguments lists, parameters in parameter lists etc.
@@ -149090,7 +149286,8 @@ var ts;
149090
149286
  ts.Diagnostics.Cannot_find_namespace_0.code,
149091
149287
  ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code,
149092
149288
  ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here.code,
149093
- ts.Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer.code
149289
+ ts.Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer.code,
149290
+ ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type.code,
149094
149291
  ];
149095
149292
  codefix.registerCodeFix({
149096
149293
  errorCodes: errorCodes,
@@ -149136,7 +149333,7 @@ var ts;
149136
149333
  var symbolName = ts.getNameForExportedSymbol(exportedSymbol, ts.getEmitScriptTarget(compilerOptions));
149137
149334
  var checker = program.getTypeChecker();
149138
149335
  var symbol = checker.getMergedSymbol(ts.skipAlias(exportedSymbol, checker));
149139
- var exportInfos = getAllReExportingModules(sourceFile, symbol, moduleSymbol, symbolName, host, program, preferences, useAutoImportProvider);
149336
+ var exportInfos = getAllReExportingModules(sourceFile, symbol, moduleSymbol, symbolName, /*isJsxTagName*/ false, host, program, preferences, useAutoImportProvider);
149140
149337
  var useRequire = shouldUseRequire(sourceFile, program);
149141
149338
  var fix = getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, symbolName, program, /*position*/ undefined, !!isValidTypeOnlyUseSite, useRequire, host, preferences);
149142
149339
  if (fix) {
@@ -149195,6 +149392,9 @@ var ts;
149195
149392
  }
149196
149393
  break;
149197
149394
  }
149395
+ case 4 /* PromoteTypeOnly */:
149396
+ // Excluding from fix-all
149397
+ break;
149198
149398
  default:
149199
149399
  ts.Debug.assertNever(fix, "fix wasn't never - got kind " + fix.kind);
149200
149400
  }
@@ -149286,6 +149486,7 @@ var ts;
149286
149486
  ImportFixKind[ImportFixKind["JsdocTypeImport"] = 1] = "JsdocTypeImport";
149287
149487
  ImportFixKind[ImportFixKind["AddToExisting"] = 2] = "AddToExisting";
149288
149488
  ImportFixKind[ImportFixKind["AddNew"] = 3] = "AddNew";
149489
+ ImportFixKind[ImportFixKind["PromoteTypeOnly"] = 4] = "PromoteTypeOnly";
149289
149490
  })(ImportFixKind || (ImportFixKind = {}));
149290
149491
  // These should not be combined as bitflags, but are given powers of 2 values to
149291
149492
  // easily detect conflicts between `NotAllowed` and `Required` by giving them a unique sum.
@@ -149297,11 +149498,11 @@ var ts;
149297
149498
  AddAsTypeOnly[AddAsTypeOnly["Required"] = 2] = "Required";
149298
149499
  AddAsTypeOnly[AddAsTypeOnly["NotAllowed"] = 4] = "NotAllowed";
149299
149500
  })(AddAsTypeOnly || (AddAsTypeOnly = {}));
149300
- function getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, symbolName, host, program, formatContext, position, preferences) {
149501
+ function getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, symbolName, isJsxTagName, host, program, formatContext, position, preferences) {
149301
149502
  var compilerOptions = program.getCompilerOptions();
149302
149503
  var exportInfos = ts.pathIsBareSpecifier(ts.stripQuotes(moduleSymbol.name))
149303
149504
  ? [getSymbolExportInfoForSymbol(targetSymbol, moduleSymbol, program, host)]
149304
- : getAllReExportingModules(sourceFile, targetSymbol, moduleSymbol, symbolName, host, program, preferences, /*useAutoImportProvider*/ true);
149505
+ : getAllReExportingModules(sourceFile, targetSymbol, moduleSymbol, symbolName, isJsxTagName, host, program, preferences, /*useAutoImportProvider*/ true);
149305
149506
  var useRequire = shouldUseRequire(sourceFile, program);
149306
149507
  var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(ts.getTokenAtPosition(sourceFile, position));
149307
149508
  var fix = ts.Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, symbolName, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences));
@@ -149311,6 +149512,13 @@ var ts;
149311
149512
  };
149312
149513
  }
149313
149514
  codefix.getImportCompletionAction = getImportCompletionAction;
149515
+ function getPromoteTypeOnlyCompletionAction(sourceFile, symbolToken, program, host, formatContext, preferences) {
149516
+ var compilerOptions = program.getCompilerOptions();
149517
+ var symbolName = getSymbolName(sourceFile, program.getTypeChecker(), symbolToken, compilerOptions);
149518
+ var fix = getTypeOnlyPromotionFix(sourceFile, symbolToken, symbolName, program);
149519
+ return fix && codeFixActionToCodeAction(codeActionForFix({ host: host, formatContext: formatContext, preferences: preferences }, sourceFile, symbolName, fix, 1 /* Double */, compilerOptions));
149520
+ }
149521
+ codefix.getPromoteTypeOnlyCompletionAction = getPromoteTypeOnlyCompletionAction;
149314
149522
  function getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, symbolName, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences) {
149315
149523
  ts.Debug.assert(exportInfos.some(function (info) { return info.moduleSymbol === moduleSymbol || info.symbol.parent === moduleSymbol; }), "Some exportInfo should match the specified moduleSymbol");
149316
149524
  var packageJsonImportFilter = ts.createPackageJsonImportFilter(sourceFile, preferences, host);
@@ -149340,7 +149548,7 @@ var ts;
149340
149548
  }
149341
149549
  }
149342
149550
  }
149343
- function getAllReExportingModules(importingFile, targetSymbol, exportingModuleSymbol, symbolName, host, program, preferences, useAutoImportProvider) {
149551
+ function getAllReExportingModules(importingFile, targetSymbol, exportingModuleSymbol, symbolName, isJsxTagName, host, program, preferences, useAutoImportProvider) {
149344
149552
  var result = [];
149345
149553
  var compilerOptions = program.getCompilerOptions();
149346
149554
  var getModuleSpecifierResolutionHost = ts.memoizeOne(function (isFromPackageJson) {
@@ -149353,7 +149561,7 @@ var ts;
149353
149561
  return;
149354
149562
  }
149355
149563
  var defaultInfo = ts.getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions);
149356
- if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, ts.getEmitScriptTarget(compilerOptions)) === symbolName) && ts.skipAlias(defaultInfo.symbol, checker) === targetSymbol && isImportable(program, moduleFile, isFromPackageJson)) {
149564
+ if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, ts.getEmitScriptTarget(compilerOptions), isJsxTagName) === symbolName) && ts.skipAlias(defaultInfo.symbol, checker) === targetSymbol && isImportable(program, moduleFile, isFromPackageJson)) {
149357
149565
  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 });
149358
149566
  }
149359
149567
  for (var _i = 0, _a = checker.getExportsAndPropertiesOfModule(moduleSymbol); _i < _a.length; _i++) {
@@ -149591,9 +149799,21 @@ var ts;
149591
149799
  }
149592
149800
  function getFixesInfo(context, errorCode, pos, useAutoImportProvider) {
149593
149801
  var symbolToken = ts.getTokenAtPosition(context.sourceFile, pos);
149594
- var info = errorCode === ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code
149595
- ? getFixesInfoForUMDImport(context, symbolToken)
149596
- : ts.isIdentifier(symbolToken) ? getFixesInfoForNonUMDImport(context, symbolToken, useAutoImportProvider) : undefined;
149802
+ var info;
149803
+ if (errorCode === ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code) {
149804
+ info = getFixesInfoForUMDImport(context, symbolToken);
149805
+ }
149806
+ else if (!ts.isIdentifier(symbolToken)) {
149807
+ return undefined;
149808
+ }
149809
+ else if (errorCode === ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type.code) {
149810
+ var symbolName_1 = getSymbolName(context.sourceFile, context.program.getTypeChecker(), symbolToken, context.program.getCompilerOptions());
149811
+ var fix = getTypeOnlyPromotionFix(context.sourceFile, symbolToken, symbolName_1, context.program);
149812
+ return fix && { fixes: [fix], symbolName: symbolName_1 };
149813
+ }
149814
+ else {
149815
+ info = getFixesInfoForNonUMDImport(context, symbolToken, useAutoImportProvider);
149816
+ }
149597
149817
  var packageJsonImportFilter = ts.createPackageJsonImportFilter(context.sourceFile, context.preferences, context.host);
149598
149818
  return info && __assign(__assign({}, info), { fixes: sortFixes(info.fixes, context.sourceFile, context.program, packageJsonImportFilter) });
149599
149819
  }
@@ -149710,13 +149930,23 @@ var ts;
149710
149930
  ts.Debug.assert(symbolName !== "default" /* Default */, "'default' isn't a legal identifier and couldn't occur here");
149711
149931
  var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(symbolToken);
149712
149932
  var useRequire = shouldUseRequire(sourceFile, program);
149713
- var exportInfos = getExportInfos(symbolName, ts.getMeaningFromLocation(symbolToken), cancellationToken, sourceFile, program, useAutoImportProvider, host, preferences);
149933
+ var exportInfos = getExportInfos(symbolName, ts.isJSXTagName(symbolToken), ts.getMeaningFromLocation(symbolToken), cancellationToken, sourceFile, program, useAutoImportProvider, host, preferences);
149714
149934
  var fixes = ts.arrayFrom(ts.flatMapIterator(exportInfos.entries(), function (_a) {
149715
149935
  var _ = _a[0], exportInfos = _a[1];
149716
149936
  return getImportFixes(exportInfos, symbolName, symbolToken.getStart(sourceFile), isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences);
149717
149937
  }));
149718
149938
  return { fixes: fixes, symbolName: symbolName };
149719
149939
  }
149940
+ function getTypeOnlyPromotionFix(sourceFile, symbolToken, symbolName, program) {
149941
+ var checker = program.getTypeChecker();
149942
+ var symbol = checker.resolveName(symbolName, symbolToken, 111551 /* Value */, /*excludeGlobals*/ true);
149943
+ if (!symbol)
149944
+ return undefined;
149945
+ var typeOnlyAliasDeclaration = checker.getTypeOnlyAliasDeclaration(symbol);
149946
+ if (!typeOnlyAliasDeclaration || ts.getSourceFileOfNode(typeOnlyAliasDeclaration) !== sourceFile)
149947
+ return undefined;
149948
+ return { kind: 4 /* PromoteTypeOnly */, typeOnlyAliasDeclaration: typeOnlyAliasDeclaration };
149949
+ }
149720
149950
  function jsxModeNeedsExplicitImport(jsx) {
149721
149951
  return jsx === 2 /* React */ || jsx === 3 /* ReactNative */;
149722
149952
  }
@@ -149724,14 +149954,20 @@ var ts;
149724
149954
  var parent = symbolToken.parent;
149725
149955
  if ((ts.isJsxOpeningLikeElement(parent) || ts.isJsxClosingElement(parent)) && parent.tagName === symbolToken && jsxModeNeedsExplicitImport(compilerOptions.jsx)) {
149726
149956
  var jsxNamespace = checker.getJsxNamespace(sourceFile);
149727
- if (ts.isIntrinsicJsxName(symbolToken.text) || !checker.resolveName(jsxNamespace, parent, 111551 /* Value */, /*excludeGlobals*/ true)) {
149957
+ if (needsJsxNamespaceFix(jsxNamespace, symbolToken, checker)) {
149728
149958
  return jsxNamespace;
149729
149959
  }
149730
149960
  }
149731
149961
  return symbolToken.text;
149732
149962
  }
149963
+ function needsJsxNamespaceFix(jsxNamespace, symbolToken, checker) {
149964
+ if (ts.isIntrinsicJsxName(symbolToken.text))
149965
+ return true; // If we were triggered by a matching error code on an intrinsic, the error must have been about missing the JSX factory
149966
+ var namespaceSymbol = checker.resolveName(jsxNamespace, symbolToken, 111551 /* Value */, /*excludeGlobals*/ true);
149967
+ return !namespaceSymbol || ts.some(namespaceSymbol.declarations, ts.isTypeOnlyImportOrExportDeclaration) && !(namespaceSymbol.flags & 111551 /* Value */);
149968
+ }
149733
149969
  // Returns a map from an exported symbol's ID to a list of every way it's (re-)exported.
149734
- function getExportInfos(symbolName, currentTokenMeaning, cancellationToken, fromFile, program, useAutoImportProvider, host, preferences) {
149970
+ function getExportInfos(symbolName, isJsxTagName, currentTokenMeaning, cancellationToken, fromFile, program, useAutoImportProvider, host, preferences) {
149735
149971
  var _a;
149736
149972
  // For each original symbol, keep all re-exports of that symbol together so we can call `getCodeActionsForImport` on the whole group at once.
149737
149973
  // Maps symbol id to info for modules providing that symbol (original export + re-exports).
@@ -149754,7 +149990,7 @@ var ts;
149754
149990
  cancellationToken.throwIfCancellationRequested();
149755
149991
  var compilerOptions = program.getCompilerOptions();
149756
149992
  var defaultInfo = ts.getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions);
149757
- if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, ts.getEmitScriptTarget(compilerOptions)) === symbolName) && symbolHasMeaning(defaultInfo.symbolForMeaning, currentTokenMeaning)) {
149993
+ if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, ts.getEmitScriptTarget(compilerOptions), isJsxTagName) === symbolName) && symbolHasMeaning(defaultInfo.symbolForMeaning, currentTokenMeaning)) {
149758
149994
  addSymbol(moduleSymbol, sourceFile, defaultInfo.symbol, defaultInfo.exportKind, program, isFromPackageJson);
149759
149995
  }
149760
149996
  // check exports with the same name
@@ -149828,10 +150064,80 @@ var ts;
149828
150064
  ts.insertImports(changes, sourceFile, getDeclarations(moduleSpecifier, quotePreference, defaultImport, namedImports, namespaceLikeImport), /*blankLineBetween*/ true);
149829
150065
  return [importKind === 1 /* Default */ ? ts.Diagnostics.Import_default_0_from_module_1 : ts.Diagnostics.Import_0_from_module_1, symbolName, moduleSpecifier];
149830
150066
  }
150067
+ case 4 /* PromoteTypeOnly */: {
150068
+ var typeOnlyAliasDeclaration = fix.typeOnlyAliasDeclaration;
150069
+ var promotedDeclaration = promoteFromTypeOnly(changes, typeOnlyAliasDeclaration, compilerOptions, sourceFile);
150070
+ return promotedDeclaration.kind === 269 /* ImportSpecifier */
150071
+ ? [ts.Diagnostics.Remove_type_from_import_of_0_from_1, symbolName, getModuleSpecifierText(promotedDeclaration.parent.parent)]
150072
+ : [ts.Diagnostics.Remove_type_from_import_declaration_from_0, getModuleSpecifierText(promotedDeclaration)];
150073
+ }
149831
150074
  default:
149832
150075
  return ts.Debug.assertNever(fix, "Unexpected fix kind " + fix.kind);
149833
150076
  }
149834
150077
  }
150078
+ function getModuleSpecifierText(promotedDeclaration) {
150079
+ var _a, _b;
150080
+ return promotedDeclaration.kind === 264 /* ImportEqualsDeclaration */
150081
+ ? ((_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()
150082
+ : ts.cast(promotedDeclaration.parent.moduleSpecifier, ts.isStringLiteral).text;
150083
+ }
150084
+ function promoteFromTypeOnly(changes, aliasDeclaration, compilerOptions, sourceFile) {
150085
+ // See comment in `doAddExistingFix` on constant with the same name.
150086
+ var convertExistingToTypeOnly = compilerOptions.preserveValueImports && compilerOptions.isolatedModules;
150087
+ switch (aliasDeclaration.kind) {
150088
+ case 269 /* ImportSpecifier */:
150089
+ if (aliasDeclaration.isTypeOnly) {
150090
+ if (aliasDeclaration.parent.elements.length > 1 && ts.OrganizeImports.importSpecifiersAreSorted(aliasDeclaration.parent.elements)) {
150091
+ changes.delete(sourceFile, aliasDeclaration);
150092
+ var newSpecifier = ts.factory.updateImportSpecifier(aliasDeclaration, /*isTypeOnly*/ false, aliasDeclaration.propertyName, aliasDeclaration.name);
150093
+ var insertionIndex = ts.OrganizeImports.getImportSpecifierInsertionIndex(aliasDeclaration.parent.elements, newSpecifier);
150094
+ changes.insertImportSpecifierAtIndex(sourceFile, newSpecifier, aliasDeclaration.parent, insertionIndex);
150095
+ }
150096
+ else {
150097
+ changes.deleteRange(sourceFile, aliasDeclaration.getFirstToken());
150098
+ }
150099
+ return aliasDeclaration;
150100
+ }
150101
+ else {
150102
+ ts.Debug.assert(aliasDeclaration.parent.parent.isTypeOnly);
150103
+ promoteImportClause(aliasDeclaration.parent.parent);
150104
+ return aliasDeclaration.parent.parent;
150105
+ }
150106
+ case 266 /* ImportClause */:
150107
+ promoteImportClause(aliasDeclaration);
150108
+ return aliasDeclaration;
150109
+ case 267 /* NamespaceImport */:
150110
+ promoteImportClause(aliasDeclaration.parent);
150111
+ return aliasDeclaration.parent;
150112
+ case 264 /* ImportEqualsDeclaration */:
150113
+ changes.deleteRange(sourceFile, aliasDeclaration.getChildAt(1));
150114
+ return aliasDeclaration;
150115
+ default:
150116
+ ts.Debug.failBadSyntaxKind(aliasDeclaration);
150117
+ }
150118
+ function promoteImportClause(importClause) {
150119
+ changes.delete(sourceFile, ts.getTypeKeywordOfTypeOnlyImport(importClause, sourceFile));
150120
+ if (convertExistingToTypeOnly) {
150121
+ var namedImports = ts.tryCast(importClause.namedBindings, ts.isNamedImports);
150122
+ if (namedImports && namedImports.elements.length > 1) {
150123
+ if (ts.OrganizeImports.importSpecifiersAreSorted(namedImports.elements) &&
150124
+ aliasDeclaration.kind === 269 /* ImportSpecifier */ &&
150125
+ namedImports.elements.indexOf(aliasDeclaration) !== 0) {
150126
+ // The import specifier being promoted will be the only non-type-only,
150127
+ // import in the NamedImports, so it should be moved to the front.
150128
+ changes.delete(sourceFile, aliasDeclaration);
150129
+ changes.insertImportSpecifierAtIndex(sourceFile, aliasDeclaration, namedImports, 0);
150130
+ }
150131
+ for (var _i = 0, _a = namedImports.elements; _i < _a.length; _i++) {
150132
+ var element = _a[_i];
150133
+ if (element !== aliasDeclaration && !element.isTypeOnly) {
150134
+ changes.insertModifierBefore(sourceFile, 151 /* TypeKeyword */, element);
150135
+ }
150136
+ }
150137
+ }
150138
+ }
150139
+ }
150140
+ }
149835
150141
  function doAddExistingFix(changes, sourceFile, clause, defaultImport, namedImports, compilerOptions) {
149836
150142
  var _a;
149837
150143
  if (clause.kind === 200 /* ObjectBindingPattern */) {
@@ -149869,13 +150175,7 @@ var ts;
149869
150175
  var insertionIndex = convertExistingToTypeOnly && !spec.isTypeOnly
149870
150176
  ? 0
149871
150177
  : ts.OrganizeImports.getImportSpecifierInsertionIndex(existingSpecifiers, spec);
149872
- var prevSpecifier = clause.namedBindings.elements[insertionIndex - 1];
149873
- if (prevSpecifier) {
149874
- changes.insertNodeInListAfter(sourceFile, prevSpecifier, spec);
149875
- }
149876
- else {
149877
- changes.insertNodeBefore(sourceFile, existingSpecifiers[0], spec, !ts.positionsAreOnSameLine(existingSpecifiers[0].getStart(), clause.parent.getStart(), sourceFile));
149878
- }
150178
+ changes.insertImportSpecifierAtIndex(sourceFile, spec, clause.namedBindings, insertionIndex);
149879
150179
  }
149880
150180
  }
149881
150181
  else if (existingSpecifiers === null || existingSpecifiers === void 0 ? void 0 : existingSpecifiers.length) {
@@ -149990,17 +150290,20 @@ var ts;
149990
150290
  var declarations = _a.declarations;
149991
150291
  return ts.some(declarations, function (decl) { return !!(ts.getMeaningFromDeclaration(decl) & meaning); });
149992
150292
  }
149993
- function moduleSymbolToValidIdentifier(moduleSymbol, target) {
149994
- return moduleSpecifierToValidIdentifier(ts.removeFileExtension(ts.stripQuotes(moduleSymbol.name)), target);
150293
+ function moduleSymbolToValidIdentifier(moduleSymbol, target, forceCapitalize) {
150294
+ return moduleSpecifierToValidIdentifier(ts.removeFileExtension(ts.stripQuotes(moduleSymbol.name)), target, forceCapitalize);
149995
150295
  }
149996
150296
  codefix.moduleSymbolToValidIdentifier = moduleSymbolToValidIdentifier;
149997
- function moduleSpecifierToValidIdentifier(moduleSpecifier, target) {
150297
+ function moduleSpecifierToValidIdentifier(moduleSpecifier, target, forceCapitalize) {
149998
150298
  var baseName = ts.getBaseFileName(ts.removeSuffix(moduleSpecifier, "/index"));
149999
150299
  var res = "";
150000
150300
  var lastCharWasValid = true;
150001
150301
  var firstCharCode = baseName.charCodeAt(0);
150002
150302
  if (ts.isIdentifierStart(firstCharCode, target)) {
150003
150303
  res += String.fromCharCode(firstCharCode);
150304
+ if (forceCapitalize) {
150305
+ res = res.toUpperCase();
150306
+ }
150004
150307
  }
150005
150308
  else {
150006
150309
  lastCharWasValid = false;
@@ -159969,13 +160272,11 @@ var ts;
159969
160272
  switch (context === null || context === void 0 ? void 0 : context.kind) {
159970
160273
  case 171 /* GetAccessor */:
159971
160274
  if (!this.contextualGetAccessorDocumentationComment) {
159972
- this.contextualGetAccessorDocumentationComment = ts.emptyArray;
159973
160275
  this.contextualGetAccessorDocumentationComment = getDocumentationComment(ts.filter(this.declarations, ts.isGetAccessor), checker);
159974
160276
  }
159975
160277
  return this.contextualGetAccessorDocumentationComment;
159976
160278
  case 172 /* SetAccessor */:
159977
160279
  if (!this.contextualSetAccessorDocumentationComment) {
159978
- this.contextualSetAccessorDocumentationComment = ts.emptyArray;
159979
160280
  this.contextualSetAccessorDocumentationComment = getDocumentationComment(ts.filter(this.declarations, ts.isSetAccessor), checker);
159980
160281
  }
159981
160282
  return this.contextualSetAccessorDocumentationComment;
@@ -159985,10 +160286,26 @@ var ts;
159985
160286
  };
159986
160287
  SymbolObject.prototype.getJsDocTags = function (checker) {
159987
160288
  if (this.tags === undefined) {
159988
- this.tags = ts.JsDoc.getJsDocTagsFromDeclarations(this.declarations, checker);
160289
+ this.tags = getJsDocTagsOfDeclarations(this.declarations, checker);
159989
160290
  }
159990
160291
  return this.tags;
159991
160292
  };
160293
+ SymbolObject.prototype.getContextualJsDocTags = function (context, checker) {
160294
+ switch (context === null || context === void 0 ? void 0 : context.kind) {
160295
+ case 171 /* GetAccessor */:
160296
+ if (!this.contextualGetAccessorTags) {
160297
+ this.contextualGetAccessorTags = getJsDocTagsOfDeclarations(ts.filter(this.declarations, ts.isGetAccessor), checker);
160298
+ }
160299
+ return this.contextualGetAccessorTags;
160300
+ case 172 /* SetAccessor */:
160301
+ if (!this.contextualSetAccessorTags) {
160302
+ this.contextualSetAccessorTags = getJsDocTagsOfDeclarations(ts.filter(this.declarations, ts.isSetAccessor), checker);
160303
+ }
160304
+ return this.contextualSetAccessorTags;
160305
+ default:
160306
+ return this.getJsDocTags(checker);
160307
+ }
160308
+ };
159992
160309
  return SymbolObject;
159993
160310
  }());
159994
160311
  var TokenObject = /** @class */ (function (_super) {
@@ -160158,10 +160475,7 @@ var ts;
160158
160475
  return this.documentationComment || (this.documentationComment = getDocumentationComment(ts.singleElementArray(this.declaration), this.checker));
160159
160476
  };
160160
160477
  SignatureObject.prototype.getJsDocTags = function () {
160161
- if (this.jsDocTags === undefined) {
160162
- this.jsDocTags = this.declaration ? getJsDocTagsOfSignature(this.declaration, this.checker) : [];
160163
- }
160164
- return this.jsDocTags;
160478
+ return this.jsDocTags || (this.jsDocTags = getJsDocTagsOfDeclarations(ts.singleElementArray(this.declaration), this.checker));
160165
160479
  };
160166
160480
  return SignatureObject;
160167
160481
  }());
@@ -160173,12 +160487,30 @@ var ts;
160173
160487
  function hasJSDocInheritDocTag(node) {
160174
160488
  return ts.getJSDocTags(node).some(function (tag) { return tag.tagName.text === "inheritDoc"; });
160175
160489
  }
160176
- function getJsDocTagsOfSignature(declaration, checker) {
160177
- var tags = ts.JsDoc.getJsDocTagsFromDeclarations([declaration], checker);
160178
- if (tags.length === 0 || hasJSDocInheritDocTag(declaration)) {
160179
- 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; });
160180
- if (inheritedTags) {
160181
- tags = __spreadArray(__spreadArray([], inheritedTags, true), tags, true);
160490
+ function getJsDocTagsOfDeclarations(declarations, checker) {
160491
+ if (!declarations)
160492
+ return ts.emptyArray;
160493
+ var tags = ts.JsDoc.getJsDocTagsFromDeclarations(declarations, checker);
160494
+ if (checker && (tags.length === 0 || declarations.some(hasJSDocInheritDocTag))) {
160495
+ var seenSymbols_1 = new ts.Set();
160496
+ var _loop_22 = function (declaration) {
160497
+ var inheritedTags = findBaseOfDeclaration(checker, declaration, function (symbol) {
160498
+ var _a;
160499
+ if (!seenSymbols_1.has(symbol)) {
160500
+ seenSymbols_1.add(symbol);
160501
+ if (declaration.kind === 171 /* GetAccessor */ || declaration.kind === 172 /* SetAccessor */) {
160502
+ return symbol.getContextualJsDocTags(declaration, checker);
160503
+ }
160504
+ return ((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.length) === 1 ? symbol.getJsDocTags() : undefined;
160505
+ }
160506
+ });
160507
+ if (inheritedTags) {
160508
+ tags = __spreadArray(__spreadArray([], inheritedTags, true), tags, true);
160509
+ }
160510
+ };
160511
+ for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) {
160512
+ var declaration = declarations_6[_i];
160513
+ _loop_22(declaration);
160182
160514
  }
160183
160515
  }
160184
160516
  return tags;
@@ -160188,18 +160520,24 @@ var ts;
160188
160520
  return ts.emptyArray;
160189
160521
  var doc = ts.JsDoc.getJsDocCommentsFromDeclarations(declarations, checker);
160190
160522
  if (checker && (doc.length === 0 || declarations.some(hasJSDocInheritDocTag))) {
160191
- var seenSymbols_1 = new ts.Set();
160192
- for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) {
160193
- var declaration = declarations_6[_i];
160523
+ var seenSymbols_2 = new ts.Set();
160524
+ var _loop_23 = function (declaration) {
160194
160525
  var inheritedDocs = findBaseOfDeclaration(checker, declaration, function (symbol) {
160195
- if (!seenSymbols_1.has(symbol)) {
160196
- seenSymbols_1.add(symbol);
160526
+ if (!seenSymbols_2.has(symbol)) {
160527
+ seenSymbols_2.add(symbol);
160528
+ if (declaration.kind === 171 /* GetAccessor */ || declaration.kind === 172 /* SetAccessor */) {
160529
+ return symbol.getContextualDocumentationComment(declaration, checker);
160530
+ }
160197
160531
  return symbol.getDocumentationComment(checker);
160198
160532
  }
160199
160533
  });
160200
160534
  // TODO: GH#16312 Return a ReadonlyArray, avoid copying inheritedDocs
160201
160535
  if (inheritedDocs)
160202
160536
  doc = doc.length === 0 ? inheritedDocs.slice() : inheritedDocs.concat(ts.lineBreakPart(), doc);
160537
+ };
160538
+ for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) {
160539
+ var declaration = declarations_7[_i];
160540
+ _loop_23(declaration);
160203
160541
  }
160204
160542
  }
160205
160543
  return doc;