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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/typescript.js CHANGED
@@ -294,7 +294,7 @@ var ts;
294
294
  // The following is baselined as a literal template type without intervention
295
295
  /** The version of the TypeScript compiler release */
296
296
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
297
- ts.version = ts.versionMajorMinor + ".0-insiders.20220124";
297
+ ts.version = ts.versionMajorMinor + ".0-insiders.20220127";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -5112,13 +5112,14 @@ var ts;
5112
5112
  // Flags that require TypeFlags.Object
5113
5113
  ObjectFlags[ObjectFlags["ContainsSpread"] = 4194304] = "ContainsSpread";
5114
5114
  ObjectFlags[ObjectFlags["ObjectRestType"] = 8388608] = "ObjectRestType";
5115
+ ObjectFlags[ObjectFlags["InstantiationExpressionType"] = 16777216] = "InstantiationExpressionType";
5115
5116
  /* @internal */
5116
- ObjectFlags[ObjectFlags["IsClassInstanceClone"] = 16777216] = "IsClassInstanceClone";
5117
+ ObjectFlags[ObjectFlags["IsClassInstanceClone"] = 33554432] = "IsClassInstanceClone";
5117
5118
  // Flags that require TypeFlags.Object and ObjectFlags.Reference
5118
5119
  /* @internal */
5119
- ObjectFlags[ObjectFlags["IdenticalBaseTypeCalculated"] = 33554432] = "IdenticalBaseTypeCalculated";
5120
+ ObjectFlags[ObjectFlags["IdenticalBaseTypeCalculated"] = 67108864] = "IdenticalBaseTypeCalculated";
5120
5121
  /* @internal */
5121
- ObjectFlags[ObjectFlags["IdenticalBaseTypeExists"] = 67108864] = "IdenticalBaseTypeExists";
5122
+ ObjectFlags[ObjectFlags["IdenticalBaseTypeExists"] = 134217728] = "IdenticalBaseTypeExists";
5122
5123
  // Flags that require TypeFlags.UnionOrIntersection or TypeFlags.Substitution
5123
5124
  /* @internal */
5124
5125
  ObjectFlags[ObjectFlags["IsGenericTypeComputed"] = 4194304] = "IsGenericTypeComputed";
@@ -8724,6 +8725,7 @@ var ts;
8724
8725
  Cannot_assign_to_0_because_it_is_an_import: diag(2632, ts.DiagnosticCategory.Error, "Cannot_assign_to_0_because_it_is_an_import_2632", "Cannot assign to '{0}' because it is an import."),
8725
8726
  JSX_property_access_expressions_cannot_include_JSX_namespace_names: diag(2633, ts.DiagnosticCategory.Error, "JSX_property_access_expressions_cannot_include_JSX_namespace_names_2633", "JSX property access expressions cannot include JSX namespace names"),
8726
8727
  _0_index_signatures_are_incompatible: diag(2634, ts.DiagnosticCategory.Error, "_0_index_signatures_are_incompatible_2634", "'{0}' index signatures are incompatible."),
8728
+ Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable: diag(2635, ts.DiagnosticCategory.Error, "Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable_2635", "Type '{0}' has no signatures for which the type argument list is applicable."),
8727
8729
  Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: diag(2649, ts.DiagnosticCategory.Error, "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", "Cannot augment module '{0}' with value exports because it resolves to a non-module entity."),
8728
8730
  A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: diag(2651, ts.DiagnosticCategory.Error, "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums."),
8729
8731
  Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: diag(2652, ts.DiagnosticCategory.Error, "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead."),
@@ -9667,6 +9669,8 @@ var ts;
9667
9669
  Remove_unused_declarations_for_Colon_0: diag(90041, ts.DiagnosticCategory.Message, "Remove_unused_declarations_for_Colon_0_90041", "Remove unused declarations for: '{0}'"),
9668
9670
  Declare_a_private_field_named_0: diag(90053, ts.DiagnosticCategory.Message, "Declare_a_private_field_named_0_90053", "Declare a private field named '{0}'."),
9669
9671
  Includes_imports_of_types_referenced_by_0: diag(90054, ts.DiagnosticCategory.Message, "Includes_imports_of_types_referenced_by_0_90054", "Includes imports of types referenced by '{0}'"),
9672
+ Remove_type_from_import_declaration_from_0: diag(90055, ts.DiagnosticCategory.Message, "Remove_type_from_import_declaration_from_0_90055", "Remove 'type' from import declaration from \"{0}\""),
9673
+ Remove_type_from_import_of_0_from_1: diag(90056, ts.DiagnosticCategory.Message, "Remove_type_from_import_of_0_from_1_90056", "Remove 'type' from import of '{0}' from \"{1}\""),
9670
9674
  Convert_function_to_an_ES2015_class: diag(95001, ts.DiagnosticCategory.Message, "Convert_function_to_an_ES2015_class_95001", "Convert function to an ES2015 class"),
9671
9675
  Convert_0_to_1_in_0: diag(95003, ts.DiagnosticCategory.Message, "Convert_0_to_1_in_0_95003", "Convert '{0}' to '{1} in {0}'"),
9672
9676
  Extract_to_0_in_1: diag(95004, ts.DiagnosticCategory.Message, "Extract_to_0_in_1_95004", "Extract to {0} in {1}"),
@@ -13607,6 +13611,7 @@ var ts;
13607
13611
  case 110 /* TrueKeyword */:
13608
13612
  case 106 /* SuperKeyword */:
13609
13613
  case 229 /* NonNullExpression */:
13614
+ case 227 /* ExpressionWithTypeArguments */:
13610
13615
  case 230 /* MetaProperty */:
13611
13616
  case 100 /* ImportKeyword */: // technically this is only an Expression if it's in a CallExpression
13612
13617
  return true;
@@ -14257,10 +14262,13 @@ var ts;
14257
14262
  function packageIdIsEqual(a, b) {
14258
14263
  return a === b || !!a && !!b && a.name === b.name && a.subModuleName === b.subModuleName && a.version === b.version;
14259
14264
  }
14260
- function packageIdToString(_a) {
14261
- var name = _a.name, subModuleName = _a.subModuleName, version = _a.version;
14262
- var fullName = subModuleName ? name + "/" + subModuleName : name;
14263
- return fullName + "@" + version;
14265
+ function packageIdToPackageName(_a) {
14266
+ var name = _a.name, subModuleName = _a.subModuleName;
14267
+ return subModuleName ? name + "/" + subModuleName : name;
14268
+ }
14269
+ ts.packageIdToPackageName = packageIdToPackageName;
14270
+ function packageIdToString(packageId) {
14271
+ return packageIdToPackageName(packageId) + "@" + packageId.version;
14264
14272
  }
14265
14273
  ts.packageIdToString = packageIdToString;
14266
14274
  function typeDirectiveIsEqualTo(oldResolution, newResolution) {
@@ -15093,6 +15101,15 @@ var ts;
15093
15101
  };
15094
15102
  }
15095
15103
  ts.createDiagnosticForFileFromMessageChain = createDiagnosticForFileFromMessageChain;
15104
+ function createDiagnosticMessageChainFromDiagnostic(diagnostic) {
15105
+ return typeof diagnostic.messageText === "string" ? {
15106
+ code: diagnostic.code,
15107
+ category: diagnostic.category,
15108
+ messageText: diagnostic.messageText,
15109
+ next: diagnostic.next,
15110
+ } : diagnostic.messageText;
15111
+ }
15112
+ ts.createDiagnosticMessageChainFromDiagnostic = createDiagnosticMessageChainFromDiagnostic;
15096
15113
  function createDiagnosticForRange(sourceFile, range, message) {
15097
15114
  return {
15098
15115
  file: sourceFile,
@@ -15261,7 +15278,8 @@ var ts;
15261
15278
  node.kind === 212 /* FunctionExpression */ ||
15262
15279
  node.kind === 213 /* ArrowFunction */ ||
15263
15280
  node.kind === 211 /* ParenthesizedExpression */ ||
15264
- node.kind === 253 /* VariableDeclaration */) ?
15281
+ node.kind === 253 /* VariableDeclaration */ ||
15282
+ node.kind === 274 /* ExportSpecifier */) ?
15265
15283
  ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) :
15266
15284
  ts.getLeadingCommentRanges(text, node.pos);
15267
15285
  // True if the comment starts with '/**' but not if it is '/**/'
@@ -15295,7 +15313,7 @@ var ts;
15295
15313
  case 114 /* VoidKeyword */:
15296
15314
  return node.parent.kind !== 216 /* VoidExpression */;
15297
15315
  case 227 /* ExpressionWithTypeArguments */:
15298
- return !isExpressionWithTypeArgumentsInClassExtendsClause(node);
15316
+ return ts.isHeritageClause(node.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(node);
15299
15317
  case 162 /* TypeParameter */:
15300
15318
  return node.parent.kind === 194 /* MappedType */ || node.parent.kind === 189 /* InferType */;
15301
15319
  // Identifiers and qualified names may be type nodes, depending on their context. Climb
@@ -15332,7 +15350,7 @@ var ts;
15332
15350
  }
15333
15351
  switch (parent.kind) {
15334
15352
  case 227 /* ExpressionWithTypeArguments */:
15335
- return !isExpressionWithTypeArgumentsInClassExtendsClause(parent);
15353
+ return ts.isHeritageClause(parent.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(parent);
15336
15354
  case 162 /* TypeParameter */:
15337
15355
  return node === parent.constraint;
15338
15356
  case 342 /* JSDocTemplateTag */:
@@ -16035,7 +16053,7 @@ var ts;
16035
16053
  case 296 /* SpreadAssignment */:
16036
16054
  return true;
16037
16055
  case 227 /* ExpressionWithTypeArguments */:
16038
- return parent.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent);
16056
+ return parent.expression === node && !isPartOfTypeNode(parent);
16039
16057
  case 295 /* ShorthandPropertyAssignment */:
16040
16058
  return parent.objectAssignmentInitializer === node;
16041
16059
  default:
@@ -22969,16 +22987,18 @@ var ts;
22969
22987
  return updateConstructorTypeNode1(node, node.modifiers, typeParameters, parameters, type);
22970
22988
  }
22971
22989
  // @api
22972
- function createTypeQueryNode(exprName) {
22990
+ function createTypeQueryNode(exprName, typeArguments) {
22973
22991
  var node = createBaseNode(180 /* TypeQuery */);
22974
22992
  node.exprName = exprName;
22993
+ node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments);
22975
22994
  node.transformFlags = 1 /* ContainsTypeScript */;
22976
22995
  return node;
22977
22996
  }
22978
22997
  // @api
22979
- function updateTypeQueryNode(node, exprName) {
22998
+ function updateTypeQueryNode(node, exprName, typeArguments) {
22980
22999
  return node.exprName !== exprName
22981
- ? update(createTypeQueryNode(exprName), node)
23000
+ || node.typeArguments !== typeArguments
23001
+ ? update(createTypeQueryNode(exprName, typeArguments), node)
22982
23002
  : node;
22983
23003
  }
22984
23004
  // @api
@@ -30094,7 +30114,8 @@ var ts;
30094
30114
  visitNode(cbNode, node.parameterName) ||
30095
30115
  visitNode(cbNode, node.type);
30096
30116
  case 180 /* TypeQuery */:
30097
- return visitNode(cbNode, node.exprName);
30117
+ return visitNode(cbNode, node.exprName) ||
30118
+ visitNodes(cbNode, cbNodes, node.typeArguments);
30098
30119
  case 181 /* TypeLiteral */:
30099
30120
  return visitNodes(cbNode, cbNodes, node.members);
30100
30121
  case 182 /* ArrayType */:
@@ -32627,7 +32648,9 @@ var ts;
32627
32648
  function parseTypeQuery() {
32628
32649
  var pos = getNodePos();
32629
32650
  parseExpected(112 /* TypeOfKeyword */);
32630
- return finishNode(factory.createTypeQueryNode(parseEntityName(/*allowReservedWords*/ true)), pos);
32651
+ var entityName = parseEntityName(/*allowReservedWords*/ true);
32652
+ var typeArguments = tryParseTypeArguments();
32653
+ return finishNode(factory.createTypeQueryNode(entityName, typeArguments), pos);
32631
32654
  }
32632
32655
  function parseTypeParameter() {
32633
32656
  var pos = getNodePos();
@@ -33566,7 +33589,7 @@ var ts;
33566
33589
  function parseInitializer() {
33567
33590
  return parseOptional(63 /* EqualsToken */) ? parseAssignmentExpressionOrHigher() : undefined;
33568
33591
  }
33569
- function parseAssignmentExpressionOrHigher(parsingConditionalExpression) {
33592
+ function parseAssignmentExpressionOrHigher() {
33570
33593
  // AssignmentExpression[in,yield]:
33571
33594
  // 1) ConditionalExpression[?in,?yield]
33572
33595
  // 2) LeftHandSideExpression = AssignmentExpression[?in,?yield]
@@ -33592,7 +33615,7 @@ var ts;
33592
33615
  // If we do successfully parse arrow-function, we must *not* recurse for productions 1, 2 or 3. An ArrowFunction is
33593
33616
  // not a LeftHandSideExpression, nor does it start a ConditionalExpression. So we are done
33594
33617
  // with AssignmentExpression if we see one.
33595
- var arrowExpression = tryParseParenthesizedArrowFunctionExpression(parsingConditionalExpression) || tryParseAsyncSimpleArrowFunctionExpression();
33618
+ var arrowExpression = tryParseParenthesizedArrowFunctionExpression() || tryParseAsyncSimpleArrowFunctionExpression();
33596
33619
  if (arrowExpression) {
33597
33620
  return arrowExpression;
33598
33621
  }
@@ -33611,7 +33634,7 @@ var ts;
33611
33634
  // parameter ('x => ...') above. We handle it here by checking if the parsed expression was a single
33612
33635
  // identifier and the current token is an arrow.
33613
33636
  if (expr.kind === 79 /* Identifier */ && token() === 38 /* EqualsGreaterThanToken */) {
33614
- return parseSimpleArrowFunctionExpression(pos, expr, /*asyncModifier*/ undefined, parsingConditionalExpression);
33637
+ return parseSimpleArrowFunctionExpression(pos, expr, /*asyncModifier*/ undefined);
33615
33638
  }
33616
33639
  // Now see if we might be in cases '2' or '3'.
33617
33640
  // If the expression was a LHS expression, and we have an assignment operator, then
@@ -33671,7 +33694,7 @@ var ts;
33671
33694
  return finishNode(factory.createYieldExpression(/*asteriskToken*/ undefined, /*expression*/ undefined), pos);
33672
33695
  }
33673
33696
  }
33674
- function parseSimpleArrowFunctionExpression(pos, identifier, asyncModifier, parsingConditionalExpression) {
33697
+ function parseSimpleArrowFunctionExpression(pos, identifier, asyncModifier) {
33675
33698
  ts.Debug.assert(token() === 38 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>");
33676
33699
  var parameter = factory.createParameterDeclaration(
33677
33700
  /*decorators*/ undefined,
@@ -33683,11 +33706,11 @@ var ts;
33683
33706
  finishNode(parameter, identifier.pos);
33684
33707
  var parameters = createNodeArray([parameter], parameter.pos, parameter.end);
33685
33708
  var equalsGreaterThanToken = parseExpectedToken(38 /* EqualsGreaterThanToken */);
33686
- var body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier, parsingConditionalExpression);
33709
+ var body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier);
33687
33710
  var node = factory.createArrowFunction(asyncModifier, /*typeParameters*/ undefined, parameters, /*type*/ undefined, equalsGreaterThanToken, body);
33688
33711
  return addJSDocComment(finishNode(node, pos));
33689
33712
  }
33690
- function tryParseParenthesizedArrowFunctionExpression(parsingConditionalExpression) {
33713
+ function tryParseParenthesizedArrowFunctionExpression() {
33691
33714
  var triState = isParenthesizedArrowFunctionExpression();
33692
33715
  if (triState === 0 /* False */) {
33693
33716
  // It's definitely not a parenthesized arrow function expression.
@@ -33698,8 +33721,8 @@ var ts;
33698
33721
  // it out, but don't allow any ambiguity, and return 'undefined' if this could be an
33699
33722
  // expression instead.
33700
33723
  return triState === 1 /* True */ ?
33701
- parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true, parsingConditionalExpression) :
33702
- tryParse(function () { return parsePossibleParenthesizedArrowFunctionExpression(parsingConditionalExpression); });
33724
+ parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true) :
33725
+ tryParse(parsePossibleParenthesizedArrowFunctionExpression);
33703
33726
  }
33704
33727
  // True -> We definitely expect a parenthesized arrow function here.
33705
33728
  // False -> There *cannot* be a parenthesized arrow function here.
@@ -33829,25 +33852,25 @@ var ts;
33829
33852
  return 2 /* Unknown */;
33830
33853
  }
33831
33854
  }
33832
- function parsePossibleParenthesizedArrowFunctionExpression(parsingConditionalExpression) {
33855
+ function parsePossibleParenthesizedArrowFunctionExpression() {
33833
33856
  var tokenPos = scanner.getTokenPos();
33834
33857
  if (notParenthesizedArrow === null || notParenthesizedArrow === void 0 ? void 0 : notParenthesizedArrow.has(tokenPos)) {
33835
33858
  return undefined;
33836
33859
  }
33837
- var result = parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ false, parsingConditionalExpression);
33860
+ var result = parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ false);
33838
33861
  if (!result) {
33839
33862
  (notParenthesizedArrow || (notParenthesizedArrow = new ts.Set())).add(tokenPos);
33840
33863
  }
33841
33864
  return result;
33842
33865
  }
