@typescript-deploys/pr-build 4.8.0-pr-49481-2 → 4.8.0-pr-49554-2

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.
@@ -91,6 +91,15 @@ var __extends = (this && this.__extends) || (function () {
91
91
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
92
92
  };
93
93
  })();
94
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
95
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
96
+ return new (P || (P = Promise))(function (resolve, reject) {
97
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
98
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
99
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
100
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
101
+ });
102
+ };
94
103
  /* @internal */
95
104
  var ts;
96
105
  (function (ts) {
@@ -294,7 +303,7 @@ var ts;
294
303
  // The following is baselined as a literal template type without intervention
295
304
  /** The version of the TypeScript compiler release */
296
305
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
297
- ts.version = ts.versionMajorMinor + ".0-insiders.20220610";
306
+ ts.version = ts.versionMajorMinor + ".0-insiders.20220615";
298
307
  /* @internal */
299
308
  var Comparison;
300
309
  (function (Comparison) {
@@ -2851,7 +2860,7 @@ var ts;
2851
2860
  return members.length > 0 && members[0][0] === 0 ? members[0][1] : "0";
2852
2861
  }
2853
2862
  if (isFlags) {
2854
- var result = "";
2863
+ var result = [];
2855
2864
  var remainingFlags = value;
2856
2865
  for (var _i = 0, members_1 = members; _i < members_1.length; _i++) {
2857
2866
  var _a = members_1[_i], enumValue = _a[0], enumName = _a[1];
@@ -2859,12 +2868,12 @@ var ts;
2859
2868
  break;
2860
2869
  }
2861
2870
  if (enumValue !== 0 && enumValue & value) {
2862
- result = "" + result + (result ? "|" : "") + enumName;
2871
+ result.push(enumName);
2863
2872
  remainingFlags &= ~enumValue;
2864
2873
  }
2865
2874
  }
2866
2875
  if (remainingFlags === 0) {
2867
- return result;
2876
+ return result.join("|");
2868
2877
  }
2869
2878
  }
2870
2879
  else {
@@ -2878,7 +2887,15 @@ var ts;
2878
2887
  return value.toString();
2879
2888
  }
2880
2889
  Debug.formatEnum = formatEnum;
2890
+ var enumMemberCache = new ts.Map();
2881
2891
  function getEnumMembers(enumObject) {
2892
+ // Assuming enum objects do not change at runtime, we can cache the enum members list
2893
+ // to reuse later. This saves us from reconstructing this each and every time we call
2894
+ // a formatting function (which can be expensive for large enums like SyntaxKind).
2895
+ var existing = enumMemberCache.get(enumObject);
2896
+ if (existing) {
2897
+ return existing;
2898
+ }
2882
2899
  var result = [];
2883
2900
  for (var name in enumObject) {
2884
2901
  var value = enumObject[name];
@@ -2886,7 +2903,9 @@ var ts;
2886
2903
  result.push([value, name]);
2887
2904
  }
2888
2905
  }
2889
- return ts.stableSort(result, function (x, y) { return ts.compareValues(x[0], y[0]); });
2906
+ var sorted = ts.stableSort(result, function (x, y) { return ts.compareValues(x[0], y[0]); });
2907
+ enumMemberCache.set(enumObject, sorted);
2908
+ return sorted;
2890
2909
  }
2891
2910
  function formatSyntaxKind(kind) {
2892
2911
  return formatEnum(kind, ts.SyntaxKind, /*isFlags*/ false);
@@ -4525,6 +4544,7 @@ var ts;
4525
4544
  SyntaxKind[SyntaxKind["JSDocFunctionType"] = 317] = "JSDocFunctionType";
4526
4545
  SyntaxKind[SyntaxKind["JSDocVariadicType"] = 318] = "JSDocVariadicType";
4527
4546
  SyntaxKind[SyntaxKind["JSDocNamepathType"] = 319] = "JSDocNamepathType";
4547
+ SyntaxKind[SyntaxKind["JSDoc"] = 320] = "JSDoc";
4528
4548
  /** @deprecated Use SyntaxKind.JSDoc */
4529
4549
  SyntaxKind[SyntaxKind["JSDocComment"] = 320] = "JSDocComment";
4530
4550
  SyntaxKind[SyntaxKind["JSDocText"] = 321] = "JSDocText";
@@ -4599,7 +4619,6 @@ var ts;
4599
4619
  SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 347] = "LastJSDocTagNode";
4600
4620
  /* @internal */ SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 126] = "FirstContextualKeyword";
4601
4621
  /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 160] = "LastContextualKeyword";
4602
- SyntaxKind[SyntaxKind["JSDoc"] = 320] = "JSDoc";
4603
4622
  })(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {}));
4604
4623
  var NodeFlags;
4605
4624
  (function (NodeFlags) {
@@ -8662,6 +8681,7 @@ var ts;
8662
8681
  The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate: diag(2209, ts.DiagnosticCategory.Error, "The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_roo_2209", "The project root is ambiguous, but is required to resolve export map entry '{0}' in file '{1}'. Supply the `rootDir` compiler option to disambiguate."),
8663
8682
  The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate: diag(2210, ts.DiagnosticCategory.Error, "The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_roo_2210", "The project root is ambiguous, but is required to resolve import map entry '{0}' in file '{1}'. Supply the `rootDir` compiler option to disambiguate."),
8664
8683
  Add_extends_constraint: diag(2211, ts.DiagnosticCategory.Message, "Add_extends_constraint_2211", "Add `extends` constraint."),
8684
+ Add_extends_constraint_to_all_type_parameters: diag(2212, ts.DiagnosticCategory.Message, "Add_extends_constraint_to_all_type_parameters_2212", "Add `extends` constraint to all type parameters"),
8665
8685
  Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."),
8666
8686
  Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2301, ts.DiagnosticCategory.Error, "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."),
8667
8687
  Static_members_cannot_reference_class_type_parameters: diag(2302, ts.DiagnosticCategory.Error, "Static_members_cannot_reference_class_type_parameters_2302", "Static members cannot reference class type parameters."),
@@ -9147,6 +9167,8 @@ var ts;
9147
9167
  This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value: diag(2839, ts.DiagnosticCategory.Error, "This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value_2839", "This condition will always return '{0}' since JavaScript compares objects by reference, not value."),
9148
9168
  An_interface_cannot_extend_a_primitive_type_like_0_an_interface_can_only_extend_named_types_and_classes: diag(2840, ts.DiagnosticCategory.Error, "An_interface_cannot_extend_a_primitive_type_like_0_an_interface_can_only_extend_named_types_and_clas_2840", "An interface cannot extend a primitive type like '{0}'; an interface can only extend named types and classes"),
9149
9169
  The_type_of_this_expression_cannot_be_named_without_a_resolution_mode_assertion_which_is_an_unstable_feature_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next: diag(2841, ts.DiagnosticCategory.Error, "The_type_of_this_expression_cannot_be_named_without_a_resolution_mode_assertion_which_is_an_unstable_2841", "The type of this expression cannot be named without a 'resolution-mode' assertion, which is an unstable feature. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."),
9170
+ _0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation: diag(2842, ts.DiagnosticCategory.Error, "_0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation_2842", "'{0}' is an unused renaming of '{1}'. Did you intend to use it as a type annotation?"),
9171
+ We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here: diag(2843, ts.DiagnosticCategory.Error, "We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here_2843", "We can only write a type for '{0}' by adding a type for the entire parameter here."),
9150
9172
  Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
9151
9173
  Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
9152
9174
  Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
@@ -35961,10 +35983,11 @@ var ts;
35961
35983
  }
