@typescript-deploys/pr-build 4.5.0-pr-45836-7 → 4.5.0-pr-45903-8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsserver.js CHANGED
@@ -100,7 +100,7 @@ var ts;
100
100
  // The following is baselined as a literal template type without intervention
101
101
  /** The version of the TypeScript compiler release */
102
102
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
103
- ts.version = ts.versionMajorMinor + ".0-insiders.20210913";
103
+ ts.version = ts.versionMajorMinor + ".0-insiders.20210916";
104
104
  /* @internal */
105
105
  var Comparison;
106
106
  (function (Comparison) {
@@ -8643,6 +8643,7 @@ var ts;
8643
8643
  Property_0_has_no_initializer_and_is_not_definitely_assigned_in_a_class_static_block: diag(2817, ts.DiagnosticCategory.Error, "Property_0_has_no_initializer_and_is_not_definitely_assigned_in_a_class_static_block_2817", "Property '{0}' has no initializer and is not definitely assigned in a class static block."),
8644
8644
  Duplicate_identifier_0_Compiler_reserves_name_1_when_emitting_super_references_in_static_initializers: diag(2818, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_Compiler_reserves_name_1_when_emitting_super_references_in_static_initializer_2818", "Duplicate identifier '{0}'. Compiler reserves name '{1}' when emitting 'super' references in static initializers."),
8645
8645
  Namespace_name_cannot_be_0: diag(2819, ts.DiagnosticCategory.Error, "Namespace_name_cannot_be_0_2819", "Namespace name cannot be '{0}'."),
8646
+ Type_0_is_not_assignable_to_type_1_Did_you_mean_2: diag(2820, ts.DiagnosticCategory.Error, "Type_0_is_not_assignable_to_type_1_Did_you_mean_2_2820", "Type '{0}' is not assignable to type '{1}'. Did you mean '{2}'?"),
8646
8647
  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}'."),
8647
8648
  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}'."),
8648
8649
  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}'."),
@@ -8744,6 +8745,11 @@ var ts;
8744
8745
  This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared_in_the_base_class_0: diag(4116, ts.DiagnosticCategory.Error, "This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared__4116", "This member must have an 'override' modifier because it overrides an abstract method that is declared in the base class '{0}'."),
8745
8746
  This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1: diag(4117, ts.DiagnosticCategory.Error, "This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_Did_you__4117", "This member cannot have an 'override' modifier because it is not declared in the base class '{0}'. Did you mean '{1}'?"),
8746
8747
  The_type_of_this_node_cannot_be_serialized_because_its_property_0_cannot_be_serialized: diag(4118, ts.DiagnosticCategory.Error, "The_type_of_this_node_cannot_be_serialized_because_its_property_0_cannot_be_serialized_4118", "The type of this node cannot be serialized because its property '{0}' cannot be serialized."),
8748
+ This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0: diag(4119, ts.DiagnosticCategory.Error, "This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_4119", "This member must have a JSDoc comment with an '@override' tag because it overrides a member in the base class '{0}'."),
8749
+ This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0: diag(4120, ts.DiagnosticCategory.Error, "This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_4120", "This parameter property must have a JSDoc comment with an '@override' tag because it overrides a member in the base class '{0}'."),
8750
+ This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_extend_another_class: diag(4121, ts.DiagnosticCategory.Error, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_4121", "This member cannot have a JSDoc comment with an '@override' tag because its containing class '{0}' does not extend another class."),
8751
+ This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0: diag(4122, ts.DiagnosticCategory.Error, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4122", "This member cannot have a JSDoc comment with an '@override' tag because it is not declared in the base class '{0}'."),
8752
+ This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1: diag(4123, ts.DiagnosticCategory.Error, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4123", "This member cannot have a JSDoc comment with an 'override' tag because it is not declared in the base class '{0}'. Did you mean '{1}'?"),
8747
8753
  The_current_host_does_not_support_the_0_option: diag(5001, ts.DiagnosticCategory.Error, "The_current_host_does_not_support_the_0_option_5001", "The current host does not support the '{0}' option."),
8748
8754
  Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, ts.DiagnosticCategory.Error, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."),
8749
8755
  File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, ts.DiagnosticCategory.Error, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."),
@@ -20678,6 +20684,15 @@ var ts;
20678
20684
  return name === "Infinity" || name === "-Infinity" || name === "NaN";
20679
20685
  }
20680
20686
  ts.isInfinityOrNaNString = isInfinityOrNaNString;
20687
+ function isCatchClauseVariableDeclaration(node) {
20688
+ return node.kind === 252 /* VariableDeclaration */ && node.parent.kind === 290 /* CatchClause */;
20689
+ }
20690
+ ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration;
20691
+ function isParameterOrCatchClauseVariable(symbol) {
20692
+ var declaration = symbol.valueDeclaration && getRootDeclaration(symbol.valueDeclaration);
20693
+ return !!declaration && (ts.isParameter(declaration) || isCatchClauseVariableDeclaration(declaration));
20694
+ }
20695
+ ts.isParameterOrCatchClauseVariable = isParameterOrCatchClauseVariable;
20681
20696
  })(ts || (ts = {}));
20682
20697
  /* @internal */
20683
20698
  var ts;
@@ -45926,6 +45941,7 @@ var ts;
45926
45941
  var totalInstantiationCount = 0;
45927
45942
  var instantiationCount = 0;
45928
45943
  var instantiationDepth = 0;
45944
+ var inlineLevel = 0;
45929
45945
  var currentNode;
45930
45946
  var emptySymbols = ts.createSymbolTable();
45931
45947
  var arrayVariances = [1 /* Covariant */];
@@ -61937,6 +61953,13 @@ var ts;
61937
61953
  message = ts.Diagnostics.Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties;
61938
61954
  }
61939
61955
  else {
61956
+ if (source.flags & 128 /* StringLiteral */ && target.flags & 1048576 /* Union */) {
61957
+ var suggestedType = getSuggestedTypeForNonexistentStringLiteralType(source, target);
61958
+ if (suggestedType) {
61959
+ reportError(ts.Diagnostics.Type_0_is_not_assignable_to_type_1_Did_you_mean_2, generalizedSourceType, targetType, typeToString(suggestedType));
61960
+ return;
61961
+ }
61962
+ }
61940
61963
  message = ts.Diagnostics.Type_0_is_not_assignable_to_type_1;
61941
61964
  }
61942
61965
  }
@@ -66490,25 +66513,6 @@ var ts;
66490
66513
  function getTypeWithFacts(type, include) {
66491
66514
  return filterType(type, function (t) { return (getTypeFacts(t) & include) !== 0; });
66492
66515
  }