33843
- function tryParseAsyncSimpleArrowFunctionExpression(parsingConditionalExpression) {
33866
+ function tryParseAsyncSimpleArrowFunctionExpression() {
33844
33867
  // We do a check here so that we won't be doing unnecessarily call to "lookAhead"
33845
33868
  if (token() === 131 /* AsyncKeyword */) {
33846
33869
  if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* True */) {
33847
33870
  var pos = getNodePos();
33848
33871
  var asyncModifier = parseModifiersForArrowFunction();
33849
33872
  var expr = parseBinaryExpressionOrHigher(0 /* Lowest */);
33850
- return parseSimpleArrowFunctionExpression(pos, expr, asyncModifier, parsingConditionalExpression);
33873
+ return parseSimpleArrowFunctionExpression(pos, expr, asyncModifier);
33851
33874
  }
33852
33875
  }
33853
33876
  return undefined;
@@ -33871,7 +33894,7 @@ var ts;
33871
33894
  }
33872
33895
  return 0 /* False */;
33873
33896
  }
33874
- function parseParenthesizedArrowFunctionExpression(allowAmbiguity, parsingConditionalExpression) {
33897
+ function parseParenthesizedArrowFunctionExpression(allowAmbiguity) {
33875
33898
  var pos = getNodePos();
33876
33899
  var hasJSDoc = hasPrecedingJSDocComment();
33877
33900
  var modifiers = parseModifiersForArrowFunction();
@@ -33897,20 +33920,6 @@ var ts;
33897
33920
  return undefined;
33898
33921
  }
33899
33922
  }
33900
- // Given:
33901
- // x ? y => ({ y }) : z => ({ z })
33902
- // We try to parse the body of the first arrow function by looking at:
33903
- // ({ y }) : z => ({ z })
33904
- // This is a valid arrow function with "z" as the return type.
33905
- //
33906
- // But, if we're in the true side of a conditional expression, this colon
33907
- // terminates the true side, so cannot be the return type. If we are in the
33908
- // false side, we may still be within the true side of a parent conditional
33909
- // expression, so don't allow it to be a return type either.
33910
- if (parsingConditionalExpression && token() === 58 /* ColonToken */) {
33911
- ts.Debug.assert(!allowAmbiguity);
33912
- return undefined;
33913
- }
33914
33923
  var type = parseReturnType(58 /* ColonToken */, /*isType*/ false);
33915
33924
  if (type && !allowAmbiguity && typeHasArrowFunctionBlockingParseError(type)) {
33916
33925
  return undefined;
@@ -33944,7 +33953,7 @@ var ts;
33944
33953
  var node = factory.createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body);
33945
33954
  return withJSDoc(finishNode(node, pos), hasJSDoc);
33946
33955
  }
33947
- function parseArrowFunctionExpressionBody(isAsync, parsingConditionalExpression) {
33956
+ function parseArrowFunctionExpressionBody(isAsync) {
33948
33957
  if (token() === 18 /* OpenBraceToken */) {
33949
33958
  return parseFunctionBlock(isAsync ? 2 /* Await */ : 0 /* None */);
33950
33959
  }
@@ -33972,8 +33981,8 @@ var ts;
33972
33981
  var savedTopLevel = topLevel;
33973
33982
  topLevel = false;
33974
33983
  var node = isAsync
33975
- ? doInAwaitContext(function () { return parseAssignmentExpressionOrHigher(parsingConditionalExpression); })
33976
- : doOutsideOfAwaitContext(function () { return parseAssignmentExpressionOrHigher(parsingConditionalExpression); });
33984
+ ? doInAwaitContext(parseAssignmentExpressionOrHigher)
33985
+ : doOutsideOfAwaitContext(parseAssignmentExpressionOrHigher);
33977
33986
  topLevel = savedTopLevel;
33978
33987
  return node;
33979
33988
  }
@@ -33986,8 +33995,8 @@ var ts;
33986
33995
  // Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and
33987
33996
  // we do not that for the 'whenFalse' part.
33988
33997
  var colonToken;
33989
- return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, function () { return parseAssignmentExpressionOrHigher(/*parsingConditionalExpression*/ true); }), colonToken = parseExpectedToken(58 /* ColonToken */), ts.nodeIsPresent(colonToken)
33990
- ? parseAssignmentExpressionOrHigher(/*parsingConditionalExpression*/ true)
33998
+ return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher), colonToken = parseExpectedToken(58 /* ColonToken */), ts.nodeIsPresent(colonToken)
33999
+ ? parseAssignmentExpressionOrHigher()
33991
34000
  : createMissingNode(79 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(58 /* ColonToken */))), pos);
33992
34001
  }
33993
34002
  function parseBinaryExpressionOrHigher(precedence) {
@@ -34758,12 +34767,16 @@ var ts;
34758
34767
  expression = parseTaggedTemplateRest(pos, expression, questionDotToken, typeArguments);
34759
34768
  continue;
34760
34769
  }
34761
- var argumentList = parseArgumentList();
34762
- var callExpr = questionDotToken || tryReparseOptionalChain(expression) ?
34763
- factory.createCallChain(expression, questionDotToken, typeArguments, argumentList) :
34764
- factory.createCallExpression(expression, typeArguments, argumentList);
34765
- expression = finishNode(callExpr, pos);
34766
- continue;
34770
+ if (questionDotToken || token() === 20 /* OpenParenToken */) {
34771
+ var argumentList = parseArgumentList();
34772
+ var callExpr = questionDotToken || tryReparseOptionalChain(expression) ?
34773
+ factory.createCallChain(expression, questionDotToken, typeArguments, argumentList) :
34774
+ factory.createCallExpression(expression, typeArguments, argumentList);
34775
+ expression = finishNode(callExpr, pos);
34776
+ continue;
34777
+ }
34778
+ expression = finishNode(factory.createExpressionWithTypeArguments(expression, typeArguments), pos);
34779
+ break;
34767
34780
  }
34768
34781
  }
34769
34782
  else if (token() === 20 /* OpenParenToken */) {
@@ -34803,20 +34816,23 @@ var ts;
34803
34816
  // If it doesn't have the closing `>` then it's definitely not an type argument list.
34804
34817
  return undefined;
34805
34818
  }
34806
- // If we have a '<', then only parse this as a argument list if the type arguments
34807
- // are complete and we have an open paren. if we don't, rewind and return nothing.
34808
- return typeArguments && canFollowTypeArgumentsInExpression()
34809
- ? typeArguments
34810
- : undefined;
34819
+ // We successfully parsed a type argument list. The next token determines whether we want to
34820
+ // treat it as such. If the type argument list is followed by `(` or a template literal, as in
34821
+ // `f<number>(42)`, we favor the type argument interpretation even though JavaScript would view
34822
+ // it as a relational expression.
34823
+ return typeArguments && canFollowTypeArgumentsInExpression() ? typeArguments : undefined;
34811
34824
  }
34812
34825
  function canFollowTypeArgumentsInExpression() {
34813
34826
  switch (token()) {
34827
+ // These tokens can follow a type argument list in a call expression.
34814
34828
  case 20 /* OpenParenToken */: // foo<x>(
34815
34829
  case 14 /* NoSubstitutionTemplateLiteral */: // foo<T> `...`
34816
34830
  case 15 /* TemplateHead */: // foo<T> `...${100}...`
34817
- // these are the only tokens can legally follow a type argument
34818
- // list. So we definitely want to treat them as type arg lists.
34831
+ // These tokens can't follow in a call expression, nor can they start an
34832
+ // expression. So, consider the type argument list part of an instantiation
34833
+ // expression.
34819
34834
  // falls through
34835
+ case 27 /* CommaToken */: // foo<x>,
34820
34836
  case 24 /* DotToken */: // foo<x>.
34821
34837
  case 21 /* CloseParenToken */: // foo<x>)
34822
34838
  case 23 /* CloseBracketToken */: // foo<x>]
@@ -34835,20 +34851,10 @@ var ts;
34835
34851
  case 51 /* BarToken */: // foo<x> |
34836
34852
  case 19 /* CloseBraceToken */: // foo<x> }
34837
34853
  case 1 /* EndOfFileToken */: // foo<x>
34838
- // these cases can't legally follow a type arg list. However, they're not legal
34839
- // expressions either. The user is probably in the middle of a generic type. So
34840
- // treat it as such.
34841
34854
  return true;
34842
- case 27 /* CommaToken */: // foo<x>,
34843
- case 18 /* OpenBraceToken */: // foo<x> {
34844
- // We don't want to treat these as type arguments. Otherwise we'll parse this
34845
- // as an invocation expression. Instead, we want to parse out the expression
34846
- // in isolation from the type arguments.
34847
- // falls through
34848
- default:
34849
- // Anything else treat as an expression.
34850
- return false;
34851
34855
  }
34856
+ // Treat anything else as an expression.
34857
+ return false;
34852
34858
  }
