@typescript-deploys/pr-build 4.7.0-pr-48112-6 → 4.7.0-pr-47172-7

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.20220304";
103
+ ts.version = ts.versionMajorMinor + ".0-insiders.20220305";
104
104
  /* @internal */
105
105
  var Comparison;
106
106
  (function (Comparison) {
@@ -8707,7 +8707,6 @@ var ts;
8707
8707
  Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node12_or_nodenext_Did_you_mean_0: diag(2835, ts.DiagnosticCategory.Error, "Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2835", "Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean '{0}'?"),
8708
8708
  Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls: diag(2836, ts.DiagnosticCategory.Error, "Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls_2836", "Import assertions are not allowed on statements that transpile to commonjs 'require' calls."),
8709
8709
  Import_assertion_values_must_be_string_literal_expressions: diag(2837, ts.DiagnosticCategory.Error, "Import_assertion_values_must_be_string_literal_expressions_2837", "Import assertion values must be string literal expressions."),
8710
- All_declarations_of_0_must_have_identical_constraints: diag(2838, ts.DiagnosticCategory.Error, "All_declarations_of_0_must_have_identical_constraints_2838", "All declarations of '{0}' must have identical constraints."),
8711
8710
  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}'."),
8712
8711
  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}'."),
8713
8712
  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}'."),
@@ -21014,7 +21013,6 @@ var ts;
21014
21013
  parenthesizeExpressionForDisallowedComma: parenthesizeExpressionForDisallowedComma,
21015
21014
  parenthesizeExpressionOfExpressionStatement: parenthesizeExpressionOfExpressionStatement,
21016
21015
  parenthesizeConciseBodyOfArrowFunction: parenthesizeConciseBodyOfArrowFunction,
21017
- parenthesizeCheckTypeOfConditionalType: parenthesizeCheckTypeOfConditionalType,
21018
21016
  parenthesizeMemberOfConditionalType: parenthesizeMemberOfConditionalType,
21019
21017
  parenthesizeMemberOfElementType: parenthesizeMemberOfElementType,
21020
21018
  parenthesizeElementTypeOfArrayType: parenthesizeElementTypeOfArrayType,
@@ -21331,10 +21329,6 @@ var ts;
21331
21329
  }
21332
21330
  return body;
21333
21331
  }
21334
- function parenthesizeCheckTypeOfConditionalType(member) {
21335
- return ts.isInferTypeNode(member) ? factory.createParenthesizedType(member) :
21336
- parenthesizeMemberOfConditionalType(member);
21337
- }
21338
21332
  function parenthesizeMemberOfConditionalType(member) {
21339
21333
  return member.kind === 188 /* ConditionalType */ ? factory.createParenthesizedType(member) : member;
21340
21334
  }
@@ -21387,7 +21381,6 @@ var ts;
21387
21381
  parenthesizeExpressionForDisallowedComma: ts.identity,
21388
21382
  parenthesizeExpressionOfExpressionStatement: ts.identity,
21389
21383
  parenthesizeConciseBodyOfArrowFunction: ts.identity,
21390
- parenthesizeCheckTypeOfConditionalType: ts.identity,
21391
21384
  parenthesizeMemberOfConditionalType: ts.identity,
21392
21385
  parenthesizeMemberOfElementType: ts.identity,
21393
21386
  parenthesizeElementTypeOfArrayType: ts.identity,
@@ -23004,7 +22997,7 @@ var ts;
23004
22997
  // @api
23005
22998
  function createConditionalTypeNode(checkType, extendsType, trueType, falseType) {
23006
22999
  var node = createBaseNode(188 /* ConditionalType */);
23007
- node.checkType = parenthesizerRules().parenthesizeCheckTypeOfConditionalType(checkType);
23000
+ node.checkType = parenthesizerRules().parenthesizeMemberOfConditionalType(checkType);
23008
23001
  node.extendsType = parenthesizerRules().parenthesizeMemberOfConditionalType(extendsType);
23009
23002
  node.trueType = trueType;
23010
23003
  node.falseType = falseType;
@@ -32578,9 +32571,6 @@ var ts;
32578
32571
  return finishNode(factory.createTypeQueryNode(entityName, typeArguments), pos);
32579
32572
  }