66493
- function truthyTypeFilter(type, truthiness) {
66494
- if (!truthiness) {
66495
- if (type.flags & 64 /* BigInt */) {
66496
- return zeroBigIntType;
66497
- }
66498
- else if (type.flags & 16 /* Boolean */) {
66499
- return falseType;
66500
- }
66501
- else if (type.flags & 4 /* String */) {
66502
- return emptyStringType;
66503
- }
66504
- else if (type.flags & 8 /* Number */) {
66505
- return zeroType;
66506
- }
66507
- }
66508
- var facts = getTypeFacts(type);
66509
- var include = truthiness ? 4194304 /* Truthy */ : 8388608 /* Falsy */;
66510
- return ((facts & include) === 0) ? undefined : type;
66511
- }
66512
66516
  function getTypeWithDefault(type, defaultExpression) {
66513
66517
  return defaultExpression ?
66514
66518
  getUnionType([getNonUndefinedType(type), getTypeOfExpression(defaultExpression)]) :
@@ -66712,17 +66716,10 @@ var ts;
66712
66716
  function everyContainedType(type, f) {
66713
66717
  return type.flags & 3145728 /* UnionOrIntersection */ ? ts.every(type.types, f) : f(type);
66714
66718
  }
66715
- // TODO: make this actually performant
66716
- function compactMap(array, f) {
66717
- var result = ts.compact(ts.map(array, f));
66718
- return result.length === array.length && ts.every(array, function (item, i) { return item === result[i]; })
66719
- ? array
66720
- : result;
66721
- }
66722
- function filterAndNarrowType(type, narrow) {
66719
+ function filterType(type, f) {
66723
66720
  if (type.flags & 1048576 /* Union */) {
66724
66721
  var types = type.types;
66725
- var filtered = compactMap(types, narrow);
66722
+ var filtered = ts.filter(types, f);
66726
66723
  if (filtered === types) {
66727
66724
  return type;
66728
66725
  }
@@ -66735,7 +66732,7 @@ var ts;
66735
66732
  // Otherwise, if we have exactly one type left in the origin set, return that as the filtered type.
66736
66733
  // Otherwise, construct a new filtered origin type.
66737
66734
  var originTypes = origin.types;
66738
- var originFiltered = compactMap(originTypes, function (t) { return !!(t.flags & 1048576 /* Union */) ? t : narrow(t); });
66735
+ var originFiltered = ts.filter(originTypes, function (t) { return !!(t.flags & 1048576 /* Union */) || f(t); });
66739
66736
  if (originTypes.length - originFiltered.length === types.length - filtered.length) {
66740
66737
  if (originFiltered.length === 1) {
66741
66738
  return originFiltered[0];
@@ -66745,13 +66742,7 @@ var ts;
66745
66742
  }
66746
66743
  return getUnionTypeFromSortedList(filtered, type.objectFlags, /*aliasSymbol*/ undefined, /*aliasTypeArguments*/ undefined, newOrigin);
66747
66744
  }
66748
- if (type.flags & 131072 /* Never */) {
66749
- return type;
66750
- }
66751
- return narrow(type) || neverType;
66752
- }
66753
- function filterType(type, f) {
66754
- return filterAndNarrowType(type, function (t) { return f(t) ? t : undefined; });
66745
+ return type.flags & 131072 /* Never */ || f(type) ? type : neverType;
66755
66746
  }
66756
66747
  function removeType(type, targetType) {
66757
66748
  return filterType(type, function (t) { return t !== targetType; });
@@ -67129,9 +67120,10 @@ var ts;
67129
67120
  }
67130
67121
  function isConstantReference(node) {
67131
67122
  switch (node.kind) {
67132
- case 79 /* Identifier */:
67123
+ case 79 /* Identifier */: {
67133
67124
  var symbol = getResolvedSymbol(node);
67134
- return isConstVariable(symbol) || !!symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 162 /* Parameter */ && !isParameterAssigned(symbol);
67125
+ return isConstVariable(symbol) || ts.isParameterOrCatchClauseVariable(symbol) && !isSymbolAssigned(symbol);
67126
+ }
67135
67127
  case 204 /* PropertyAccessExpression */:
67136
67128
  case 205 /* ElementAccessExpression */:
67137
67129
  // The resolvedSymbol property is initialized by checkPropertyAccess or checkElementAccess before we get here.
@@ -67144,7 +67136,6 @@ var ts;
67144
67136
  var key;
67145
67137
  var isKeySet = false;
67146
67138
  var flowDepth = 0;
67147
- var inlineLevel = 0;
67148
67139
  if (flowAnalysisDisabled) {
67149
67140
  return errorType;
67150
67141
  }
@@ -67637,7 +67628,7 @@ var ts;
67637
67628
  function narrowTypeByTruthiness(type, expr, assumeTrue) {
67638
67629
  if (isMatchingReference(reference, expr)) {
67639
67630
  return type.flags & 2 /* Unknown */ && assumeTrue ? nonNullUnknownType :
67640
- filterAndNarrowType(type, function (t) { return truthyTypeFilter(t, assumeTrue); });
67631
+ getTypeWithFacts(type, assumeTrue ? 4194304 /* Truthy */ : 8388608 /* Falsy */);
67641
67632
  }
67642
67633
  if (strictNullChecks && assumeTrue && optionalChainContainsReference(expr, reference)) {
67643
67634
  type = getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
@@ -68214,35 +68205,37 @@ var ts;
68214
68205
  node.kind === 165 /* PropertyDeclaration */;
68215
68206
  });
68216
68207
  }
68217
- // Check if a parameter is assigned anywhere within its declaring function.
68218
- function isParameterAssigned(symbol) {
68208
+ // Check if a parameter or catch variable is assigned anywhere
68209
+ function isSymbolAssigned(symbol) {
68219
68210
  if (!symbol.valueDeclaration) {
68220
68211
  return false;
68221
68212
  }
68222
- var func = ts.getRootDeclaration(symbol.valueDeclaration).parent;
68223
- var links = getNodeLinks(func);
68213
+ var parent = ts.getRootDeclaration(symbol.valueDeclaration).parent;
68214
+ var links = getNodeLinks(parent);
68224
68215
  if (!(links.flags & 8388608 /* AssignmentsMarked */)) {
68225
68216
  links.flags |= 8388608 /* AssignmentsMarked */;
68226
- if (!hasParentWithAssignmentsMarked(func)) {
68227
- markParameterAssignments(func);
68217
+ if (!hasParentWithAssignmentsMarked(parent)) {
68218
+ markNodeAssignments(parent);
68228
68219
  }
68229
68220
  }
68230
68221
  return symbol.isAssigned || false;
68231
68222
  }
68232
68223
  function hasParentWithAssignmentsMarked(node) {
68233
- return !!ts.findAncestor(node.parent, function (node) { return ts.isFunctionLike(node) && !!(getNodeLinks(node).flags & 8388608 /* AssignmentsMarked */); });
68224
+ return !!ts.findAncestor(node.parent, function (node) {
68225
+ return (ts.isFunctionLike(node) || ts.isCatchClause(node)) && !!(getNodeLinks(node).flags & 8388608 /* AssignmentsMarked */);
68226
+ });
68234
68227
  }
68235
- function markParameterAssignments(node) {
68228
+ function markNodeAssignments(node) {
68236
68229
  if (node.kind === 79 /* Identifier */) {
68237
68230
  if (ts.isAssignmentTarget(node)) {
68238
68231
  var symbol = getResolvedSymbol(node);
68239
- if (symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 162 /* Parameter */) {
68232
+ if (ts.isParameterOrCatchClauseVariable(symbol)) {
68240
68233
  symbol.isAssigned = true;
68241
68234
  }
68242
68235
  }
68243
68236
  }
68244
68237
  else {
68245
- ts.forEachChild(node, markParameterAssignments);
68238
+ ts.forEachChild(node, markNodeAssignments);
68246
68239
  }
68247
68240
  }
68248
68241
  function isConstVariable(symbol) {
@@ -68302,7 +68295,19 @@ var ts;
68302
68295
  return substituteConstraints ? mapType(type, function (t) { return t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOrType(t) : t; }) : type;
68303
68296
  }
68304
68297
  function isExportOrExportExpression(location) {
68305
- return !!ts.findAncestor(location, function (e) { return e.parent && ts.isExportAssignment(e.parent) && e.parent.expression === e && ts.isEntityNameExpression(e); });
68298
+ return !!ts.findAncestor(location, function (n) {
68299
+ var parent = n.parent;
68300
+ if (parent === undefined) {
68301
+ return "quit";
68302
+ }
68303
+ if (ts.isExportAssignment(parent)) {
68304
+ return parent.expression === n && ts.isEntityNameExpression(n);
68305
+ }
68306
+ if (ts.isExportSpecifier(parent)) {
68307
+ return parent.name === n || parent.propertyName === n;
68308
+ }
68309
+ return false;
68310
+ });
68306
68311
  }
68307
68312
  function markAliasReferenced(symbol, location) {
68308
68313
  if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* Value */) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol)) {
@@ -68451,7 +68456,7 @@ var ts;
68451
68456
  // analysis to include the immediately enclosing function.
68452
68457
  while (flowContainer !== declarationContainer && (flowContainer.kind === 211 /* FunctionExpression */ ||
68453
68458
  flowContainer.kind === 212 /* ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) &&
68454
- (isConstVariable(localOrExportSymbol) && type !== autoArrayType || isParameter && !isParameterAssigned(localOrExportSymbol))) {
68459
+ (isConstVariable(localOrExportSymbol) && type !== autoArrayType || isParameter && !isSymbolAssigned(localOrExportSymbol))) {
68455
68460
  flowContainer = getControlFlowContainer(flowContainer);
68456
68461
  }
68457
68462
  // We only look for uninitialized variables in strict null checking mode, and only when we can analyze
@@ -71681,6 +71686,10 @@ var ts;
71681
71686
  }
71682
71687
  return suggestion;
71683
71688
  }
71689
+ function getSuggestedTypeForNonexistentStringLiteralType(source, target) {
71690
+ var candidates = target.types.filter(function (type) { return !!(type.flags & 128 /* StringLiteral */); });
71691
+ return ts.getSpellingSuggestion(source.value, candidates, function (type) { return type.value; });
71692
+ }
71684
71693
  /**
71685
71694
  * Given a name and a list of symbols whose names are *not* equal to the name, return a spelling suggestion if there is one that is close enough.
71686
71695
  * Names less than length 3 only check for case-insensitive equality, not levenshtein distance.
@@ -80509,6 +80518,7 @@ var ts;
80509
80518
  function checkClassMember(member, memberIsParameterProperty) {
80510
80519
  var hasOverride = ts.hasOverrideModifier(member);
80511
80520
  var hasStatic = ts.isStatic(member);
80521
+ var isJs = ts.isInJSFile(member);
80512
80522
  if (baseWithThis && (hasOverride || compilerOptions.noImplicitOverride)) {
80513
80523
  var declaredProp = member.name && getSymbolAtLocation(member.name) || getSymbolAtLocation(member);
80514
80524
  if (!declaredProp) {
@@ -80522,8 +80532,12 @@ var ts;
80522
80532
  if (prop && !baseProp && hasOverride) {
80523
80533
  var suggestion = getSuggestedSymbolForNonexistentClassMember(ts.symbolName(declaredProp), baseType);
80524
80534
  suggestion ?
80525
- error(member, ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1, baseClassName, symbolToString(suggestion)) :
80526
- error(member, ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0, baseClassName);
80535
+ error(member, isJs ?
80536
+ ts.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1 :
80537
+ ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1, baseClassName, symbolToString(suggestion)) :
80538
+ error(member, isJs ?
80539
+ ts.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0 :
80540
+ ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0, baseClassName);
80527
80541
  }
80528
80542
  else if (prop && (baseProp === null || baseProp === void 0 ? void 0 : baseProp.declarations) && compilerOptions.noImplicitOverride && !nodeInAmbientContext) {
80529
80543
  var baseHasAbstract = ts.some(baseProp.declarations, ts.hasAbstractModifier);
@@ -80532,8 +80546,12 @@ var ts;
80532
80546
  }
80533
80547
  if (!baseHasAbstract) {
80534
80548
  var diag = memberIsParameterProperty ?
80535
- ts.Diagnostics.This_parameter_property_must_have_an_override_modifier_because_it_overrides_a_member_in_base_class_0 :
80536
- ts.Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0;
80549
+ isJs ?
80550
+ ts.Diagnostics.This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0 :
80551
+ ts.Diagnostics.This_parameter_property_must_have_an_override_modifier_because_it_overrides_a_member_in_base_class_0 :
80552
+ isJs ?
80553
+ ts.Diagnostics.This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0 :
80554
+ ts.Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0;
80537
80555
  error(member, diag, baseClassName);
80538
80556
  }
80539
80557
  else if (ts.hasAbstractModifier(member) && baseHasAbstract) {
@@ -80543,7 +80561,9 @@ var ts;
80543
80561
  }
80544
80562
  else if (hasOverride) {
80545
80563
  var className = typeToString(type);
80546
- error(member, ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class, className);
80564
+ error(member, isJs ?
80565
+ ts.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_extend_another_class :
80566
+ ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class, className);
80547
80567
  }
80548
80568
  }
80549
80569
  }
@@ -112049,7 +112069,7 @@ var ts;
112049
112069
  }
112050
112070
  else {
112051
112071
  ts.forEach(options.lib, function (libFileName, index) {
112052
- processRootFile(ts.combinePaths(defaultLibraryPath, libFileName), /*isDefaultLib*/ true, /*ignoreNoDefaultLib*/ false, { kind: ts.FileIncludeKind.LibFile, index: index });
112072
+ processRootFile(pathForLibFile(libFileName), /*isDefaultLib*/ true, /*ignoreNoDefaultLib*/ false, { kind: ts.FileIncludeKind.LibFile, index: index });
112053
112073
  });
112054
112074
  }
112055
112075
  }