34853
34859
  function parsePrimaryExpression() {
34854
34860
  switch (token()) {
@@ -35029,17 +35035,12 @@ var ts;
35029
35035
  return finishNode(factory.createMetaProperty(103 /* NewKeyword */, name), pos);
35030
35036
  }
35031
35037
  var expressionPos = getNodePos();
35032
- var expression = parsePrimaryExpression();
35033
- var typeArguments;
35034
- while (true) {
35035
- expression = parseMemberExpressionRest(expressionPos, expression, /*allowOptionalChain*/ false);
35036
- typeArguments = tryParse(parseTypeArgumentsInExpression);
35037
- if (isTemplateStartOfTaggedTemplate()) {
35038
- ts.Debug.assert(!!typeArguments, "Expected a type argument list; all plain tagged template starts should be consumed in 'parseMemberExpressionRest'");
35039
- expression = parseTaggedTemplateRest(expressionPos, expression, /*optionalChain*/ undefined, typeArguments);
35040
- typeArguments = undefined;
35041
- }
35042
- break;
35038
+ var expression = parseMemberExpressionRest(expressionPos, parsePrimaryExpression(), /*allowOptionalChain*/ false);
35039
+ var typeArguments = tryParse(parseTypeArgumentsInExpression);
35040
+ if (isTemplateStartOfTaggedTemplate()) {
35041
+ ts.Debug.assert(!!typeArguments, "Expected a type argument list; all plain tagged template starts should be consumed in 'parseMemberExpressionRest'");
35042
+ expression = parseTaggedTemplateRest(expressionPos, expression, /*optionalChain*/ undefined, typeArguments);
35043
+ typeArguments = undefined;
35043
35044
  }
35044
35045
  var argumentsArray;
35045
35046
  if (token() === 20 /* OpenParenToken */) {
@@ -36136,6 +36137,9 @@ var ts;
36136
36137
  function parseExpressionWithTypeArguments() {
36137
36138
  var pos = getNodePos();
36138
36139
  var expression = parseLeftHandSideExpressionOrHigher();
36140
+ if (expression.kind === 227 /* ExpressionWithTypeArguments */) {
36141
+ return expression;
36142
+ }
36139
36143
  var typeArguments = tryParseTypeArguments();
36140
36144
  return finishNode(factory.createExpressionWithTypeArguments(expression, typeArguments), pos);
36141
36145
  }
@@ -36426,7 +36430,8 @@ var ts;
36426
36430
  return finishNode(node, pos);
36427
36431
  }
36428
36432
  function parseExportSpecifier() {
36429
- return parseImportOrExportSpecifier(274 /* ExportSpecifier */);
36433
+ var hasJSDoc = hasPrecedingJSDocComment();
36434
+ return withJSDoc(parseImportOrExportSpecifier(274 /* ExportSpecifier */), hasJSDoc);
36430
36435
  }
36431
36436
  function parseImportSpecifier() {
36432
36437
  return parseImportOrExportSpecifier(269 /* ImportSpecifier */);
@@ -43631,14 +43636,12 @@ var ts;
43631
43636
  }
43632
43637
  var binder = createBinder();
43633
43638
  function bindSourceFile(file, options) {
43634
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("bind" /* Bind */, "bindSourceFile", { path: file.path }, /*separateBeginAndEnd*/ true);
43635
43639
  ts.performance.mark("beforeBind");
43636
43640
  ts.perfLogger.logStartBindFile("" + file.fileName);
43637
43641
  binder(file, options);
43638
43642
  ts.perfLogger.logStopBindFile();
43639
43643
  ts.performance.mark("afterBind");
43640
43644
  ts.performance.measure("Bind", "beforeBind", "afterBind");
43641
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
43642
43645
  }
43643
43646
  ts.bindSourceFile = bindSourceFile;
43644
43647
  function createBinder() {
@@ -43698,7 +43701,9 @@ var ts;
43698
43701
  ts.Debug.attachFlowNodeDebugInfo(unreachableFlow);
43699
43702
  ts.Debug.attachFlowNodeDebugInfo(reportedUnreachableFlow);
43700
43703
  if (!file.locals) {
43704
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("bind" /* Bind */, "bindSourceFile", { path: file.path }, /*separateBeginAndEnd*/ true);
43701
43705
  bind(file);
43706
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
43702
43707
  file.symbolCount = symbolCount;
43703
43708
  file.classifiableNames = classifiableNames;
43704
43709
  delayedBindJSDocTypedefTag();
@@ -47965,6 +47970,9 @@ var ts;
47965
47970
  suggestionDiagnostics.add(diagnostic);
47966
47971
  return diagnostic;
47967
47972
  }
47973
+ function isDeprecatedSymbol(symbol) {
47974
+ return !!(getDeclarationNodeFlagsFromSymbol(symbol) & 134217728 /* Deprecated */);
47975
+ }
47968
47976
  function addDeprecatedSuggestion(location, declarations, deprecatedEntity) {
47969
47977
  var diagnostic = ts.createDiagnosticForNode(location, ts.Diagnostics._0_is_deprecated, deprecatedEntity);
47970
47978
  return addDeprecatedSuggestionWorker(declarations, diagnostic);
@@ -51060,7 +51068,7 @@ var ts;
51060
51068
  // get symbol of the first identifier of the entityName
51061
51069
  var meaning;
51062
51070
  if (entityName.parent.kind === 180 /* TypeQuery */ ||
51063
- ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent) ||
51071
+ entityName.parent.kind === 227 /* ExpressionWithTypeArguments */ && !ts.isPartOfTypeNode(entityName.parent) ||
51064
51072
  entityName.parent.kind === 161 /* ComputedPropertyName */) {
51065
51073
  // Typeof value
51066
51074
  meaning = 111551 /* Value */ | 1048576 /* ExportValue */;
@@ -51171,7 +51179,7 @@ var ts;
51171
51179
  return flags & 814775659 /* NodeBuilderFlagsMask */;
51172
51180
  }
51173
51181
  function isClassInstanceSide(type) {
51174
- return !!type.symbol && !!(type.symbol.flags & 32 /* Class */) && (type === getDeclaredTypeOfClassOrInterface(type.symbol) || (!!(type.flags & 524288 /* Object */) && !!(ts.getObjectFlags(type) & 16777216 /* IsClassInstanceClone */)));
51182
+ return !!type.symbol && !!(type.symbol.flags & 32 /* Class */) && (type === getDeclaredTypeOfClassOrInterface(type.symbol) || (!!(type.flags & 524288 /* Object */) && !!(ts.getObjectFlags(type) & 33554432 /* IsClassInstanceClone */)));
51175
51183
  }
51176
51184
  function createNodeBuilder() {
51177
51185
  return {
@@ -52735,7 +52743,8 @@ var ts;
52735
52743
  includePrivateSymbol === null || includePrivateSymbol === void 0 ? void 0 : includePrivateSymbol(sym);
52736
52744
  }
52737
52745
  if (ts.isIdentifier(node)) {
52738
- var name = sym.flags & 262144 /* TypeParameter */ ? typeParameterToName(getDeclaredTypeOfSymbol(sym), context) : ts.factory.cloneNode(node);
52746
+ var type = getDeclaredTypeOfSymbol(sym);
52747
+ var name = sym.flags & 262144 /* TypeParameter */ && !isTypeSymbolAccessible(type.symbol, context.enclosingDeclaration) ? typeParameterToName(type, context) : ts.factory.cloneNode(node);
52739
52748
  name.symbol = sym; // for quickinfo, which uses identifier symbol information
52740
52749
  return { introducesError: introducesError, node: ts.setEmitFlags(ts.setOriginalNode(name, node), 16777216 /* NoAsciiEscaping */) };
52741
52750
  }
@@ -55098,7 +55107,7 @@ var ts;
55098
55107
  members_4, exportedType.callSignatures, exportedType.constructSignatures, exportedType.indexInfos);
55099
55108
  result.objectFlags |= (ts.getObjectFlags(type) & 8192 /* JSLiteral */); // Propagate JSLiteral flag
55100
55109
  if (result.symbol && result.symbol.flags & 32 /* Class */ && type === getDeclaredTypeOfClassOrInterface(result.symbol)) {
55101
- result.objectFlags |= 16777216 /* IsClassInstanceClone */; // Propagate the knowledge that this type is equivalent to the symbol's class instance type
55110
+ result.objectFlags |= 33554432 /* IsClassInstanceClone */; // Propagate the knowledge that this type is equivalent to the symbol's class instance type
55102
55111
  }
55103
55112
  return result;
55104
55113
  }
@@ -57108,87 +57117,87 @@ var ts;
57108
57117
  * Converts an AnonymousType to a ResolvedType.
57109
57118
  */
57110
57119
  function resolveAnonymousTypeMembers(type) {
57111
- var symbol = getMergedSymbol(type.symbol);
57112
57120
  if (type.target) {
57113
57121
  setStructuredTypeMembers(type, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
57114
- var members = createInstantiatedSymbolTable(getPropertiesOfObjectType(type.target), type.mapper, /*mappingThisOnly*/ false);
57122
+ var members_6 = createInstantiatedSymbolTable(getPropertiesOfObjectType(type.target), type.mapper, /*mappingThisOnly*/ false);
57115
57123
  var callSignatures = instantiateSignatures(getSignaturesOfType(type.target, 0 /* Call */), type.mapper);
57116
57124
  var constructSignatures = instantiateSignatures(getSignaturesOfType(type.target, 1 /* Construct */), type.mapper);
57117
- var indexInfos = instantiateIndexInfos(getIndexInfosOfType(type.target), type.mapper);
57118
- setStructuredTypeMembers(type, members, callSignatures, constructSignatures, indexInfos);
57125
+ var indexInfos_1 = instantiateIndexInfos(getIndexInfosOfType(type.target), type.mapper);
57126
+ setStructuredTypeMembers(type, members_6, callSignatures, constructSignatures, indexInfos_1);
57127
+ return;
57119
57128
  }
57120
- else if (symbol.flags & 2048 /* TypeLiteral */) {
57129
+ var symbol = getMergedSymbol(type.symbol);
57130
+ if (symbol.flags & 2048 /* TypeLiteral */) {
57121
57131
  setStructuredTypeMembers(type, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
57122
- var members = getMembersOfSymbol(symbol);
57123
- var callSignatures = getSignaturesOfSymbol(members.get("__call" /* Call */));
57124
- var constructSignatures = getSignaturesOfSymbol(members.get("__new" /* New */));
57125
- var indexInfos = getIndexInfosOfSymbol(symbol);
57126
- setStructuredTypeMembers(type, members, callSignatures, constructSignatures, indexInfos);
57132
+ var members_7 = getMembersOfSymbol(symbol);
57133
+ var callSignatures = getSignaturesOfSymbol(members_7.get("__call" /* Call */));
57134
+ var constructSignatures = getSignaturesOfSymbol(members_7.get("__new" /* New */));
57135
+ var indexInfos_2 = getIndexInfosOfSymbol(symbol);
57136
+ setStructuredTypeMembers(type, members_7, callSignatures, constructSignatures, indexInfos_2);
57137
+ return;
57127
57138
  }
57128
- else {
57129
- // Combinations of function, class, enum and module
57130
- var members = emptySymbols;
57131
- var indexInfos = void 0;
57132
- if (symbol.exports) {
57133
- members = getExportsOfSymbol(symbol);
57134
- if (symbol === globalThisSymbol) {
57135
- var varsOnly_1 = new ts.Map();
57136
- members.forEach(function (p) {
57137
- if (!(p.flags & 418 /* BlockScoped */)) {
57138
- varsOnly_1.set(p.escapedName, p);
57139
- }
57140
- });
57141
- members = varsOnly_1;
57142
- }
57139
+ // Combinations of function, class, enum and module
57140
+ var members = emptySymbols;
57141
+ var indexInfos;
57142
+ if (symbol.exports) {
57143
+ members = getExportsOfSymbol(symbol);
57144
+ if (symbol === globalThisSymbol) {
57145
+ var varsOnly_1 = new ts.Map();
57146
+ members.forEach(function (p) {
57147
+ if (!(p.flags & 418 /* BlockScoped */)) {
57148
+ varsOnly_1.set(p.escapedName, p);
57149
+ }
57150
+ });
57151
+ members = varsOnly_1;
57143
57152
  }
57144
- var baseConstructorIndexInfo = void 0;
57145
- setStructuredTypeMembers(type, members, ts.emptyArray, ts.emptyArray, ts.emptyArray);
57146
- if (symbol.flags & 32 /* Class */) {
57147
- var classType = getDeclaredTypeOfClassOrInterface(symbol);
57148
- var baseConstructorType = getBaseConstructorTypeOfClass(classType);
57149
- if (baseConstructorType.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 8650752 /* TypeVariable */)) {
57150
- members = ts.createSymbolTable(getNamedOrIndexSignatureMembers(members));
57151
- addInheritedMembers(members, getPropertiesOfType(baseConstructorType));
57152
- }
57153
- else if (baseConstructorType === anyType) {
57154
- baseConstructorIndexInfo = createIndexInfo(stringType, anyType, /*isReadonly*/ false);
57155
- }
57153
+ }
57154
+ var baseConstructorIndexInfo;
57155
+ setStructuredTypeMembers(type, members, ts.emptyArray, ts.emptyArray, ts.emptyArray);
57156
+ if (symbol.flags & 32 /* Class */) {
57157
+ var classType = getDeclaredTypeOfClassOrInterface(symbol);
57158
+ var baseConstructorType = getBaseConstructorTypeOfClass(classType);
57159
+ if (baseConstructorType.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 8650752 /* TypeVariable */)) {
57160
+ members = ts.createSymbolTable(getNamedOrIndexSignatureMembers(members));
57161
+ addInheritedMembers(members, getPropertiesOfType(baseConstructorType));
57156
57162
  }
57157
- var indexSymbol = getIndexSymbolFromSymbolTable(members);
57158
- if (indexSymbol) {
57159
- indexInfos = getIndexInfosOfIndexSymbol(indexSymbol);
57163
+ else if (baseConstructorType === anyType) {
57164
+ baseConstructorIndexInfo = createIndexInfo(stringType, anyType, /*isReadonly*/ false);
57160
57165
  }
57161
- else {
57162
- if (baseConstructorIndexInfo) {
57163
- indexInfos = ts.append(indexInfos, baseConstructorIndexInfo);
57164
- }
57165
- if (symbol.flags & 384 /* Enum */ && (getDeclaredTypeOfSymbol(symbol).flags & 32 /* Enum */ ||
57166
- ts.some(type.properties, function (prop) { return !!(getTypeOfSymbol(prop).flags & 296 /* NumberLike */); }))) {
57167
- indexInfos = ts.append(indexInfos, enumNumberIndexInfo);
57168
- }
57166
+ }
57167
+ var indexSymbol = getIndexSymbolFromSymbolTable(members);
57168
+ if (indexSymbol) {
57169
+ indexInfos = getIndexInfosOfIndexSymbol(indexSymbol);
57170
+ }
57171
+ else {
57172
+ if (baseConstructorIndexInfo) {
57173
+ indexInfos = ts.append(indexInfos, baseConstructorIndexInfo);
57169
57174
  }
57170
- setStructuredTypeMembers(type, members, ts.emptyArray, ts.emptyArray, indexInfos || ts.emptyArray);
57171
- // We resolve the members before computing the signatures because a signature may use
57172
- // typeof with a qualified name expression that circularly references the type we are
57173
- // in the process of resolving (see issue #6072). The temporarily empty signature list
57174
- // will never be observed because a qualified name can't reference signatures.
57175
- if (symbol.flags & (16 /* Function */ | 8192 /* Method */)) {
57176
- type.callSignatures = getSignaturesOfSymbol(symbol);
57175
+ if (symbol.flags & 384 /* Enum */ && (getDeclaredTypeOfSymbol(symbol).flags & 32 /* Enum */ ||
57176
+ ts.some(type.properties, function (prop) { return !!(getTypeOfSymbol(prop).flags & 296 /* NumberLike */); }))) {
57177
+ indexInfos = ts.append(indexInfos, enumNumberIndexInfo);
57177
57178
  }
57178
- // And likewise for construct signatures for classes
57179
- if (symbol.flags & 32 /* Class */) {
57180
- var classType_1 = getDeclaredTypeOfClassOrInterface(symbol);
57181
- var constructSignatures = symbol.members ? getSignaturesOfSymbol(symbol.members.get("__constructor" /* Constructor */)) : ts.emptyArray;
57182
- if (symbol.flags & 16 /* Function */) {
57183
- constructSignatures = ts.addRange(constructSignatures.slice(), ts.mapDefined(type.callSignatures, function (sig) { return isJSConstructor(sig.declaration) ?
57184
- createSignature(sig.declaration, sig.typeParameters, sig.thisParameter, sig.parameters, classType_1, /*resolvedTypePredicate*/ undefined, sig.minArgumentCount, sig.flags & 39 /* PropagatingFlags */) :
57185
- undefined; }));
57186
- }
57187
- if (!constructSignatures.length) {
57188
- constructSignatures = getDefaultConstructSignatures(classType_1);
57189
- }
57190
- type.constructSignatures = constructSignatures;
57179
+ }
57180
+ setStructuredTypeMembers(type, members, ts.emptyArray, ts.emptyArray, indexInfos || ts.emptyArray);
57181
+ // We resolve the members before computing the signatures because a signature may use
57182
+ // typeof with a qualified name expression that circularly references the type we are
57183
+ // in the process of resolving (see issue #6072). The temporarily empty signature list
57184
+ // will never be observed because a qualified name can't reference signatures.
57185
+ if (symbol.flags & (16 /* Function */ | 8192 /* Method */)) {
57186
+ type.callSignatures = getSignaturesOfSymbol(symbol);
57187
+ }
57188
+ // And likewise for construct signatures for classes
57189
+ if (symbol.flags & 32 /* Class */) {
57190
+ var classType_1 = getDeclaredTypeOfClassOrInterface(symbol);
57191
+ var constructSignatures = symbol.members ? getSignaturesOfSymbol(symbol.members.get("__constructor" /* Constructor */)) : ts.emptyArray;
57192
+ if (symbol.flags & 16 /* Function */) {
57193
+ constructSignatures = ts.addRange(constructSignatures.slice(), ts.mapDefined(type.callSignatures, function (sig) { return isJSConstructor(sig.declaration) ?
57194
+ createSignature(sig.declaration, sig.typeParameters, sig.thisParameter, sig.parameters, classType_1, /*resolvedTypePredicate*/ undefined, sig.minArgumentCount, sig.flags & 39 /* PropagatingFlags */) :
57195
+ undefined; }));
57196
+ }
57197
+ if (!constructSignatures.length) {
57198
+ constructSignatures = getDefaultConstructSignatures(classType_1);
57191
57199
  }
57200
+ type.constructSignatures = constructSignatures;
57192
57201
  }
57193
57202
  }
57194
57203
  function replaceIndexedAccess(instantiable, type, replacement) {
@@ -58180,8 +58189,8 @@ var ts;
58180
58189
  var stringIndexInfo;
58181
58190
  var applicableInfo;
58182
58191
  var applicableInfos;
58183
- for (var _i = 0, indexInfos_1 = indexInfos; _i < indexInfos_1.length; _i++) {
58184
- var info = indexInfos_1[_i];
58192
+ for (var _i = 0, indexInfos_3 = indexInfos; _i < indexInfos_3.length; _i++) {
58193
+ var info = indexInfos_3[_i];
58185
58194
  if (info.keyType === stringType) {
58186
58195
  stringIndexInfo = info;
58187
58196
  }
@@ -58745,14 +58754,14 @@ var ts;
58745
58754
  }
58746
58755
  function getIndexInfosOfIndexSymbol(indexSymbol) {
58747
58756
  if (indexSymbol.declarations) {
58748
- var indexInfos_2 = [];
58757
+ var indexInfos_4 = [];
58749
58758
  var _loop_14 = function (declaration) {
58750
58759
  if (declaration.parameters.length === 1) {
58751
58760
  var parameter = declaration.parameters[0];
58752
58761
  if (parameter.type) {
58753
58762
  forEachType(getTypeFromTypeNode(parameter.type), function (keyType) {
58754
- if (isValidIndexKeyType(keyType) && !findIndexInfo(indexInfos_2, keyType)) {
58755
- indexInfos_2.push(createIndexInfo(keyType, declaration.type ? getTypeFromTypeNode(declaration.type) : anyType, ts.hasEffectiveModifier(declaration, 64 /* Readonly */), declaration));
58763
+ if (isValidIndexKeyType(keyType) && !findIndexInfo(indexInfos_4, keyType)) {
58764
+ indexInfos_4.push(createIndexInfo(keyType, declaration.type ? getTypeFromTypeNode(declaration.type) : anyType, ts.hasEffectiveModifier(declaration, 64 /* Readonly */), declaration));
58756
58765
  }
58757
58766
  });
58758
58767
  }
@@ -58762,7 +58771,7 @@ var ts;
58762
58771
  var declaration = _a[_i];
58763
58772
  _loop_14(declaration);
58764
58773
  }
58765
- return indexInfos_2;
58774
+ return indexInfos_4;
58766
58775
  }
58767
58776
  return ts.emptyArray;
58768
58777
  }
@@ -59310,7 +59319,7 @@ var ts;
59310
59319
  // The expression is processed as an identifier expression (section 4.3)
59311
59320
  // or property access expression(section 4.10),
59312
59321
  // the widened type(section 3.9) of which becomes the result.
59313
- var type = ts.isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName);
59322
+ var type = checkExpressionWithTypeArguments(node);
59314
59323
  links.resolvedType = getRegularTypeOfLiteralType(getWidenedType(type));
59315
59324
  }
59316
59325
  return links.resolvedType;
@@ -60751,7 +60760,7 @@ var ts;
60751
60760
  }
60752
60761
  var prop = getPropertyOfType(objectType, propName);
60753
60762
  if (prop) {
60754
- if (accessFlags & 64 /* ReportDeprecated */ && accessNode && prop.declarations && getDeclarationNodeFlagsFromSymbol(prop) & 134217728 /* Deprecated */ && isUncalledFunctionReference(accessNode, prop)) {
60763
+ if (accessFlags & 64 /* ReportDeprecated */ && accessNode && prop.declarations && isDeprecatedSymbol(prop) && isUncalledFunctionReference(accessNode, prop)) {
60755
60764
  var deprecatedNode = (_a = accessExpression === null || accessExpression === void 0 ? void 0 : accessExpression.argumentExpression) !== null && _a !== void 0 ? _a : (ts.isIndexedAccessTypeNode(accessNode) ? accessNode.indexType : accessNode);
60756
60765
  addDeprecatedSuggestion(deprecatedNode, prop.declarations, propName);
60757
60766
  }
@@ -62014,7 +62023,9 @@ var ts;
62014
62023
  return result;
62015
62024
  }
62016
62025
  function getObjectTypeInstantiation(type, mapper, aliasSymbol, aliasTypeArguments) {
62017
- var declaration = type.objectFlags & 4 /* Reference */ ? type.node : type.symbol.declarations[0];
62026
+ var declaration = type.objectFlags & 4 /* Reference */ ? type.node :
62027
+ type.objectFlags & 16777216 /* InstantiationExpressionType */ ? type.node :
62028
+ type.symbol.declarations[0];
62018
62029
  var links = getNodeLinks(declaration);
62019
62030
  var target = type.objectFlags & 4 /* Reference */ ? links.resolvedType :
62020
62031
  type.objectFlags & 64 /* Instantiated */ ? type.target : type;
@@ -62030,8 +62041,8 @@ var ts;
62030
62041
  outerTypeParameters = ts.addRange(outerTypeParameters, templateTagParameters);
62031
62042
  }
62032
62043
  typeParameters = outerTypeParameters || ts.emptyArray;
62033
- var allDeclarations_1 = type.objectFlags & 4 /* Reference */ ? [declaration] : type.symbol.declarations;
62034
- typeParameters = (target.objectFlags & 4 /* Reference */ || target.symbol.flags & 8192 /* Method */ || target.symbol.flags & 2048 /* TypeLiteral */) && !target.aliasTypeArguments ?
62044
+ var allDeclarations_1 = type.objectFlags & (4 /* Reference */ | 16777216 /* InstantiationExpressionType */) ? [declaration] : type.symbol.declarations;
62045
+ typeParameters = (target.objectFlags & (4 /* Reference */ | 16777216 /* InstantiationExpressionType */) || target.symbol.flags & 8192 /* Method */ || target.symbol.flags & 2048 /* TypeLiteral */) && !target.aliasTypeArguments ?
62035
62046
  ts.filter(typeParameters, function (tp) { return ts.some(allDeclarations_1, function (d) { return isTypeParameterPossiblyReferenced(tp, d); }); }) :
62036
62047
  typeParameters;
62037
62048
  links.outerTypeParameters = typeParameters;
@@ -62203,6 +62214,9 @@ var ts;
62203
62214
  mapper = combineTypeMappers(makeUnaryTypeMapper(origTypeParameter, freshTypeParameter), mapper);
62204
62215
  freshTypeParameter.mapper = mapper;
62205
62216
  }
62217
+ if (type.objectFlags & 16777216 /* InstantiationExpressionType */) {
62218
+ result.node = type.node;
62219
+ }
62206
62220
  result.target = type;
62207
62221
  result.mapper = mapper;
62208
62222
  result.aliasSymbol = aliasSymbol || type.aliasSymbol;
@@ -65377,8 +65391,8 @@ var ts;
65377
65391
  var indexInfos = getIndexInfosOfType(target);
65378
65392
  var targetHasStringIndex = ts.some(indexInfos, function (info) { return info.keyType === stringType; });
65379
65393
  var result = -1 /* True */;
65380
- for (var _i = 0, indexInfos_3 = indexInfos; _i < indexInfos_3.length; _i++) {
65381
- var targetInfo = indexInfos_3[_i];
65394
+ for (var _i = 0, indexInfos_5 = indexInfos; _i < indexInfos_5.length; _i++) {
65395
+ var targetInfo = indexInfos_5[_i];
65382
65396
  var related = !sourceIsPrimitive && targetHasStringIndex && targetInfo.type.flags & 1 /* Any */ ? -1 /* True */ :
65383
65397
  isGenericMappedType(source) && targetHasStringIndex ? isRelatedTo(getTemplateTypeFromMappedType(source), targetInfo.type, 3 /* Both */, reportErrors) :
65384
65398
  typeRelatedToIndexInfo(source, targetInfo, reportErrors, intersectionState);
@@ -65985,10 +65999,10 @@ var ts;
65985
65999
  if (!(ts.getObjectFlags(type) & 4 /* Reference */) || !(ts.getObjectFlags(type.target) & 3 /* ClassOrInterface */)) {
65986
66000
  return undefined;
65987
66001
  }
65988
- if (ts.getObjectFlags(type) & 33554432 /* IdenticalBaseTypeCalculated */) {
65989
- return ts.getObjectFlags(type) & 67108864 /* IdenticalBaseTypeExists */ ? type.cachedEquivalentBaseType : undefined;
66002
+ if (ts.getObjectFlags(type) & 67108864 /* IdenticalBaseTypeCalculated */) {
66003
+ return ts.getObjectFlags(type) & 134217728 /* IdenticalBaseTypeExists */ ? type.cachedEquivalentBaseType : undefined;
65990
66004
  }
65991
- type.objectFlags |= 33554432 /* IdenticalBaseTypeCalculated */;
66005
+ type.objectFlags |= 67108864 /* IdenticalBaseTypeCalculated */;
65992
66006
  var target = type.target;
65993
66007
  if (ts.getObjectFlags(target) & 1 /* Class */) {
65994
66008
  var baseTypeNode = getBaseTypeNodeOfClass(target);
@@ -66009,7 +66023,7 @@ var ts;
66009
66023
  if (ts.length(getTypeArguments(type)) > ts.length(target.typeParameters)) {
66010
66024
  instantiatedBase = getTypeWithThisArgument(instantiatedBase, ts.last(getTypeArguments(type)));
66011
66025
  }
66012
- type.objectFlags |= 67108864 /* IdenticalBaseTypeExists */;
66026
+ type.objectFlags |= 134217728 /* IdenticalBaseTypeExists */;
66013
66027
  return type.cachedEquivalentBaseType = instantiatedBase;
66014
66028
  }
66015
66029
  function isEmptyLiteralType(type) {
@@ -66673,7 +66687,7 @@ var ts;
66673
66687
  var result = !!(type.flags & 465829888 /* Instantiable */ ||
66674
66688
  type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || ts.forEach(getTypeArguments(type), couldContainTypeVariables)) ||
66675
66689
  objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations ||
66676
- objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 8388608 /* ObjectRestType */)) ||
66690
+ objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 8388608 /* ObjectRestType */ | 16777216 /* InstantiationExpressionType */)) ||
66677
66691
  type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && ts.some(type.types, couldContainTypeVariables));
66678
66692
  if (type.flags & 3899393 /* ObjectFlagsType */) {
66679
66693
  type.objectFlags |= 1048576 /* CouldContainTypeVariablesComputed */ | (result ? 2097152 /* CouldContainTypeVariables */ : 0);
@@ -67590,8 +67604,8 @@ var ts;
67590
67604
  var priority = (ts.getObjectFlags(source) & ts.getObjectFlags(target) & 32 /* Mapped */) ? 8 /* HomomorphicMappedType */ : 0;
67591
67605
  var indexInfos = getIndexInfosOfType(target);
67592
67606
  if (isObjectTypeWithInferableIndex(source)) {
67593
- for (var _i = 0, indexInfos_4 = indexInfos; _i < indexInfos_4.length; _i++) {
67594
- var targetInfo = indexInfos_4[_i];
67607
+ for (var _i = 0, indexInfos_6 = indexInfos; _i < indexInfos_6.length; _i++) {
67608
+ var targetInfo = indexInfos_6[_i];
67595
67609
  var propTypes = [];
67596
67610
  for (var _a = 0, _b = getPropertiesOfType(source); _a < _b.length; _a++) {
67597
67611
  var prop = _b[_a];
@@ -67611,8 +67625,8 @@ var ts;
67611
67625
  }
67612
67626
  }
67613
67627
  }
67614
- for (var _e = 0, indexInfos_5 = indexInfos; _e < indexInfos_5.length; _e++) {
67615
- var targetInfo = indexInfos_5[_e];
67628
+ for (var _e = 0, indexInfos_7 = indexInfos; _e < indexInfos_7.length; _e++) {
67629
+ var targetInfo = indexInfos_7[_e];
67616
67630
  var sourceInfo = getApplicableIndexInfo(source, targetInfo.keyType);
67617
67631
  if (sourceInfo) {
67618
67632
  inferWithPriority(sourceInfo.type, targetInfo.type, priority);
@@ -70154,9 +70168,9 @@ var ts;
70154
70168
  markAliasReferenced(symbol, node);
70155
70169
  }
70156
70170
  var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
70157
- var sourceSymbol = localOrExportSymbol.flags & 2097152 /* Alias */ ? resolveAlias(localOrExportSymbol) : localOrExportSymbol;
70158
- if (sourceSymbol.declarations && getDeclarationNodeFlagsFromSymbol(sourceSymbol) & 134217728 /* Deprecated */ && isUncalledFunctionReference(node, sourceSymbol)) {
70159
- addDeprecatedSuggestion(node, sourceSymbol.declarations, node.escapedText);
70171
+ var targetSymbol = checkDeprecatedAliasedSymbol(localOrExportSymbol, node);
70172
+ if (isDeprecatedSymbol(targetSymbol) && isUncalledFunctionReference(node, targetSymbol) && targetSymbol.declarations) {
70173
+ addDeprecatedSuggestion(node, targetSymbol.declarations, node.escapedText);
70160
70174
  }
70161
70175
  var declaration = localOrExportSymbol.valueDeclaration;
70162
70176
  if (declaration && localOrExportSymbol.flags & 32 /* Class */) {
@@ -73168,7 +73182,7 @@ var ts;
73168
73182
  }
73169
73183
  }
73170
73184
  else {
73171
- if (prop.declarations && getDeclarationNodeFlagsFromSymbol(prop) & 134217728 /* Deprecated */ && isUncalledFunctionReference(node, prop)) {
73185
+ if (isDeprecatedSymbol(prop) && isUncalledFunctionReference(node, prop) && prop.declarations) {
73172
73186
  addDeprecatedSuggestion(right, prop.declarations, right.escapedText);
73173
73187
  }
73174
73188
  checkPropertyNotUsedBeforeDeclaration(prop, node, right);
@@ -74627,7 +74641,7 @@ var ts;
74627
74641
  }
74628
74642
  var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
74629
74643
  ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
74630
- var chain = ts.chainDiagnosticMessages(ts.map(diags_3, function (d) { return typeof d.messageText === "string" ? d : d.messageText; }), ts.Diagnostics.No_overload_matches_this_call);
74644
+ var chain = ts.chainDiagnosticMessages(ts.map(diags_3, ts.createDiagnosticMessageChainFromDiagnostic), ts.Diagnostics.No_overload_matches_this_call);
74631
74645
  // The below is a spread to guarantee we get a new (mutable) array - our `flatMap` helper tries to do "smart" optimizations where it reuses input
74632
74646
  // arrays and the emptyArray singleton where possible, which is decidedly not what we want while we're still constructing this diagnostic
74633
74647
  var related = __spreadArray([], ts.flatMap(diags_3, function (d) { return d.relatedInformation; }), true);
@@ -75782,6 +75796,66 @@ var ts;
75782
75796
  return node.flags & 32 /* OptionalChain */ ? checkNonNullChain(node) :
75783
75797
  getNonNullableType(checkExpression(node.expression));
75784
75798
  }
75799
+ function checkExpressionWithTypeArguments(node) {
75800
+ checkGrammarExpressionWithTypeArguments(node);
75801
+ var exprType = node.kind === 227 /* ExpressionWithTypeArguments */ ? checkExpression(node.expression) :
75802
+ ts.isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) :
75803
+ checkExpression(node.exprName);
75804
+ var typeArguments = node.typeArguments;
75805
+ if (!ts.some(typeArguments)) {
75806
+ return exprType;
75807
+ }
75808
+ var funcType = getApparentType(exprType);
75809
+ if (funcType === silentNeverType || isErrorType(funcType)) {
75810
+ return funcType;
75811
+ }
75812
+ var hasSomeApplicableSignature = false;
75813
+ var nonApplicableType;
75814
+ var hasSignatures;
75815
+ var hasApplicableSignature;
75816
+ var result = mapType(funcType, getInstantiatedType);
75817
+ var errorType = hasSomeApplicableSignature ? nonApplicableType : funcType;
75818
+ if (errorType) {
75819
+ diagnostics.add(ts.createDiagnosticForNodeArray(ts.getSourceFileOfNode(node), typeArguments, ts.Diagnostics.Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable, typeToString(errorType)));
75820
+ }
75821
+ return result;
75822
+ function getInstantiatedType(type) {
75823
+ hasSignatures = false;
75824
+ hasApplicableSignature = false;
75825
+ var result = getInstantiatedTypeWorker(type);
75826
+ hasSomeApplicableSignature || (hasSomeApplicableSignature = hasApplicableSignature);
75827
+ if (hasSignatures && !hasApplicableSignature) {
75828
+ nonApplicableType !== null && nonApplicableType !== void 0 ? nonApplicableType : (nonApplicableType = type);
75829
+ }
75830
+ return result;
75831
+ }
75832
+ function getInstantiatedTypeWorker(type) {
75833
+ if (type.flags & 524288 /* Object */) {
75834
+ var resolved = resolveStructuredTypeMembers(type);
75835
+ var callSignatures = getInstantiatedSignatures(resolved.callSignatures);
75836
+ var constructSignatures = getInstantiatedSignatures(resolved.constructSignatures);
75837
+ hasSignatures || (hasSignatures = resolved.callSignatures.length !== 0 || resolved.constructSignatures.length !== 0);
75838
+ hasApplicableSignature || (hasApplicableSignature = callSignatures.length !== 0 || constructSignatures.length !== 0);
75839
+ if (callSignatures !== resolved.callSignatures || constructSignatures !== resolved.constructSignatures) {
75840
+ var result_11 = createAnonymousType(undefined, resolved.members, callSignatures, constructSignatures, resolved.indexInfos);
75841
+ result_11.objectFlags |= 16777216 /* InstantiationExpressionType */;
75842
+ result_11.node = node;
75843
+ return result_11;
75844
+ }
75845
+ }
75846
+ else if (type.flags & 2097152 /* Intersection */) {
75847
+ return getIntersectionType(ts.sameMap(type.types, getInstantiatedTypeWorker));
75848
+ }
75849
+ return type;
75850
+ }
75851
+ function getInstantiatedSignatures(signatures) {
75852
+ var applicableSignatures = ts.filter(signatures, function (sig) { return !!sig.typeParameters && hasCorrectTypeArgumentArity(sig, typeArguments); });
75853
+ return ts.sameMap(applicableSignatures, function (sig) {
75854
+ var typeArgumentTypes = checkTypeArguments(sig, typeArguments, /*reportErrors*/ true);
75855
+ return typeArgumentTypes ? getSignatureInstantiation(sig, typeArgumentTypes, ts.isInJSFile(sig.declaration)) : sig;
75856
+ });
75857
+ }
75858
+ }
75785
75859
  function checkMetaProperty(node) {
75786
75860
  checkGrammarMetaProperty(node);
75787
75861
  if (node.keywordToken === 103 /* NewKeyword */) {
@@ -78291,6 +78365,8 @@ var ts;
78291
78365
  return checkAssertion(node);
78292
78366
  case 229 /* NonNullExpression */:
78293
78367
  return checkNonNullAssertion(node);
78368
+ case 227 /* ExpressionWithTypeArguments */:
78369
+ return checkExpressionWithTypeArguments(node);
78294
78370
  case 230 /* MetaProperty */:
78295
78371
  return checkMetaProperty(node);
78296
78372
  case 214 /* DeleteExpression */:
@@ -79496,12 +79572,12 @@ var ts;
79496
79572
  case 264 /* ImportEqualsDeclaration */:
79497
79573
  case 267 /* NamespaceImport */:
79498
79574
  case 266 /* ImportClause */:
79499
- var result_11 = 0 /* None */;
79575
+ var result_12 = 0 /* None */;
79500
79576
  var target = resolveAlias(getSymbolOfNode(d));
79501
79577
  ts.forEach(target.declarations, function (d) {
79502
- result_11 |= getDeclarationSpaces(d);
79578
+ result_12 |= getDeclarationSpaces(d);
79503
79579
  });
79504
- return result_11;
79580
+ return result_12;
79505
79581
  case 253 /* VariableDeclaration */:
79506
79582
  case 202 /* BindingElement */:
79507
79583
  case 255 /* FunctionDeclaration */:
@@ -82088,8 +82164,8 @@ var ts;
82088
82164
  }
82089
82165
  }
82090
82166
  if (indexInfos.length > 1) {
82091
- for (var _d = 0, indexInfos_6 = indexInfos; _d < indexInfos_6.length; _d++) {
82092
- var info = indexInfos_6[_d];
82167
+ for (var _d = 0, indexInfos_8 = indexInfos; _d < indexInfos_8.length; _d++) {
82168
+ var info = indexInfos_8[_d];
82093
82169
  checkIndexConstraintForIndexSignature(type, info);
82094
82170
  }
82095
82171
  }
@@ -82115,8 +82191,8 @@ var ts;
82115
82191
  error(errorNode, ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_2_index_type_3, symbolToString(prop), typeToString(propType), typeToString(info.keyType), typeToString(info.type));
82116
82192
  }
82117
82193
  };
82118
- for (var _i = 0, indexInfos_7 = indexInfos; _i < indexInfos_7.length; _i++) {
82119
- var info = indexInfos_7[_i];
82194
+ for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
82195
+ var info = indexInfos_9[_i];
82120
82196
  _loop_27(info);
82121
82197
  }
82122
82198
  }
@@ -82138,8 +82214,8 @@ var ts;
82138
82214
  error(errorNode, ts.Diagnostics._0_index_type_1_is_not_assignable_to_2_index_type_3, typeToString(checkInfo.keyType), typeToString(checkInfo.type), typeToString(info.keyType), typeToString(info.type));
82139
82215
  }
82140
82216
  };
82141
- for (var _i = 0, indexInfos_8 = indexInfos; _i < indexInfos_8.length; _i++) {
82142
- var info = indexInfos_8[_i];
82217
+ for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
82218
+ var info = indexInfos_10[_i];
82143
82219
  _loop_28(info);
82144
82220
  }
82145
82221
  }
@@ -83006,16 +83082,15 @@ var ts;
83006
83082
  return ts.nodeIsMissing(expr) ? 0 : evaluateEnumMember(expr, getSymbolOfNode(member.parent), identifier.escapedText);
83007
83083
  case 206 /* ElementAccessExpression */:
83008
83084
  case 205 /* PropertyAccessExpression */:
83009
- var ex = expr;
83010
- if (isConstantMemberAccess(ex)) {
83011
- var type = getTypeOfExpression(ex.expression);
83085
+ if (isConstantMemberAccess(expr)) {
83086
+ var type = getTypeOfExpression(expr.expression);
83012
83087
  if (type.symbol && type.symbol.flags & 384 /* Enum */) {
83013
83088
  var name = void 0;
83014
- if (ex.kind === 205 /* PropertyAccessExpression */) {
83015
- name = ex.name.escapedText;
83089
+ if (expr.kind === 205 /* PropertyAccessExpression */) {
83090
+ name = expr.name.escapedText;
83016
83091
  }
83017
83092
  else {
83018
- name = ts.escapeLeadingUnderscores(ts.cast(ex.argumentExpression, ts.isLiteralExpression).text);
83093
+ name = ts.escapeLeadingUnderscores(ts.cast(expr.argumentExpression, ts.isLiteralExpression).text);
83019
83094
  }
83020
83095
  return evaluateEnumMember(expr, type.symbol, name);
83021
83096
  }
@@ -83043,6 +83118,10 @@ var ts;
83043
83118
  }
83044
83119
  }
83045
83120
  function isConstantMemberAccess(node) {
83121
+ var type = getTypeOfExpression(node);
83122
+ if (type === errorType) {
83123
+ return false;
83124
+ }
83046
83125
  return node.kind === 79 /* Identifier */ ||
83047
83126
  node.kind === 205 /* PropertyAccessExpression */ && isConstantMemberAccess(node.expression) ||
83048
83127
  node.kind === 206 /* ElementAccessExpression */ && isConstantMemberAccess(node.expression) &&
@@ -83337,7 +83416,6 @@ var ts;
83337
83416
  return true;
83338
83417
  }
83339
83418
  function checkAliasSymbol(node) {
83340
- var _a;
83341
83419
  var symbol = getSymbolOfNode(node);
83342
83420
  var target = resolveAlias(symbol);
83343
83421
  if (target !== unknownSymbol) {
@@ -83393,10 +83471,45 @@ var ts;
83393
83471
  }
83394
83472
  }
83395
83473
  }
83396
- if (ts.isImportSpecifier(node) && ((_a = target.declarations) === null || _a === void 0 ? void 0 : _a.every(function (d) { return !!(ts.getCombinedNodeFlags(d) & 134217728 /* Deprecated */); }))) {
83397
- addDeprecatedSuggestion(node.name, target.declarations, symbol.escapedName);
83474
+ if (ts.isImportSpecifier(node)) {
83475
+ var targetSymbol = checkDeprecatedAliasedSymbol(symbol, node);
83476
+ if (isDeprecatedAliasedSymbol(targetSymbol) && targetSymbol.declarations) {
83477
+ addDeprecatedSuggestion(node, targetSymbol.declarations, targetSymbol.escapedName);
83478
+ }
83479
+ }
83480
+ }
83481
+ }
83482
+ function isDeprecatedAliasedSymbol(symbol) {
83483
+ return !!symbol.declarations && ts.every(symbol.declarations, function (d) { return !!(ts.getCombinedNodeFlags(d) & 134217728 /* Deprecated */); });
83484
+ }
83485
+ function checkDeprecatedAliasedSymbol(symbol, location) {
83486
+ if (!(symbol.flags & 2097152 /* Alias */))
83487
+ return symbol;
83488
+ var targetSymbol = resolveAlias(symbol);
83489
+ if (targetSymbol === unknownSymbol)
83490
+ return targetSymbol;
83491
+ while (symbol.flags & 2097152 /* Alias */) {
83492
+ var target = getImmediateAliasedSymbol(symbol);
83493
+ if (target) {
83494
+ if (target === targetSymbol)
83495
+ break;
83496
+ if (target.declarations && ts.length(target.declarations)) {
83497
+ if (isDeprecatedAliasedSymbol(target)) {
83498
+ addDeprecatedSuggestion(location, target.declarations, target.escapedName);
83499
+ break;
83500
+ }
83501
+ else {
83502
+ if (symbol === targetSymbol)
83503
+ break;
83504
+ symbol = target;
83505
+ }
83506
+ }
83507
+ }
83508
+ else {
83509
+ break;
83398
83510
  }
83399
83511
  }
83512
+ return targetSymbol;
83400
83513
  }
83401
83514
  function checkImportBinding(node) {
83402
83515
  checkCollisionsForDeclarationName(node, node.name);
@@ -87698,7 +87811,7 @@ var ts;
87698
87811
  return factory.updateConstructorTypeNode(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode));
87699
87812
  case 180 /* TypeQuery */:
87700
87813
  ts.Debug.type(node);
87701
- return factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName));
87814
+ return factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode));
87702
87815
  case 181 /* TypeLiteral */:
87703
87816
  ts.Debug.type(node);
87704
87817
  return factory.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor, ts.isTypeElement));
@@ -90590,8 +90703,8 @@ var ts;
90590
90703
  function generateClassElementDecorationExpressions(node, isStatic) {
90591
90704
  var members = getDecoratedClassElements(node, isStatic);
90592
90705
  var expressions;
90593
- for (var _i = 0, members_6 = members; _i < members_6.length; _i++) {
90594
- var member = members_6[_i];
90706
+ for (var _i = 0, members_8 = members; _i < members_8.length; _i++) {
90707
+ var member = members_8[_i];
90595
90708
  var expression = generateClassElementDecorationExpression(node, member);
90596
90709
  if (expression) {
90597
90710
  if (!expressions) {
@@ -95792,8 +95905,8 @@ var ts;
95792
95905
  function convertJsxChildrenToChildrenPropAssignment(children) {
95793
95906
  var nonWhitespaceChildren = ts.getSemanticJsxChildren(children);
95794
95907
  if (ts.length(nonWhitespaceChildren) === 1 && !nonWhitespaceChildren[0].dotDotDotToken) {
95795
- var result_12 = transformJsxChildToExpression(nonWhitespaceChildren[0]);
95796
- return result_12 && factory.createPropertyAssignment("children", result_12);
95908
+ var result_13 = transformJsxChildToExpression(nonWhitespaceChildren[0]);
95909
+ return result_13 && factory.createPropertyAssignment("children", result_13);
95797
95910
  }
95798
95911
  var result = ts.mapDefined(children, transformJsxChildToExpression);
95799
95912
  return ts.length(result) ? factory.createPropertyAssignment("children", factory.createArrayLiteralExpression(result)) : undefined;
@@ -109422,6 +109535,8 @@ var ts;
109422
109535
  return emitAsExpression(node);
109423
109536
  case 229 /* NonNullExpression */:
109424
109537
  return emitNonNullExpression(node);
109538
+ case 227 /* ExpressionWithTypeArguments */:
109539
+ return emitExpressionWithTypeArguments(node);
109425
109540
  case 230 /* MetaProperty */:
109426
109541
  return emitMetaProperty(node);
109427
109542
  case 231 /* SyntheticExpression */:
@@ -109866,6 +109981,7 @@ var ts;
109866
109981
  writeKeyword("typeof");
109867
109982
  writeSpace();
109868
109983
  emit(node.exprName);
109984
+ emitTypeArguments(node, node.typeArguments);
109869
109985
  }
109870
109986
  function emitTypeLiteral(node) {
109871
109987
  writePunctuation("{");
@@ -114825,15 +114941,15 @@ var ts;
114825
114941
  // which per above occurred during the current program creation.
114826
114942
  // Since we assume the filesystem does not change during program creation,
114827
114943
  // it is safe to reuse resolutions from the earlier call.
114828
- var result_13 = [];
114944
+ var result_14 = [];
114829
114945
  var i = 0;
114830
114946
  for (var _i = 0, moduleNames_1 = moduleNames; _i < moduleNames_1.length; _i++) {
114831
114947
  var moduleName = moduleNames_1[_i];
114832
114948
  var resolvedModule = file.resolvedModules.get(moduleName, getModeForResolutionAtIndex(file, i));
114833
114949
  i++;
114834
- result_13.push(resolvedModule);
114950
+ result_14.push(resolvedModule);
114835
114951
  }
114836
- return result_13;
114952
+ return result_14;
114837
114953
  }
114838
114954
  // At this point, we know at least one of the following hold:
114839
114955
  // - file has local declarations for ambient modules
@@ -116055,14 +116171,14 @@ var ts;
116055
116171
  redirectTargetsMap.add(fileFromPackageId.path, fileName);
116056
116172
  addFileToFilesByName(dupFile, path, redirectedPath);
116057
116173
  addFileIncludeReason(dupFile, reason);
116058
- sourceFileToPackageName.set(path, packageId.name);
116174
+ sourceFileToPackageName.set(path, ts.packageIdToPackageName(packageId));
116059
116175
  processingOtherFiles.push(dupFile);
116060
116176
  return dupFile;
116061
116177
  }
116062
116178
  else if (file) {
116063
116179
  // This is the first source file to have this packageId.
116064
116180
  packageIdToSourceFile.set(packageIdKey, file);
116065
- sourceFileToPackageName.set(path, packageId.name);
116181
+ sourceFileToPackageName.set(path, ts.packageIdToPackageName(packageId));
116066
116182
  }
116067
116183
  }
116068
116184
  addFileToFilesByName(file, path, redirectedPath);
@@ -119941,9 +120057,9 @@ var ts;
119941
120057
  if (!preferSymlinks) {
119942
120058
  // Symlinks inside ignored paths are already filtered out of the symlink cache,
119943
120059
  // so we only need to remove them from the realpath filenames.
119944
- var result_14 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
119945
- if (result_14)
119946
- return result_14;
120060
+ var result_15 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
120061
+ if (result_15)
120062
+ return result_15;
119947
120063
  }
119948
120064
  var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
119949
120065
  var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
@@ -119963,10 +120079,10 @@ var ts;
119963
120079
  for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
119964
120080
  var symlinkDirectory = symlinkDirectories_1[_i];
119965
120081
  var option = ts.resolvePath(symlinkDirectory, relative);
119966
- var result_15 = cb(option, target === referenceRedirect);
120082
+ var result_16 = cb(option, target === referenceRedirect);
119967
120083
  shouldFilterIgnoredPaths = true; // We found a non-ignored path in symlinks, so we can reject ignored-path realpaths
119968
- if (result_15)
119969
- return result_15;
120084
+ if (result_16)
120085
+ return result_16;
119970
120086
  }
119971
120087
  });
119972
120088
  });