35962
35984
  nextToken();
35963
35985
  var typeArguments = parseDelimitedList(20 /* TypeArguments */, parseType);
35964
- if (!parseExpected(31 /* GreaterThanToken */)) {
35986
+ if (reScanGreaterToken() !== 31 /* GreaterThanToken */) {
35965
35987
  // If it doesn't have the closing `>` then it's definitely not an type argument list.
35966
35988
  return undefined;
35967
35989
  }
35990
+ nextToken();
35968
35991
  // We successfully parsed a type argument list. The next token determines whether we want to
35969
35992
  // treat it as such. If the type argument list is followed by `(` or a template literal, as in
35970
35993
  // `f<number>(42)`, we favor the type argument interpretation even though JavaScript would view
@@ -45390,7 +45413,7 @@ var ts;
45390
45413
  case 164 /* Parameter */:
45391
45414
  // Parameters with names are handled at the top of this function. Parameters
45392
45415
  // without names can only come from JSDocFunctionTypes.
45393
- ts.Debug.assert(node.parent.kind === 317 /* JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: " + (ts.SyntaxKind ? ts.SyntaxKind[node.parent.kind] : node.parent.kind) + ", expected JSDocFunctionType"; });
45416
+ ts.Debug.assert(node.parent.kind === 317 /* JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: " + ts.Debug.formatSyntaxKind(node.parent.kind) + ", expected JSDocFunctionType"; });
45394
45417
  var functionType = node.parent;
45395
45418
  var index = functionType.parameters.indexOf(node);
45396
45419
  return "arg" + index;
@@ -49378,6 +49401,7 @@ var ts;
49378
49401
  var potentialNewTargetCollisions = [];
49379
49402
  var potentialWeakMapSetCollisions = [];
49380
49403
  var potentialReflectCollisions = [];
49404
+ var potentialUnusedRenamedBindingElementsInTypes = [];
49381
49405
  var awaitedTypeStack = [];
49382
49406
  var diagnostics = ts.createDiagnosticCollection();
49383
49407
  var suggestionDiagnostics = ts.createDiagnosticCollection();
@@ -52713,6 +52737,9 @@ var ts;
52713
52737
  if (symbol && symbol.flags & 262144 /* TypeParameter */ && meaning & 788968 /* Type */) {
52714
52738
  return { accessibility: 0 /* Accessible */ };
52715
52739
  }
52740
+ if (!symbol && ts.isThisIdentifier(firstIdentifier) && isSymbolAccessible(getSymbolOfNode(ts.getThisContainer(firstIdentifier, /*includeArrowFunctions*/ false)), firstIdentifier, meaning, /*computeAliases*/ false).accessibility === 0 /* Accessible */) {
52741
+ return { accessibility: 0 /* Accessible */ };
52742
+ }
52716
52743
  // Verify if the symbol is accessible
52717
52744
  return (symbol && hasVisibleDeclarations(symbol, /*shouldComputeAliasToMakeVisible*/ true)) || {
52718
52745
  accessibility: 1 /* NotAccessible */,
@@ -53885,15 +53912,22 @@ var ts;
53885
53912
  context.approximateLength += ts.symbolName(parameterSymbol).length + 3;
53886
53913
  return parameterNode;
53887
53914
  function cloneBindingName(node) {
53888
- return elideInitializerAndSetEmitFlags(node);
53889
- function elideInitializerAndSetEmitFlags(node) {
53915
+ return elideInitializerAndPropertyRenamingAndSetEmitFlags(node);
53916
+ function elideInitializerAndPropertyRenamingAndSetEmitFlags(node) {
53890
53917
  if (context.tracker.trackSymbol && ts.isComputedPropertyName(node) && isLateBindableName(node)) {
53891
53918
  trackComputedName(node.expression, context.enclosingDeclaration, context);
53892
53919
  }
53893
- var visited = ts.visitEachChild(node, elideInitializerAndSetEmitFlags, ts.nullTransformationContext, /*nodesVisitor*/ undefined, elideInitializerAndSetEmitFlags);
53920
+ var visited = ts.visitEachChild(node, elideInitializerAndPropertyRenamingAndSetEmitFlags, ts.nullTransformationContext, /*nodesVisitor*/ undefined, elideInitializerAndPropertyRenamingAndSetEmitFlags);
53894
53921
  if (ts.isBindingElement(visited)) {
53895
- visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken, visited.propertyName, visited.name,
53896
- /*initializer*/ undefined);
53922
+ if (visited.propertyName && ts.isIdentifier(visited.propertyName) && ts.isIdentifier(visited.name)) {
53923
+ visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken,
53924
+ /* propertyName*/ undefined, visited.propertyName,
53925
+ /*initializer*/ undefined);
53926
+ }
53927
+ else {
53928
+ visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken, visited.propertyName, visited.name,
53929
+ /*initializer*/ undefined);
53930
+ }
53897
53931
  }
53898
53932
  if (!ts.nodeIsSynthesized(visited)) {
53899
53933
  visited = ts.factory.cloneNode(visited);
@@ -65103,7 +65137,7 @@ var ts;
65103
65137
  return true;
65104
65138
  if (s & 65536 /* Null */ && (!strictNullChecks && !(t & 3145728 /* UnionOrIntersection */) || t & 65536 /* Null */))
65105
65139
  return true;
65106
- if (s & 524288 /* Object */ && t & 67108864 /* NonPrimitive */ && !(relation === strictSubtypeRelation && isEmptyAnonymousObjectType(source)))
65140
+ if (s & 524288 /* Object */ && t & 67108864 /* NonPrimitive */ && !(relation === strictSubtypeRelation && isEmptyAnonymousObjectType(source) && !(ts.getObjectFlags(source) & 8192 /* FreshLiteral */)))
65107
65141
  return true;
65108
65142
  if (relation === assignableRelation || relation === comparableRelation) {
65109
65143
  if (s & 1 /* Any */)
@@ -65667,8 +65701,12 @@ var ts;
65667
65701
  }
65668
65702
  reportRelationError(headMessage, source, target);
65669
65703
  if (source.flags & 262144 /* TypeParameter */ && ((_b = (_a = source.symbol) === null || _a === void 0 ? void 0 : _a.declarations) === null || _b === void 0 ? void 0 : _b[0]) && !getConstraintOfType(source)) {
65670
- var targetConstraintString = typeToString(target, source.symbol.declarations[0]);
65671
- associateRelatedInfo(ts.createDiagnosticForNode(source.symbol.declarations[0], ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint, targetConstraintString));
65704
+ var syntheticParam = cloneTypeParameter(source);
65705
+ syntheticParam.constraint = instantiateType(target, makeUnaryTypeMapper(source, syntheticParam));
65706
+ if (hasNonCircularBaseConstraint(syntheticParam)) {
65707
+ var targetConstraintString = typeToString(target, source.symbol.declarations[0]);
65708
+ associateRelatedInfo(ts.createDiagnosticForNode(source.symbol.declarations[0], ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint, targetConstraintString));
65709
+ }
65672
65710
  }
65673
65711
  }
65674
65712
  function traceUnionsOrIntersectionsTooLarge(source, target) {
@@ -65807,7 +65845,7 @@ var ts;
65807
65845
  return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source), target, reportErrors && !(source.flags & 131068 /* Primitive */) && !(target.flags & 131068 /* Primitive */));
65808
65846
  }