@@ -112711,7 +112731,7 @@ var ts;
112711
112731
  return equalityComparer(file.fileName, getDefaultLibraryFileName());
112712
112732
  }
112713
112733
  else {
112714
- return ts.some(options.lib, function (libFileName) { return equalityComparer(file.fileName, ts.combinePaths(defaultLibraryPath, libFileName)); });
112734
+ return ts.some(options.lib, function (libFileName) { return equalityComparer(file.fileName, pathForLibFile(libFileName)); });
112715
112735
  }
112716
112736
  }
112717
112737
  function getDiagnosticsProducingTypeChecker() {
@@ -113293,7 +113313,7 @@ var ts;
113293
113313
  var libName = ts.toFileNameLowerCase(ref.fileName);
113294
113314
  var libFileName = ts.libMap.get(libName);
113295
113315
  if (libFileName) {
113296
- return getSourceFile(ts.combinePaths(defaultLibraryPath, libFileName));
113316
+ return getSourceFile(pathForLibFile(libFileName));
113297
113317
  }
113298
113318
  }
113299
113319
  /** This should have similar behavior to 'processSourceFile' without diagnostics or mutation. */
@@ -113704,13 +113724,31 @@ var ts;
113704
113724
  resolvedTypeReferenceDirectives.set(typeReferenceDirective, resolvedTypeReferenceDirective);