@@ -124276,7 +124392,7 @@ var ts;
124276
124392
  case 199 /* ImportType */:
124277
124393
  return !node.parent.isTypeOf;
124278
124394
  case 227 /* ExpressionWithTypeArguments */:
124279
- return !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent);
124395
+ return ts.isPartOfTypeNode(node.parent);
124280
124396
  }
124281
124397
  return false;
124282
124398
  }
@@ -127139,11 +127255,11 @@ var ts;
127139
127255
  return ts.isArray(valueOrArray) ? ts.first(valueOrArray) : valueOrArray;
127140
127256
  }
127141
127257
  ts.firstOrOnly = firstOrOnly;
127142
- function getNameForExportedSymbol(symbol, scriptTarget) {
127258
+ function getNameForExportedSymbol(symbol, scriptTarget, preferCapitalized) {
127143
127259
  if (!(symbol.flags & 33554432 /* Transient */) && (symbol.escapedName === "export=" /* ExportEquals */ || symbol.escapedName === "default" /* Default */)) {
127144
127260
  // Name of "export default foo;" is "foo". Name of "export default 0" is the filename converted to camelCase.
127145
127261
  return ts.firstDefined(symbol.declarations, function (d) { var _a; return ts.isExportAssignment(d) ? (_a = ts.tryCast(ts.skipOuterExpressions(d.expression), ts.isIdentifier)) === null || _a === void 0 ? void 0 : _a.text : undefined; })
127146
- || ts.codefix.moduleSymbolToValidIdentifier(getSymbolParentOrFail(symbol), scriptTarget);
127262
+ || ts.codefix.moduleSymbolToValidIdentifier(getSymbolParentOrFail(symbol), scriptTarget, !!preferCapitalized);
127147
127263
  }
127148
127264
  return symbol.name;
127149
127265
  }
@@ -127271,7 +127387,7 @@ var ts;
127271
127387
  symbols.clear();
127272
127388
  usableByFileName = undefined;
127273
127389
  },