32580
32573
  function parseTypeParameter() {
32581
- return parseTypeParameterWorker(/*canHaveDefault*/ true);
32582
- }
32583
- function parseTypeParameterWorker(canHaveDefault) {
32584
32574
  var pos = getNodePos();
32585
32575
  var name = parseIdentifier();
32586
32576
  var constraint;
@@ -32604,7 +32594,7 @@ var ts;
32604
32594
  expression = parseUnaryExpressionOrHigher();
32605
32595
  }
32606
32596
  }
32607
- var defaultType = canHaveDefault && parseOptional(63 /* EqualsToken */) ? parseType() : undefined;
32597
+ var defaultType = parseOptional(63 /* EqualsToken */) ? parseType() : undefined;
32608
32598
  var node = factory.createTypeParameterDeclaration(name, constraint, defaultType);
32609
32599
  node.expression = expression;
32610
32600
  return finishNode(node, pos);
@@ -33269,10 +33259,16 @@ var ts;
33269
33259
  parseExpected(operator);
33270
33260
  return finishNode(factory.createTypeOperatorNode(operator, parseTypeOperatorOrHigher()), pos);
33271
33261
  }
33262
+ function parseTypeParameterOfInferType() {
33263
+ var pos = getNodePos();
33264
+ return finishNode(factory.createTypeParameterDeclaration(parseIdentifier(),
33265
+ /*constraint*/ undefined,
33266
+ /*defaultType*/ undefined), pos);
33267
+ }
33272
33268
  function parseInferType() {
33273
33269
  var pos = getNodePos();
33274
33270
  parseExpected(137 /* InferKeyword */);
33275
- return finishNode(factory.createInferTypeNode(parseTypeParameterWorker(/*canHaveDefault*/ false)), pos);
33271
+ return finishNode(factory.createInferTypeNode(parseTypeParameterOfInferType()), pos);
33276
33272
  }
33277
33273
  function parseTypeOperatorOrHigher() {
33278
33274
  var operator = token();
@@ -39240,7 +39236,8 @@ var ts;
39240
39236
  name: "jsxFragmentFactory",
39241
39237
  type: "string",
39242
39238
  category: ts.Diagnostics.Language_and_Environment,
39243
- description: ts.Diagnostics.Specify_the_JSX_Fragment_reference_used_for_fragments_when_targeting_React_JSX_emit_e_g_React_Fragment_or_Fragment
39239
+ description: ts.Diagnostics.Specify_the_JSX_Fragment_reference_used_for_fragments_when_targeting_React_JSX_emit_e_g_React_Fragment_or_Fragment,
39240
+ defaultValueDescription: "React.Fragment",
39244
39241
  },
39245
39242
  {
39246
39243
  name: "jsxImportSource",
@@ -44329,7 +44326,7 @@ var ts;
44329
44326
  return ts.isDottedName(expr)
44330
44327
  || (ts.isPropertyAccessExpression(expr) || ts.isNonNullExpression(expr) || ts.isParenthesizedExpression(expr)) && isNarrowableReference(expr.expression)
44331
44328
  || ts.isBinaryExpression(expr) && expr.operatorToken.kind === 27 /* CommaToken */ && isNarrowableReference(expr.right)
44332
- || ts.isElementAccessExpression(expr) && ts.isStringOrNumericLiteralLike(expr.argumentExpression) && isNarrowableReference(expr.expression)
44329
+ || ts.isElementAccessExpression(expr) && (ts.isStringOrNumericLiteralLike(expr.argumentExpression) || ts.isEntityNameExpression(expr.argumentExpression)) && isNarrowableReference(expr.expression)
44333
44330
  || ts.isAssignmentExpression(expr) && isNarrowableReference(expr.left);
44334
44331
  }
44335
44332
  function containsNarrowableReference(expr) {
@@ -52565,7 +52562,15 @@ var ts;
52565
52562
  });
52566
52563
  }
52567
52564
  }
