@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/tsc.js CHANGED
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
69
69
  var ts;
70
70
  (function (ts) {
71
71
  ts.versionMajorMinor = "4.7";
72
- ts.version = ts.versionMajorMinor + ".0-insiders.20220304";
72
+ ts.version = ts.versionMajorMinor + ".0-insiders.20220305";
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  var globals = typeof globalThis !== "undefined" ? globalThis :
@@ -5915,7 +5915,6 @@ var ts;
5915
5915
  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}'?"),
5916
5916
  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."),
5917
5917
  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."),
5918
- 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."),
5919
5918
  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}'."),
5920
5919
  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}'."),
5921
5920
  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}'."),
@@ -16717,7 +16716,6 @@ var ts;
16717
16716
  parenthesizeExpressionForDisallowedComma: parenthesizeExpressionForDisallowedComma,
16718
16717
  parenthesizeExpressionOfExpressionStatement: parenthesizeExpressionOfExpressionStatement,
16719
16718
  parenthesizeConciseBodyOfArrowFunction: parenthesizeConciseBodyOfArrowFunction,
16720
- parenthesizeCheckTypeOfConditionalType: parenthesizeCheckTypeOfConditionalType,
16721
16719
  parenthesizeMemberOfConditionalType: parenthesizeMemberOfConditionalType,
16722
16720
  parenthesizeMemberOfElementType: parenthesizeMemberOfElementType,
16723
16721
  parenthesizeElementTypeOfArrayType: parenthesizeElementTypeOfArrayType,
@@ -16910,10 +16908,6 @@ var ts;
16910
16908
  }
16911
16909
  return body;
16912
16910
  }
16913
- function parenthesizeCheckTypeOfConditionalType(member) {
16914
- return ts.isInferTypeNode(member) ? factory.createParenthesizedType(member) :
16915
- parenthesizeMemberOfConditionalType(member);
16916
- }
16917
16911
  function parenthesizeMemberOfConditionalType(member) {
16918
16912
  return member.kind === 188 ? factory.createParenthesizedType(member) : member;
16919
16913
  }
@@ -16966,7 +16960,6 @@ var ts;
16966
16960
  parenthesizeExpressionForDisallowedComma: ts.identity,
16967
16961
  parenthesizeExpressionOfExpressionStatement: ts.identity,
16968
16962
  parenthesizeConciseBodyOfArrowFunction: ts.identity,
16969
- parenthesizeCheckTypeOfConditionalType: ts.identity,
16970
16963
  parenthesizeMemberOfConditionalType: ts.identity,
16971
16964
  parenthesizeMemberOfElementType: ts.identity,
16972
16965
  parenthesizeElementTypeOfArrayType: ts.identity,
@@ -18398,7 +18391,7 @@ var ts;
18398
18391
  }
18399
18392
  function createConditionalTypeNode(checkType, extendsType, trueType, falseType) {
18400
18393
  var node = createBaseNode(188);
18401
- node.checkType = parenthesizerRules().parenthesizeCheckTypeOfConditionalType(checkType);
18394
+ node.checkType = parenthesizerRules().parenthesizeMemberOfConditionalType(checkType);
18402
18395
  node.extendsType = parenthesizerRules().parenthesizeMemberOfConditionalType(extendsType);
18403
18396
  node.trueType = trueType;
18404
18397
  node.falseType = falseType;
@@ -26261,9 +26254,6 @@ var ts;
26261
26254
  return finishNode(factory.createTypeQueryNode(entityName, typeArguments), pos);
26262
26255
  }
26263
26256
  function parseTypeParameter() {
26264
- return parseTypeParameterWorker(true);
26265
- }
26266
- function parseTypeParameterWorker(canHaveDefault) {
26267
26257
  var pos = getNodePos();
26268
26258
  var name = parseIdentifier();
26269
26259
  var constraint;
@@ -26276,7 +26266,7 @@ var ts;
26276
26266
  expression = parseUnaryExpressionOrHigher();
26277
26267
  }
26278
26268
  }
26279
- var defaultType = canHaveDefault && parseOptional(63) ? parseType() : undefined;
26269
+ var defaultType = parseOptional(63) ? parseType() : undefined;
26280
26270
  var node = factory.createTypeParameterDeclaration(name, constraint, defaultType);