127274
- add: function (importingFile, symbol, symbolTableKey, moduleSymbol, moduleFile, exportKind, isFromPackageJson, scriptTarget, checker) {
127390
+ add: function (importingFile, symbol, symbolTableKey, moduleSymbol, moduleFile, exportKind, isFromPackageJson, checker) {
127275
127391
  if (importingFile !== usableByFileName) {
127276
127392
  cache.clear();
127277
127393
  usableByFileName = importingFile;
@@ -127287,7 +127403,7 @@ var ts;
127287
127403
  // get a better name.
127288
127404
  var importedName = exportKind === 0 /* Named */ || ts.isExternalModuleSymbol(namedSymbol)
127289
127405
  ? ts.unescapeLeadingUnderscores(symbolTableKey)
127290
- : ts.getNameForExportedSymbol(namedSymbol, scriptTarget);
127406
+ : ts.getNameForExportedSymbol(namedSymbol, /*scriptTarget*/ undefined);
127291
127407
  var moduleName = ts.stripQuotes(moduleSymbol.name);
127292
127408
  var id = exportInfoId++;
127293
127409
  var target = ts.skipAlias(symbol, checker);
@@ -127320,7 +127436,14 @@ var ts;
127320
127436
  return;
127321
127437
  exportInfo.forEach(function (info, key) {
127322
127438
  var _a = parseKey(key), symbolName = _a.symbolName, ambientModuleName = _a.ambientModuleName;
127323
- action(info.map(rehydrateCachedInfo), symbolName, !!ambientModuleName, key);
127439
+ var rehydrated = info.map(rehydrateCachedInfo);
127440
+ action(rehydrated, function (preferCapitalized) {
127441
+ var _a = rehydrated[0], symbol = _a.symbol, exportKind = _a.exportKind;
127442
+ var namedSymbol = exportKind === 1 /* Default */ && ts.getLocalSymbolForExportDefault(symbol) || symbol;
127443
+ return preferCapitalized
127444
+ ? ts.getNameForExportedSymbol(namedSymbol, /*scriptTarget*/ undefined, /*preferCapitalized*/ true)
127445
+ : symbolName;
127446
+ }, !!ambientModuleName, key);
127324
127447
  });
127325
127448
  },
127326
127449
  releaseSymbols: function () {
@@ -127502,7 +127625,6 @@ var ts;
127502
127625
  }
127503
127626
  (_d = host.log) === null || _d === void 0 ? void 0 : _d.call(host, "getExportInfoMap: cache miss or empty; calculating new results");
127504
127627
  var compilerOptions = program.getCompilerOptions();
127505
- var scriptTarget = ts.getEmitScriptTarget(compilerOptions);
127506
127628
  var moduleCount = 0;
127507
127629
  forEachExternalModuleToImportFrom(program, host, /*useAutoImportProvider*/ true, function (moduleSymbol, moduleFile, program, isFromPackageJson) {
127508
127630
  if (++moduleCount % 100 === 0)
@@ -127513,11 +127635,11 @@ var ts;
127513
127635
  // Note: I think we shouldn't actually see resolved module symbols here, but weird merges
127514
127636
  // can cause it to happen: see 'completionsImport_mergedReExport.ts'
127515
127637
  if (defaultInfo && isImportableSymbol(defaultInfo.symbol, checker)) {
127516
- cache.add(importingFile.path, defaultInfo.symbol, defaultInfo.exportKind === 1 /* Default */ ? "default" /* Default */ : "export=" /* ExportEquals */, moduleSymbol, moduleFile, defaultInfo.exportKind, isFromPackageJson, scriptTarget, checker);
127638
+ cache.add(importingFile.path, defaultInfo.symbol, defaultInfo.exportKind === 1 /* Default */ ? "default" /* Default */ : "export=" /* ExportEquals */, moduleSymbol, moduleFile, defaultInfo.exportKind, isFromPackageJson, checker);
127517
127639
  }
127518
127640
  checker.forEachExportAndPropertyOfModule(moduleSymbol, function (exported, key) {
127519
127641
  if (exported !== (defaultInfo === null || defaultInfo === void 0 ? void 0 : defaultInfo.symbol) && isImportableSymbol(exported, checker) && ts.addToSeen(seenExports, key)) {
127520
- cache.add(importingFile.path, exported, key, moduleSymbol, moduleFile, 0 /* Named */, isFromPackageJson, scriptTarget, checker);
127642
+ cache.add(importingFile.path, exported, key, moduleSymbol, moduleFile, 0 /* Named */, isFromPackageJson, checker);
127521
127643
  }
127522
127644
  });
127523
127645
  });
@@ -129591,6 +129713,8 @@ var ts;
129591
129713
  CompletionSource["ThisProperty"] = "ThisProperty/";
129592
129714
  /** Auto-import that comes attached to a class member snippet */
129593
129715
  CompletionSource["ClassMemberSnippet"] = "ClassMemberSnippet/";
129716
+ /** A type-only import that needs to be promoted in order to be used at the completion location */
129717
+ CompletionSource["TypeOnlyAlias"] = "TypeOnlyAlias/";
129594
129718
  })(CompletionSource = Completions.CompletionSource || (Completions.CompletionSource = {}));
129595
129719
  var SymbolOriginInfoKind;
129596
129720
  (function (SymbolOriginInfoKind) {
@@ -129600,6 +129724,7 @@ var ts;
129600
129724
  SymbolOriginInfoKind[SymbolOriginInfoKind["Promise"] = 8] = "Promise";
129601
129725
  SymbolOriginInfoKind[SymbolOriginInfoKind["Nullable"] = 16] = "Nullable";
129602
129726
  SymbolOriginInfoKind[SymbolOriginInfoKind["ResolvedExport"] = 32] = "ResolvedExport";
129727
+ SymbolOriginInfoKind[SymbolOriginInfoKind["TypeOnlyAlias"] = 64] = "TypeOnlyAlias";
129603
129728
  SymbolOriginInfoKind[SymbolOriginInfoKind["SymbolMemberNoExport"] = 2] = "SymbolMemberNoExport";
129604
129729
  SymbolOriginInfoKind[SymbolOriginInfoKind["SymbolMemberExport"] = 6] = "SymbolMemberExport";
129605
129730
  })(SymbolOriginInfoKind || (SymbolOriginInfoKind = {}));