65809
65847
  if (target.flags & 2097152 /* Intersection */) {
65810
- return typeRelatedToEachType(getRegularTypeOfObjectLiteral(source), target, reportErrors, 2 /* Target */);
65848
+ return typeRelatedToEachType(source, target, reportErrors, 2 /* Target */);
65811
65849
  }
65812
65850
  // Source is an intersection. For the comparable relation, if the target is a primitive type we hoist the
65813
65851
  // constraints of all non-primitive types in the source into a new intersection. We do this because the
@@ -68218,12 +68256,13 @@ var ts;
68218
68256
  * with no call or construct signatures.
68219
68257
  */
68220
68258
  function isObjectTypeWithInferableIndex(type) {
68259
+ var objectFlags = ts.getObjectFlags(type);
68221
68260
  return type.flags & 2097152 /* Intersection */
68222
68261
  ? ts.every(type.types, isObjectTypeWithInferableIndex)
68223
68262
  : !!(type.symbol
68224
68263
  && (type.symbol.flags & (4096 /* ObjectLiteral */ | 2048 /* TypeLiteral */ | 384 /* Enum */ | 512 /* ValueModule */)) !== 0
68225
68264
  && !(type.symbol.flags & 32 /* Class */)
68226
- && !typeHasCallOrConstructSignatures(type)) || !!(ts.getObjectFlags(type) & 1024 /* ReverseMapped */ && isObjectTypeWithInferableIndex(type.source));
68265
+ && !typeHasCallOrConstructSignatures(type)) || !!(objectFlags & 4194304 /* ObjectRestType */) || !!(objectFlags & 1024 /* ReverseMapped */ && isObjectTypeWithInferableIndex(type.source));
68227
68266
  }
68228
68267
  function createSymbolWithType(source, type) {
68229
68268
  var symbol = createSymbol(source.flags, source.escapedName, ts.getCheckFlags(source) & 8 /* Readonly */);
@@ -82822,6 +82861,22 @@ var ts;
82822
82861
  }
82823
82862
  });
82824
82863
  }
82864
+ function checkPotentialUncheckedRenamedBindingElementsInTypes() {
82865
+ var _a;
82866
+ for (var _i = 0, potentialUnusedRenamedBindingElementsInTypes_1 = potentialUnusedRenamedBindingElementsInTypes; _i < potentialUnusedRenamedBindingElementsInTypes_1.length; _i++) {
82867
+ var node = potentialUnusedRenamedBindingElementsInTypes_1[_i];
82868
+ if (!((_a = getSymbolOfNode(node)) === null || _a === void 0 ? void 0 : _a.isReferenced)) {
82869
+ var wrappingDeclaration = ts.walkUpBindingElementsAndPatterns(node);
82870
+ ts.Debug.assert(ts.isParameterDeclaration(wrappingDeclaration), "Only parameter declaration should be checked here");
82871
+ var diagnostic = ts.createDiagnosticForNode(node.name, ts.Diagnostics._0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation, ts.declarationNameToString(node.name), ts.declarationNameToString(node.propertyName));
82872
+ if (!wrappingDeclaration.type) {
82873
+ // entire parameter does not have type annotation, suggest adding an annotation
82874
+ ts.addRelatedInfo(diagnostic, ts.createFileDiagnostic(ts.getSourceFileOfNode(wrappingDeclaration), wrappingDeclaration.end, 1, ts.Diagnostics.We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here, ts.declarationNameToString(node.propertyName)));
82875
+ }
82876
+ diagnostics.add(diagnostic);
82877
+ }
82878
+ }
82879
+ }
82825
82880
  function bindingNameText(name) {
82826
82881
  switch (name.kind) {
82827
82882
  case 79 /* Identifier */:
@@ -83123,6 +83178,17 @@ var ts;
83123
83178
  }
83124
83179
  }
83125
83180
  if (ts.isBindingElement(node)) {
83181
+ if (node.propertyName &&
83182
+ ts.isIdentifier(node.name) &&
83183
+ ts.isParameterDeclaration(node) &&
83184
+ ts.nodeIsMissing(ts.getContainingFunction(node).body)) {
83185
+ // type F = ({a: string}) => void;
83186
+ // ^^^^^^
83187
+ // variable renaming in function type notation is confusing,
83188
+ // so we forbid it even if noUnusedLocals is not enabled
83189
+ potentialUnusedRenamedBindingElementsInTypes.push(node);
83190
+ return;
83191
+ }
83126
83192
  if (ts.isObjectBindingPattern(node.parent) && node.dotDotDotToken && languageVersion < 5 /* ES2018 */) {
83127
83193
  checkExternalEmitHelpers(node, 4 /* Rest */);
83128
83194
  }
@@ -86586,6 +86652,7 @@ var ts;
86586
86652
  ts.clear(potentialNewTargetCollisions);
86587
86653
  ts.clear(potentialWeakMapSetCollisions);
86588
86654
  ts.clear(potentialReflectCollisions);
86655
+ ts.clear(potentialUnusedRenamedBindingElementsInTypes);
86589
86656
  ts.forEach(node.statements, checkSourceElement);
86590
86657
  checkSourceElement(node.endOfFileToken);
86591
86658
  checkDeferredNodes(node);
@@ -86601,6 +86668,9 @@ var ts;
86601
86668
  }