26281
26271
  node.expression = expression;
26282
26272
  return finishNode(node, pos);
@@ -26851,10 +26841,14 @@ var ts;
26851
26841
  parseExpected(operator);
26852
26842
  return finishNode(factory.createTypeOperatorNode(operator, parseTypeOperatorOrHigher()), pos);
26853
26843
  }
26844
+ function parseTypeParameterOfInferType() {
26845
+ var pos = getNodePos();
26846
+ return finishNode(factory.createTypeParameterDeclaration(parseIdentifier(), undefined, undefined), pos);
26847
+ }
26854
26848
  function parseInferType() {
26855
26849
  var pos = getNodePos();
26856
26850
  parseExpected(137);
26857
- return finishNode(factory.createInferTypeNode(parseTypeParameterWorker(false)), pos);
26851
+ return finishNode(factory.createInferTypeNode(parseTypeParameterOfInferType()), pos);
26858
26852
  }
26859
26853
  function parseTypeOperatorOrHigher() {
26860
26854
  var operator = token();
@@ -31839,7 +31833,8 @@ var ts;
31839
31833
  name: "jsxFragmentFactory",
31840
31834
  type: "string",
31841
31835
  category: ts.Diagnostics.Language_and_Environment,
31842
- description: ts.Diagnostics.Specify_the_JSX_Fragment_reference_used_for_fragments_when_targeting_React_JSX_emit_e_g_React_Fragment_or_Fragment
31836
+ description: ts.Diagnostics.Specify_the_JSX_Fragment_reference_used_for_fragments_when_targeting_React_JSX_emit_e_g_React_Fragment_or_Fragment,
31837
+ defaultValueDescription: "React.Fragment",
31843
31838
  },
31844
31839
  {
31845
31840
  name: "jsxImportSource",
@@ -36241,7 +36236,7 @@ var ts;
36241
36236
  return ts.isDottedName(expr)
36242
36237
  || (ts.isPropertyAccessExpression(expr) || ts.isNonNullExpression(expr) || ts.isParenthesizedExpression(expr)) && isNarrowableReference(expr.expression)
36243
36238
  || ts.isBinaryExpression(expr) && expr.operatorToken.kind === 27 && isNarrowableReference(expr.right)
36244
- || ts.isElementAccessExpression(expr) && ts.isStringOrNumericLiteralLike(expr.argumentExpression) && isNarrowableReference(expr.expression)
36239
+ || ts.isElementAccessExpression(expr) && (ts.isStringOrNumericLiteralLike(expr.argumentExpression) || ts.isEntityNameExpression(expr.argumentExpression)) && isNarrowableReference(expr.expression)
36245
36240
  || ts.isAssignmentExpression(expr) && isNarrowableReference(expr.left);
36246
36241
  }
36247
36242
  function containsNarrowableReference(expr) {
@@ -43373,7 +43368,15 @@ var ts;
43373
43368
  });
43374
43369
  }
43375
43370
  }