@@ -129627,6 +129752,9 @@ var ts;
129627
129752
  function originIsNullableMember(origin) {
129628
129753
  return !!(origin.kind & 16 /* Nullable */);
129629
129754
  }
129755
+ function originIsTypeOnlyAlias(origin) {
129756
+ return !!(origin && origin.kind & 64 /* TypeOnlyAlias */);
129757
+ }
129630
129758
  var KeywordCompletionFilters;
129631
129759
  (function (KeywordCompletionFilters) {
129632
129760
  KeywordCompletionFilters[KeywordCompletionFilters["None"] = 0] = "None";
@@ -130031,6 +130159,9 @@ var ts;
130031
130159
  isSnippet = preferences.includeCompletionsWithSnippetText ? true : undefined;
130032
130160
  }
130033
130161
  }
130162
+ if ((origin === null || origin === void 0 ? void 0 : origin.kind) === 64 /* TypeOnlyAlias */) {
130163
+ hasAction = true;
130164
+ }
130034
130165
  if (preferences.includeCompletionsWithClassMemberSnippets &&
130035
130166
  preferences.includeCompletionsWithInsertText &&
130036
130167
  completionKind === 3 /* MemberLike */ &&
@@ -130375,6 +130506,9 @@ var ts;
130375
130506
  if ((origin === null || origin === void 0 ? void 0 : origin.kind) === 1 /* ThisType */) {
130376
130507
  return CompletionSource.ThisProperty;
130377
130508
  }
130509
+ if ((origin === null || origin === void 0 ? void 0 : origin.kind) === 64 /* TypeOnlyAlias */) {
130510
+ return CompletionSource.TypeOnlyAlias;
130511
+ }
130378
130512
  }
130379
130513
  function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextIdMap, isJsxIdentifierExpected, isRightOfOpenTag) {
130380
130514
  var _a;
@@ -130402,7 +130536,7 @@ var ts;
130402
130536
  continue;
130403
130537
  }
130404
130538
  /** True for locals; false for globals, module exports from other files, `this.` completions. */
130405
- var shouldShadowLaterSymbols = !origin && !(symbol.parent === undefined && !ts.some(symbol.declarations, function (d) { return d.getSourceFile() === location.getSourceFile(); }));
130539
+ var shouldShadowLaterSymbols = (!origin || originIsTypeOnlyAlias(origin)) && !(symbol.parent === undefined && !ts.some(symbol.declarations, function (d) { return d.getSourceFile() === location.getSourceFile(); }));
130406
130540
  uniques.set(name, shouldShadowLaterSymbols);
130407
130541
  ts.insertSorted(entries, entry, compareCompletionEntries, /*allowDuplicates*/ true);
130408
130542
  }
@@ -130415,6 +130549,7 @@ var ts;
130415
130549
  add: function (name) { return uniques.set(name, true); },
130416
130550
  };
130417
130551
  function shouldIncludeSymbol(symbol, symbolToSortTextIdMap) {
130552
+ var allFlags = symbol.flags;
130418
130553
  if (!ts.isSourceFile(location)) {
130419
130554
  // export = /**/ here we want to get all meanings, so any symbol is ok
130420
130555
  if (ts.isExportAssignment(location.parent)) {
@@ -130440,11 +130575,10 @@ var ts;
130440
130575
  || symbolToSortTextIdMap[ts.getSymbolId(symbolOrigin)] === 11 /* LocationPriority */)) {
130441
130576
  return false;
130442
130577
  }
130443
- // Continue with origin symbol
130444
- symbol = symbolOrigin;
130578
+ allFlags |= ts.getCombinedLocalAndExportSymbolFlags(symbolOrigin);
130445
130579
  // import m = /**/ <-- It can only access namespace (if typing import = x. this would get member symbols and not namespace)
130446
130580
  if (ts.isInRightSideOfInternalImportEqualsDeclaration(location)) {
130447
- return !!(symbol.flags & 1920 /* Namespace */);
130581
+ return !!(allFlags & 1920 /* Namespace */);
130448
130582
  }
130449
130583
  if (isTypeOnlyLocation) {
130450
130584
  // It's a type, but you can reach it by namespace.type as well
@@ -130452,7 +130586,7 @@ var ts;
130452
130586
  }
130453
130587
  }
130454
130588
  // expressions are value space (which includes the value namespaces)
130455
- return !!(ts.getCombinedLocalAndExportSymbolFlags(symbol) & 111551 /* Value */);
130589
+ return !!(allFlags & 111551 /* Value */);
130456
130590
  }
130457
130591
  }
130458
130592
  Completions.getCompletionEntriesFromSymbols = getCompletionEntriesFromSymbols;
@@ -130586,8 +130720,7 @@ var ts;
130586
130720
  Completions.createCompletionDetails = createCompletionDetails;
130587
130721
  function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source) {
130588
130722
  if (data === null || data === void 0 ? void 0 : data.moduleSpecifier) {
130589
- var _a = getRelevantTokens(position, sourceFile), contextToken_3 = _a.contextToken, previousToken_2 = _a.previousToken;
130590
- if (previousToken_2 && getImportStatementCompletionInfo(contextToken_3 || previousToken_2).replacementNode) {
130723
+ if (previousToken && getImportStatementCompletionInfo(contextToken || previousToken).replacementNode) {
130591
130724
  // Import statement completion: 'import c|'
130592
130725
  return { codeActions: undefined, sourceDisplay: [ts.textPart(data.moduleSpecifier)] };
130593
130726
  }
@@ -130605,13 +130738,19 @@ var ts;
130605
130738
  };
130606
130739
  }
130607
130740
  }
130741
+ if (originIsTypeOnlyAlias(origin)) {
130742
+ var codeAction_1 = ts.codefix.getPromoteTypeOnlyCompletionAction(sourceFile, origin.declaration.name, program, host, formatContext, preferences);
130743
+ ts.Debug.assertIsDefined(codeAction_1, "Expected to have a code action for promoting type-only alias");
130744
+ return { codeActions: [codeAction_1], sourceDisplay: undefined };
130745
+ }
130608
130746
  if (!origin || !(originIsExport(origin) || originIsResolvedExport(origin))) {
130609
130747
  return { codeActions: undefined, sourceDisplay: undefined };
130610
130748
  }
130611
130749
  var checker = origin.isFromPackageJson ? host.getPackageJsonAutoImportProvider().getTypeChecker() : program.getTypeChecker();
130612
130750
  var moduleSymbol = origin.moduleSymbol;
130613
130751
  var targetSymbol = checker.getMergedSymbol(ts.skipAlias(symbol.exportSymbol || symbol, checker));
130614
- var _b = ts.codefix.getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, ts.getNameForExportedSymbol(symbol, ts.getEmitScriptTarget(compilerOptions)), host, program, formatContext, previousToken && ts.isIdentifier(previousToken) ? previousToken.getStart(sourceFile) : position, preferences), moduleSpecifier = _b.moduleSpecifier, codeAction = _b.codeAction;
130752
+ var isJsxOpeningTagName = (contextToken === null || contextToken === void 0 ? void 0 : contextToken.kind) === 29 /* LessThanToken */ && ts.isJsxOpeningLikeElement(contextToken.parent);
130753
+ var _a = ts.codefix.getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, ts.getNameForExportedSymbol(symbol, ts.getEmitScriptTarget(compilerOptions), isJsxOpeningTagName), isJsxOpeningTagName, host, program, formatContext, previousToken && ts.isIdentifier(previousToken) ? previousToken.getStart(sourceFile) : position, preferences), moduleSpecifier = _a.moduleSpecifier, codeAction = _a.codeAction;
130615
130754
  ts.Debug.assert(!(data === null || data === void 0 ? void 0 : data.moduleSpecifier) || moduleSpecifier === data.moduleSpecifier);
130616
130755
  return { sourceDisplay: [ts.textPart(moduleSpecifier)], codeActions: [codeAction] };
130617
130756
  }
@@ -131281,21 +131420,29 @@ var ts;
131281
131420
  var scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile) || sourceFile;
131282
131421
  isInSnippetScope = isSnippetScope(scopeNode);
131283
131422
  var symbolMeanings = (isTypeOnlyLocation ? 0 /* None */ : 111551 /* Value */) | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */;
131423
+ var typeOnlyAliasNeedsPromotion = previousToken && !ts.isValidTypeOnlyAliasUseSite(previousToken);
131284
131424
  symbols = ts.concatenate(symbols, typeChecker.getSymbolsInScope(scopeNode, symbolMeanings));
131285
131425
  ts.Debug.assertEachIsDefined(symbols, "getSymbolsInScope() should all be defined");