86602
86669
  });
86603
86670
  }
86671
+ if (!node.isDeclarationFile) {
86672
+ checkPotentialUncheckedRenamedBindingElementsInTypes();
86673
+ }
86604
86674
  });
86605
86675
  if (compilerOptions.importsNotUsedAsValues === 2 /* Error */ &&
86606
86676
  !node.isDeclarationFile &&
@@ -108651,7 +108721,7 @@ var ts;
108651
108721
  return getTypeAliasDeclarationVisibilityError;
108652
108722
  }
108653
108723
  else {
108654
- return ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: " + ts.SyntaxKind[node.kind]);
108724
+ return ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: " + ts.Debug.formatSyntaxKind(node.kind));
108655
108725
  }
108656
108726
  function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {
108657
108727
  if (node.kind === 254 /* VariableDeclaration */ || node.kind === 203 /* BindingElement */) {
@@ -108862,7 +108932,7 @@ var ts;
108862
108932
  ts.Diagnostics.Parameter_0_of_accessor_has_or_is_using_name_1_from_private_module_2 :
108863
108933
  ts.Diagnostics.Parameter_0_of_accessor_has_or_is_using_private_name_1;
108864
108934
  default:
108865
- return ts.Debug.fail("Unknown parent for parameter: " + ts.SyntaxKind[node.parent.kind]);
108935
+ return ts.Debug.fail("Unknown parent for parameter: " + ts.Debug.formatSyntaxKind(node.parent.kind));
108866
108936
  }
108867
108937
  }
108868
108938
  function getTypeParameterConstraintVisibilityError() {
@@ -109342,7 +109412,7 @@ var ts;
109342
109412
  });
109343
109413
  return ret;
109344
109414
  }
109345
- function filterBindingPatternInitializers(name) {
109415
+ function filterBindingPatternInitializersAndRenamings(name) {
109346
109416
  if (name.kind === 79 /* Identifier */) {
109347
109417
  return name;
109348
109418
  }
@@ -109358,7 +109428,12 @@ var ts;
109358
109428
  if (elem.kind === 227 /* OmittedExpression */) {
109359
109429
  return elem;
109360
109430
  }
109361
- return factory.updateBindingElement(elem, elem.dotDotDotToken, elem.propertyName, filterBindingPatternInitializers(elem.name), shouldPrintWithInitializer(elem) ? elem.initializer : undefined);
109431
+ if (elem.propertyName && ts.isIdentifier(elem.propertyName) && ts.isIdentifier(elem.name) && !elem.symbol.isReferenced) {
109432
+ // Unnecessary property renaming is forbidden in types, so remove renaming
109433
+ return factory.updateBindingElement(elem, elem.dotDotDotToken,
109434
+ /* propertyName */ undefined, elem.propertyName, shouldPrintWithInitializer(elem) ? elem.initializer : undefined);
109435
+ }
109436
+ return factory.updateBindingElement(elem, elem.dotDotDotToken, elem.propertyName, filterBindingPatternInitializersAndRenamings(elem.name), shouldPrintWithInitializer(elem) ? elem.initializer : undefined);
109362
109437
  }
109363
109438
  }
109364
109439
  function ensureParameter(p, modifierMask, type) {
@@ -109367,7 +109442,7 @@ var ts;
109367
109442
  oldDiag = getSymbolAccessibilityDiagnostic;
109368
109443
  getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(p);
109369
109444
  }
109370
- var newParam = factory.updateParameterDeclaration(p, maskModifiers(p, modifierMask), p.dotDotDotToken, filterBindingPatternInitializers(p.name), resolver.isOptionalParameter(p) ? (p.questionToken || factory.createToken(57 /* QuestionToken */)) : undefined, ensureType(p, type || p.type, /*ignorePrivate*/ true), // Ignore private param props, since this type is going straight back into a param
109445
+ var newParam = factory.updateParameterDeclaration(p, maskModifiers(p, modifierMask), p.dotDotDotToken, filterBindingPatternInitializersAndRenamings(p.name), resolver.isOptionalParameter(p) ? (p.questionToken || factory.createToken(57 /* QuestionToken */)) : undefined, ensureType(p, type || p.type, /*ignorePrivate*/ true), // Ignore private param props, since this type is going straight back into a param
109371
109446
  ensureNoInitializer(p));
109372
109447
  if (!suppressNewDiagnosticContexts) {
109373
109448
  getSymbolAccessibilityDiagnostic = oldDiag;
@@ -109628,7 +109703,7 @@ var ts;
109628
109703
  while (ts.length(lateMarkedStatements)) {
109629
109704
  var i = lateMarkedStatements.shift();
109630
109705
  if (!ts.isLateVisibilityPaintedStatement(i)) {
109631
- return ts.Debug.fail("Late replaced statement was found which is not handled by the declaration transformer!: " + (ts.SyntaxKind ? ts.SyntaxKind[i.kind] : i.kind));
109706
+ return ts.Debug.fail("Late replaced statement was found which is not handled by the declaration transformer!: " + ts.Debug.formatSyntaxKind(i.kind));
109632
109707
  }
109633
109708
  var priorNeedsDeclare = needsDeclare;
109634
109709
  needsDeclare = i.parent && ts.isSourceFile(i.parent) && !(ts.isExternalModule(i.parent) && isBundledEmit);
@@ -109811,7 +109886,7 @@ var ts;
109811
109886
  return cleanup(input);
109812
109887
  return cleanup(factory.updateImportTypeNode(input, factory.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)), input.assertions, input.qualifier, ts.visitNodes(input.typeArguments, visitDeclarationSubtree, ts.isTypeNode), input.isTypeOf));
109813
109888
  }
109814
- default: ts.Debug.assertNever(input, "Attempted to process unhandled node kind: " + ts.SyntaxKind[input.kind]);
109889
+ default: ts.Debug.assertNever(input, "Attempted to process unhandled node kind: " + ts.Debug.formatSyntaxKind(input.kind));
109815
109890
  }
109816
109891
  }
109817
109892
  if (ts.isTupleTypeNode(input) && (ts.getLineAndCharacterOfPosition(currentSourceFile, input.pos).line === ts.getLineAndCharacterOfPosition(currentSourceFile, input.end).line)) {
@@ -110133,7 +110208,7 @@ var ts;
110133
110208
  }
110134
110209
  }
110135
110210
  // Anything left unhandled is an error, so this should be unreachable