113705
113725
  }
113706
113726
  }
113727
+ function pathForLibFile(libFileName) {
113728
+ // Support resolving to lib.dom.d.ts -> @typescript/dom, and
113729
+ // lib.dom.iterable.d.ts -> @typescript/dom/iterable
113730
+ // lib.es2015.symbol.wellknown.d.ts -> @typescript/es2015/symbol-wellknown
113731
+ var components = libFileName.split(".");
113732
+ var path = components[1];
113733
+ var i = 2;
113734
+ while (components[i] && components[i] !== "d") {
113735
+ path += (i === 2 ? "/" : "-") + components[i];
113736
+ i++;
113737
+ }
113738
+ var resolveFrom = ts.combinePaths(currentDirectory, "__lib_node_modules_lookup_" + libFileName + "__.ts");
113739
+ var localOverrideModuleResult = ts.resolveModuleName("@typescript/" + path, resolveFrom, { moduleResolution: ts.ModuleResolutionKind.NodeJs }, host, moduleResolutionCache);
113740
+ if (localOverrideModuleResult === null || localOverrideModuleResult === void 0 ? void 0 : localOverrideModuleResult.resolvedModule) {
113741
+ return localOverrideModuleResult.resolvedModule.resolvedFileName;
113742
+ }
113743
+ return ts.combinePaths(defaultLibraryPath, libFileName);
113744
+ }
113707
113745
  function processLibReferenceDirectives(file) {
113708
113746
  ts.forEach(file.libReferenceDirectives, function (libReference, index) {
113709
113747
  var libName = ts.toFileNameLowerCase(libReference.fileName);
113710
113748
  var libFileName = ts.libMap.get(libName);
113711
113749
  if (libFileName) {
113712
113750
  // we ignore any 'no-default-lib' reference set on this file.
113713
- processRootFile(ts.combinePaths(defaultLibraryPath, libFileName), /*isDefaultLib*/ true, /*ignoreNoDefaultLib*/ true, { kind: ts.FileIncludeKind.LibReferenceDirective, file: file.path, index: index, });
113751
+ processRootFile(pathForLibFile(libFileName), /*isDefaultLib*/ true, /*ignoreNoDefaultLib*/ true, { kind: ts.FileIncludeKind.LibReferenceDirective, file: file.path, index: index, });
113714
113752
  }
113715
113753
  else {
113716
113754
  var unqualifiedLibName = ts.removeSuffix(ts.removePrefix(libName, "lib."), ".d.ts");
@@ -126612,6 +126650,32 @@ var ts;
126612
126650
  data = originToCompletionEntryData(origin);
126613
126651
  hasAction = !importCompletionNode;
126614
126652
  }
126653
+ var kind = ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, location); // TODO: GH#18217
126654
+ if (kind === "JSX attribute" /* jsxAttribute */ && preferences.jsxSnippetCompletion && preferences.jsxSnippetCompletion !== "none") {
126655
+ var useBraces_1 = preferences.jsxSnippetCompletion === "braces";
126656
+ var type = typeChecker.getTypeOfSymbolAtLocation(symbol, location);
126657
+ // If is boolean like or undefined, don't return a snippet we want just to return the completion.
126658
+ if (preferences.jsxSnippetCompletion === "auto"
126659
+ && !(type.flags & 528 /* BooleanLike */)
126660
+ && !(type.flags & 1048576 /* Union */ && ts.every(type.types, function (type) { return !!(type.flags & (528 /* BooleanLike */ | 32768 /* Undefined */)); }))) {
126661
+ if (type.flags & 402653316 /* StringLike */ || (type.flags & 1048576 /* Union */ && ts.every(type.types, function (type) { return !!(type.flags & (402653316 /* StringLike */ | 32768 /* Undefined */)); }))) {
126662
+ // If is string like or undefined use quotes
126663
+ insertText = name + "=" + ts.quote(sourceFile, preferences, "$1");
126664
+ isSnippet = true;
126665
+ }
126666
+ else {
126667
+ // Use braces for everything else
126668
+ useBraces_1 = true;
126669
+ }
126670
+ }
126671
+ if (useBraces_1) {
126672
+ insertText = name + "={$1}";
126673
+ isSnippet = true;
126674
+ }
126675
+ if (isSnippet) {
126676
+ replacementSpan = ts.createTextSpanFromNode(location, sourceFile);
126677
+ }
126678
+ }
126615
126679
  // TODO(drosen): Right now we just permit *all* semantic meanings when calling
126616
126680
  // 'getSymbolKind' which is permissible given that it is backwards compatible; but
126617
126681
  // really we should consider passing the meaning for the node so that we don't report
@@ -126621,7 +126685,7 @@ var ts;
126621
126685
  // entries (like JavaScript identifier entries).
126622
126686
  return {
126623
126687
  name: name,
126624
- kind: ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, location),
126688
+ kind: kind,
126625
126689
  kindModifiers: ts.SymbolDisplay.getSymbolModifiers(typeChecker, symbol),
126626
126690
  sortText: sortText,
126627
126691
  source: getSourceFromOrigin(origin),
@@ -146864,6 +146928,7 @@ var ts;
146864
146928
  ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0.code,
146865
146929
  ts.Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2.code,
146866
146930
  ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1.code,
146931
+ ts.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1.code,
146867
146932
  // for JSX class components
146868
146933
  ts.Diagnostics.No_overload_matches_this_call.code,
146869
146934
  // for JSX FC
@@ -2722,8 +2722,8 @@ declare namespace ts {
2722
2722
  root: ConditionalRoot;
2723
2723
  checkType: Type;
2724
2724
  extendsType: Type;
2725
- resolvedTrueType: Type;
2726
- resolvedFalseType: Type;
2725
+ resolvedTrueType?: Type;
2726
+ resolvedFalseType?: Type;
2727
2727
  }
2728
2728
  export interface TemplateLiteralType extends InstantiableType {
2729
2729
  texts: readonly string[];
@@ -3995,6 +3995,7 @@ declare namespace ts {
3995
3995
  readonly providePrefixAndSuffixTextForRename?: boolean;
3996
3996
  readonly includePackageJsonAutoImports?: "auto" | "on" | "off";
3997
3997
  readonly provideRefactorNotApplicableReason?: boolean;
3998
+ readonly jsxSnippetCompletion?: "auto" | "braces" | "none";
3998
3999
  }
3999
4000
  /** Represents a bigint literal value without requiring bigint support */
4000
4001
  export interface PseudoBigInt {
@@ -9458,6 +9459,7 @@ declare namespace ts.server.protocol {
9458
9459
  readonly provideRefactorNotApplicableReason?: boolean;
9459
9460
  readonly allowRenameOfImportPath?: boolean;
9460
9461
  readonly includePackageJsonAutoImports?: "auto" | "on" | "off";
9462
+ readonly jsxSnippetCompletion?: "auto" | "braces" | "none";
9461
9463
  readonly displayPartsForJSDoc?: boolean;
9462
9464
  readonly generateReturnInDocTemplate?: boolean;
9463
9465
  }
@@ -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.20210913";
297
+ ts.version = ts.versionMajorMinor + ".0-insiders.20210916";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -8837,6 +8837,7 @@ var ts;
8837
8837
  Property_0_has_no_initializer_and_is_not_definitely_assigned_in_a_class_static_block: diag(2817, ts.DiagnosticCategory.Error, "Property_0_has_no_initializer_and_is_not_definitely_assigned_in_a_class_static_block_2817", "Property '{0}' has no initializer and is not definitely assigned in a class static block."),
8838
8838
  Duplicate_identifier_0_Compiler_reserves_name_1_when_emitting_super_references_in_static_initializers: diag(2818, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_Compiler_reserves_name_1_when_emitting_super_references_in_static_initializer_2818", "Duplicate identifier '{0}'. Compiler reserves name '{1}' when emitting 'super' references in static initializers."),
8839
8839
  Namespace_name_cannot_be_0: diag(2819, ts.DiagnosticCategory.Error, "Namespace_name_cannot_be_0_2819", "Namespace name cannot be '{0}'."),
8840
+ Type_0_is_not_assignable_to_type_1_Did_you_mean_2: diag(2820, ts.DiagnosticCategory.Error, "Type_0_is_not_assignable_to_type_1_Did_you_mean_2_2820", "Type '{0}' is not assignable to type '{1}'. Did you mean '{2}'?"),
8840
8841
  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}'."),
8841
8842
  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}'."),
8842
8843
  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}'."),
@@ -8938,6 +8939,11 @@ var ts;
8938
8939
  This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared_in_the_base_class_0: diag(4116, ts.DiagnosticCategory.Error, "This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared__4116", "This member must have an 'override' modifier because it overrides an abstract method that is declared in the base class '{0}'."),
8939
8940
  This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1: diag(4117, ts.DiagnosticCategory.Error, "This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_Did_you__4117", "This member cannot have an 'override' modifier because it is not declared in the base class '{0}'. Did you mean '{1}'?"),
8940
8941
  The_type_of_this_node_cannot_be_serialized_because_its_property_0_cannot_be_serialized: diag(4118, ts.DiagnosticCategory.Error, "The_type_of_this_node_cannot_be_serialized_because_its_property_0_cannot_be_serialized_4118", "The type of this node cannot be serialized because its property '{0}' cannot be serialized."),
8942
+ This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0: diag(4119, ts.DiagnosticCategory.Error, "This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_4119", "This member must have a JSDoc comment with an '@override' tag because it overrides a member in the base class '{0}'."),
8943
+ This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0: diag(4120, ts.DiagnosticCategory.Error, "This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_4120", "This parameter property must have a JSDoc comment with an '@override' tag because it overrides a member in the base class '{0}'."),
8944
+ This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_extend_another_class: diag(4121, ts.DiagnosticCategory.Error, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_4121", "This member cannot have a JSDoc comment with an '@override' tag because its containing class '{0}' does not extend another class."),
8945
+ This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0: diag(4122, ts.DiagnosticCategory.Error, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4122", "This member cannot have a JSDoc comment with an '@override' tag because it is not declared in the base class '{0}'."),
8946
+ This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1: diag(4123, ts.DiagnosticCategory.Error, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4123", "This member cannot have a JSDoc comment with an 'override' tag because it is not declared in the base class '{0}'. Did you mean '{1}'?"),
8941
8947
  The_current_host_does_not_support_the_0_option: diag(5001, ts.DiagnosticCategory.Error, "The_current_host_does_not_support_the_0_option_5001", "The current host does not support the '{0}' option."),
8942
8948
  Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, ts.DiagnosticCategory.Error, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."),
8943
8949
  File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, ts.DiagnosticCategory.Error, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."),
@@ -20872,6 +20878,15 @@ var ts;
20872
20878
  return name === "Infinity" || name === "-Infinity" || name === "NaN";
20873
20879
  }
20874
20880
  ts.isInfinityOrNaNString = isInfinityOrNaNString;
20881
+ function isCatchClauseVariableDeclaration(node) {
20882
+ return node.kind === 252 /* VariableDeclaration */ && node.parent.kind === 290 /* CatchClause */;
20883
+ }
20884
+ ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration;
20885
+ function isParameterOrCatchClauseVariable(symbol) {
20886
+ var declaration = symbol.valueDeclaration && getRootDeclaration(symbol.valueDeclaration);
20887
+ return !!declaration && (ts.isParameter(declaration) || isCatchClauseVariableDeclaration(declaration));
20888
+ }
20889
+ ts.isParameterOrCatchClauseVariable = isParameterOrCatchClauseVariable;
20875
20890
  })(ts || (ts = {}));
20876
20891
  /* @internal */
20877
20892
  var ts;
@@ -46120,6 +46135,7 @@ var ts;
46120
46135
  var totalInstantiationCount = 0;
46121
46136
  var instantiationCount = 0;
46122
46137
  var instantiationDepth = 0;
46138
+ var inlineLevel = 0;
46123
46139
  var currentNode;
46124
46140
  var emptySymbols = ts.createSymbolTable();
46125
46141
  var arrayVariances = [1 /* Covariant */];
@@ -62131,6 +62147,13 @@ var ts;
62131
62147
  message = ts.Diagnostics.Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties;
62132
62148
  }
62133
62149
  else {
62150
+ if (source.flags & 128 /* StringLiteral */ && target.flags & 1048576 /* Union */) {
62151
+ var suggestedType = getSuggestedTypeForNonexistentStringLiteralType(source, target);
62152
+ if (suggestedType) {
62153
+ reportError(ts.Diagnostics.Type_0_is_not_assignable_to_type_1_Did_you_mean_2, generalizedSourceType, targetType, typeToString(suggestedType));
62154
+ return;
62155
+ }
62156
+ }
62134
62157
  message = ts.Diagnostics.Type_0_is_not_assignable_to_type_1;
62135
62158
  }
62136
62159
  }