131286
- for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) {
131287
- var symbol = symbols_1[_i];
131426
+ for (var i = 0; i < symbols.length; i++) {
131427
+ var symbol = symbols[i];
131288
131428
  if (!typeChecker.isArgumentsSymbol(symbol) &&
131289
131429
  !ts.some(symbol.declarations, function (d) { return d.getSourceFile() === sourceFile; })) {
131290
131430
  symbolToSortTextIdMap[ts.getSymbolId(symbol)] = 15 /* GlobalsOrKeywords */;
131291
131431
  }
131432
+ if (typeOnlyAliasNeedsPromotion && !(symbol.flags & 111551 /* Value */)) {
131433
+ var typeOnlyAliasDeclaration = symbol.declarations && ts.find(symbol.declarations, ts.isTypeOnlyImportOrExportDeclaration);
131434
+ if (typeOnlyAliasDeclaration) {
131435
+ var origin = { kind: 64 /* TypeOnlyAlias */, declaration: typeOnlyAliasDeclaration };
131436
+ symbolToOriginInfoMap[i] = origin;
131437
+ }
131438
+ }
131292
131439
  }
131293
131440
  // Need to insert 'this.' before properties of `this` type, so only do that if `includeInsertTextCompletions`
131294
131441
  if (preferences.includeCompletionsWithInsertText && scopeNode.kind !== 303 /* SourceFile */) {
131295
131442
  var thisType = typeChecker.tryGetThisTypeAt(scopeNode, /*includeGlobalThis*/ false);
131296
131443
  if (thisType && !isProbablyGlobalType(thisType, sourceFile, typeChecker)) {
131297
- for (var _a = 0, _b = getPropertiesForCompletion(thisType, typeChecker); _a < _b.length; _a++) {
131298
- var symbol = _b[_a];
131444
+ for (var _i = 0, _a = getPropertiesForCompletion(thisType, typeChecker); _i < _a.length; _i++) {
131445
+ var symbol = _a[_i];
131299
131446
  symbolToOriginInfoMap[symbols.length] = { kind: 1 /* ThisType */ };
131300
131447
  symbols.push(symbol);
131301
131448
  symbolToSortTextIdMap[ts.getSymbolId(symbol)] = 14 /* SuggestedClassMembers */;
@@ -131398,7 +131545,8 @@ var ts;
131398
131545
  var packageJsonAutoImportProvider = (_b = host.getPackageJsonAutoImportProvider) === null || _b === void 0 ? void 0 : _b.call(host);
131399
131546
  var packageJsonFilter = detailsEntryId ? undefined : ts.createPackageJsonImportFilter(sourceFile, preferences, host);
131400
131547
  resolvingModuleSpecifiers("collectAutoImports", host, program, sourceFile, preferences, !!importCompletionNode, function (context) {
131401
- exportInfo.forEach(sourceFile.path, function (info, symbolName, isFromAmbientModule, exportMapKey) {
131548
+ exportInfo.forEach(sourceFile.path, function (info, getSymbolName, isFromAmbientModule, exportMapKey) {
131549
+ var symbolName = getSymbolName(/*preferCapitalized*/ isRightOfOpenTag);
131402
131550
  if (!ts.isIdentifierText(symbolName, ts.getEmitScriptTarget(host.getCompilationSettings())))
131403
131551
  return;
131404
131552
  if (!detailsEntryId && ts.isStringANonContextualKeyword(symbolName))
@@ -131408,6 +131556,10 @@ var ts;
131408
131556
  return;
131409
131557
  if (isTypeOnlyLocation && !(info[0].targetFlags & (1536 /* Module */ | 788968 /* Type */)))
131410
131558
  return;
131559
+ // Do not try to auto-import something with a lowercase first letter for a JSX tag
131560
+ var firstChar = symbolName.charCodeAt(0);
131561
+ if (isRightOfOpenTag && (firstChar < 65 /* A */ || firstChar > 90 /* Z */))
131562
+ return;
131411
131563
  var isCompletionDetailsMatch = detailsEntryId && ts.some(info, function (i) { return detailsEntryId.source === ts.stripQuotes(i.moduleSymbol.name); });
131412
131564
  if (isCompletionDetailsMatch || !detailsEntryId && charactersFuzzyMatchInString(symbolName, lowerCaseTokenText)) {
131413
131565
  var defaultExportInfo = ts.find(info, isImportableExportInfo);
@@ -131484,16 +131636,19 @@ var ts;
131484
131636
  return true;
131485
131637
  }
131486
131638
  if (contextToken.kind === 31 /* GreaterThanToken */ && contextToken.parent) {
131639
+ // <Component<string> /**/ />
131640
+ // <Component<string> /**/ ><Component>
131641
+ // - contextToken: GreaterThanToken (before cursor)
131642
+ // - location: JsxSelfClosingElement or JsxOpeningElement
131643
+ // - contextToken.parent === location
131644
+ if (location === contextToken.parent && (location.kind === 279 /* JsxOpeningElement */ || location.kind === 278 /* JsxSelfClosingElement */)) {
131645
+ return false;
131646
+ }
131487
131647
  if (contextToken.parent.kind === 279 /* JsxOpeningElement */) {
131488
- // Two possibilities:
131489
- // 1. <div>/**/
131490
- // - contextToken: GreaterThanToken (before cursor)
131491
- // - location: JSXElement
131492
- // - different parents (JSXOpeningElement, JSXElement)
131493
- // 2. <Component<string> /**/>
131494
- // - contextToken: GreaterThanToken (before cursor)
131495
- // - location: GreaterThanToken (after cursor)
131496
- // - same parent (JSXOpeningElement)
131648
+ // <div>/**/
131649
+ // - contextToken: GreaterThanToken (before cursor)
131650
+ // - location: JSXElement
131651
+ // - different parents (JSXOpeningElement, JSXElement)
131497
131652
  return location.parent.kind !== 279 /* JsxOpeningElement */;
131498
131653
  }
131499
131654
  if (contextToken.parent.kind === 280 /* JsxClosingElement */ || contextToken.parent.kind === 278 /* JsxSelfClosingElement */) {
@@ -132694,10 +132849,14 @@ var ts;
132694
132849
  /** True if symbol is a type or a module containing at least one type. */
132695
132850
  function symbolCanBeReferencedAtTypeLocation(symbol, checker, seenModules) {
132696
132851
  if (seenModules === void 0) { seenModules = new ts.Map(); }
132697
- var sym = ts.skipAlias(symbol.exportSymbol || symbol, checker);
132698
- return !!(sym.flags & 788968 /* Type */) || checker.isUnknownSymbol(sym) ||
132699
- !!(sym.flags & 1536 /* Module */) && ts.addToSeen(seenModules, ts.getSymbolId(sym)) &&
132700
- checker.getExportsOfModule(sym).some(function (e) { return symbolCanBeReferencedAtTypeLocation(e, checker, seenModules); });
132852
+ // Since an alias can be merged with a local declaration, we need to test both the alias and its target.
132853
+ // This code used to just test the result of `skipAlias`, but that would ignore any locally introduced meanings.
132854
+ return nonAliasCanBeReferencedAtTypeLocation(symbol) || nonAliasCanBeReferencedAtTypeLocation(ts.skipAlias(symbol.exportSymbol || symbol, checker));
132855
+ function nonAliasCanBeReferencedAtTypeLocation(symbol) {
132856
+ return !!(symbol.flags & 788968 /* Type */) || checker.isUnknownSymbol(symbol) ||
132857
+ !!(symbol.flags & 1536 /* Module */) && ts.addToSeen(seenModules, ts.getSymbolId(symbol)) &&
132858
+ checker.getExportsOfModule(symbol).some(function (e) { return symbolCanBeReferencedAtTypeLocation(e, checker, seenModules); });
132859
+ }
132701
132860
  }
132702
132861
  function isDeprecated(symbol, checker) {
132703
132862
  var declarations = ts.skipAlias(symbol, checker).declarations;
@@ -134951,8 +135110,8 @@ var ts;
134951
135110
  var sourceId = ts.getNodeId(sourceFile);
134952
135111
  var seenSymbols = this.sourceFileToSeenSymbols[sourceId] || (this.sourceFileToSeenSymbols[sourceId] = new ts.Set());
134953
135112
  var anyNewSymbols = false;
134954
- for (var _i = 0, symbols_2 = symbols; _i < symbols_2.length; _i++) {
134955
- var sym = symbols_2[_i];
135113
+ for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) {
135114
+ var sym = symbols_1[_i];
134956
135115
  anyNewSymbols = ts.tryAddToSet(seenSymbols, ts.getSymbolId(sym)) || anyNewSymbols;
134957
135116
  }
134958
135117
  return anyNewSymbols;
@@ -141912,6 +142071,8 @@ var ts;
141912
142071
  }
141913
142072
  if (flags & 16 /* Function */)
141914
142073
  return isLocalVariableOrFunction(symbol) ? "local function" /* localFunctionElement */ : "function" /* functionElement */;
142074
+ // FIXME: getter and setter use the same symbol. And it is rare to use only setter without getter, so in most cases the symbol always has getter flag.
142075
+ // So, even when the location is just on the declaration of setter, this function returns getter.
141915
142076
  if (flags & 32768 /* GetAccessor */)
141916
142077
  return "getter" /* memberGetAccessorElement */;
141917
142078
  if (flags & 65536 /* SetAccessor */)
@@ -141998,9 +142159,24 @@ var ts;
141998
142159
  }
141999
142160
  // Class at constructor site need to be shown as constructor apart from property,method, vars
142000
142161
  if (symbolKind !== "" /* unknown */ || symbolFlags & 32 /* Class */ || symbolFlags & 2097152 /* Alias */) {
142001
- // If it is accessor they are allowed only if location is at name of the accessor
142162
+ // If symbol is accessor, they are allowed only if location is at declaration identifier of the accessor
142002
142163
  if (symbolKind === "getter" /* memberGetAccessorElement */ || symbolKind === "setter" /* memberSetAccessorElement */) {
142003
- symbolKind = "property" /* memberVariableElement */;
142164
+ var declaration = ts.find(symbol.declarations, function (declaration) { return declaration.name === location; });
142165
+ if (declaration) {
142166
+ switch (declaration.kind) {
142167
+ case 171 /* GetAccessor */:
142168
+ symbolKind = "getter" /* memberGetAccessorElement */;
142169
+ break;
142170
+ case 172 /* SetAccessor */:
142171
+ symbolKind = "setter" /* memberSetAccessorElement */;
142172
+ break;
142173
+ default:
142174
+ ts.Debug.assertNever(declaration);
142175
+ }
142176
+ }
142177
+ else {
142178
+ symbolKind = "property" /* memberVariableElement */;
142179
+ }
142004
142180
  }
142005
142181
  var signature = void 0;
142006
142182
  type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location);
@@ -142314,6 +142490,8 @@ var ts;
142314
142490
  }
142315
142491
  // For properties, variables and local vars: show the type
142316
142492
  if (symbolKind === "property" /* memberVariableElement */ ||
142493
+ symbolKind === "getter" /* memberGetAccessorElement */ ||
142494
+ symbolKind === "setter" /* memberSetAccessorElement */ ||
142317
142495
  symbolKind === "JSX attribute" /* jsxAttribute */ ||
142318
142496
  symbolFlags & 3 /* Variable */ ||
142319
142497
  symbolKind === "local var" /* localVariableElement */ ||
@@ -142384,7 +142562,7 @@ var ts;
142384
142562
  }
142385
142563
  }
142386
142564
  if (tags.length === 0 && !hasMultipleSignatures) {
142387
- tags = symbol.getJsDocTags(typeChecker);
142565
+ tags = symbol.getContextualJsDocTags(enclosingDeclaration, typeChecker);
142388
142566
  }
142389
142567
  if (documentation.length === 0 && documentationFromAlias) {
142390
142568
  documentation = documentationFromAlias;
@@ -145804,6 +145982,7 @@ var ts;
145804
145982
  ChangeTracker.prototype.delete = function (sourceFile, node) {
145805
145983
  this.deletedNodes.push({ sourceFile: sourceFile, node: node });
145806
145984
  };
145985
+ /** Stop! Consider using `delete` instead, which has logic for deleting nodes from delimited lists. */
145807
145986
  ChangeTracker.prototype.deleteNode = function (sourceFile, node, options) {
145808
145987
  if (options === void 0) { options = { leadingTriviaOption: LeadingTriviaOption.IncludeAll }; }
145809
145988
  this.deleteRange(sourceFile, getAdjustedRange(sourceFile, node, node, options));
@@ -146207,6 +146386,15 @@ var ts;
146207
146386
  ChangeTracker.prototype.insertExportModifier = function (sourceFile, node) {
146208
146387
  this.insertText(sourceFile, node.getStart(sourceFile), "export ");
146209
146388
  };
146389
+ ChangeTracker.prototype.insertImportSpecifierAtIndex = function (sourceFile, importSpecifier, namedImports, index) {
146390
+ var prevSpecifier = namedImports.elements[index - 1];
146391
+ if (prevSpecifier) {
146392
+ this.insertNodeInListAfter(sourceFile, prevSpecifier, importSpecifier);
146393
+ }
146394
+ else {
146395
+ this.insertNodeBefore(sourceFile, namedImports.elements[0], importSpecifier, !ts.positionsAreOnSameLine(namedImports.elements[0].getStart(), namedImports.parent.parent.getStart(), sourceFile));
146396
+ }
146397
+ };
146210
146398
  /**
146211
146399
  * This function should be used to insert nodes in lists when nodes don't carry separators as the part of the node range,
146212
146400
  * i.e. arguments in arguments lists, parameters in parameter lists etc.
@@ -149709,7 +149897,8 @@ var ts;
149709
149897
  ts.Diagnostics.Cannot_find_namespace_0.code,
149710
149898
  ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code,
149711
149899
  ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here.code,
149712
- ts.Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer.code
149900
+ ts.Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer.code,
149901
+ ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type.code,
149713
149902
  ];
149714
149903
  codefix.registerCodeFix({
149715
149904
  errorCodes: errorCodes,
@@ -149755,7 +149944,7 @@ var ts;
149755
149944
  var symbolName = ts.getNameForExportedSymbol(exportedSymbol, ts.getEmitScriptTarget(compilerOptions));
149756
149945
  var checker = program.getTypeChecker();
149757
149946
  var symbol = checker.getMergedSymbol(ts.skipAlias(exportedSymbol, checker));
149758
- var exportInfos = getAllReExportingModules(sourceFile, symbol, moduleSymbol, symbolName, host, program, preferences, useAutoImportProvider);
149947
+ var exportInfos = getAllReExportingModules(sourceFile, symbol, moduleSymbol, symbolName, /*isJsxTagName*/ false, host, program, preferences, useAutoImportProvider);
149759
149948
  var useRequire = shouldUseRequire(sourceFile, program);
149760
149949
  var fix = getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, symbolName, program, /*position*/ undefined, !!isValidTypeOnlyUseSite, useRequire, host, preferences);
149761
149950
  if (fix) {
@@ -149814,6 +150003,9 @@ var ts;
149814
150003
  }
149815
150004
  break;
149816
150005
  }
150006
+ case 4 /* PromoteTypeOnly */:
150007
+ // Excluding from fix-all
150008
+ break;
149817
150009
  default:
149818
150010
  ts.Debug.assertNever(fix, "fix wasn't never - got kind " + fix.kind);
149819
150011
  }
@@ -149905,6 +150097,7 @@ var ts;
149905
150097
  ImportFixKind[ImportFixKind["JsdocTypeImport"] = 1] = "JsdocTypeImport";
149906
150098
  ImportFixKind[ImportFixKind["AddToExisting"] = 2] = "AddToExisting";
149907
150099
  ImportFixKind[ImportFixKind["AddNew"] = 3] = "AddNew";
150100
+ ImportFixKind[ImportFixKind["PromoteTypeOnly"] = 4] = "PromoteTypeOnly";
149908
150101
  })(ImportFixKind || (ImportFixKind = {}));
149909
150102
  // These should not be combined as bitflags, but are given powers of 2 values to
149910
150103
  // easily detect conflicts between `NotAllowed` and `Required` by giving them a unique sum.
@@ -149916,11 +150109,11 @@ var ts;
149916
150109
  AddAsTypeOnly[AddAsTypeOnly["Required"] = 2] = "Required";
149917
150110
  AddAsTypeOnly[AddAsTypeOnly["NotAllowed"] = 4] = "NotAllowed";
149918
150111
  })(AddAsTypeOnly || (AddAsTypeOnly = {}));
149919
- function getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, symbolName, host, program, formatContext, position, preferences) {
150112
+ function getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, symbolName, isJsxTagName, host, program, formatContext, position, preferences) {
149920
150113
  var compilerOptions = program.getCompilerOptions();
149921
150114
  var exportInfos = ts.pathIsBareSpecifier(ts.stripQuotes(moduleSymbol.name))
149922
150115
  ? [getSymbolExportInfoForSymbol(targetSymbol, moduleSymbol, program, host)]
149923
- : getAllReExportingModules(sourceFile, targetSymbol, moduleSymbol, symbolName, host, program, preferences, /*useAutoImportProvider*/ true);
150116
+ : getAllReExportingModules(sourceFile, targetSymbol, moduleSymbol, symbolName, isJsxTagName, host, program, preferences, /*useAutoImportProvider*/ true);
149924
150117
  var useRequire = shouldUseRequire(sourceFile, program);
149925
150118
  var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(ts.getTokenAtPosition(sourceFile, position));
149926
150119
  var fix = ts.Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, symbolName, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences));
@@ -149930,6 +150123,13 @@ var ts;
149930
150123
  };
149931
150124
  }
149932
150125
  codefix.getImportCompletionAction = getImportCompletionAction;
150126
+ function getPromoteTypeOnlyCompletionAction(sourceFile, symbolToken, program, host, formatContext, preferences) {
150127
+ var compilerOptions = program.getCompilerOptions();
150128
+ var symbolName = getSymbolName(sourceFile, program.getTypeChecker(), symbolToken, compilerOptions);
150129
+ var fix = getTypeOnlyPromotionFix(sourceFile, symbolToken, symbolName, program);
150130
+ return fix && codeFixActionToCodeAction(codeActionForFix({ host: host, formatContext: formatContext, preferences: preferences }, sourceFile, symbolName, fix, 1 /* Double */, compilerOptions));
150131
+ }
150132
+ codefix.getPromoteTypeOnlyCompletionAction = getPromoteTypeOnlyCompletionAction;
149933
150133
  function getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, symbolName, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences) {
149934
150134
  ts.Debug.assert(exportInfos.some(function (info) { return info.moduleSymbol === moduleSymbol || info.symbol.parent === moduleSymbol; }), "Some exportInfo should match the specified moduleSymbol");
149935
150135
  var packageJsonImportFilter = ts.createPackageJsonImportFilter(sourceFile, preferences, host);
@@ -149959,7 +150159,7 @@ var ts;
149959
150159
  }
149960
150160
  }
149961
150161
  }
149962
- function getAllReExportingModules(importingFile, targetSymbol, exportingModuleSymbol, symbolName, host, program, preferences, useAutoImportProvider) {
150162
+ function getAllReExportingModules(importingFile, targetSymbol, exportingModuleSymbol, symbolName, isJsxTagName, host, program, preferences, useAutoImportProvider) {
149963
150163
  var result = [];
149964
150164
  var compilerOptions = program.getCompilerOptions();
149965
150165
  var getModuleSpecifierResolutionHost = ts.memoizeOne(function (isFromPackageJson) {
@@ -149972,7 +150172,7 @@ var ts;
149972
150172
  return;
149973
150173
  }
149974
150174
  var defaultInfo = ts.getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions);
149975
- if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, ts.getEmitScriptTarget(compilerOptions)) === symbolName) && ts.skipAlias(defaultInfo.symbol, checker) === targetSymbol && isImportable(program, moduleFile, isFromPackageJson)) {
150175
+ if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, ts.getEmitScriptTarget(compilerOptions), isJsxTagName) === symbolName) && ts.skipAlias(defaultInfo.symbol, checker) === targetSymbol && isImportable(program, moduleFile, isFromPackageJson)) {
149976
150176
  result.push({ symbol: defaultInfo.symbol, moduleSymbol: moduleSymbol, moduleFileName: moduleFile === null || moduleFile === void 0 ? void 0 : moduleFile.fileName, exportKind: defaultInfo.exportKind, targetFlags: ts.skipAlias(defaultInfo.symbol, checker).flags, isFromPackageJson: isFromPackageJson });
149977
150177
  }
149978
150178
  for (var _i = 0, _a = checker.getExportsAndPropertiesOfModule(moduleSymbol); _i < _a.length; _i++) {
@@ -150210,9 +150410,21 @@ var ts;
150210
150410
  }
150211
150411
  function getFixesInfo(context, errorCode, pos, useAutoImportProvider) {
150212
150412
  var symbolToken = ts.getTokenAtPosition(context.sourceFile, pos);
150213
- var info = errorCode === ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code
150214
- ? getFixesInfoForUMDImport(context, symbolToken)
150215
- : ts.isIdentifier(symbolToken) ? getFixesInfoForNonUMDImport(context, symbolToken, useAutoImportProvider) : undefined;
150413
+ var info;
150414
+ if (errorCode === ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code) {
150415
+ info = getFixesInfoForUMDImport(context, symbolToken);
150416
+ }
150417
+ else if (!ts.isIdentifier(symbolToken)) {
150418
+ return undefined;
150419
+ }
150420
+ else if (errorCode === ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type.code) {
150421
+ var symbolName_1 = getSymbolName(context.sourceFile, context.program.getTypeChecker(), symbolToken, context.program.getCompilerOptions());
150422
+ var fix = getTypeOnlyPromotionFix(context.sourceFile, symbolToken, symbolName_1, context.program);
150423
+ return fix && { fixes: [fix], symbolName: symbolName_1 };
150424
+ }
150425
+ else {
150426
+ info = getFixesInfoForNonUMDImport(context, symbolToken, useAutoImportProvider);
150427
+ }
150216
150428
  var packageJsonImportFilter = ts.createPackageJsonImportFilter(context.sourceFile, context.preferences, context.host);
150217
150429
  return info && __assign(__assign({}, info), { fixes: sortFixes(info.fixes, context.sourceFile, context.program, packageJsonImportFilter) });
150218
150430
  }
@@ -150329,13 +150541,23 @@ var ts;
150329
150541
  ts.Debug.assert(symbolName !== "default" /* Default */, "'default' isn't a legal identifier and couldn't occur here");
150330
150542
  var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(symbolToken);
150331
150543
  var useRequire = shouldUseRequire(sourceFile, program);
150332
- var exportInfos = getExportInfos(symbolName, ts.getMeaningFromLocation(symbolToken), cancellationToken, sourceFile, program, useAutoImportProvider, host, preferences);
150544
+ var exportInfos = getExportInfos(symbolName, ts.isJSXTagName(symbolToken), ts.getMeaningFromLocation(symbolToken), cancellationToken, sourceFile, program, useAutoImportProvider, host, preferences);
150333
150545
  var fixes = ts.arrayFrom(ts.flatMapIterator(exportInfos.entries(), function (_a) {
150334
150546
  var _ = _a[0], exportInfos = _a[1];
150335
150547
  return getImportFixes(exportInfos, symbolName, symbolToken.getStart(sourceFile), isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences);
150336
150548
  }));
150337
150549
  return { fixes: fixes, symbolName: symbolName };
150338
150550
  }
150551
+ function getTypeOnlyPromotionFix(sourceFile, symbolToken, symbolName, program) {
150552
+ var checker = program.getTypeChecker();
150553
+ var symbol = checker.resolveName(symbolName, symbolToken, 111551 /* Value */, /*excludeGlobals*/ true);
150554
+ if (!symbol)
150555
+ return undefined;
150556
+ var typeOnlyAliasDeclaration = checker.getTypeOnlyAliasDeclaration(symbol);
150557
+ if (!typeOnlyAliasDeclaration || ts.getSourceFileOfNode(typeOnlyAliasDeclaration) !== sourceFile)
150558
+ return undefined;
150559
+ return { kind: 4 /* PromoteTypeOnly */, typeOnlyAliasDeclaration: typeOnlyAliasDeclaration };
150560
+ }
150339
150561
  function jsxModeNeedsExplicitImport(jsx) {
150340
150562
  return jsx === 2 /* React */ || jsx === 3 /* ReactNative */;
150341
150563
  }
@@ -150343,14 +150565,20 @@ var ts;
150343
150565
  var parent = symbolToken.parent;
150344
150566
  if ((ts.isJsxOpeningLikeElement(parent) || ts.isJsxClosingElement(parent)) && parent.tagName === symbolToken && jsxModeNeedsExplicitImport(compilerOptions.jsx)) {
150345
150567
  var jsxNamespace = checker.getJsxNamespace(sourceFile);
150346
- if (ts.isIntrinsicJsxName(symbolToken.text) || !checker.resolveName(jsxNamespace, parent, 111551 /* Value */, /*excludeGlobals*/ true)) {
150568
+ if (needsJsxNamespaceFix(jsxNamespace, symbolToken, checker)) {
150347
150569
  return jsxNamespace;
150348
150570
  }
150349
150571
  }
150350
150572
  return symbolToken.text;
150351
150573
  }
150574
+ function needsJsxNamespaceFix(jsxNamespace, symbolToken, checker) {
150575
+ if (ts.isIntrinsicJsxName(symbolToken.text))
150576
+ return true; // If we were triggered by a matching error code on an intrinsic, the error must have been about missing the JSX factory
150577
+ var namespaceSymbol = checker.resolveName(jsxNamespace, symbolToken, 111551 /* Value */, /*excludeGlobals*/ true);
150578
+ return !namespaceSymbol || ts.some(namespaceSymbol.declarations, ts.isTypeOnlyImportOrExportDeclaration) && !(namespaceSymbol.flags & 111551 /* Value */);
150579
+ }
150352
150580
  // Returns a map from an exported symbol's ID to a list of every way it's (re-)exported.