110136
- return ts.Debug.assertNever(input, "Unhandled top-level node in declaration emit: " + ts.SyntaxKind[input.kind]);
110211
+ return ts.Debug.assertNever(input, "Unhandled top-level node in declaration emit: " + ts.Debug.formatSyntaxKind(input.kind));
110137
110212
  function cleanup(node) {
110138
110213
  if (isEnclosingDeclaration(input)) {
110139
110214
  enclosingDeclaration = previousEnclosingDeclaration;
@@ -117510,6 +117585,7 @@ var ts;
117510
117585
  ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations.code,
117511
117586
  ts.Diagnostics.Class_constructor_may_not_be_a_generator.code,
117512
117587
  ts.Diagnostics.Class_constructor_may_not_be_an_accessor.code,
117588
+ ts.Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
117513
117589
  ]);
117514
117590
  /**
117515
117591
  * Determine if source file needs to be re-created even if its text hasn't changed
@@ -122644,9 +122720,11 @@ var ts;
122644
122720
  }
122645
122721
  function watchAffectingLocationsOfResolution(resolution, addToResolutionsWithOnlyAffectingLocations) {
122646
122722
  ts.Debug.assert(!!resolution.refCount);
122723
+ var affectingLocations = resolution.affectingLocations;
122724
+ if (!affectingLocations.length)
122725
+ return;
122647
122726
  if (addToResolutionsWithOnlyAffectingLocations)
122648
122727
  resolutionsWithOnlyAffectingLocations.push(resolution);
122649
- var affectingLocations = resolution.affectingLocations;
122650
122728
  // Watch package json
122651
122729
  for (var _i = 0, affectingLocations_1 = affectingLocations; _i < affectingLocations_1.length; _i++) {
122652
122730
  var affectingLocation = affectingLocations_1[_i];
@@ -145762,7 +145840,7 @@ var ts;
145762
145840
  return type.symbol && (type.symbol.flags & 1536 /* Module */);
145763
145841
  }
145764
145842
  function visitVariableLikeDeclaration(decl) {
145765
- if (!decl.initializer || ts.isBindingPattern(decl.name)) {
145843
+ if (!decl.initializer || ts.isBindingPattern(decl.name) || ts.isVariableDeclaration(decl) && !isHintableDeclaration(decl)) {
145766
145844
  return;
145767
145845
  }
145768
145846
  var effectiveTypeAnnotation = ts.getEffectiveTypeAnnotationNode(decl);
@@ -145890,6 +145968,9 @@ var ts;
145890
145968
  }
145891
145969
  for (var i = 0; i < node.parameters.length && i < signature.parameters.length; ++i) {
145892
145970
  var param = node.parameters[i];
145971
+ if (!isHintableDeclaration(param)) {
145972
+ continue;
145973
+ }
145893
145974
  var effectiveTypeAnnotation = ts.getEffectiveTypeAnnotationNode(param);
145894
145975
  if (effectiveTypeAnnotation) {
145895
145976
  continue;
@@ -145931,6 +146012,13 @@ var ts;
145931
146012
  function isUndefined(name) {
145932
146013
  return name === "undefined";
145933
146014
  }
146015
+ function isHintableDeclaration(node) {
146016
+ if ((ts.isParameterDeclaration(node) || ts.isVariableDeclaration(node) && ts.isVarConst(node)) && node.initializer) {
146017
+ var initializer = ts.skipParentheses(node.initializer);
146018
+ return !(isHintableLiteral(initializer) || ts.isNewExpression(initializer) || ts.isObjectLiteralExpression(initializer) || ts.isAssertionExpression(initializer));
146019
+ }
146020
+ return true;
146021
+ }
145934
146022
  }
145935
146023
  InlayHints.provideInlayHints = provideInlayHints;
145936
146024
  })(InlayHints = ts.InlayHints || (ts.InlayHints = {}));
@@ -150681,7 +150769,7 @@ var ts;
150681
150769
  return {
150682
150770
  indentation: indentation,
150683
150771
  prefix: (insertLeadingComma ? "," : "") + this.newLineCharacter,
150684
- suffix: insertTrailingComma ? "," : ""
150772
+ suffix: insertTrailingComma ? "," : ts.isInterfaceDeclaration(node) && isEmpty ? ";" : ""
150685
150773
  };
150686
150774
  };
150687
150775
  ChangeTracker.prototype.insertNodeAfterComma = function (sourceFile, after, newNode) {
@@ -155383,6 +155471,7 @@ var ts;
155383
155471
  ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties.code,
155384
155472
  ts.Diagnostics.Property_0_is_incompatible_with_index_signature.code,
155385
155473
  ts.Diagnostics.Property_0_in_type_1_is_not_assignable_to_type_2.code,
155474
+ ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1.code,
155386
155475
  ];
155387
155476
  codefix.registerCodeFix({
155388
155477
  errorCodes: errorCodes,
@@ -155393,7 +155482,7 @@ var ts;
155393
155482
  return;
155394
155483
  }
155395
155484
  var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addMissingConstraint(t, related); });
155396
- return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_extends_constraint, fixId, ts.Diagnostics.Add_missing_new_operator_to_all_calls)];
155485
+ return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_extends_constraint, fixId, ts.Diagnostics.Add_extends_constraint_to_all_type_parameters)];
155397
155486
  },
155398
155487
  fixIds: [fixId],
155399
155488
  getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) {
@@ -155404,13 +155493,10 @@ var ts;
155404
155493
  }); },
155405
155494
  });
155406
155495
  function getDiagnosticRelatedInfo(program, sourceFile, span) {
155407
- var diags = program.getSemanticDiagnostics(sourceFile).filter(function (diag) { return diag.start === span.start && diag.length === span.length; });
155408
- if (!ts.length(diags))
155496
+ var diag = ts.find(program.getSemanticDiagnostics(sourceFile), function (diag) { return diag.start === span.start && diag.length === span.length; });
155497
+ if (!diag || !diag.relatedInformation)
155409
155498
  return;
155410
- var diag = diags[0];
155411
- if (!diag.relatedInformation)
155412
- return;
155413
- var related = ts.filter(diag.relatedInformation, function (related) { return related.code === ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint.code; })[0];
155499
+ var related = ts.find(diag.relatedInformation, function (related) { return related.code === ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint.code; });
155414
155500
  if (!related)
155415
155501
  return;
155416
155502
  return related;
@@ -156505,7 +156591,7 @@ var ts;
156505
156591
  var checker = context.program.getTypeChecker();
156506
156592
  var props = ts.map(info.properties, function (prop) {
156507
156593
  var initializer = tryGetValueFromType(context, checker, importAdder, quotePreference, checker.getTypeOfSymbol(prop), info.parentDeclaration);
156508
- return ts.factory.createPropertyAssignment(ts.createPropertyNameNodeForIdentifierOrLiteral(prop.name, target, quotePreference === 0 /* Single */), initializer);
156594
+ return ts.factory.createPropertyAssignment(createPropertyNameFromSymbol(prop, target, quotePreference, checker), initializer);
156509
156595
  });
156510
156596
  var options = {
156511
156597
  leadingTriviaOption: ts.textChanges.LeadingTriviaOption.Exclude,
@@ -156625,6 +156711,15 @@ var ts;
156625
156711
  var declaration = ts.findAncestor(callExpression, function (n) { return ts.isMethodDeclaration(n) || ts.isConstructorDeclaration(n); });
156626
156712
  return declaration && declaration.parent === node ? declaration : undefined;
156627
156713
  }
156714
+ function createPropertyNameFromSymbol(symbol, target, quotePreference, checker) {
156715
+ if (ts.isTransientSymbol(symbol) && symbol.nameType && symbol.nameType.flags & 8192 /* UniqueESSymbol */) {
156716
+ var expression = checker.symbolToExpression(symbol.nameType.symbol, 111551 /* Value */, symbol.valueDeclaration, 1048576 /* AllowUniqueESSymbolType */);
156717
+ if (expression) {
156718
+ return ts.factory.createComputedPropertyName(expression);
156719
+ }
156720
+ }
156721
+ return ts.createPropertyNameNodeForIdentifierOrLiteral(symbol.name, target, quotePreference === 0 /* Single */);
156722
+ }
156628
156723
  })(codefix = ts.codefix || (ts.codefix = {}));