43376
- if (!symbolName) {
43371
+ if (symbolName === undefined) {
43372
+ var name = ts.firstDefined(symbol.declarations, ts.getNameOfDeclaration);
43373
+ if (name && ts.isComputedPropertyName(name) && ts.isEntityName(name.expression)) {
43374
+ var LHS = createAccessFromSymbolChain(chain, index - 1, stopper);
43375
+ if (ts.isEntityName(LHS)) {
43376
+ return ts.factory.createIndexedAccessTypeNode(ts.factory.createParenthesizedType(ts.factory.createTypeQueryNode(LHS)), ts.factory.createTypeQueryNode(name.expression));
43377
+ }
43378
+ return LHS;
43379
+ }
43377
43380
  symbolName = getNameOfSymbolAsWritten(symbol, context);
43378
43381
  }
43379
43382
  context.approximateLength += symbolName.length + 1;
@@ -54397,7 +54400,7 @@ var ts;
54397
54400
  var requireOptionalProperties = (relation === subtypeRelation || relation === strictSubtypeRelation) && !isObjectLiteralType(source) && !isEmptyArrayLiteralType(source) && !isTupleType(source);
54398
54401
  var unmatchedProperty = getUnmatchedProperty(source, target, requireOptionalProperties, false);
54399
54402
  if (unmatchedProperty) {
54400
- if (reportErrors) {
54403
+ if (reportErrors && shouldReportUnmatchedPropertyError(source, target)) {
54401
54404
  reportUnmatchedProperty(source, target, unmatchedProperty, requireOptionalProperties);
54402
54405
  }
54403
54406
  return 0;
@@ -54537,6 +54540,19 @@ var ts;
54537
54540
  }
54538
54541
  return result;
54539
54542
  }
54543
+ function shouldReportUnmatchedPropertyError(source, target) {
54544
+ var typeCallSignatures = getSignaturesOfStructuredType(source, 0);
54545
+ var typeConstructSignatures = getSignaturesOfStructuredType(source, 1);
54546
+ var typeProperties = getPropertiesOfObjectType(source);
54547
+ if ((typeCallSignatures.length || typeConstructSignatures.length) && !typeProperties.length) {
54548
+ if ((getSignaturesOfType(target, 0).length && typeCallSignatures.length) ||
54549
+ (getSignaturesOfType(target, 1).length && typeConstructSignatures.length)) {
54550
+ return true;
54551
+ }
54552
+ return false;
54553
+ }
54554
+ return true;
54555
+ }
54540
54556
  function reportIncompatibleCallSignatureReturn(siga, sigb) {
54541
54557
  if (siga.parameters.length === 0 && sigb.parameters.length === 0) {
54542
54558
  return function (source, target) { return reportIncompatibleError(ts.Diagnostics.Call_signatures_with_no_arguments_have_incompatible_return_types_0_and_1, typeToString(source), typeToString(target)); };
@@ -56763,8 +56779,9 @@ var ts;
56763
56779
  return isMatchingReference(source.expression, target);
56764
56780
  case 205:
56765
56781
  case 206:
56766
- return ts.isAccessExpression(target) &&
56767
- getAccessedPropertyName(source) === getAccessedPropertyName(target) &&
56782
+ var sourcePropertyName = getAccessedPropertyName(source);
56783
+ var targetPropertyName = ts.isAccessExpression(target) ? getAccessedPropertyName(target) : undefined;
56784
+ return sourcePropertyName !== undefined && targetPropertyName !== undefined && targetPropertyName === sourcePropertyName &&
56768
56785
  isMatchingReference(source.expression, target.expression);
56769
56786
  case 160:
56770
56787
  return ts.isAccessExpression(target) &&
@@ -56776,12 +56793,49 @@ var ts;
56776
56793
  return false;
56777
56794
  }
56778
56795
  function getAccessedPropertyName(access) {
56779
- var propertyName;
56780
- return access.kind === 205 ? access.name.escapedText :
56781
- access.kind === 206 && ts.isStringOrNumericLiteralLike(access.argumentExpression) ? ts.escapeLeadingUnderscores(access.argumentExpression.text) :
56782
- access.kind === 202 && (propertyName = getDestructuringPropertyName(access)) ? ts.escapeLeadingUnderscores(propertyName) :
56783
- access.kind === 163 ? ("" + access.parent.parameters.indexOf(access)) :
56784
- undefined;
56796
+ if (ts.isPropertyAccessExpression(access)) {
56797
+ return access.name.escapedText;
56798
+ }
56799
+ if (ts.isElementAccessExpression(access)) {
56800
+ return tryGetElementAccessExpressionName(access);
56801
+ }
56802
+ if (ts.isBindingElement(access)) {
56803
+ var name = getDestructuringPropertyName(access);
56804
+ return name ? ts.escapeLeadingUnderscores(name) : undefined;
56805
+ }
56806
+ if (ts.isParameter(access)) {
56807
+ return ("" + access.parent.parameters.indexOf(access));
56808
+ }
56809
+ return undefined;
56810
+ }
56811
+ function tryGetNameFromType(type) {
56812
+ return type.flags & 8192 ? type.escapedName :
56813
+ type.flags & 384 ? ts.escapeLeadingUnderscores("" + type.value) : undefined;
56814
+ }
56815
+ function tryGetElementAccessExpressionName(node) {
56816
+ if (ts.isStringOrNumericLiteralLike(node.argumentExpression)) {
56817
+ return ts.escapeLeadingUnderscores(node.argumentExpression.text);
56818
+ }
56819
+ if (ts.isEntityNameExpression(node.argumentExpression)) {
56820
+ var symbol = resolveEntityName(node.argumentExpression, 111551, true);
56821
+ if (!symbol || !isConstVariable(symbol))
56822
+ return undefined;
56823
+ var declaration = symbol.valueDeclaration;
56824
+ if (declaration === undefined)
56825
+ return undefined;
56826
+ var type = tryGetTypeFromEffectiveTypeNode(declaration);
56827
+ if (type) {
56828
+ var name = tryGetNameFromType(type);
56829
+ if (name !== undefined) {
56830
+ return name;
56831
+ }
56832
+ }
56833
+ if (ts.hasOnlyExpressionInitializer(declaration)) {
56834
+ var initializer = ts.getEffectiveInitializer(declaration);
56835
+ return initializer && tryGetNameFromType(getTypeOfExpression(initializer));
56836
+ }
56837
+ }
56838
+ return undefined;
56785
56839
  }
56786
56840
  function containsMatchingReference(source, target) {
56787
56841
  while (ts.isAccessExpression(source)) {
@@ -58451,6 +58505,14 @@ var ts;
58451
58505
  }
58452
58506
  if (type.flags & 1048576) {
58453
58507
  var assignableType = filterType(type, function (t) { return isRelated(t, candidate); });
58508
+ if (candidate.flags & 1048576) {
58509
+ var unionAssignableType = mapType(type, function (type) {
58510
+ return filterType(candidate, function (candidate) { return isRelated(candidate, type); });
58511
+ });
58512
+ if (!isTypeSubtypeOf(unionAssignableType, assignableType)) {
58513
+ assignableType = unionAssignableType;
58514
+ }
58515
+ }
58454
58516
  if (!(assignableType.flags & 131072)) {
58455
58517
  return assignableType;
58456
58518
  }
@@ -59764,11 +59826,21 @@ var ts;
59764
59826
  }
59765
59827
  return false;
59766
59828
  }
59829
+ function uniqueStrings(strings) {
59830
+ var unique = new ts.Set(strings);
59831
+ var result = [];
59832
+ unique.forEach(function (str) { return result.push(str); });
59833
+ return result;
59834
+ }
59767
59835
  function discriminateContextualTypeByObjectMembers(node, contextualType) {
59768
- return getMatchingUnionConstituentForObjectLiteral(contextualType, node) || discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 295 && 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) && !!((_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);
59836
+ return getMatchingUnionConstituentForObjectLiteral(contextualType, node) || discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 295 && 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) {
59837
+ return ts.map(ts.filter(getPropertiesOfType(memberType), function (s) { var _a; return !!(s.flags & 16777216) && !!((_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; });
59838
+ })), function (name) { return [function () { return undefinedType; }, name]; })), isTypeAssignableTo, contextualType);
59769
59839
  }