@@ -66684,25 +66707,6 @@ var ts;
66684
66707
  function getTypeWithFacts(type, include) {
66685
66708
  return filterType(type, function (t) { return (getTypeFacts(t) & include) !== 0; });
66686
66709
  }
66687
- function truthyTypeFilter(type, truthiness) {
66688
- if (!truthiness) {
66689
- if (type.flags & 64 /* BigInt */) {
66690
- return zeroBigIntType;
66691
- }
66692
- else if (type.flags & 16 /* Boolean */) {
66693
- return falseType;
66694
- }
66695
- else if (type.flags & 4 /* String */) {
66696
- return emptyStringType;
66697
- }
66698
- else if (type.flags & 8 /* Number */) {
66699
- return zeroType;
66700
- }
66701
- }
66702
- var facts = getTypeFacts(type);
66703
- var include = truthiness ? 4194304 /* Truthy */ : 8388608 /* Falsy */;
66704
- return ((facts & include) === 0) ? undefined : type;
66705
- }
66706
66710
  function getTypeWithDefault(type, defaultExpression) {
66707
66711
  return defaultExpression ?
66708
66712
  getUnionType([getNonUndefinedType(type), getTypeOfExpression(defaultExpression)]) :
@@ -66906,17 +66910,10 @@ var ts;
66906
66910
  function everyContainedType(type, f) {
66907
66911
  return type.flags & 3145728 /* UnionOrIntersection */ ? ts.every(type.types, f) : f(type);
66908
66912
  }
66909
- // TODO: make this actually performant
66910
- function compactMap(array, f) {
66911
- var result = ts.compact(ts.map(array, f));
66912
- return result.length === array.length && ts.every(array, function (item, i) { return item === result[i]; })
66913
- ? array
66914
- : result;
66915
- }
66916
- function filterAndNarrowType(type, narrow) {
66913
+ function filterType(type, f) {
66917
66914
  if (type.flags & 1048576 /* Union */) {
66918
66915
  var types = type.types;
66919
- var filtered = compactMap(types, narrow);
66916
+ var filtered = ts.filter(types, f);
66920
66917
  if (filtered === types) {
66921
66918
  return type;
66922
66919
  }
@@ -66929,7 +66926,7 @@ var ts;
66929
66926
  // Otherwise, if we have exactly one type left in the origin set, return that as the filtered type.
66930
66927
  // Otherwise, construct a new filtered origin type.
66931
66928
  var originTypes = origin.types;
66932
- var originFiltered = compactMap(originTypes, function (t) { return !!(t.flags & 1048576 /* Union */) ? t : narrow(t); });
66929
+ var originFiltered = ts.filter(originTypes, function (t) { return !!(t.flags & 1048576 /* Union */) || f(t); });
66933
66930
  if (originTypes.length - originFiltered.length === types.length - filtered.length) {
66934
66931
  if (originFiltered.length === 1) {
66935
66932
  return originFiltered[0];
@@ -66939,13 +66936,7 @@ var ts;
66939
66936
  }
66940
66937
  return getUnionTypeFromSortedList(filtered, type.objectFlags, /*aliasSymbol*/ undefined, /*aliasTypeArguments*/ undefined, newOrigin);
66941
66938
  }
66942
- if (type.flags & 131072 /* Never */) {
66943
- return type;
66944
- }
66945
- return narrow(type) || neverType;
66946
- }
66947
- function filterType(type, f) {
66948
- return filterAndNarrowType(type, function (t) { return f(t) ? t : undefined; });
66939
+ return type.flags & 131072 /* Never */ || f(type) ? type : neverType;
66949
66940
  }
66950
66941
  function removeType(type, targetType) {
66951
66942
  return filterType(type, function (t) { return t !== targetType; });
@@ -67323,9 +67314,10 @@ var ts;
67323
67314
  }
67324
67315
  function isConstantReference(node) {
67325
67316
  switch (node.kind) {
67326
- case 79 /* Identifier */:
67317
+ case 79 /* Identifier */: {
67327
67318
  var symbol = getResolvedSymbol(node);
67328
- return isConstVariable(symbol) || !!symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 162 /* Parameter */ && !isParameterAssigned(symbol);
67319
+ return isConstVariable(symbol) || ts.isParameterOrCatchClauseVariable(symbol) && !isSymbolAssigned(symbol);
67320
+ }
67329
67321
  case 204 /* PropertyAccessExpression */:
67330
67322
  case 205 /* ElementAccessExpression */:
67331
67323
  // The resolvedSymbol property is initialized by checkPropertyAccess or checkElementAccess before we get here.
@@ -67338,7 +67330,6 @@ var ts;
67338
67330
  var key;
67339
67331
  var isKeySet = false;
67340
67332
  var flowDepth = 0;
67341
- var inlineLevel = 0;
67342
67333
  if (flowAnalysisDisabled) {
67343
67334
  return errorType;
67344
67335
  }
@@ -67831,7 +67822,7 @@ var ts;
67831
67822
  function narrowTypeByTruthiness(type, expr, assumeTrue) {
67832
67823
  if (isMatchingReference(reference, expr)) {
67833
67824
  return type.flags & 2 /* Unknown */ && assumeTrue ? nonNullUnknownType :
67834
- filterAndNarrowType(type, function (t) { return truthyTypeFilter(t, assumeTrue); });
67825
+ getTypeWithFacts(type, assumeTrue ? 4194304 /* Truthy */ : 8388608 /* Falsy */);
67835
67826
  }
67836
67827
  if (strictNullChecks && assumeTrue && optionalChainContainsReference(expr, reference)) {
67837
67828
  type = getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
@@ -68408,35 +68399,37 @@ var ts;
68408
68399
  node.kind === 165 /* PropertyDeclaration */;
68409
68400
  });
68410
68401
  }
68411
- // Check if a parameter is assigned anywhere within its declaring function.
68412
- function isParameterAssigned(symbol) {
68402
+ // Check if a parameter or catch variable is assigned anywhere
68403
+ function isSymbolAssigned(symbol) {
68413
68404
  if (!symbol.valueDeclaration) {
68414
68405
  return false;
68415
68406
  }
68416
- var func = ts.getRootDeclaration(symbol.valueDeclaration).parent;
68417
- var links = getNodeLinks(func);
68407
+ var parent = ts.getRootDeclaration(symbol.valueDeclaration).parent;
68408
+ var links = getNodeLinks(parent);
68418
68409
  if (!(links.flags & 8388608 /* AssignmentsMarked */)) {
68419
68410
  links.flags |= 8388608 /* AssignmentsMarked */;
68420
- if (!hasParentWithAssignmentsMarked(func)) {
68421
- markParameterAssignments(func);
68411
+ if (!hasParentWithAssignmentsMarked(parent)) {
68412
+ markNodeAssignments(parent);
68422
68413
  }
68423
68414
  }
68424
68415
  return symbol.isAssigned || false;
68425
68416
  }
68426
68417
  function hasParentWithAssignmentsMarked(node) {
68427
- return !!ts.findAncestor(node.parent, function (node) { return ts.isFunctionLike(node) && !!(getNodeLinks(node).flags & 8388608 /* AssignmentsMarked */); });
68418
+ return !!ts.findAncestor(node.parent, function (node) {
68419
+ return (ts.isFunctionLike(node) || ts.isCatchClause(node)) && !!(getNodeLinks(node).flags & 8388608 /* AssignmentsMarked */);
68420
+ });
68428
68421
  }
68429
- function markParameterAssignments(node) {
68422
+ function markNodeAssignments(node) {
68430
68423
  if (node.kind === 79 /* Identifier */) {
68431
68424
  if (ts.isAssignmentTarget(node)) {
68432
68425
  var symbol = getResolvedSymbol(node);
68433
- if (symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 162 /* Parameter */) {
68426
+ if (ts.isParameterOrCatchClauseVariable(symbol)) {
68434
68427
  symbol.isAssigned = true;
68435
68428
  }
68436
68429
  }
68437
68430
  }
68438
68431
  else {
68439
- ts.forEachChild(node, markParameterAssignments);
68432
+ ts.forEachChild(node, markNodeAssignments);
68440
68433
  }
68441
68434
  }
68442
68435
  function isConstVariable(symbol) {
@@ -68496,7 +68489,19 @@ var ts;
68496
68489
  return substituteConstraints ? mapType(type, function (t) { return t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOrType(t) : t; }) : type;
68497
68490
  }
68498
68491
  function isExportOrExportExpression(location) {
68499
- return !!ts.findAncestor(location, function (e) { return e.parent && ts.isExportAssignment(e.parent) && e.parent.expression === e && ts.isEntityNameExpression(e); });
68492
+ return !!ts.findAncestor(location, function (n) {
68493
+ var parent = n.parent;
68494
+ if (parent === undefined) {
68495
+ return "quit";
68496
+ }
68497
+ if (ts.isExportAssignment(parent)) {
68498
+ return parent.expression === n && ts.isEntityNameExpression(n);
68499
+ }
68500
+ if (ts.isExportSpecifier(parent)) {
68501
+ return parent.name === n || parent.propertyName === n;
68502
+ }
68503
+ return false;
68504
+ });
68500
68505
  }
68501
68506
  function markAliasReferenced(symbol, location) {
68502
68507
  if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* Value */) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol)) {
@@ -68645,7 +68650,7 @@ var ts;
68645
68650
  // analysis to include the immediately enclosing function.
68646
68651
  while (flowContainer !== declarationContainer && (flowContainer.kind === 211 /* FunctionExpression */ ||
68647
68652
  flowContainer.kind === 212 /* ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) &&
68648
- (isConstVariable(localOrExportSymbol) && type !== autoArrayType || isParameter && !isParameterAssigned(localOrExportSymbol))) {
68653
+ (isConstVariable(localOrExportSymbol) && type !== autoArrayType || isParameter && !isSymbolAssigned(localOrExportSymbol))) {
68649
68654
  flowContainer = getControlFlowContainer(flowContainer);
68650
68655
  }
68651
68656
  // We only look for uninitialized variables in strict null checking mode, and only when we can analyze
@@ -71875,6 +71880,10 @@ var ts;
71875
71880
  }
71876
71881
  return suggestion;
71877
71882
  }
71883
+ function getSuggestedTypeForNonexistentStringLiteralType(source, target) {
71884
+ var candidates = target.types.filter(function (type) { return !!(type.flags & 128 /* StringLiteral */); });
71885
+ return ts.getSpellingSuggestion(source.value, candidates, function (type) { return type.value; });
71886
+ }
71878
71887
  /**
71879
71888
  * Given a name and a list of symbols whose names are *not* equal to the name, return a spelling suggestion if there is one that is close enough.
71880
71889
  * Names less than length 3 only check for case-insensitive equality, not levenshtein distance.
@@ -80703,6 +80712,7 @@ var ts;
80703
80712
  function checkClassMember(member, memberIsParameterProperty) {
80704
80713
  var hasOverride = ts.hasOverrideModifier(member);
80705
80714
  var hasStatic = ts.isStatic(member);
80715
+ var isJs = ts.isInJSFile(member);
80706
80716
  if (baseWithThis && (hasOverride || compilerOptions.noImplicitOverride)) {
80707
80717
  var declaredProp = member.name && getSymbolAtLocation(member.name) || getSymbolAtLocation(member);
80708
80718
  if (!declaredProp) {
@@ -80716,8 +80726,12 @@ var ts;
80716
80726
  if (prop && !baseProp && hasOverride) {
80717
80727
  var suggestion = getSuggestedSymbolForNonexistentClassMember(ts.symbolName(declaredProp), baseType);
80718
80728
  suggestion ?
80719
- error(member, ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1, baseClassName, symbolToString(suggestion)) :
80720
- error(member, ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0, baseClassName);
80729
+ error(member, isJs ?
80730
+ ts.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1 :
80731
+ ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1, baseClassName, symbolToString(suggestion)) :
80732
+ error(member, isJs ?
80733
+ ts.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0 :
80734
+ ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0, baseClassName);
80721
80735
  }
80722
80736
  else if (prop && (baseProp === null || baseProp === void 0 ? void 0 : baseProp.declarations) && compilerOptions.noImplicitOverride && !nodeInAmbientContext) {
80723
80737
  var baseHasAbstract = ts.some(baseProp.declarations, ts.hasAbstractModifier);
@@ -80726,8 +80740,12 @@ var ts;
80726
80740
  }
80727
80741
  if (!baseHasAbstract) {
80728
80742
  var diag = memberIsParameterProperty ?
80729
- ts.Diagnostics.This_parameter_property_must_have_an_override_modifier_because_it_overrides_a_member_in_base_class_0 :
80730
- ts.Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0;
80743
+ isJs ?
80744
+ ts.Diagnostics.This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0 :
80745
+ ts.Diagnostics.This_parameter_property_must_have_an_override_modifier_because_it_overrides_a_member_in_base_class_0 :
80746
+ isJs ?
80747
+ ts.Diagnostics.This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0 :
80748
+ ts.Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0;
80731
80749
  error(member, diag, baseClassName);
80732
80750
  }
80733
80751
  else if (ts.hasAbstractModifier(member) && baseHasAbstract) {
@@ -80737,7 +80755,9 @@ var ts;
80737
80755
  }
80738
80756
  else if (hasOverride) {
80739
80757
  var className = typeToString(type);
80740
- error(member, ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class, className);
80758
+ error(member, isJs ?
80759
+ ts.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_extend_another_class :
80760
+ ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class, className);
80741
80761
  }
80742
80762
  }
80743
80763
  }
@@ -112243,7 +112263,7 @@ var ts;
112243
112263
  }
112244
112264
  else {
112245
112265
  ts.forEach(options.lib, function (libFileName, index) {
112246
- processRootFile(ts.combinePaths(defaultLibraryPath, libFileName), /*isDefaultLib*/ true, /*ignoreNoDefaultLib*/ false, { kind: ts.FileIncludeKind.LibFile, index: index });
112266
+ processRootFile(pathForLibFile(libFileName), /*isDefaultLib*/ true, /*ignoreNoDefaultLib*/ false, { kind: ts.FileIncludeKind.LibFile, index: index });
112247
112267
  });
112248
112268
  }
112249
112269
  }