52568
- if (!symbolName) {
52565
+ if (symbolName === undefined) {
52566
+ var name = ts.firstDefined(symbol.declarations, ts.getNameOfDeclaration);
52567
+ if (name && ts.isComputedPropertyName(name) && ts.isEntityName(name.expression)) {
52568
+ var LHS = createAccessFromSymbolChain(chain, index - 1, stopper);
52569
+ if (ts.isEntityName(LHS)) {
52570
+ return ts.factory.createIndexedAccessTypeNode(ts.factory.createParenthesizedType(ts.factory.createTypeQueryNode(LHS)), ts.factory.createTypeQueryNode(name.expression));
52571
+ }
52572
+ return LHS;
52573
+ }
52569
52574
  symbolName = getNameOfSymbolAsWritten(symbol, context);
52570
52575
  }
52571
52576
  context.approximateLength += symbolName.length + 1;
@@ -65305,7 +65310,7 @@ var ts;
65305
65310
  var requireOptionalProperties = (relation === subtypeRelation || relation === strictSubtypeRelation) && !isObjectLiteralType(source) && !isEmptyArrayLiteralType(source) && !isTupleType(source);
65306
65311
  var unmatchedProperty = getUnmatchedProperty(source, target, requireOptionalProperties, /*matchDiscriminantProperties*/ false);
65307
65312
  if (unmatchedProperty) {
65308
- if (reportErrors) {
65313
+ if (reportErrors && shouldReportUnmatchedPropertyError(source, target)) {
65309
65314
  reportUnmatchedProperty(source, target, unmatchedProperty, requireOptionalProperties);
65310
65315
  }
65311
65316
  return 0 /* False */;
@@ -65461,6 +65466,19 @@ var ts;
65461
65466
  }
65462
65467
  return result;
65463
65468
  }
65469
+ function shouldReportUnmatchedPropertyError(source, target) {
65470
+ var typeCallSignatures = getSignaturesOfStructuredType(source, 0 /* Call */);
65471
+ var typeConstructSignatures = getSignaturesOfStructuredType(source, 1 /* Construct */);
65472
+ var typeProperties = getPropertiesOfObjectType(source);
65473
+ if ((typeCallSignatures.length || typeConstructSignatures.length) && !typeProperties.length) {
65474
+ if ((getSignaturesOfType(target, 0 /* Call */).length && typeCallSignatures.length) ||
65475
+ (getSignaturesOfType(target, 1 /* Construct */).length && typeConstructSignatures.length)) {
65476
+ return true; // target has similar signature kinds to source, still focus on the unmatched property
65477
+ }
65478
+ return false;
65479
+ }
65480
+ return true;
65481
+ }
65464
65482
  function reportIncompatibleCallSignatureReturn(siga, sigb) {
65465
65483
  if (siga.parameters.length === 0 && sigb.parameters.length === 0) {
65466
65484
  return function (source, target) { return reportIncompatibleError(ts.Diagnostics.Call_signatures_with_no_arguments_have_incompatible_return_types_0_and_1, typeToString(source), typeToString(target)); };
@@ -68036,8 +68054,9 @@ var ts;
68036
68054
  return isMatchingReference(source.expression, target);
68037
68055
  case 205 /* PropertyAccessExpression */:
68038
68056
  case 206 /* ElementAccessExpression */:
68039
- return ts.isAccessExpression(target) &&
68040
- getAccessedPropertyName(source) === getAccessedPropertyName(target) &&
68057
+ var sourcePropertyName = getAccessedPropertyName(source);
68058
+ var targetPropertyName = ts.isAccessExpression(target) ? getAccessedPropertyName(target) : undefined;
68059
+ return sourcePropertyName !== undefined && targetPropertyName !== undefined && targetPropertyName === sourcePropertyName &&
68041
68060
  isMatchingReference(source.expression, target.expression);
68042
68061
  case 160 /* QualifiedName */:
68043
68062
  return ts.isAccessExpression(target) &&
@@ -68049,12 +68068,49 @@ var ts;
68049
68068
  return false;
68050
68069
  }
68051
68070
  function getAccessedPropertyName(access) {
68052
- var propertyName;
68053
- return access.kind === 205 /* PropertyAccessExpression */ ? access.name.escapedText :
68054
- access.kind === 206 /* ElementAccessExpression */ && ts.isStringOrNumericLiteralLike(access.argumentExpression) ? ts.escapeLeadingUnderscores(access.argumentExpression.text) :
68055
- access.kind === 202 /* BindingElement */ && (propertyName = getDestructuringPropertyName(access)) ? ts.escapeLeadingUnderscores(propertyName) :
68056
- access.kind === 163 /* Parameter */ ? ("" + access.parent.parameters.indexOf(access)) :
68057
- undefined;
68071
+ if (ts.isPropertyAccessExpression(access)) {
68072
+ return access.name.escapedText;
68073
+ }
68074
+ if (ts.isElementAccessExpression(access)) {
68075
+ return tryGetElementAccessExpressionName(access);
68076
+ }
68077
+ if (ts.isBindingElement(access)) {
68078
+ var name = getDestructuringPropertyName(access);
68079
+ return name ? ts.escapeLeadingUnderscores(name) : undefined;
68080
+ }
68081
+ if (ts.isParameter(access)) {
68082
+ return ("" + access.parent.parameters.indexOf(access));
68083
+ }
68084
+ return undefined;
68085
+ }
68086
+ function tryGetNameFromType(type) {
68087
+ return type.flags & 8192 /* UniqueESSymbol */ ? type.escapedName :
68088
+ type.flags & 384 /* StringOrNumberLiteral */ ? ts.escapeLeadingUnderscores("" + type.value) : undefined;
68089
+ }
68090
+ function tryGetElementAccessExpressionName(node) {
68091
+ if (ts.isStringOrNumericLiteralLike(node.argumentExpression)) {
68092
+ return ts.escapeLeadingUnderscores(node.argumentExpression.text);
68093
+ }
68094
+ if (ts.isEntityNameExpression(node.argumentExpression)) {
68095
+ var symbol = resolveEntityName(node.argumentExpression, 111551 /* Value */, /*ignoreErrors*/ true);
68096
+ if (!symbol || !isConstVariable(symbol))
68097
+ return undefined;
68098
+ var declaration = symbol.valueDeclaration;
68099
+ if (declaration === undefined)
68100
+ return undefined;
68101
+ var type = tryGetTypeFromEffectiveTypeNode(declaration);
68102
+ if (type) {
68103
+ var name = tryGetNameFromType(type);
68104
+ if (name !== undefined) {
68105
+ return name;
68106
+ }
68107
+ }
68108
+ if (ts.hasOnlyExpressionInitializer(declaration)) {
68109
+ var initializer = ts.getEffectiveInitializer(declaration);
68110
+ return initializer && tryGetNameFromType(getTypeOfExpression(initializer));
68111
+ }
68112
+ }
68113
+ return undefined;
68058
68114
  }
68059
68115
  function containsMatchingReference(source, target) {
68060
68116
  while (ts.isAccessExpression(source)) {
@@ -69948,6 +70004,14 @@ var ts;
69948
70004
  // the candidate type. If one or more constituents remain, return a union of those.
69949
70005
  if (type.flags & 1048576 /* Union */) {
69950
70006
  var assignableType = filterType(type, function (t) { return isRelated(t, candidate); });
70007
+ if (candidate.flags & 1048576 /* Union */) {
70008
+ var unionAssignableType = mapType(type, function (type) {
70009
+ return filterType(candidate, function (candidate) { return isRelated(candidate, type); });
70010
+ });
70011
+ if (!isTypeSubtypeOf(unionAssignableType, assignableType)) {
70012
+ assignableType = unionAssignableType;
70013
+ }
70014
+ }
69951
70015
  if (!(assignableType.flags & 131072 /* Never */)) {
69952
70016
  return assignableType;
69953
70017
  }
@@ -71560,11 +71624,21 @@ var ts;
71560
71624
  }
71561
71625
  return false;
71562
71626
  }
71627
+ function uniqueStrings(strings) {
71628
+ var unique = new ts.Set(strings);
71629
+ var result = [];
71630
+ unique.forEach(function (str) { return result.push(str); });
71631
+ return result;
71632
+ }
71563
71633
  function discriminateContextualTypeByObjectMembers(node, contextualType) {
71564
- return getMatchingUnionConstituentForObjectLiteral(contextualType, node) || discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 295 /* PropertyAssignment */ && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return getContextFreeTypeOfExpression(prop.initializer); }, prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType);
71634
+ return getMatchingUnionConstituentForObjectLiteral(contextualType, node) || discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 295 /* PropertyAssignment */ && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return getContextFreeTypeOfExpression(prop.initializer); }, prop.symbol.escapedName]; }), ts.map(uniqueStrings(ts.flatMap(contextualType.types, function (memberType) {
71635
+ return ts.map(ts.filter(getPropertiesOfType(memberType), function (s) { var _a; return !!(s.flags & 16777216 /* Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return s.escapedName; });
71636
+ })), function (name) { return [function () { return undefinedType; }, name]; })), isTypeAssignableTo, contextualType);
71565
71637
  }
71566
71638
  function discriminateContextualTypeByJSXAttributes(node, contextualType) {
71567
- return discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 284 /* JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return getContextFreeTypeOfExpression(prop.initializer); }), prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType);
71639
+ return discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 284 /* JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return getContextFreeTypeOfExpression(prop.initializer); }), prop.symbol.escapedName]; }), ts.map(uniqueStrings(ts.flatMap(contextualType.types, function (memberType) {
71640
+ return ts.map(ts.filter(getPropertiesOfType(memberType), function (s) { var _a; return !!(s.flags & 16777216 /* Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return s.escapedName; });
71641
+ })), function (name) { return [function () { return undefinedType; }, name]; })), isTypeAssignableTo, contextualType);
71568
71642
  }
71569
71643
  // Return the contextual type for a given expression node. During overload resolution, a contextual type may temporarily
71570
71644
  // be "pushed" onto a node using the contextualType property.
@@ -73059,21 +73133,20 @@ var ts;
73059
73133
  // of the property as base classes
73060
73134
  var enclosingClass = forEachEnclosingClass(location, function (enclosingDeclaration) {
73061
73135
  var enclosingClass = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingDeclaration));
73062
- return isClassDerivedFromDeclaringClasses(enclosingClass, prop, writing) ? enclosingClass : undefined;
73136
+ return isClassDerivedFromDeclaringClasses(enclosingClass, prop, writing);
73063
73137
  });
73064
73138
  // A protected property is accessible if the property is within the declaring class or classes derived from it
73065
73139
  if (!enclosingClass) {
73066
73140
  // allow PropertyAccessibility if context is in function with this parameter
73067
- // static member access is disallow
73068
- var thisParameter = void 0;
73069
- if (flags & 32 /* Static */ || !(thisParameter = getThisParameterFromNodeContext(location)) || !thisParameter.type) {
73141
+ // static member access is disallowed
73142
+ enclosingClass = getEnclosingClassFromThisParameter(location);
73143
+ enclosingClass = enclosingClass && isClassDerivedFromDeclaringClasses(enclosingClass, prop, writing);
73144
+ if (flags & 32 /* Static */ || !enclosingClass) {
73070
73145
  if (errorNode) {
73071
73146
  error(errorNode, ts.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(getDeclaringClass(prop) || containingType));
73072
73147
  }
73073
73148
  return false;
73074
73149
  }
73075
- var thisType = getTypeFromTypeNode(thisParameter.type);
73076
- enclosingClass = ((thisType.flags & 262144 /* TypeParameter */) ? getConstraintOfTypeParameter(thisType) : thisType).target;
73077
73150
  }
73078
73151
  // No further restrictions for static properties
73079
73152
  if (flags & 32 /* Static */) {
@@ -73091,6 +73164,17 @@ var ts;
73091
73164
  }
73092
73165
  return true;
73093
73166
  }
73167
+ function getEnclosingClassFromThisParameter(node) {
73168
+ var thisParameter = getThisParameterFromNodeContext(node);
73169
+ var thisType = (thisParameter === null || thisParameter === void 0 ? void 0 : thisParameter.type) && getTypeFromTypeNode(thisParameter.type);
73170
+ if (thisType && thisType.flags & 262144 /* TypeParameter */) {
73171
+ thisType = getConstraintOfTypeParameter(thisType);
73172
+ }
73173
+ if (thisType && ts.getObjectFlags(thisType) & (3 /* ClassOrInterface */ | 4 /* Reference */)) {
73174
+ return getTargetType(thisType);
73175
+ }
73176
+ return undefined;
73177
+ }
73094
73178
  function getThisParameterFromNodeContext(node) {
73095
73179
  var thisContainer = ts.getThisContainer(node, /* includeArrowFunctions */ false);
73096
73180
  return thisContainer && ts.isFunctionLike(thisContainer) ? ts.getThisParameter(thisContainer) : undefined;
@@ -77072,7 +77156,7 @@ var ts;
77072
77156
  case 40 /* MinusToken */:
77073
77157
  case 54 /* TildeToken */:
77074
77158
  checkNonNullType(operandType, node.operand);
77075
- if (maybeTypeOfKind(operandType, 12288 /* ESSymbolLike */)) {
77159
+ if (maybeTypeOfKindConsideringBaseConstraint(operandType, 12288 /* ESSymbolLike */)) {
77076
77160
  error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator));
77077
77161
  }
77078
77162
  if (node.operator === 39 /* PlusToken */) {
@@ -77120,6 +77204,13 @@ var ts;
77120
77204
  // If it's not a bigint type, implicit coercion will result in a number
77121
77205
  return numberType;
77122
77206
  }
77207
+ function maybeTypeOfKindConsideringBaseConstraint(type, kind) {
77208
+ if (maybeTypeOfKind(type, kind)) {
77209
+ return true;
77210
+ }
77211
+ var baseConstraint = getBaseConstraintOrType(type);
77212
+ return !!baseConstraint && maybeTypeOfKind(baseConstraint, kind);
77213
+ }
77123
77214
  // Return true if type might be of the given kind. A union or intersection type might be of a given
77124
77215
  // kind if at least one constituent type is of the given kind.
77125
77216
  function maybeTypeOfKind(type, kind) {
@@ -77829,8 +77920,8 @@ var ts;
77829
77920
  }
77830
77921
  // Return true if there was no error, false if there was an error.
77831
77922
  function checkForDisallowedESSymbolOperand(operator) {
77832
- var offendingSymbolOperand = maybeTypeOfKind(leftType, 12288 /* ESSymbolLike */) ? left :
77833
- maybeTypeOfKind(rightType, 12288 /* ESSymbolLike */) ? right :
77923
+ var offendingSymbolOperand = maybeTypeOfKindConsideringBaseConstraint(leftType, 12288 /* ESSymbolLike */) ? left :
77924
+ maybeTypeOfKindConsideringBaseConstraint(rightType, 12288 /* ESSymbolLike */) ? right :
77834
77925
  undefined;
77835
77926
  if (offendingSymbolOperand) {
77836
77927
  error(offendingSymbolOperand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(operator));
@@ -78034,7 +78125,7 @@ var ts;
78034
78125
  for (var _i = 0, _a = node.templateSpans; _i < _a.length; _i++) {
78035
78126
  var span = _a[_i];
78036
78127
  var type = checkExpression(span.expression);
78037
- if (maybeTypeOfKind(type, 12288 /* ESSymbolLike */)) {
78128
+ if (maybeTypeOfKindConsideringBaseConstraint(type, 12288 /* ESSymbolLike */)) {
78038
78129
  error(span.expression, ts.Diagnostics.Implicit_conversion_of_a_symbol_to_a_string_will_fail_at_runtime_Consider_wrapping_this_expression_in_String);
78039
78130
  }
78040
78131
  texts.push(span.literal.text);
@@ -79380,23 +79471,6 @@ var ts;
79380
79471
  grammarErrorOnNode(node, ts.Diagnostics.infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type);
79381
79472
  }
79382
79473
  checkSourceElement(node.typeParameter);
79383
- var symbol = getSymbolOfNode(node.typeParameter);
79384
- if (symbol.declarations && symbol.declarations.length > 1) {
79385
- var links = getSymbolLinks(symbol);
79386
- if (!links.typeParametersChecked) {
79387
- links.typeParametersChecked = true;
79388
- var typeParameter = getDeclaredTypeOfTypeParameter(symbol);
79389
- var declarations = ts.getDeclarationsOfKind(symbol, 162 /* TypeParameter */);
79390
- if (!areTypeParametersIdentical(declarations, [typeParameter], function (decl) { return [decl]; })) {
79391
- // Report an error on every conflicting declaration.
79392
- var name = symbolToString(symbol);
79393
- for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) {
79394
- var declaration = declarations_4[_i];
79395
- error(declaration.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_constraints, name);
79396
- }
79397
- }
79398
- }
79399
- }
79400
79474
  registerForUnusedIdentifiersCheck(node);
79401
79475
  }
79402
79476
  function checkTemplateLiteralType(node) {
@@ -79576,8 +79650,8 @@ var ts;
79576
79650
  var hasNonAmbientClass = false;
79577
79651
  var functionDeclarations = [];
79578
79652
  if (declarations) {
79579
- for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) {
79580
- var current = declarations_5[_i];
79653
+ for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) {
79654
+ var current = declarations_4[_i];
79581
79655
  var node = current;
79582
79656
  var inAmbientContext = node.flags & 8388608 /* Ambient */;
79583
79657
  var inAmbientContextOrInterface = node.parent && (node.parent.kind === 257 /* InterfaceDeclaration */ || node.parent.kind === 181 /* TypeLiteral */) || inAmbientContext;
@@ -80724,8 +80798,8 @@ var ts;
80724
80798
  : ts.createDiagnosticForNode(declarationList.parent.kind === 236 /* VariableStatement */ ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused));
80725
80799
  }
80726
80800
  else {
80727
- for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) {
80728
- var decl = declarations_6[_i];
80801
+ for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) {
80802
+ var decl = declarations_5[_i];
80729
80803
  addDiagnostic(decl, 0 /* Local */, ts.createDiagnosticForNode(decl, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(decl.name)));
80730
80804
  }
80731
80805
  }
@@ -82518,23 +82592,23 @@ var ts;
82518
82592
  return;
82519
82593
  }
82520
82594
  var type = getDeclaredTypeOfSymbol(symbol);
82521
- if (!areTypeParametersIdentical(declarations, type.localTypeParameters, ts.getEffectiveTypeParameterDeclarations)) {
82595
+ if (!areTypeParametersIdentical(declarations, type.localTypeParameters)) {
82522
82596
  // Report an error on every conflicting declaration.
82523
82597
  var name = symbolToString(symbol);
82524
- for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) {
82525
- var declaration = declarations_7[_i];
82598
+ for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) {
82599
+ var declaration = declarations_6[_i];
82526
82600
  error(declaration.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, name);
82527
82601
  }
82528
82602
  }
82529
82603
  }
82530
82604
  }
82531
- function areTypeParametersIdentical(declarations, targetParameters, getTypeParameterDeclarations) {
82605
+ function areTypeParametersIdentical(declarations, targetParameters) {
82532
82606
  var maxTypeArgumentCount = ts.length(targetParameters);
82533
82607
  var minTypeArgumentCount = getMinTypeArgumentCount(targetParameters);
82534
- for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) {
82535
- var declaration = declarations_8[_i];
82608
+ for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) {
82609
+ var declaration = declarations_7[_i];
82536
82610
  // If this declaration has too few or too many type parameters, we report an error
82537
- var sourceParameters = getTypeParameterDeclarations(declaration);
82611
+ var sourceParameters = ts.getEffectiveTypeParameterDeclarations(declaration);
82538
82612
  var numTypeParameters = sourceParameters.length;
82539
82613
  if (numTypeParameters < minTypeArgumentCount || numTypeParameters > maxTypeArgumentCount) {
82540
82614
  return false;
@@ -83078,7 +83152,7 @@ var ts;
83078
83152
  }
83079
83153
  if (!ts.isStatic(member) && isPropertyWithoutInitializer(member)) {
83080
83154
  var propName = member.name;
83081
- if (ts.isIdentifier(propName) || ts.isPrivateIdentifier(propName)) {
83155
+ if (ts.isIdentifier(propName) || ts.isPrivateIdentifier(propName) || ts.isComputedPropertyName(propName)) {
83082
83156
  var type = getTypeOfSymbol(getSymbolOfNode(member));
83083
83157
  if (!(type.flags & 3 /* AnyOrUnknown */ || getFalsyFlags(type) & 32768 /* Undefined */)) {
83084
83158
  if (!constructor || !isPropertyInitializedInConstructor(propName, type, constructor)) {
@@ -83113,7 +83187,9 @@ var ts;
83113
83187
  return false;
83114
83188
  }
83115
83189
  function isPropertyInitializedInConstructor(propName, propType, constructor) {
83116
- var reference = ts.factory.createPropertyAccessExpression(ts.factory.createThis(), propName);
83190
+ var reference = ts.isComputedPropertyName(propName)
83191
+ ? ts.factory.createElementAccessExpression(ts.factory.createThis(), propName.expression)
83192
+ : ts.factory.createPropertyAccessExpression(ts.factory.createThis(), propName);
83117
83193
  ts.setParent(reference.expression, reference);
83118
83194
  ts.setParent(reference, constructor);
83119
83195
  reference.flowNode = constructor.returnFlowNode;
@@ -83402,8 +83478,8 @@ var ts;
83402
83478
  function getFirstNonAmbientClassOrFunctionDeclaration(symbol) {
83403
83479
  var declarations = symbol.declarations;
83404
83480
  if (declarations) {
83405
- for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) {
83406
- var declaration = declarations_9[_i];
83481
+ for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) {
83482
+ var declaration = declarations_8[_i];
83407
83483
  if ((declaration.kind === 256 /* ClassDeclaration */ ||
83408
83484
  (declaration.kind === 255 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) &&
83409
83485
  !(declaration.flags & 8388608 /* Ambient */)) {
@@ -92670,10 +92746,7 @@ var ts;
92670
92746
  var substitute = typeof constantValue === "string" ? factory.createStringLiteral(constantValue) : factory.createNumericLiteral(constantValue);
92671
92747
  if (!compilerOptions.removeComments) {
92672
92748
  var originalNode = ts.getOriginalNode(node, ts.isAccessExpression);
92673
- var propertyName = ts.isPropertyAccessExpression(originalNode)
92674
- ? ts.declarationNameToString(originalNode.name)
92675
- : safeMultiLineComment(ts.getTextOfNode(originalNode.argumentExpression));
92676
- ts.addSyntheticTrailingComment(substitute, 3 /* MultiLineCommentTrivia */, " " + propertyName + " ");
92749
+ ts.addSyntheticTrailingComment(substitute, 3 /* MultiLineCommentTrivia */, " " + safeMultiLineComment(ts.getTextOfNode(originalNode)) + " ");
92677
92750
  }
92678
92751
  return substitute;
92679
92752
  }
@@ -98472,8 +98545,8 @@ var ts;
98472
98545
  // declarations may not be sorted by position.
98473
98546
  // pos should be the minimum* position over all nodes (that's not -1), end should be the maximum end over all nodes.
98474
98547
  var pos = -1, end = -1;
98475
- for (var _i = 0, declarations_10 = declarations; _i < declarations_10.length; _i++) {
98476
- var node = declarations_10[_i];
98548
+ for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) {
98549
+ var node = declarations_9[_i];
98477
98550
  pos = pos === -1 ? node.pos : node.pos === -1 ? pos : Math.min(pos, node.pos);
98478
98551
  end = Math.max(end, node.end);
98479
98552
  }
@@ -150874,8 +150947,10 @@ var ts;
150874
150947
  var checker = program.getTypeChecker();
150875
150948
  var compilerOptions = program.getCompilerOptions();
150876
150949
  var symbolName = getSymbolName(sourceFile, checker, symbolToken, compilerOptions);
150877
- // "default" is a keyword and not a legal identifier for the import, so we don't expect it here
150878
- ts.Debug.assert(symbolName !== "default" /* Default */, "'default' isn't a legal identifier and couldn't occur here");
150950
+ // "default" is a keyword and not a legal identifier for the import, but appears as an identifier.
150951
+ if (symbolName === "default" /* Default */) {
150952
+ return undefined;
150953
+ }
150879
150954
  var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(symbolToken);
150880
150955
  var useRequire = shouldUseRequire(sourceFile, program);
150881
150956
  var exportInfo = getExportInfos(symbolName, ts.isJSXTagName(symbolToken), ts.getMeaningFromLocation(symbolToken), cancellationToken, sourceFile, program, useAutoImportProvider, host, preferences);