59770
59840
  function discriminateContextualTypeByJSXAttributes(node, contextualType) {
59771
- return discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 284 && 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) && !!((_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);
59841
+ return discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 284 && 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) {
59842
+ return ts.map(ts.filter(getPropertiesOfType(memberType), function (s) { var _a; return !!(s.flags & 16777216) && !!((_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; });
59843
+ })), function (name) { return [function () { return undefinedType; }, name]; })), isTypeAssignableTo, contextualType);
59772
59844
  }
59773
59845
  function getApparentTypeOfContextualType(node, contextFlags) {
59774
59846
  var contextualType = ts.isObjectLiteralMethod(node) ?
@@ -61008,18 +61080,17 @@ var ts;
61008
61080
  }
61009
61081
  var enclosingClass = forEachEnclosingClass(location, function (enclosingDeclaration) {
61010
61082
  var enclosingClass = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingDeclaration));
61011
- return isClassDerivedFromDeclaringClasses(enclosingClass, prop, writing) ? enclosingClass : undefined;
61083
+ return isClassDerivedFromDeclaringClasses(enclosingClass, prop, writing);
61012
61084
  });
61013
61085
  if (!enclosingClass) {
61014
- var thisParameter = void 0;
61015
- if (flags & 32 || !(thisParameter = getThisParameterFromNodeContext(location)) || !thisParameter.type) {
61086
+ enclosingClass = getEnclosingClassFromThisParameter(location);
61087
+ enclosingClass = enclosingClass && isClassDerivedFromDeclaringClasses(enclosingClass, prop, writing);
61088
+ if (flags & 32 || !enclosingClass) {
61016
61089
  if (errorNode) {
61017
61090
  error(errorNode, ts.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(getDeclaringClass(prop) || containingType));
61018
61091
  }
61019
61092
  return false;
61020
61093
  }
61021
- var thisType = getTypeFromTypeNode(thisParameter.type);
61022
- enclosingClass = ((thisType.flags & 262144) ? getConstraintOfTypeParameter(thisType) : thisType).target;
61023
61094
  }
61024
61095
  if (flags & 32) {
61025
61096
  return true;
@@ -61035,6 +61106,17 @@ var ts;
61035
61106
  }
61036
61107
  return true;
61037
61108
  }