156629
156724
  })(ts || (ts = {}));
156630
156725
  /* @internal */
@@ -159352,7 +159447,7 @@ var ts;
159352
159447
  /*questionToken*/ undefined, typeParameters, parameters, type, createStubbedMethodBody(quotePreference));
159353
159448
  case 168 /* MethodSignature */:
159354
159449
  return ts.factory.createMethodSignature(modifiers, name,
159355
- /*questionToken*/ undefined, typeParameters, parameters, type);
159450
+ /*questionToken*/ undefined, typeParameters, parameters, type === undefined ? ts.factory.createKeywordTypeNode(155 /* UnknownKeyword */) : type);
159356
159451
  case 256 /* FunctionDeclaration */:
159357
159452
  return ts.factory.createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference));
159358
159453
  default:
@@ -170653,6 +170748,38 @@ var ts;
170653
170748
  }
170654
170749
  return result.module;
170655
170750
  };
170751
+ /*@internal*/
170752
+ Project.importServicePluginAsync = function (moduleName, initialDir, host, log, logErrors) {
170753
+ return __awaiter(this, void 0, void 0, function () {
170754
+ var resolvedPath, result, e_1, err;
170755
+ return __generator(this, function (_a) {
170756
+ switch (_a.label) {
170757
+ case 0:
170758
+ ts.Debug.assertIsDefined(host.importServicePlugin);
170759
+ resolvedPath = ts.combinePaths(initialDir, "node_modules");
170760
+ log("Dynamically importing " + moduleName + " from " + initialDir + " (resolved to " + resolvedPath + ")");
170761
+ _a.label = 1;
170762
+ case 1:
170763
+ _a.trys.push([1, 3, , 4]);
170764
+ return [4 /*yield*/, host.importServicePlugin(resolvedPath, moduleName)];
170765
+ case 2:
170766
+ result = _a.sent();
170767
+ return [3 /*break*/, 4];
170768
+ case 3:
170769
+ e_1 = _a.sent();
170770
+ result = { module: undefined, error: e_1 };
170771
+ return [3 /*break*/, 4];
170772
+ case 4:
170773
+ if (result.error) {
170774
+ err = result.error.stack || result.error.message || JSON.stringify(result.error);
170775
+ (logErrors || log)("Failed to dynamically import module '" + moduleName + "' from " + resolvedPath + ": " + err);
170776
+ return [2 /*return*/, undefined];
170777
+ }
170778
+ return [2 /*return*/, result.module];
170779
+ }
170780
+ });
170781
+ });
170782
+ };
170656
170783
  Project.prototype.isKnownTypesPackageName = function (name) {
170657
170784
  return this.typingsCache.isKnownTypesPackageName(name);
170658
170785
  };
@@ -171713,7 +171840,7 @@ var ts;
171713
171840
  };
171714
171841
  Project.prototype.enableGlobalPlugins = function (options, pluginConfigOverrides) {
171715
171842
  var host = this.projectService.host;
171716
- if (!host.require) {
171843
+ if (!host.require && !host.importServicePlugin) {
171717
171844
  this.projectService.logger.info("Plugins were requested but not running in environment that supports 'require'. Nothing will be loaded");
171718
171845
  return;
171719
171846
  }
@@ -171742,21 +171869,66 @@ var ts;
171742
171869
  }
171743
171870
  }
171744
171871
  };