@@ -112905,7 +112925,7 @@ var ts;
112905
112925
  return equalityComparer(file.fileName, getDefaultLibraryFileName());
112906
112926
  }
112907
112927
  else {
112908
- return ts.some(options.lib, function (libFileName) { return equalityComparer(file.fileName, ts.combinePaths(defaultLibraryPath, libFileName)); });
112928
+ return ts.some(options.lib, function (libFileName) { return equalityComparer(file.fileName, pathForLibFile(libFileName)); });
112909
112929
  }
112910
112930
  }
112911
112931
  function getDiagnosticsProducingTypeChecker() {
@@ -113487,7 +113507,7 @@ var ts;
113487
113507
  var libName = ts.toFileNameLowerCase(ref.fileName);
113488
113508
  var libFileName = ts.libMap.get(libName);
113489
113509
  if (libFileName) {
113490
- return getSourceFile(ts.combinePaths(defaultLibraryPath, libFileName));
113510
+ return getSourceFile(pathForLibFile(libFileName));
113491
113511
  }
113492
113512
  }
113493
113513
  /** This should have similar behavior to 'processSourceFile' without diagnostics or mutation. */
@@ -113898,13 +113918,31 @@ var ts;
113898
113918
  resolvedTypeReferenceDirectives.set(typeReferenceDirective, resolvedTypeReferenceDirective);