61109
+ function getEnclosingClassFromThisParameter(node) {
61110
+ var thisParameter = getThisParameterFromNodeContext(node);
61111
+ var thisType = (thisParameter === null || thisParameter === void 0 ? void 0 : thisParameter.type) && getTypeFromTypeNode(thisParameter.type);
61112
+ if (thisType && thisType.flags & 262144) {
61113
+ thisType = getConstraintOfTypeParameter(thisType);
61114
+ }
61115
+ if (thisType && ts.getObjectFlags(thisType) & (3 | 4)) {
61116
+ return getTargetType(thisType);
61117
+ }
61118
+ return undefined;
61119
+ }
61038
61120
  function getThisParameterFromNodeContext(node) {
61039
61121
  var thisContainer = ts.getThisContainer(node, false);
61040
61122
  return thisContainer && ts.isFunctionLike(thisContainer) ? ts.getThisParameter(thisContainer) : undefined;
@@ -64505,7 +64587,7 @@ var ts;
64505
64587
  case 40:
64506
64588
  case 54:
64507
64589
  checkNonNullType(operandType, node.operand);
64508
- if (maybeTypeOfKind(operandType, 12288)) {
64590
+ if (maybeTypeOfKindConsideringBaseConstraint(operandType, 12288)) {
64509
64591
  error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator));
64510
64592
  }
64511
64593
  if (node.operator === 39) {
@@ -64550,6 +64632,13 @@ var ts;
64550
64632
  }
64551
64633
  return numberType;
64552
64634
  }