150353
- function getExportInfos(symbolName, currentTokenMeaning, cancellationToken, fromFile, program, useAutoImportProvider, host, preferences) {
150581
+ function getExportInfos(symbolName, isJsxTagName, currentTokenMeaning, cancellationToken, fromFile, program, useAutoImportProvider, host, preferences) {
150354
150582
  var _a;
150355
150583
  // For each original symbol, keep all re-exports of that symbol together so we can call `getCodeActionsForImport` on the whole group at once.
150356
150584
  // Maps symbol id to info for modules providing that symbol (original export + re-exports).
@@ -150373,7 +150601,7 @@ var ts;
150373
150601
  cancellationToken.throwIfCancellationRequested();
150374
150602
  var compilerOptions = program.getCompilerOptions();
150375
150603
  var defaultInfo = ts.getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions);
150376
- if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, ts.getEmitScriptTarget(compilerOptions)) === symbolName) && symbolHasMeaning(defaultInfo.symbolForMeaning, currentTokenMeaning)) {
150604
+ if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, ts.getEmitScriptTarget(compilerOptions), isJsxTagName) === symbolName) && symbolHasMeaning(defaultInfo.symbolForMeaning, currentTokenMeaning)) {
150377
150605
  addSymbol(moduleSymbol, sourceFile, defaultInfo.symbol, defaultInfo.exportKind, program, isFromPackageJson);
150378
150606
  }
150379
150607
  // check exports with the same name
@@ -150447,10 +150675,80 @@ var ts;
150447
150675
  ts.insertImports(changes, sourceFile, getDeclarations(moduleSpecifier, quotePreference, defaultImport, namedImports, namespaceLikeImport), /*blankLineBetween*/ true);
150448
150676
  return [importKind === 1 /* Default */ ? ts.Diagnostics.Import_default_0_from_module_1 : ts.Diagnostics.Import_0_from_module_1, symbolName, moduleSpecifier];
150449
150677
  }
150678
+ case 4 /* PromoteTypeOnly */: {
150679
+ var typeOnlyAliasDeclaration = fix.typeOnlyAliasDeclaration;
150680
+ var promotedDeclaration = promoteFromTypeOnly(changes, typeOnlyAliasDeclaration, compilerOptions, sourceFile);
150681
+ return promotedDeclaration.kind === 269 /* ImportSpecifier */
150682
+ ? [ts.Diagnostics.Remove_type_from_import_of_0_from_1, symbolName, getModuleSpecifierText(promotedDeclaration.parent.parent)]
150683
+ : [ts.Diagnostics.Remove_type_from_import_declaration_from_0, getModuleSpecifierText(promotedDeclaration)];
150684
+ }
150450
150685
  default:
150451
150686
  return ts.Debug.assertNever(fix, "Unexpected fix kind " + fix.kind);
150452
150687
  }
150453
150688
  }
150689
+ function getModuleSpecifierText(promotedDeclaration) {
150690
+ var _a, _b;
150691
+ return promotedDeclaration.kind === 264 /* ImportEqualsDeclaration */
150692
+ ? ((_b = ts.tryCast((_a = ts.tryCast(promotedDeclaration.moduleReference, ts.isExternalModuleReference)) === null || _a === void 0 ? void 0 : _a.expression, ts.isStringLiteralLike)) === null || _b === void 0 ? void 0 : _b.text) || promotedDeclaration.moduleReference.getText()
150693
+ : ts.cast(promotedDeclaration.parent.moduleSpecifier, ts.isStringLiteral).text;
150694
+ }
150695
+ function promoteFromTypeOnly(changes, aliasDeclaration, compilerOptions, sourceFile) {
150696
+ // See comment in `doAddExistingFix` on constant with the same name.
150697
+ var convertExistingToTypeOnly = compilerOptions.preserveValueImports && compilerOptions.isolatedModules;
150698
+ switch (aliasDeclaration.kind) {
150699
+ case 269 /* ImportSpecifier */:
150700
+ if (aliasDeclaration.isTypeOnly) {
150701
+ if (aliasDeclaration.parent.elements.length > 1 && ts.OrganizeImports.importSpecifiersAreSorted(aliasDeclaration.parent.elements)) {
150702
+ changes.delete(sourceFile, aliasDeclaration);
150703
+ var newSpecifier = ts.factory.updateImportSpecifier(aliasDeclaration, /*isTypeOnly*/ false, aliasDeclaration.propertyName, aliasDeclaration.name);
150704
+ var insertionIndex = ts.OrganizeImports.getImportSpecifierInsertionIndex(aliasDeclaration.parent.elements, newSpecifier);
150705
+ changes.insertImportSpecifierAtIndex(sourceFile, newSpecifier, aliasDeclaration.parent, insertionIndex);
150706
+ }
150707
+ else {
150708
+ changes.deleteRange(sourceFile, aliasDeclaration.getFirstToken());
150709
+ }
150710
+ return aliasDeclaration;
150711
+ }
150712
+ else {
150713
+ ts.Debug.assert(aliasDeclaration.parent.parent.isTypeOnly);
150714
+ promoteImportClause(aliasDeclaration.parent.parent);
150715
+ return aliasDeclaration.parent.parent;
150716
+ }
150717
+ case 266 /* ImportClause */:
150718
+ promoteImportClause(aliasDeclaration);
150719
+ return aliasDeclaration;
150720
+ case 267 /* NamespaceImport */:
150721
+ promoteImportClause(aliasDeclaration.parent);
150722
+ return aliasDeclaration.parent;
150723
+ case 264 /* ImportEqualsDeclaration */:
150724
+ changes.deleteRange(sourceFile, aliasDeclaration.getChildAt(1));
150725
+ return aliasDeclaration;
150726
+ default:
150727
+ ts.Debug.failBadSyntaxKind(aliasDeclaration);
150728
+ }
150729
+ function promoteImportClause(importClause) {
150730
+ changes.delete(sourceFile, ts.getTypeKeywordOfTypeOnlyImport(importClause, sourceFile));
150731
+ if (convertExistingToTypeOnly) {
150732
+ var namedImports = ts.tryCast(importClause.namedBindings, ts.isNamedImports);
150733
+ if (namedImports && namedImports.elements.length > 1) {
150734
+ if (ts.OrganizeImports.importSpecifiersAreSorted(namedImports.elements) &&
150735
+ aliasDeclaration.kind === 269 /* ImportSpecifier */ &&
150736
+ namedImports.elements.indexOf(aliasDeclaration) !== 0) {
150737
+ // The import specifier being promoted will be the only non-type-only,
150738
+ // import in the NamedImports, so it should be moved to the front.
150739
+ changes.delete(sourceFile, aliasDeclaration);
150740
+ changes.insertImportSpecifierAtIndex(sourceFile, aliasDeclaration, namedImports, 0);
150741
+ }
150742
+ for (var _i = 0, _a = namedImports.elements; _i < _a.length; _i++) {
150743
+ var element = _a[_i];
150744
+ if (element !== aliasDeclaration && !element.isTypeOnly) {
150745
+ changes.insertModifierBefore(sourceFile, 151 /* TypeKeyword */, element);
150746
+ }
150747
+ }
150748
+ }
150749
+ }
150750
+ }
150751
+ }
150454
150752
  function doAddExistingFix(changes, sourceFile, clause, defaultImport, namedImports, compilerOptions) {
150455
150753
  var _a;
150456
150754
  if (clause.kind === 200 /* ObjectBindingPattern */) {
@@ -150488,13 +150786,7 @@ var ts;
150488
150786
  var insertionIndex = convertExistingToTypeOnly && !spec.isTypeOnly
150489
150787
  ? 0
150490
150788
  : ts.OrganizeImports.getImportSpecifierInsertionIndex(existingSpecifiers, spec);
150491
- var prevSpecifier = clause.namedBindings.elements[insertionIndex - 1];
150492
- if (prevSpecifier) {
150493
- changes.insertNodeInListAfter(sourceFile, prevSpecifier, spec);
150494
- }
150495
- else {
150496
- changes.insertNodeBefore(sourceFile, existingSpecifiers[0], spec, !ts.positionsAreOnSameLine(existingSpecifiers[0].getStart(), clause.parent.getStart(), sourceFile));
150497
- }
150789
+ changes.insertImportSpecifierAtIndex(sourceFile, spec, clause.namedBindings, insertionIndex);
150498
150790
  }
150499
150791
  }
150500
150792
  else if (existingSpecifiers === null || existingSpecifiers === void 0 ? void 0 : existingSpecifiers.length) {
@@ -150609,17 +150901,20 @@ var ts;
150609
150901
  var declarations = _a.declarations;
150610
150902
  return ts.some(declarations, function (decl) { return !!(ts.getMeaningFromDeclaration(decl) & meaning); });
150611
150903
  }
150612
- function moduleSymbolToValidIdentifier(moduleSymbol, target) {
150613
- return moduleSpecifierToValidIdentifier(ts.removeFileExtension(ts.stripQuotes(moduleSymbol.name)), target);
150904
+ function moduleSymbolToValidIdentifier(moduleSymbol, target, forceCapitalize) {
150905
+ return moduleSpecifierToValidIdentifier(ts.removeFileExtension(ts.stripQuotes(moduleSymbol.name)), target, forceCapitalize);
150614
150906
  }
150615
150907
  codefix.moduleSymbolToValidIdentifier = moduleSymbolToValidIdentifier;
150616
- function moduleSpecifierToValidIdentifier(moduleSpecifier, target) {
150908
+ function moduleSpecifierToValidIdentifier(moduleSpecifier, target, forceCapitalize) {
150617
150909
  var baseName = ts.getBaseFileName(ts.removeSuffix(moduleSpecifier, "/index"));
150618
150910
  var res = "";
150619
150911
  var lastCharWasValid = true;
150620
150912
  var firstCharCode = baseName.charCodeAt(0);
150621
150913
  if (ts.isIdentifierStart(firstCharCode, target)) {
150622
150914
  res += String.fromCharCode(firstCharCode);
150915
+ if (forceCapitalize) {
150916
+ res = res.toUpperCase();
150917
+ }
150623
150918
  }
150624
150919
  else {
150625
150920
  lastCharWasValid = false;
@@ -160588,13 +160883,11 @@ var ts;
160588
160883
  switch (context === null || context === void 0 ? void 0 : context.kind) {
160589
160884
  case 171 /* GetAccessor */:
160590
160885
  if (!this.contextualGetAccessorDocumentationComment) {
160591
- this.contextualGetAccessorDocumentationComment = ts.emptyArray;
160592
160886
  this.contextualGetAccessorDocumentationComment = getDocumentationComment(ts.filter(this.declarations, ts.isGetAccessor), checker);
160593
160887
  }
160594
160888
  return this.contextualGetAccessorDocumentationComment;
160595
160889
  case 172 /* SetAccessor */:
160596
160890
  if (!this.contextualSetAccessorDocumentationComment) {
160597
- this.contextualSetAccessorDocumentationComment = ts.emptyArray;
160598
160891
  this.contextualSetAccessorDocumentationComment = getDocumentationComment(ts.filter(this.declarations, ts.isSetAccessor), checker);
160599
160892
  }
160600
160893
  return this.contextualSetAccessorDocumentationComment;
@@ -160604,10 +160897,26 @@ var ts;
160604
160897
  };
160605
160898
  SymbolObject.prototype.getJsDocTags = function (checker) {
160606
160899
  if (this.tags === undefined) {
160607
- this.tags = ts.JsDoc.getJsDocTagsFromDeclarations(this.declarations, checker);
160900
+ this.tags = getJsDocTagsOfDeclarations(this.declarations, checker);
160608
160901
  }
160609
160902
  return this.tags;
160610
160903
  };
160904
+ SymbolObject.prototype.getContextualJsDocTags = function (context, checker) {
160905
+ switch (context === null || context === void 0 ? void 0 : context.kind) {
160906
+ case 171 /* GetAccessor */:
160907
+ if (!this.contextualGetAccessorTags) {
160908
+ this.contextualGetAccessorTags = getJsDocTagsOfDeclarations(ts.filter(this.declarations, ts.isGetAccessor), checker);
160909
+ }
160910
+ return this.contextualGetAccessorTags;
160911
+ case 172 /* SetAccessor */:
160912
+ if (!this.contextualSetAccessorTags) {
160913
+ this.contextualSetAccessorTags = getJsDocTagsOfDeclarations(ts.filter(this.declarations, ts.isSetAccessor), checker);
160914
+ }
160915
+ return this.contextualSetAccessorTags;
160916
+ default:
160917
+ return this.getJsDocTags(checker);
160918
+ }
160919
+ };
160611
160920
  return SymbolObject;
160612
160921
  }());
160613
160922
  var TokenObject = /** @class */ (function (_super) {
@@ -160777,10 +161086,7 @@ var ts;
160777
161086
  return this.documentationComment || (this.documentationComment = getDocumentationComment(ts.singleElementArray(this.declaration), this.checker));
160778
161087
  };
160779
161088
  SignatureObject.prototype.getJsDocTags = function () {
160780
- if (this.jsDocTags === undefined) {
160781
- this.jsDocTags = this.declaration ? getJsDocTagsOfSignature(this.declaration, this.checker) : [];
160782
- }
160783
- return this.jsDocTags;
161089
+ return this.jsDocTags || (this.jsDocTags = getJsDocTagsOfDeclarations(ts.singleElementArray(this.declaration), this.checker));
160784
161090
  };
160785
161091
  return SignatureObject;
160786
161092
  }());
@@ -160792,12 +161098,30 @@ var ts;
160792
161098
  function hasJSDocInheritDocTag(node) {
160793
161099
  return ts.getJSDocTags(node).some(function (tag) { return tag.tagName.text === "inheritDoc"; });
160794
161100
  }
160795
- function getJsDocTagsOfSignature(declaration, checker) {
160796
- var tags = ts.JsDoc.getJsDocTagsFromDeclarations([declaration], checker);
160797
- if (tags.length === 0 || hasJSDocInheritDocTag(declaration)) {
160798
- 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; });
160799
- if (inheritedTags) {
160800
- tags = __spreadArray(__spreadArray([], inheritedTags, true), tags, true);
161101
+ function getJsDocTagsOfDeclarations(declarations, checker) {
161102
+ if (!declarations)
161103
+ return ts.emptyArray;
161104
+ var tags = ts.JsDoc.getJsDocTagsFromDeclarations(declarations, checker);
161105
+ if (checker && (tags.length === 0 || declarations.some(hasJSDocInheritDocTag))) {
161106
+ var seenSymbols_1 = new ts.Set();
161107
+ var _loop_22 = function (declaration) {
161108
+ var inheritedTags = findBaseOfDeclaration(checker, declaration, function (symbol) {
161109
+ var _a;
161110
+ if (!seenSymbols_1.has(symbol)) {
161111
+ seenSymbols_1.add(symbol);
161112
+ if (declaration.kind === 171 /* GetAccessor */ || declaration.kind === 172 /* SetAccessor */) {
161113
+ return symbol.getContextualJsDocTags(declaration, checker);
161114
+ }
161115
+ return ((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.length) === 1 ? symbol.getJsDocTags() : undefined;
161116
+ }
161117
+ });
161118
+ if (inheritedTags) {
161119
+ tags = __spreadArray(__spreadArray([], inheritedTags, true), tags, true);
161120
+ }
161121
+ };
161122
+ for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) {
161123
+ var declaration = declarations_6[_i];
161124
+ _loop_22(declaration);
160801
161125
  }
160802
161126
  }
160803
161127
  return tags;
@@ -160807,18 +161131,24 @@ var ts;
160807
161131
  return ts.emptyArray;
160808
161132
  var doc = ts.JsDoc.getJsDocCommentsFromDeclarations(declarations, checker);
160809
161133
  if (checker && (doc.length === 0 || declarations.some(hasJSDocInheritDocTag))) {
160810
- var seenSymbols_1 = new ts.Set();
160811
- for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) {
160812
- var declaration = declarations_6[_i];
161134
+ var seenSymbols_2 = new ts.Set();
161135
+ var _loop_23 = function (declaration) {
160813
161136
  var inheritedDocs = findBaseOfDeclaration(checker, declaration, function (symbol) {
160814
- if (!seenSymbols_1.has(symbol)) {
160815
- seenSymbols_1.add(symbol);
161137
+ if (!seenSymbols_2.has(symbol)) {
161138
+ seenSymbols_2.add(symbol);
161139
+ if (declaration.kind === 171 /* GetAccessor */ || declaration.kind === 172 /* SetAccessor */) {
161140
+ return symbol.getContextualDocumentationComment(declaration, checker);
161141
+ }
160816
161142
  return symbol.getDocumentationComment(checker);
160817
161143
  }
160818
161144
  });
160819
161145
  // TODO: GH#16312 Return a ReadonlyArray, avoid copying inheritedDocs
160820
161146
  if (inheritedDocs)
160821
161147
  doc = doc.length === 0 ? inheritedDocs.slice() : inheritedDocs.concat(ts.lineBreakPart(), doc);
161148
+ };
161149
+ for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) {
161150
+ var declaration = declarations_7[_i];
161151
+ _loop_23(declaration);
160822
161152
  }
160823
161153
  }
160824
161154
  return doc;