113899
113919
  }
113900
113920
  }
113921
+ function pathForLibFile(libFileName) {
113922
+ // Support resolving to lib.dom.d.ts -> @typescript/dom, and
113923
+ // lib.dom.iterable.d.ts -> @typescript/dom/iterable
113924
+ // lib.es2015.symbol.wellknown.d.ts -> @typescript/es2015/symbol-wellknown
113925
+ var components = libFileName.split(".");
113926
+ var path = components[1];
113927
+ var i = 2;
113928
+ while (components[i] && components[i] !== "d") {
113929
+ path += (i === 2 ? "/" : "-") + components[i];
113930
+ i++;
113931
+ }
113932
+ var resolveFrom = ts.combinePaths(currentDirectory, "__lib_node_modules_lookup_" + libFileName + "__.ts");
113933
+ var localOverrideModuleResult = ts.resolveModuleName("@typescript/" + path, resolveFrom, { moduleResolution: ts.ModuleResolutionKind.NodeJs }, host, moduleResolutionCache);
113934
+ if (localOverrideModuleResult === null || localOverrideModuleResult === void 0 ? void 0 : localOverrideModuleResult.resolvedModule) {
113935
+ return localOverrideModuleResult.resolvedModule.resolvedFileName;
113936
+ }
113937
+ return ts.combinePaths(defaultLibraryPath, libFileName);
113938
+ }
113901
113939
  function processLibReferenceDirectives(file) {
113902
113940
  ts.forEach(file.libReferenceDirectives, function (libReference, index) {
113903
113941
  var libName = ts.toFileNameLowerCase(libReference.fileName);
113904
113942
  var libFileName = ts.libMap.get(libName);
113905
113943
  if (libFileName) {
113906
113944
  // we ignore any 'no-default-lib' reference set on this file.
113907
- processRootFile(ts.combinePaths(defaultLibraryPath, libFileName), /*isDefaultLib*/ true, /*ignoreNoDefaultLib*/ true, { kind: ts.FileIncludeKind.LibReferenceDirective, file: file.path, index: index, });
113945
+ processRootFile(pathForLibFile(libFileName), /*isDefaultLib*/ true, /*ignoreNoDefaultLib*/ true, { kind: ts.FileIncludeKind.LibReferenceDirective, file: file.path, index: index, });
113908
113946
  }
113909
113947
  else {
113910
113948
  var unqualifiedLibName = ts.removeSuffix(ts.removePrefix(libName, "lib."), ".d.ts");
@@ -127194,6 +127232,32 @@ var ts;
127194
127232
  data = originToCompletionEntryData(origin);
127195
127233
  hasAction = !importCompletionNode;
127196
127234
  }
127235
+ var kind = ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, location); // TODO: GH#18217
127236
+ if (kind === "JSX attribute" /* jsxAttribute */ && preferences.jsxSnippetCompletion && preferences.jsxSnippetCompletion !== "none") {
127237
+ var useBraces_1 = preferences.jsxSnippetCompletion === "braces";
127238
+ var type = typeChecker.getTypeOfSymbolAtLocation(symbol, location);
127239
+ // If is boolean like or undefined, don't return a snippet we want just to return the completion.
127240
+ if (preferences.jsxSnippetCompletion === "auto"
127241
+ && !(type.flags & 528 /* BooleanLike */)
127242
+ && !(type.flags & 1048576 /* Union */ && ts.every(type.types, function (type) { return !!(type.flags & (528 /* BooleanLike */ | 32768 /* Undefined */)); }))) {
127243
+ if (type.flags & 402653316 /* StringLike */ || (type.flags & 1048576 /* Union */ && ts.every(type.types, function (type) { return !!(type.flags & (402653316 /* StringLike */ | 32768 /* Undefined */)); }))) {
127244
+ // If is string like or undefined use quotes
127245
+ insertText = name + "=" + ts.quote(sourceFile, preferences, "$1");
127246
+ isSnippet = true;
127247
+ }
127248
+ else {
127249
+ // Use braces for everything else
127250
+ useBraces_1 = true;
127251
+ }
127252
+ }
127253
+ if (useBraces_1) {
127254
+ insertText = name + "={$1}";
127255
+ isSnippet = true;
127256
+ }
127257
+ if (isSnippet) {
127258
+ replacementSpan = ts.createTextSpanFromNode(location, sourceFile);
127259
+ }
127260
+ }
127197
127261
  // TODO(drosen): Right now we just permit *all* semantic meanings when calling
127198
127262
  // 'getSymbolKind' which is permissible given that it is backwards compatible; but
127199
127263
  // really we should consider passing the meaning for the node so that we don't report
@@ -127203,7 +127267,7 @@ var ts;
127203
127267
  // entries (like JavaScript identifier entries).
127204
127268
  return {
127205
127269
  name: name,
127206
- kind: ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, location),
127270
+ kind: kind,
127207
127271
  kindModifiers: ts.SymbolDisplay.getSymbolModifiers(typeChecker, symbol),
127208
127272
  sortText: sortText,
127209
127273
  source: getSourceFromOrigin(origin),
@@ -147446,6 +147510,7 @@ var ts;
147446
147510
  ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0.code,
147447
147511
  ts.Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2.code,
147448
147512
  ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1.code,
147513
+ ts.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1.code,
147449
147514
  // for JSX class components
147450
147515
  ts.Diagnostics.No_overload_matches_this_call.code,
147451
147516
  // for JSX FC