64635
+ function maybeTypeOfKindConsideringBaseConstraint(type, kind) {
64636
+ if (maybeTypeOfKind(type, kind)) {
64637
+ return true;
64638
+ }
64639
+ var baseConstraint = getBaseConstraintOrType(type);
64640
+ return !!baseConstraint && maybeTypeOfKind(baseConstraint, kind);
64641
+ }
64553
64642
  function maybeTypeOfKind(type, kind) {
64554
64643
  if (type.flags & kind) {
64555
64644
  return true;
@@ -65183,8 +65272,8 @@ var ts;
65183
65272
  return node.kind === 79 && node.escapedText === "eval";
65184
65273
  }
65185
65274
  function checkForDisallowedESSymbolOperand(operator) {
65186
- var offendingSymbolOperand = maybeTypeOfKind(leftType, 12288) ? left :
65187
- maybeTypeOfKind(rightType, 12288) ? right :
65275
+ var offendingSymbolOperand = maybeTypeOfKindConsideringBaseConstraint(leftType, 12288) ? left :
65276
+ maybeTypeOfKindConsideringBaseConstraint(rightType, 12288) ? right :
65188
65277
  undefined;
65189
65278
  if (offendingSymbolOperand) {
65190
65279
  error(offendingSymbolOperand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(operator));
@@ -65370,7 +65459,7 @@ var ts;
65370
65459
  for (var _i = 0, _a = node.templateSpans; _i < _a.length; _i++) {
65371
65460
  var span = _a[_i];
65372
65461
  var type = checkExpression(span.expression);
65373
- if (maybeTypeOfKind(type, 12288)) {
65462
+ if (maybeTypeOfKindConsideringBaseConstraint(type, 12288)) {
65374
65463
  error(span.expression, ts.Diagnostics.Implicit_conversion_of_a_symbol_to_a_string_will_fail_at_runtime_Consider_wrapping_this_expression_in_String);
65375
65464
  }
65376
65465
  texts.push(span.literal.text);
@@ -66575,22 +66664,6 @@ var ts;
66575
66664
  grammarErrorOnNode(node, ts.Diagnostics.infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type);
66576
66665
  }
66577
66666
  checkSourceElement(node.typeParameter);
66578
- var symbol = getSymbolOfNode(node.typeParameter);
66579
- if (symbol.declarations && symbol.declarations.length > 1) {
66580
- var links = getSymbolLinks(symbol);
66581
- if (!links.typeParametersChecked) {
66582
- links.typeParametersChecked = true;
66583
- var typeParameter = getDeclaredTypeOfTypeParameter(symbol);
66584
- var declarations = ts.getDeclarationsOfKind(symbol, 162);
66585
- if (!areTypeParametersIdentical(declarations, [typeParameter], function (decl) { return [decl]; })) {
66586
- var name = symbolToString(symbol);
66587
- for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) {
66588
- var declaration = declarations_4[_i];
66589
- error(declaration.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_constraints, name);
66590
- }
66591
- }
66592
- }
66593
- }
66594
66667
  registerForUnusedIdentifiersCheck(node);
66595
66668
  }
66596
66669
  function checkTemplateLiteralType(node) {
@@ -66747,8 +66820,8 @@ var ts;
66747
66820
  var hasNonAmbientClass = false;
66748
66821
  var functionDeclarations = [];
66749
66822
  if (declarations) {
66750
- for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) {
66751
- var current = declarations_5[_i];
66823
+ for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) {
66824
+ var current = declarations_4[_i];
66752
66825
  var node = current;
66753
66826
  var inAmbientContext = node.flags & 8388608;
66754
66827
  var inAmbientContextOrInterface = node.parent && (node.parent.kind === 257 || node.parent.kind === 181) || inAmbientContext;
@@ -67650,8 +67723,8 @@ var ts;
67650
67723
  : ts.createDiagnosticForNode(declarationList.parent.kind === 236 ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused));
67651
67724
  }
67652
67725
  else {
67653
- for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) {
67654
- var decl = declarations_6[_i];
67726
+ for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) {
67727
+ var decl = declarations_5[_i];
67655
67728
  addDiagnostic(decl, 0, ts.createDiagnosticForNode(decl, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(decl.name)));
67656
67729
  }
67657
67730
  }
@@ -69090,21 +69163,21 @@ var ts;
69090
69163
  return;
69091
69164
  }
69092
69165
  var type = getDeclaredTypeOfSymbol(symbol);
69093
- if (!areTypeParametersIdentical(declarations, type.localTypeParameters, ts.getEffectiveTypeParameterDeclarations)) {
69166
+ if (!areTypeParametersIdentical(declarations, type.localTypeParameters)) {
69094
69167
  var name = symbolToString(symbol);
69095
- for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) {
69096
- var declaration = declarations_7[_i];
69168
+ for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) {
69169
+ var declaration = declarations_6[_i];
69097
69170
  error(declaration.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, name);
69098
69171
  }
69099
69172
  }
69100
69173
  }
69101
69174
  }