171745
- Project.prototype.enablePlugin = function (pluginConfigEntry, searchPaths, pluginConfigOverrides) {
171872
+ /**
171873
+ * Performs the initial steps of enabling a plugin by finding and instantiating the module for a plugin synchronously using 'require'.
171874
+ */
171875
+ /*@internal*/
171876
+ Project.prototype.beginEnablePluginSync = function (pluginConfigEntry, searchPaths, pluginConfigOverrides) {
171746
171877
  var _this = this;
171747
- this.projectService.logger.info("Enabling plugin " + pluginConfigEntry.name + " from candidate paths: " + searchPaths.join(","));
171748
- if (!pluginConfigEntry.name || ts.parsePackageName(pluginConfigEntry.name).rest) {
171749
- this.projectService.logger.info("Skipped loading plugin " + (pluginConfigEntry.name || JSON.stringify(pluginConfigEntry)) + " because only package name is allowed plugin name");
171750
- return;
171751
- }
171752
- var log = function (message) { return _this.projectService.logger.info(message); };
171878
+ ts.Debug.assertIsDefined(this.projectService.host.require);
171753
171879
  var errorLogs;
171880
+ var log = function (message) { return _this.projectService.logger.info(message); };
171754
171881
  var logError = function (message) {
171755
- (errorLogs || (errorLogs = [])).push(message);
171882
+ (errorLogs !== null && errorLogs !== void 0 ? errorLogs : (errorLogs = [])).push(message);
171756
171883
  };
171757
171884
  var resolvedModule = ts.firstDefined(searchPaths, function (searchPath) {
171758
171885
  return Project.resolveModule(pluginConfigEntry.name, searchPath, _this.projectService.host, log, logError);
171759
171886
  });
171887
+ return { pluginConfigEntry: pluginConfigEntry, pluginConfigOverrides: pluginConfigOverrides, resolvedModule: resolvedModule, errorLogs: errorLogs };
171888
+ };
171889
+ /**
171890
+ * Performs the initial steps of enabling a plugin by finding and instantiating the module for a plugin asynchronously using dynamic `import`.
171891
+ */
171892
+ /*@internal*/
171893
+ Project.prototype.beginEnablePluginAsync = function (pluginConfigEntry, searchPaths, pluginConfigOverrides) {
171894
+ return __awaiter(this, void 0, void 0, function () {
171895
+ var errorLogs, log, logError, resolvedModule, _i, searchPaths_1, searchPath;
171896
+ var _this = this;
171897
+ return __generator(this, function (_a) {
171898
+ switch (_a.label) {
171899
+ case 0:
171900
+ ts.Debug.assertIsDefined(this.projectService.host.importServicePlugin);
171901
+ log = function (message) { return _this.projectService.logger.info(message); };
171902
+ logError = function (message) {
171903
+ (errorLogs !== null && errorLogs !== void 0 ? errorLogs : (errorLogs = [])).push(message);
171904
+ };
171905
+ _i = 0, searchPaths_1 = searchPaths;
171906
+ _a.label = 1;
171907
+ case 1:
171908
+ if (!(_i < searchPaths_1.length)) return [3 /*break*/, 4];
171909
+ searchPath = searchPaths_1[_i];
171910
+ return [4 /*yield*/, Project.importServicePluginAsync(pluginConfigEntry.name, searchPath, this.projectService.host, log, logError)];
171911
+ case 2:
171912
+ resolvedModule = (_a.sent());
171913
+ if (resolvedModule !== undefined) {
171914
+ return [3 /*break*/, 4];
171915
+ }
171916
+ _a.label = 3;
171917
+ case 3:
171918
+ _i++;
171919
+ return [3 /*break*/, 1];
171920
+ case 4: return [2 /*return*/, { pluginConfigEntry: pluginConfigEntry, pluginConfigOverrides: pluginConfigOverrides, resolvedModule: resolvedModule, errorLogs: errorLogs }];
171921
+ }
171922
+ });
171923
+ });
171924
+ };
171925
+ /**
171926
+ * Performs the remaining steps of enabling a plugin after its module has been instantiated.
171927
+ */
171928
+ /*@internal*/
171929
+ Project.prototype.endEnablePlugin = function (_a) {
171930
+ var _this = this;
171931
+ var pluginConfigEntry = _a.pluginConfigEntry, pluginConfigOverrides = _a.pluginConfigOverrides, resolvedModule = _a.resolvedModule, errorLogs = _a.errorLogs;
171760
171932
  if (resolvedModule) {
171761
171933
  var configurationOverride = pluginConfigOverrides && pluginConfigOverrides.get(pluginConfigEntry.name);
171762
171934
  if (configurationOverride) {
@@ -171768,10 +171940,13 @@ var ts;
171768
171940
  this.enableProxy(resolvedModule, pluginConfigEntry);
171769
171941
  }
171770
171942
  else {
171771
- ts.forEach(errorLogs, log);
171943
+ ts.forEach(errorLogs, function (message) { return _this.projectService.logger.info(message); });
171772
171944
  this.projectService.logger.info("Couldn't find " + pluginConfigEntry.name);
171773
171945
  }
171774
171946
  };
171947
+ Project.prototype.enablePlugin = function (pluginConfigEntry, searchPaths, pluginConfigOverrides) {
171948
+ this.projectService.requestEnablePlugin(this, pluginConfigEntry, searchPaths, pluginConfigOverrides);
171949
+ };
171775
171950
  Project.prototype.enableProxy = function (pluginModuleFactory, configEntry) {
171776
171951
  try {
171777
171952
  if (typeof pluginModuleFactory !== "function") {
@@ -172423,7 +172598,7 @@ var ts;
172423
172598
  /*@internal*/
172424
172599
  ConfiguredProject.prototype.enablePluginsWithOptions = function (options, pluginConfigOverrides) {
172425
172600
  var host = this.projectService.host;
172426
- if (!host.require) {
172601
+ if (!host.require && !host.importServicePlugin) {
172427
172602
  this.projectService.logger.info("Plugins were requested but not running in environment that supports 'require'. Nothing will be loaded");
172428
172603
  return;
172429
172604
  }
@@ -172442,7 +172617,7 @@ var ts;
172442
172617
  this.enablePlugin(pluginConfigEntry, searchPaths, pluginConfigOverrides);
172443
172618
  }
172444
172619
  }
172445
- this.enableGlobalPlugins(options, pluginConfigOverrides);
172620
+ return this.enableGlobalPlugins(options, pluginConfigOverrides);
172446
172621
  };
172447
172622
  /**
172448
172623
  * Get the errors that dont have any file name associated
@@ -175864,6 +176039,147 @@ var ts;
175864
176039
  }
175865
176040
  return false;
175866
176041
  };
176042
+ /*@internal*/
176043
+ ProjectService.prototype.requestEnablePlugin = function (project, pluginConfigEntry, searchPaths, pluginConfigOverrides) {
176044
+ var _a;
176045
+ if (!this.host.importServicePlugin && !this.host.require) {
176046
+ this.logger.info("Plugins were requested but not running in environment that supports 'require'. Nothing will be loaded");
176047
+ return;
176048
+ }
176049
+ this.logger.info("Enabling plugin " + pluginConfigEntry.name + " from candidate paths: " + searchPaths.join(","));
176050
+ if (!pluginConfigEntry.name || ts.parsePackageName(pluginConfigEntry.name).rest) {
176051
+ this.logger.info("Skipped loading plugin " + (pluginConfigEntry.name || JSON.stringify(pluginConfigEntry)) + " because only package name is allowed plugin name");
176052
+ return;
176053
+ }
176054
+ // If the host supports dynamic import, begin enabling the plugin asynchronously.
176055
+ if (this.host.importServicePlugin) {
176056
+ var importPromise = project.beginEnablePluginAsync(pluginConfigEntry, searchPaths, pluginConfigOverrides);
176057
+ (_a = this.pendingPluginEnablements) !== null && _a !== void 0 ? _a : (this.pendingPluginEnablements = new ts.Map());
176058
+ var promises = this.pendingPluginEnablements.get(project);
176059
+ if (!promises)
176060
+ this.pendingPluginEnablements.set(project, promises = []);
176061
+ promises.push(importPromise);
176062
+ return;
176063
+ }
176064
+ // Otherwise, load the plugin using `require`
176065
+ project.endEnablePlugin(project.beginEnablePluginSync(pluginConfigEntry, searchPaths, pluginConfigOverrides));
176066
+ };
176067
+ /* @internal */
176068
+ ProjectService.prototype.hasNewPluginEnablementRequests = function () {
176069
+ return !!this.pendingPluginEnablements;
176070
+ };
176071
+ /* @internal */
176072
+ ProjectService.prototype.hasPendingPluginEnablements = function () {
176073
+ return !!this.currentPluginEnablementPromise;
176074
+ };
176075
+ /**
176076
+ * Waits for any ongoing plugin enablement requests to complete.
176077
+ */
176078
+ /* @internal */
176079
+ ProjectService.prototype.waitForPendingPlugins = function () {
176080
+ return __awaiter(this, void 0, void 0, function () {
176081
+ return __generator(this, function (_a) {
176082
+ switch (_a.label) {
176083
+ case 0:
176084
+ if (!this.currentPluginEnablementPromise) return [3 /*break*/, 2];
176085
+ return [4 /*yield*/, this.currentPluginEnablementPromise];
176086
+ case 1:
176087
+ _a.sent();
176088
+ return [3 /*break*/, 0];
176089
+ case 2: return [2 /*return*/];
176090
+ }
176091
+ });
176092
+ });
176093
+ };
176094
+ /**
176095
+ * Starts enabling any requested plugins without waiting for the result.
176096
+ */
176097
+ /* @internal */
176098
+ ProjectService.prototype.enableRequestedPlugins = function () {
176099
+ if (this.pendingPluginEnablements) {
176100
+ void this.enableRequestedPluginsAsync();
176101
+ }
176102
+ };
176103
+ ProjectService.prototype.enableRequestedPluginsAsync = function () {
176104
+ return __awaiter(this, void 0, void 0, function () {
176105
+ var entries;
176106
+ return __generator(this, function (_a) {
176107
+ switch (_a.label) {
176108
+ case 0:
176109
+ if (!this.currentPluginEnablementPromise) return [3 /*break*/, 2];
176110
+ // If we're already enabling plugins, wait for any existing operations to complete
176111
+ return [4 /*yield*/, this.waitForPendingPlugins()];
176112
+ case 1:
176113
+ // If we're already enabling plugins, wait for any existing operations to complete
176114
+ _a.sent();
176115
+ _a.label = 2;
176116
+ case 2:
176117
+ // Skip if there are no new plugin enablement requests
176118
+ if (!this.pendingPluginEnablements) {
176119
+ return [2 /*return*/];
176120
+ }
176121
+ entries = ts.arrayFrom(this.pendingPluginEnablements.entries());
176122
+ this.pendingPluginEnablements = undefined;
176123
+ // Start processing the requests, keeping track of the promise for the operation so that
176124
+ // project consumers can potentially wait for the plugins to load.
176125
+ this.currentPluginEnablementPromise = this.enableRequestedPluginsWorker(entries);
176126
+ return [4 /*yield*/, this.currentPluginEnablementPromise];
176127
+ case 3:
176128
+ _a.sent();
176129
+ return [2 /*return*/];
176130
+ }
176131
+ });
176132
+ });
176133
+ };
176134
+ ProjectService.prototype.enableRequestedPluginsWorker = function (pendingPlugins) {
176135
+ return __awaiter(this, void 0, void 0, function () {
176136
+ var _this = this;
176137
+ return __generator(this, function (_a) {
176138
+ switch (_a.label) {
176139
+ case 0:
176140
+ // This should only be called from `enableRequestedPluginsAsync`, which ensures this precondition is met.
176141
+ ts.Debug.assert(this.currentPluginEnablementPromise === undefined);
176142
+ // Process all pending plugins, partitioned by project. This way a project with few plugins doesn't need to wait
176143
+ // on a project with many plugins.
176144
+ return [4 /*yield*/, Promise.all(ts.map(pendingPlugins, function (_a) {
176145
+ var project = _a[0], promises = _a[1];
176146
+ return _this.enableRequestedPluginsForProjectAsync(project, promises);
176147
+ }))];
176148
+ case 1:
176149
+ // Process all pending plugins, partitioned by project. This way a project with few plugins doesn't need to wait
176150
+ // on a project with many plugins.
176151
+ _a.sent();
176152
+ // Clear the pending operation and notify the client that projects have been updated.
176153
+ this.currentPluginEnablementPromise = undefined;
176154
+ this.sendProjectsUpdatedInBackgroundEvent();
176155
+ return [2 /*return*/];
176156
+ }
176157
+ });
176158
+ });
176159
+ };
176160
+ ProjectService.prototype.enableRequestedPluginsForProjectAsync = function (project, promises) {
176161
+ return __awaiter(this, void 0, void 0, function () {
176162
+ var results, _i, results_1, result;
176163
+ return __generator(this, function (_a) {
176164
+ switch (_a.label) {
176165
+ case 0: return [4 /*yield*/, Promise.all(promises)];
176166
+ case 1:
176167
+ results = _a.sent();
176168
+ if (project.isClosed()) {
176169
+ // project is not alive, so don't enable plugins.
176170
+ return [2 /*return*/];
176171
+ }
176172
+ for (_i = 0, results_1 = results; _i < results_1.length; _i++) {
176173
+ result = results_1[_i];
176174
+ project.endEnablePlugin(result);
176175
+ }
176176
+ // Plugins may have modified external files, so mark the project as dirty.
176177
+ this.delayUpdateProjectGraph(project);
176178
+ return [2 /*return*/];
176179
+ }
176180
+ });
176181
+ });
176182
+ };
175867
176183
  ProjectService.prototype.configurePlugin = function (args) {
175868
176184
  // For any projects that already have the plugin loaded, configure the plugin
175869
176185
  this.forEachEnabledProject(function (project) { return project.onPluginConfigurationChanged(args.pluginName, args.configuration); });
@@ -176692,7 +177008,6 @@ var ts;
176692
177008
  server.CommandNames.OrganizeImportsFull,
176693
177009
  server.CommandNames.GetEditsForFileRename,
176694
177010
  server.CommandNames.GetEditsForFileRenameFull,
176695
- server.CommandNames.ConfigurePlugin,
176696
177011
  server.CommandNames.PrepareCallHierarchy,
176697
177012
  server.CommandNames.ProvideCallHierarchyIncomingCalls,
176698
177013
  server.CommandNames.ProvideCallHierarchyOutgoingCalls,
@@ -178960,7 +179275,9 @@ var ts;
178960
179275
  Session.prototype.executeCommand = function (request) {
178961
179276
  var handler = this.handlers.get(request.command);
178962
179277
  if (handler) {
178963
- return this.executeWithRequestId(request.seq, function () { return handler(request); });
179278
+ var response = this.executeWithRequestId(request.seq, function () { return handler(request); });
179279
+ this.projectService.enableRequestedPlugins();
179280
+ return response;
178964
179281
  }
178965
179282
  else {
178966
179283
  this.logger.msg("Unrecognized JSON command:" + server.stringifyIndented(request), server.Msg.Err);