69102
- function areTypeParametersIdentical(declarations, targetParameters, getTypeParameterDeclarations) {
69175
+ function areTypeParametersIdentical(declarations, targetParameters) {
69103
69176
  var maxTypeArgumentCount = ts.length(targetParameters);
69104
69177
  var minTypeArgumentCount = getMinTypeArgumentCount(targetParameters);
69105
- for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) {
69106
- var declaration = declarations_8[_i];
69107
- var sourceParameters = getTypeParameterDeclarations(declaration);
69178
+ for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) {
69179
+ var declaration = declarations_7[_i];
69180
+ var sourceParameters = ts.getEffectiveTypeParameterDeclarations(declaration);
69108
69181
  var numTypeParameters = sourceParameters.length;
69109
69182
  if (numTypeParameters < minTypeArgumentCount || numTypeParameters > maxTypeArgumentCount) {
69110
69183
  return false;
@@ -69578,7 +69651,7 @@ var ts;
69578
69651
  }
69579
69652
  if (!ts.isStatic(member) && isPropertyWithoutInitializer(member)) {
69580
69653
  var propName = member.name;
69581
- if (ts.isIdentifier(propName) || ts.isPrivateIdentifier(propName)) {
69654
+ if (ts.isIdentifier(propName) || ts.isPrivateIdentifier(propName) || ts.isComputedPropertyName(propName)) {
69582
69655
  var type = getTypeOfSymbol(getSymbolOfNode(member));
69583
69656
  if (!(type.flags & 3 || getFalsyFlags(type) & 32768)) {
69584
69657
  if (!constructor || !isPropertyInitializedInConstructor(propName, type, constructor)) {
@@ -69612,7 +69685,9 @@ var ts;
69612
69685
  return false;
69613
69686
  }
69614
69687
  function isPropertyInitializedInConstructor(propName, propType, constructor) {
69615
- var reference = ts.factory.createPropertyAccessExpression(ts.factory.createThis(), propName);
69688
+ var reference = ts.isComputedPropertyName(propName)
69689
+ ? ts.factory.createElementAccessExpression(ts.factory.createThis(), propName.expression)
69690
+ : ts.factory.createPropertyAccessExpression(ts.factory.createThis(), propName);
69616
69691
  ts.setParent(reference.expression, reference);
69617
69692
  ts.setParent(reference, constructor);
69618
69693
  reference.flowNode = constructor.returnFlowNode;
@@ -69881,8 +69956,8 @@ var ts;
69881
69956
  function getFirstNonAmbientClassOrFunctionDeclaration(symbol) {
69882
69957
  var declarations = symbol.declarations;
69883
69958
  if (declarations) {
69884
- for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) {
69885
- var declaration = declarations_9[_i];
69959
+ for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) {
69960
+ var declaration = declarations_8[_i];
69886
69961
  if ((declaration.kind === 256 ||
69887
69962
  (declaration.kind === 255 && ts.nodeIsPresent(declaration.body))) &&
69888
69963
  !(declaration.flags & 8388608)) {
@@ -77418,10 +77493,7 @@ var ts;
77418
77493
  var substitute = typeof constantValue === "string" ? factory.createStringLiteral(constantValue) : factory.createNumericLiteral(constantValue);
77419
77494
  if (!compilerOptions.removeComments) {
77420
77495
  var originalNode = ts.getOriginalNode(node, ts.isAccessExpression);
77421
- var propertyName = ts.isPropertyAccessExpression(originalNode)
77422
- ? ts.declarationNameToString(originalNode.name)
77423
- : safeMultiLineComment(ts.getTextOfNode(originalNode.argumentExpression));
77424
- ts.addSyntheticTrailingComment(substitute, 3, " " + propertyName + " ");
77496
+ ts.addSyntheticTrailingComment(substitute, 3, " " + safeMultiLineComment(ts.getTextOfNode(originalNode)) + " ");
77425
77497
  }
77426
77498
  return substitute;
77427
77499
  }
@@ -81974,8 +82046,8 @@ var ts;
81974
82046
  }
81975
82047
  function getRangeUnion(declarations) {
81976
82048
  var pos = -1, end = -1;
81977
- for (var _i = 0, declarations_10 = declarations; _i < declarations_10.length; _i++) {
81978
- var node = declarations_10[_i];
82049
+ for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) {
82050
+ var node = declarations_9[_i];
81979
82051
  pos = pos === -1 ? node.pos : node.pos === -1 ? pos : Math.min(pos, node.pos);
81980
82052
  end = Math.max(end, node.end);
81981
82053
  }