typescript 4.7.0-dev.20220405 → 4.7.0-dev.20220406

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-dev.20220405";
72
+ ts.version = ts.versionMajorMinor + ".0-dev.20220406";
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  var globals = typeof globalThis !== "undefined" ? globalThis :
@@ -6073,6 +6073,7 @@ var ts;
6073
6073
  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}'?"),
6074
6074
  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."),
6075
6075
  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."),
6076
+ 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."),
6076
6077
  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}'."),
6077
6078
  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}'."),
6078
6079
  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}'."),
@@ -10882,17 +10883,17 @@ var ts;
10882
10883
  ts.hasChangesInResolutions = hasChangesInResolutions;
10883
10884
  function containsParseError(node) {
10884
10885
  aggregateChildData(node);
10885
- return (node.flags & 262144) !== 0;
10886
+ return (node.flags & 524288) !== 0;
10886
10887
  }
10887
10888
  ts.containsParseError = containsParseError;
10888
10889
  function aggregateChildData(node) {
10889
- if (!(node.flags & 524288)) {
10890
- var thisNodeOrAnySubNodesHasError = ((node.flags & 65536) !== 0) ||
10890
+ if (!(node.flags & 1048576)) {
10891
+ var thisNodeOrAnySubNodesHasError = ((node.flags & 131072) !== 0) ||
10891
10892
  ts.forEachChild(node, containsParseError);
10892
10893
  if (thisNodeOrAnySubNodesHasError) {
10893
- node.flags |= 262144;
10894
+ node.flags |= 524288;
10894
10895
  }
10895
- node.flags |= 524288;
10896
+ node.flags |= 1048576;
10896
10897
  }
10897
10898
  }
10898
10899
  function getSourceFileOfNode(node) {
@@ -12516,11 +12517,11 @@ var ts;
12516
12517
  }
12517
12518
  ts.isSourceFileNotJS = isSourceFileNotJS;
12518
12519
  function isInJSFile(node) {
12519
- return !!node && !!(node.flags & 131072);
12520
+ return !!node && !!(node.flags & 262144);
12520
12521
  }
12521
12522
  ts.isInJSFile = isInJSFile;
12522
12523
  function isInJsonFile(node) {
12523
- return !!node && !!(node.flags & 33554432);
12524
+ return !!node && !!(node.flags & 67108864);
12524
12525
  }
12525
12526
  ts.isInJsonFile = isInJsonFile;
12526
12527
  function isSourceFileNotJson(file) {
@@ -12528,7 +12529,7 @@ var ts;
12528
12529
  }
12529
12530
  ts.isSourceFileNotJson = isSourceFileNotJson;
12530
12531
  function isInJSDoc(node) {
12531
- return !!node && !!(node.flags & 4194304);
12532
+ return !!node && !!(node.flags & 8388608);
12532
12533
  }
12533
12534
  ts.isInJSDoc = isInJSDoc;
12534
12535
  function isJSDocIndexSignature(node) {
@@ -12856,7 +12857,7 @@ var ts;
12856
12857
  function setValueDeclaration(symbol, node) {
12857
12858
  var valueDeclaration = symbol.valueDeclaration;
12858
12859
  if (!valueDeclaration ||
12859
- !(node.flags & 8388608 && !(valueDeclaration.flags & 8388608)) &&
12860
+ !(node.flags & 16777216 && !(valueDeclaration.flags & 16777216)) &&
12860
12861
  (isAssignmentDeclaration(valueDeclaration) && !isAssignmentDeclaration(node)) ||
12861
12862
  (valueDeclaration.kind !== node.kind && isEffectiveModuleDeclaration(valueDeclaration))) {
12862
12863
  symbol.valueDeclaration = node;
@@ -16562,7 +16563,7 @@ var ts;
16562
16563
  }
16563
16564
  ts.pseudoBigIntToString = pseudoBigIntToString;
16564
16565
  function isValidTypeOnlyAliasUseSite(useSite) {
16565
- return !!(useSite.flags & 8388608)
16566
+ return !!(useSite.flags & 16777216)
16566
16567
  || isPartOfTypeQuery(useSite)
16567
16568
  || isIdentifierInNonEmittingHeritageClause(useSite)
16568
16569
  || isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(useSite)
@@ -16940,11 +16941,20 @@ var ts;
16940
16941
  parenthesizeExpressionForDisallowedComma: parenthesizeExpressionForDisallowedComma,
16941
16942
  parenthesizeExpressionOfExpressionStatement: parenthesizeExpressionOfExpressionStatement,
16942
16943
  parenthesizeConciseBodyOfArrowFunction: parenthesizeConciseBodyOfArrowFunction,
16943
- parenthesizeMemberOfConditionalType: parenthesizeMemberOfConditionalType,
16944
- parenthesizeMemberOfElementType: parenthesizeMemberOfElementType,
16945
- parenthesizeElementTypeOfArrayType: parenthesizeElementTypeOfArrayType,
16946
- parenthesizeConstituentTypesOfUnionOrIntersectionType: parenthesizeConstituentTypesOfUnionOrIntersectionType,
16944
+ parenthesizeCheckTypeOfConditionalType: parenthesizeCheckTypeOfConditionalType,
16945
+ parenthesizeExtendsTypeOfConditionalType: parenthesizeExtendsTypeOfConditionalType,
16946
+ parenthesizeConstituentTypesOfUnionType: parenthesizeConstituentTypesOfUnionType,
16947
+ parenthesizeConstituentTypeOfUnionType: parenthesizeConstituentTypeOfUnionType,
16948
+ parenthesizeConstituentTypesOfIntersectionType: parenthesizeConstituentTypesOfIntersectionType,
16949
+ parenthesizeConstituentTypeOfIntersectionType: parenthesizeConstituentTypeOfIntersectionType,
16950
+ parenthesizeOperandOfTypeOperator: parenthesizeOperandOfTypeOperator,
16951
+ parenthesizeOperandOfReadonlyTypeOperator: parenthesizeOperandOfReadonlyTypeOperator,
16952
+ parenthesizeNonArrayTypeOfPostfixType: parenthesizeNonArrayTypeOfPostfixType,
16953
+ parenthesizeElementTypesOfTupleType: parenthesizeElementTypesOfTupleType,
16954
+ parenthesizeElementTypeOfTupleType: parenthesizeElementTypeOfTupleType,
16955
+ parenthesizeTypeOfOptionalType: parenthesizeTypeOfOptionalType,
16947
16956
  parenthesizeTypeArguments: parenthesizeTypeArguments,
16957
+ parenthesizeLeadingTypeArgument: parenthesizeLeadingTypeArgument,
16948
16958
  };
16949
16959
  function getParenthesizeLeftSideOfBinaryForOperator(operatorKind) {
16950
16960
  binaryLeftOperandParenthesizerCache || (binaryLeftOperandParenthesizerCache = new ts.Map());
@@ -17132,33 +17142,102 @@ var ts;
17132
17142
  }
17133
17143
  return body;
17134
17144
  }
17135
- function parenthesizeMemberOfConditionalType(member) {
17136
- return member.kind === 189 ? factory.createParenthesizedType(member) : member;
17145
+ function parenthesizeCheckTypeOfConditionalType(checkType) {
17146
+ switch (checkType.kind) {
17147
+ case 179:
17148
+ case 180:
17149
+ case 189:
17150
+ return factory.createParenthesizedType(checkType);
17151
+ }
17152
+ return checkType;
17137
17153
  }
17138
- function parenthesizeMemberOfElementType(member) {
17139
- switch (member.kind) {
17154
+ function parenthesizeExtendsTypeOfConditionalType(extendsType) {
17155
+ switch (extendsType.kind) {
17156
+ case 189:
17157
+ return factory.createParenthesizedType(extendsType);
17158
+ }
17159
+ return extendsType;
17160
+ }
17161
+ function parenthesizeConstituentTypeOfUnionType(type) {
17162
+ switch (type.kind) {
17140
17163
  case 187:
17141
17164
  case 188:
17142
- case 179:
17143
- case 180:
17144
- return factory.createParenthesizedType(member);
17165
+ return factory.createParenthesizedType(type);
17145
17166
  }
17146
- return parenthesizeMemberOfConditionalType(member);
17167
+ return parenthesizeCheckTypeOfConditionalType(type);
17147
17168
  }
17148
- function parenthesizeElementTypeOfArrayType(member) {
17149
- switch (member.kind) {
17150
- case 181:
17169
+ function parenthesizeConstituentTypesOfUnionType(members) {
17170
+ return factory.createNodeArray(ts.sameMap(members, parenthesizeConstituentTypeOfUnionType));
17171
+ }
17172
+ function parenthesizeConstituentTypeOfIntersectionType(type) {
17173
+ switch (type.kind) {
17174
+ case 187:
17175
+ case 188:
17176
+ return factory.createParenthesizedType(type);
17177
+ }
17178
+ return parenthesizeConstituentTypeOfUnionType(type);
17179
+ }
17180
+ function parenthesizeConstituentTypesOfIntersectionType(members) {
17181
+ return factory.createNodeArray(ts.sameMap(members, parenthesizeConstituentTypeOfIntersectionType));
17182
+ }
17183
+ function parenthesizeOperandOfTypeOperator(type) {
17184
+ switch (type.kind) {
17185
+ case 188:
17186
+ return factory.createParenthesizedType(type);
17187
+ }
17188
+ return parenthesizeConstituentTypeOfIntersectionType(type);
17189
+ }
17190
+ function parenthesizeOperandOfReadonlyTypeOperator(type) {
17191
+ switch (type.kind) {
17151
17192
  case 193:
17193
+ return factory.createParenthesizedType(type);
17194
+ }
17195
+ return parenthesizeOperandOfTypeOperator(type);
17196
+ }
17197
+ function parenthesizeNonArrayTypeOfPostfixType(type) {
17198
+ switch (type.kind) {
17152
17199
  case 190:
17153
- return factory.createParenthesizedType(member);
17200
+ case 193:
17201
+ case 181:
17202
+ return factory.createParenthesizedType(type);
17154
17203
  }
17155
- return parenthesizeMemberOfElementType(member);
17204
+ return parenthesizeOperandOfTypeOperator(type);
17205
+ }
17206
+ function parenthesizeElementTypesOfTupleType(types) {
17207
+ return factory.createNodeArray(ts.sameMap(types, parenthesizeElementTypeOfTupleType));
17156
17208
  }
17157
- function parenthesizeConstituentTypesOfUnionOrIntersectionType(members) {
17158
- return factory.createNodeArray(ts.sameMap(members, parenthesizeMemberOfElementType));
17209
+ function parenthesizeElementTypeOfTupleType(type) {
17210
+ if (hasJSDocPostfixQuestion(type))
17211
+ return factory.createParenthesizedType(type);
17212
+ return type;
17213
+ }
17214
+ function hasJSDocPostfixQuestion(type) {
17215
+ if (ts.isJSDocNullableType(type))
17216
+ return type.postfix;
17217
+ if (ts.isNamedTupleMember(type))
17218
+ return hasJSDocPostfixQuestion(type.type);
17219
+ if (ts.isFunctionTypeNode(type) || ts.isConstructorTypeNode(type) || ts.isTypeOperatorNode(type))
17220
+ return hasJSDocPostfixQuestion(type.type);
17221
+ if (ts.isConditionalTypeNode(type))
17222
+ return hasJSDocPostfixQuestion(type.falseType);
17223
+ if (ts.isUnionTypeNode(type))
17224
+ return hasJSDocPostfixQuestion(ts.last(type.types));
17225
+ if (ts.isIntersectionTypeNode(type))
17226
+ return hasJSDocPostfixQuestion(ts.last(type.types));
17227
+ if (ts.isInferTypeNode(type))
17228
+ return !!type.typeParameter.constraint && hasJSDocPostfixQuestion(type.typeParameter.constraint);
17229
+ return false;
17230
+ }
17231
+ function parenthesizeTypeOfOptionalType(type) {
17232
+ if (hasJSDocPostfixQuestion(type))
17233
+ return factory.createParenthesizedType(type);
17234
+ return parenthesizeNonArrayTypeOfPostfixType(type);
17235
+ }
17236
+ function parenthesizeLeadingTypeArgument(node) {
17237
+ return ts.isFunctionOrConstructorTypeNode(node) && node.typeParameters ? factory.createParenthesizedType(node) : node;
17159
17238
  }
17160
17239
  function parenthesizeOrdinalTypeArgument(node, i) {
17161
- return i === 0 && ts.isFunctionOrConstructorTypeNode(node) && node.typeParameters ? factory.createParenthesizedType(node) : node;
17240
+ return i === 0 ? parenthesizeLeadingTypeArgument(node) : node;
17162
17241
  }
17163
17242
  function parenthesizeTypeArguments(typeArguments) {
17164
17243
  if (ts.some(typeArguments)) {
@@ -17184,11 +17263,20 @@ var ts;
17184
17263
  parenthesizeExpressionForDisallowedComma: ts.identity,
17185
17264
  parenthesizeExpressionOfExpressionStatement: ts.identity,
17186
17265
  parenthesizeConciseBodyOfArrowFunction: ts.identity,
17187
- parenthesizeMemberOfConditionalType: ts.identity,
17188
- parenthesizeMemberOfElementType: ts.identity,
17189
- parenthesizeElementTypeOfArrayType: ts.identity,
17190
- parenthesizeConstituentTypesOfUnionOrIntersectionType: function (nodes) { return ts.cast(nodes, ts.isNodeArray); },
17266
+ parenthesizeCheckTypeOfConditionalType: ts.identity,
17267
+ parenthesizeExtendsTypeOfConditionalType: ts.identity,
17268
+ parenthesizeConstituentTypesOfUnionType: function (nodes) { return ts.cast(nodes, ts.isNodeArray); },
17269
+ parenthesizeConstituentTypeOfUnionType: ts.identity,
17270
+ parenthesizeConstituentTypesOfIntersectionType: function (nodes) { return ts.cast(nodes, ts.isNodeArray); },
17271
+ parenthesizeConstituentTypeOfIntersectionType: ts.identity,
17272
+ parenthesizeOperandOfTypeOperator: ts.identity,
17273
+ parenthesizeOperandOfReadonlyTypeOperator: ts.identity,
17274
+ parenthesizeNonArrayTypeOfPostfixType: ts.identity,
17275
+ parenthesizeElementTypesOfTupleType: function (nodes) { return ts.cast(nodes, ts.isNodeArray); },
17276
+ parenthesizeElementTypeOfTupleType: ts.identity,
17277
+ parenthesizeTypeOfOptionalType: ts.identity,
17191
17278
  parenthesizeTypeArguments: function (nodes) { return nodes && ts.cast(nodes, ts.isNodeArray); },
17279
+ parenthesizeLeadingTypeArgument: ts.identity,
17192
17280
  };
17193
17281
  })(ts || (ts = {}));
17194
17282
  var ts;
@@ -17306,6 +17394,8 @@ var ts;
17306
17394
  var getJSDocPrimaryTypeCreateFunction = ts.memoizeOne(function (kind) { return function () { return createJSDocPrimaryTypeWorker(kind); }; });
17307
17395
  var getJSDocUnaryTypeCreateFunction = ts.memoizeOne(function (kind) { return function (type) { return createJSDocUnaryTypeWorker(kind, type); }; });
17308
17396
  var getJSDocUnaryTypeUpdateFunction = ts.memoizeOne(function (kind) { return function (node, type) { return updateJSDocUnaryTypeWorker(kind, node, type); }; });
17397
+ var getJSDocPrePostfixUnaryTypeCreateFunction = ts.memoizeOne(function (kind) { return function (type, postfix) { return createJSDocPrePostfixUnaryTypeWorker(kind, type, postfix); }; });
17398
+ var getJSDocPrePostfixUnaryTypeUpdateFunction = ts.memoizeOne(function (kind) { return function (node, type) { return updateJSDocPrePostfixUnaryTypeWorker(kind, node, type); }; });
17309
17399
  var getJSDocSimpleTagCreateFunction = ts.memoizeOne(function (kind) { return function (tagName, comment) { return createJSDocSimpleTagWorker(kind, tagName, comment); }; });
17310
17400
  var getJSDocSimpleTagUpdateFunction = ts.memoizeOne(function (kind) { return function (node, tagName, comment) { return updateJSDocSimpleTagWorker(kind, node, tagName, comment); }; });
17311
17401
  var getJSDocTypeLikeTagCreateFunction = ts.memoizeOne(function (kind) { return function (tagName, typeExpression, comment) { return createJSDocTypeLikeTagWorker(kind, tagName, typeExpression, comment); }; });
@@ -17313,6 +17403,8 @@ var ts;
17313
17403
  var factory = {
17314
17404
  get parenthesizer() { return parenthesizerRules(); },
17315
17405
  get converters() { return converters(); },
17406
+ baseFactory: baseFactory,
17407
+ flags: flags,
17316
17408
  createNodeArray: createNodeArray,
17317
17409
  createNumericLiteral: createNumericLiteral,
17318
17410
  createBigIntLiteral: createBigIntLiteral,
@@ -17587,10 +17679,10 @@ var ts;
17587
17679
  updateExternalModuleReference: updateExternalModuleReference,
17588
17680
  get createJSDocAllType() { return getJSDocPrimaryTypeCreateFunction(312); },
17589
17681
  get createJSDocUnknownType() { return getJSDocPrimaryTypeCreateFunction(313); },
17590
- get createJSDocNonNullableType() { return getJSDocUnaryTypeCreateFunction(315); },
17591
- get updateJSDocNonNullableType() { return getJSDocUnaryTypeUpdateFunction(315); },
17592
- get createJSDocNullableType() { return getJSDocUnaryTypeCreateFunction(314); },
17593
- get updateJSDocNullableType() { return getJSDocUnaryTypeUpdateFunction(314); },
17682
+ get createJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(315); },
17683
+ get updateJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(315); },
17684
+ get createJSDocNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(314); },
17685
+ get updateJSDocNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(314); },
17594
17686
  get createJSDocOptionalType() { return getJSDocUnaryTypeCreateFunction(316); },
17595
17687
  get updateJSDocOptionalType() { return getJSDocUnaryTypeUpdateFunction(316); },
17596
17688
  get createJSDocVariadicType() { return getJSDocUnaryTypeCreateFunction(318); },
@@ -18564,7 +18656,7 @@ var ts;
18564
18656
  }
18565
18657
  function createArrayTypeNode(elementType) {
18566
18658
  var node = createBaseNode(183);
18567
- node.elementType = parenthesizerRules().parenthesizeElementTypeOfArrayType(elementType);
18659
+ node.elementType = parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(elementType);
18568
18660
  node.transformFlags = 1;
18569
18661
  return node;
18570
18662
  }
@@ -18575,7 +18667,7 @@ var ts;
18575
18667
  }
18576
18668
  function createTupleTypeNode(elements) {
18577
18669
  var node = createBaseNode(184);
18578
- node.elements = createNodeArray(elements);
18670
+ node.elements = createNodeArray(parenthesizerRules().parenthesizeElementTypesOfTupleType(elements));
18579
18671
  node.transformFlags = 1;
18580
18672
  return node;
18581
18673
  }
@@ -18603,7 +18695,7 @@ var ts;
18603
18695
  }
18604
18696
  function createOptionalTypeNode(type) {
18605
18697
  var node = createBaseNode(185);
18606
- node.type = parenthesizerRules().parenthesizeElementTypeOfArrayType(type);
18698
+ node.type = parenthesizerRules().parenthesizeTypeOfOptionalType(type);
18607
18699
  node.transformFlags = 1;
18608
18700
  return node;
18609
18701
  }
@@ -18623,33 +18715,33 @@ var ts;
18623
18715
  ? update(createRestTypeNode(type), node)
18624
18716
  : node;
18625
18717
  }
18626
- function createUnionOrIntersectionTypeNode(kind, types) {
18718
+ function createUnionOrIntersectionTypeNode(kind, types, parenthesize) {
18627
18719
  var node = createBaseNode(kind);
18628
- node.types = parenthesizerRules().parenthesizeConstituentTypesOfUnionOrIntersectionType(types);
18720
+ node.types = factory.createNodeArray(parenthesize(types));
18629
18721
  node.transformFlags = 1;
18630
18722
  return node;
18631
18723
  }
18632
- function updateUnionOrIntersectionTypeNode(node, types) {
18724
+ function updateUnionOrIntersectionTypeNode(node, types, parenthesize) {
18633
18725
  return node.types !== types
18634
- ? update(createUnionOrIntersectionTypeNode(node.kind, types), node)
18726
+ ? update(createUnionOrIntersectionTypeNode(node.kind, types, parenthesize), node)
18635
18727
  : node;
18636
18728
  }
18637
18729
  function createUnionTypeNode(types) {
18638
- return createUnionOrIntersectionTypeNode(187, types);
18730
+ return createUnionOrIntersectionTypeNode(187, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType);
18639
18731
  }
18640
18732
  function updateUnionTypeNode(node, types) {
18641
- return updateUnionOrIntersectionTypeNode(node, types);
18733
+ return updateUnionOrIntersectionTypeNode(node, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType);
18642
18734
  }
18643
18735
  function createIntersectionTypeNode(types) {
18644
- return createUnionOrIntersectionTypeNode(188, types);
18736
+ return createUnionOrIntersectionTypeNode(188, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType);
18645
18737
  }
18646
18738
  function updateIntersectionTypeNode(node, types) {
18647
- return updateUnionOrIntersectionTypeNode(node, types);
18739
+ return updateUnionOrIntersectionTypeNode(node, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType);
18648
18740
  }
18649
18741
  function createConditionalTypeNode(checkType, extendsType, trueType, falseType) {
18650
18742
  var node = createBaseNode(189);
18651
- node.checkType = parenthesizerRules().parenthesizeMemberOfConditionalType(checkType);
18652
- node.extendsType = parenthesizerRules().parenthesizeMemberOfConditionalType(extendsType);
18743
+ node.checkType = parenthesizerRules().parenthesizeCheckTypeOfConditionalType(checkType);
18744
+ node.extendsType = parenthesizerRules().parenthesizeExtendsTypeOfConditionalType(extendsType);
18653
18745
  node.trueType = trueType;
18654
18746
  node.falseType = falseType;
18655
18747
  node.transformFlags = 1;
@@ -18735,7 +18827,9 @@ var ts;
18735
18827
  function createTypeOperatorNode(operator, type) {
18736
18828
  var node = createBaseNode(193);
18737
18829
  node.operator = operator;
18738
- node.type = parenthesizerRules().parenthesizeMemberOfElementType(type);
18830
+ node.type = operator === 145 ?
18831
+ parenthesizerRules().parenthesizeOperandOfReadonlyTypeOperator(type) :
18832
+ parenthesizerRules().parenthesizeOperandOfTypeOperator(type);
18739
18833
  node.transformFlags = 1;
18740
18834
  return node;
18741
18835
  }
@@ -18746,7 +18840,7 @@ var ts;
18746
18840
  }
18747
18841
  function createIndexedAccessTypeNode(objectType, indexType) {
18748
18842
  var node = createBaseNode(194);
18749
- node.objectType = parenthesizerRules().parenthesizeMemberOfElementType(objectType);
18843
+ node.objectType = parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(objectType);
18750
18844
  node.indexType = indexType;
18751
18845
  node.transformFlags = 1;
18752
18846
  return node;
@@ -20257,11 +20351,22 @@ var ts;
20257
20351
  function createJSDocPrimaryTypeWorker(kind) {
20258
20352
  return createBaseNode(kind);
20259
20353
  }
20354
+ function createJSDocPrePostfixUnaryTypeWorker(kind, type, postfix) {
20355
+ if (postfix === void 0) { postfix = false; }
20356
+ var node = createJSDocUnaryTypeWorker(kind, postfix ? type && parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(type) : type);
20357
+ node.postfix = postfix;
20358
+ return node;
20359
+ }
20260
20360
  function createJSDocUnaryTypeWorker(kind, type) {
20261
20361
  var node = createBaseNode(kind);
20262
20362
  node.type = type;
20263
20363
  return node;
20264
20364
  }
20365
+ function updateJSDocPrePostfixUnaryTypeWorker(kind, node, type) {
20366
+ return node.type !== type
20367
+ ? update(createJSDocPrePostfixUnaryTypeWorker(kind, type, node.postfix), node)
20368
+ : node;
20369
+ }
20265
20370
  function updateJSDocUnaryTypeWorker(kind, node, type) {
20266
20371
  return node.type !== type
20267
20372
  ? update(createJSDocUnaryTypeWorker(kind, type), node)
@@ -24329,7 +24434,7 @@ var ts;
24329
24434
  || ts.isExportDeclaration(node) ? node : undefined;
24330
24435
  }
24331
24436
  function getImportMetaIfNecessary(sourceFile) {
24332
- return sourceFile.flags & 2097152 ?
24437
+ return sourceFile.flags & 4194304 ?
24333
24438
  walkTreeForImportMeta(sourceFile) :
24334
24439
  undefined;
24335
24440
  }
@@ -24938,7 +25043,7 @@ var ts;
24938
25043
  function updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks) {
24939
25044
  if (aggressiveChecks === void 0) { aggressiveChecks = false; }
24940
25045
  var newSourceFile = IncrementalParser.updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks);
24941
- newSourceFile.flags |= (sourceFile.flags & 3145728);
25046
+ newSourceFile.flags |= (sourceFile.flags & 6291456);
24942
25047
  return newSourceFile;
24943
25048
  }
24944
25049
  ts.updateSourceFile = updateSourceFile;
@@ -25125,10 +25230,10 @@ var ts;
25125
25230
  switch (scriptKind) {
25126
25231
  case 1:
25127
25232
  case 2:
25128
- contextFlags = 131072;
25233
+ contextFlags = 262144;
25129
25234
  break;
25130
25235
  case 6:
25131
- contextFlags = 131072 | 33554432;
25236
+ contextFlags = 262144 | 67108864;
25132
25237
  break;
25133
25238
  default:
25134
25239
  contextFlags = 0;
@@ -25160,7 +25265,7 @@ var ts;
25160
25265
  function parseSourceFileWorker(languageVersion, setParentNodes, scriptKind, setExternalModuleIndicator) {
25161
25266
  var isDeclarationFile = isDeclarationFileName(fileName);
25162
25267
  if (isDeclarationFile) {
25163
- contextFlags |= 8388608;
25268
+ contextFlags |= 16777216;
25164
25269
  }
25165
25270
  sourceFlags = contextFlags;
25166
25271
  nextToken();
@@ -25197,7 +25302,7 @@ var ts;
25197
25302
  node.jsDoc = jsDoc;
25198
25303
  if (hasDeprecatedTag) {
25199
25304
  hasDeprecatedTag = false;
25200
- node.flags |= 134217728;
25305
+ node.flags |= 268435456;
25201
25306
  }
25202
25307
  return node;
25203
25308
  }
@@ -25359,6 +25464,12 @@ var ts;
25359
25464
  function disallowInAnd(func) {
25360
25465
  return doInsideOfContext(4096, func);
25361
25466
  }
25467
+ function allowConditionalTypesAnd(func) {
25468
+ return doOutsideOfContext(65536, func);
25469
+ }
25470
+ function disallowConditionalTypesAnd(func) {
25471
+ return doInsideOfContext(65536, func);
25472
+ }
25362
25473
  function doInYieldContext(func) {
25363
25474
  return doInsideOfContext(8192, func);
25364
25475
  }
@@ -25386,6 +25497,9 @@ var ts;
25386
25497
  function inDisallowInContext() {
25387
25498
  return inContext(4096);
25388
25499
  }
25500
+ function inDisallowConditionalTypesContext() {
25501
+ return inContext(65536);
25502
+ }
25389
25503
  function inDecoratorContext() {
25390
25504
  return inContext(16384);
25391
25505
  }
@@ -25704,7 +25818,7 @@ var ts;
25704
25818
  }
25705
25819
  if (parseErrorBeforeNextFinishedNode) {
25706
25820
  parseErrorBeforeNextFinishedNode = false;
25707
- node.flags |= 65536;
25821
+ node.flags |= 131072;
25708
25822
  }
25709
25823
  return node;
25710
25824
  }
@@ -26082,7 +26196,7 @@ var ts;
26082
26196
  if (ts.nodeIsMissing(node) || node.intersectsChange || ts.containsParseError(node)) {
26083
26197
  return undefined;
26084
26198
  }
26085
- var nodeContextFlags = node.flags & 25358336;
26199
+ var nodeContextFlags = node.flags & 50720768;
26086
26200
  if (nodeContextFlags !== contextFlags) {
26087
26201
  return undefined;
26088
26202
  }
@@ -26495,7 +26609,7 @@ var ts;
26495
26609
  function parseJSDocNonNullableType() {
26496
26610
  var pos = getNodePos();
26497
26611
  nextToken();
26498
- return finishNode(factory.createJSDocNonNullableType(parseNonArrayType()), pos);
26612
+ return finishNode(factory.createJSDocNonNullableType(parseNonArrayType(), false), pos);
26499
26613
  }
26500
26614
  function parseJSDocUnknownOrNullableType() {
26501
26615
  var pos = getNodePos();
@@ -26509,7 +26623,7 @@ var ts;
26509
26623
  return finishNode(factory.createJSDocUnknownType(), pos);
26510
26624
  }
26511
26625
  else {
26512
- return finishNode(factory.createJSDocNullableType(parseType()), pos);
26626
+ return finishNode(factory.createJSDocNullableType(parseType(), false), pos);
26513
26627
  }
26514
26628
  }
26515
26629
  function parseJSDocFunctionType() {
@@ -26642,7 +26756,7 @@ var ts;
26642
26756
  }
26643
26757
  function parseReturnType(returnToken, isType) {
26644
26758
  if (shouldParseReturnType(returnToken, isType)) {
26645
- return parseTypeOrTypePredicate();
26759
+ return allowConditionalTypesAnd(parseTypeOrTypePredicate);
26646
26760
  }
26647
26761
  }
26648
26762
  function shouldParseReturnType(returnToken, isType) {
@@ -26992,7 +27106,7 @@ var ts;
26992
27106
  return finishNode(factory.createImportTypeAssertionContainer(clause, multiLine), pos);
26993
27107
  }
26994
27108
  function parseImportType() {
26995
- sourceFlags |= 1048576;
27109
+ sourceFlags |= 2097152;
26996
27110
  var pos = getNodePos();
26997
27111
  var isTypeOf = parseOptional(112);
26998
27112
  parseExpected(100);
@@ -27135,14 +27249,14 @@ var ts;
27135
27249
  switch (token()) {
27136
27250
  case 53:
27137
27251
  nextToken();
27138
- type = finishNode(factory.createJSDocNonNullableType(type), pos);
27252
+ type = finishNode(factory.createJSDocNonNullableType(type, true), pos);
27139
27253
  break;
27140
27254
  case 57:
27141
27255
  if (lookAhead(nextTokenIsStartOfType)) {
27142
27256
  return type;
27143
27257
  }
27144
27258
  nextToken();
27145
- type = finishNode(factory.createJSDocNullableType(type), pos);
27259
+ type = finishNode(factory.createJSDocNullableType(type, true), pos);
27146
27260
  break;
27147
27261
  case 22:
27148
27262
  parseExpected(22);
@@ -27167,9 +27281,20 @@ var ts;
27167
27281
  parseExpected(operator);
27168
27282
  return finishNode(factory.createTypeOperatorNode(operator, parseTypeOperatorOrHigher()), pos);
27169
27283
  }
27284
+ function tryParseConstraintOfInferType() {
27285
+ if (parseOptional(94)) {
27286
+ var constraint = disallowConditionalTypesAnd(parseType);
27287
+ if (inDisallowConditionalTypesContext() || token() !== 57) {
27288
+ return constraint;
27289
+ }
27290
+ }
27291
+ }
27170
27292
  function parseTypeParameterOfInferType() {
27171
27293
  var pos = getNodePos();
27172
- return finishNode(factory.createTypeParameterDeclaration(undefined, parseIdentifier(), undefined, undefined), pos);
27294
+ var name = parseIdentifier();
27295
+ var constraint = tryParse(tryParseConstraintOfInferType);
27296
+ var node = factory.createTypeParameterDeclaration(undefined, name, constraint);
27297
+ return finishNode(node, pos);
27173
27298
  }
27174
27299
  function parseInferType() {
27175
27300
  var pos = getNodePos();
@@ -27186,7 +27311,7 @@ var ts;
27186
27311
  case 137:
27187
27312
  return parseInferType();
27188
27313
  }
27189
- return parsePostfixTypeOrHigher();
27314
+ return allowConditionalTypesAnd(parsePostfixTypeOrHigher);
27190
27315
  }
27191
27316
  function parseFunctionOrConstructorTypeToError(isInUnionType) {
27192
27317
  if (isStartOfFunctionTypeOrConstructorType()) {
@@ -27302,20 +27427,20 @@ var ts;
27302
27427
  return finishNode(factory.createTypePredicateNode(assertsModifier, parameterName, type), pos);
27303
27428
  }
27304
27429
  function parseType() {
27305
- return doOutsideOfContext(40960, parseTypeWorker);
27306
- }
27307
- function parseTypeWorker(noConditionalTypes) {
27430
+ if (contextFlags & 40960) {
27431
+ return doOutsideOfContext(40960, parseType);
27432
+ }
27308
27433
  if (isStartOfFunctionTypeOrConstructorType()) {
27309
27434
  return parseFunctionOrConstructorType();
27310
27435
  }
27311
27436
  var pos = getNodePos();
27312
27437
  var type = parseUnionTypeOrHigher();
27313
- if (!noConditionalTypes && !scanner.hasPrecedingLineBreak() && parseOptional(94)) {
27314
- var extendsType = parseTypeWorker(true);
27438
+ if (!inDisallowConditionalTypesContext() && !scanner.hasPrecedingLineBreak() && parseOptional(94)) {
27439
+ var extendsType = disallowConditionalTypesAnd(parseType);
27315
27440
  parseExpected(57);
27316
- var trueType = parseTypeWorker();
27441
+ var trueType = allowConditionalTypesAnd(parseType);
27317
27442
  parseExpected(58);
27318
- var falseType = parseTypeWorker();
27443
+ var falseType = allowConditionalTypesAnd(parseType);
27319
27444
  return finishNode(factory.createConditionalTypeNode(type, extendsType, trueType, falseType), pos);
27320
27445
  }
27321
27446
  return type;
@@ -27834,14 +27959,14 @@ var ts;
27834
27959
  var expression;
27835
27960
  if (token() === 100) {
27836
27961
  if (lookAhead(nextTokenIsOpenParenOrLessThan)) {
27837
- sourceFlags |= 1048576;
27962
+ sourceFlags |= 2097152;
27838
27963
  expression = parseTokenNode();
27839
27964
  }
27840
27965
  else if (lookAhead(nextTokenIsDot)) {
27841
27966
  nextToken();
27842
27967
  nextToken();
27843
27968
  expression = finishNode(factory.createMetaProperty(100, parseIdentifierName()), pos);
27844
- sourceFlags |= 2097152;
27969
+ sourceFlags |= 4194304;
27845
27970
  }
27846
27971
  else {
27847
27972
  expression = parseMemberExpressionOrHigher();
@@ -27985,7 +28110,7 @@ var ts;
27985
28110
  return finishNode(factory.createJsxOpeningFragment(), pos);
27986
28111
  }
27987
28112
  var tagName = parseJsxElementName();
27988
- var typeArguments = (contextFlags & 131072) === 0 ? tryParseTypeArguments() : undefined;
28113
+ var typeArguments = (contextFlags & 262144) === 0 ? tryParseTypeArguments() : undefined;
27989
28114
  var attributes = parseJsxAttributes();
27990
28115
  var node;
27991
28116
  if (token() === 31) {
@@ -28243,7 +28368,7 @@ var ts;
28243
28368
  return result;
28244
28369
  }
28245
28370
  function parseTypeArgumentsInExpression() {
28246
- if ((contextFlags & 131072) !== 0) {
28371
+ if ((contextFlags & 262144) !== 0) {
28247
28372
  return undefined;
28248
28373
  }
28249
28374
  if (reScanLessThanToken() !== 29) {
@@ -28602,7 +28727,7 @@ var ts;
28602
28727
  var openParenParsed = parseExpected(20);
28603
28728
  var expression = allowInAnd(parseExpression);
28604
28729
  parseExpectedMatchingBrackets(20, 21, openParenParsed, openParenPosition);
28605
- var statement = doInsideOfContext(16777216, parseStatement);
28730
+ var statement = doInsideOfContext(33554432, parseStatement);
28606
28731
  return withJSDoc(finishNode(factory.createWithStatement(expression, statement), pos), hasJSDoc);
28607
28732
  }
28608
28733
  function parseCaseClause() {
@@ -28924,16 +29049,16 @@ var ts;
28924
29049
  if (isAmbient) {
28925
29050
  for (var _i = 0, _a = modifiers; _i < _a.length; _i++) {
28926
29051
  var m = _a[_i];
28927
- m.flags |= 8388608;
29052
+ m.flags |= 16777216;
28928
29053
  }
28929
- return doInsideOfContext(8388608, function () { return parseDeclarationWorker(pos, hasJSDoc, decorators, modifiers); });
29054
+ return doInsideOfContext(16777216, function () { return parseDeclarationWorker(pos, hasJSDoc, decorators, modifiers); });
28930
29055
  }
28931
29056
  else {
28932
29057
  return parseDeclarationWorker(pos, hasJSDoc, decorators, modifiers);
28933
29058
  }
28934
29059
  }
28935
29060
  function tryReuseAmbientDeclaration() {
28936
- return doInsideOfContext(8388608, function () {
29061
+ return doInsideOfContext(16777216, function () {
28937
29062
  var node = currentNode(parsingContext);
28938
29063
  if (node) {
28939
29064
  return consumeNode(node);
@@ -29349,9 +29474,9 @@ var ts;
29349
29474
  if (isAmbient) {
29350
29475
  for (var _i = 0, _a = modifiers; _i < _a.length; _i++) {
29351
29476
  var m = _a[_i];
29352
- m.flags |= 8388608;
29477
+ m.flags |= 16777216;
29353
29478
  }
29354
- return doInsideOfContext(8388608, function () { return parsePropertyOrMethodDeclaration(pos, hasJSDoc, decorators, modifiers); });
29479
+ return doInsideOfContext(16777216, function () { return parsePropertyOrMethodDeclaration(pos, hasJSDoc, decorators, modifiers); });
29355
29480
  }
29356
29481
  else {
29357
29482
  return parsePropertyOrMethodDeclaration(pos, hasJSDoc, decorators, modifiers);
@@ -29809,7 +29934,7 @@ var ts;
29809
29934
  function parseJSDocTypeExpression(mayOmitBraces) {
29810
29935
  var pos = getNodePos();
29811
29936
  var hasBrace = (mayOmitBraces ? parseOptional : parseExpected)(18);
29812
- var type = doInsideOfContext(4194304, parseJSDocType);
29937
+ var type = doInsideOfContext(8388608, parseJSDocType);
29813
29938
  if (!mayOmitBraces || hasBrace) {
29814
29939
  parseExpectedJSDoc(19);
29815
29940
  }
@@ -29838,7 +29963,7 @@ var ts;
29838
29963
  JSDocParser.parseJSDocNameReference = parseJSDocNameReference;
29839
29964
  function parseIsolatedJSDocComment(content, start, length) {
29840
29965
  initializeState("", content, 99, undefined, 1);
29841
- var jsDoc = doInsideOfContext(4194304, function () { return parseJSDocCommentWorker(start, length); });
29966
+ var jsDoc = doInsideOfContext(8388608, function () { return parseJSDocCommentWorker(start, length); });
29842
29967
  var sourceFile = { languageVariant: 0, text: content };
29843
29968
  var diagnostics = ts.attachFileToDiagnostics(parseDiagnostics, sourceFile);
29844
29969
  clearState();
@@ -29849,9 +29974,9 @@ var ts;
29849
29974
  var saveToken = currentToken;
29850
29975
  var saveParseDiagnosticsLength = parseDiagnostics.length;
29851
29976
  var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode;
29852
- var comment = doInsideOfContext(4194304, function () { return parseJSDocCommentWorker(start, length); });
29977
+ var comment = doInsideOfContext(8388608, function () { return parseJSDocCommentWorker(start, length); });
29853
29978
  ts.setParent(comment, parent);
29854
- if (contextFlags & 131072) {
29979
+ if (contextFlags & 262144) {
29855
29980
  if (!jsDocDiagnostics) {
29856
29981
  jsDocDiagnostics = [];
29857
29982
  }
@@ -30620,7 +30745,7 @@ var ts;
30620
30745
  if (isBracketed) {
30621
30746
  skipWhitespace();
30622
30747
  parseExpected(63);
30623
- defaultType = doInsideOfContext(4194304, parseJSDocType);
30748
+ defaultType = doInsideOfContext(8388608, parseJSDocType);
30624
30749
  parseExpected(23);
30625
30750
  }
30626
30751
  if (ts.nodeIsMissing(name)) {
@@ -37467,7 +37592,7 @@ var ts;
37467
37592
  return !!body && body.statements.some(function (s) { return ts.isExportDeclaration(s) || ts.isExportAssignment(s); });
37468
37593
  }
37469
37594
  function setExportContextFlag(node) {
37470
- if (node.flags & 8388608 && !hasExportDeclarations(node)) {
37595
+ if (node.flags & 16777216 && !hasExportDeclarations(node)) {
37471
37596
  node.flags |= 64;
37472
37597
  }
37473
37598
  else {
@@ -37642,8 +37767,8 @@ var ts;
37642
37767
  }
37643
37768
  function checkContextualIdentifier(node) {
37644
37769
  if (!file.parseDiagnostics.length &&
37770
+ !(node.flags & 16777216) &&
37645
37771
  !(node.flags & 8388608) &&
37646
- !(node.flags & 4194304) &&
37647
37772
  !ts.isIdentifierName(node)) {
37648
37773
  if (inStrictMode &&
37649
37774
  node.originalKeywordKind >= 117 &&
@@ -38518,7 +38643,7 @@ var ts;
38518
38643
  if (node.kind === 340 && container.kind !== 323) {
38519
38644
  return;
38520
38645
  }
38521
- if (inStrictMode && !(node.flags & 8388608)) {
38646
+ if (inStrictMode && !(node.flags & 16777216)) {
38522
38647
  checkStrictModeEvalOrArguments(node, node.name);
38523
38648
  }
38524
38649
  if (ts.isBindingPattern(node.name)) {
@@ -38533,7 +38658,7 @@ var ts;
38533
38658
  }
38534
38659
  }
38535
38660
  function bindFunctionDeclaration(node) {
38536
- if (!file.isDeclarationFile && !(node.flags & 8388608)) {
38661
+ if (!file.isDeclarationFile && !(node.flags & 16777216)) {
38537
38662
  if (ts.isAsyncFunction(node)) {
38538
38663
  emitFlags |= 2048;
38539
38664
  }
@@ -38548,7 +38673,7 @@ var ts;
38548
38673
  }
38549
38674
  }
38550
38675
  function bindFunctionExpression(node) {
38551
- if (!file.isDeclarationFile && !(node.flags & 8388608)) {
38676
+ if (!file.isDeclarationFile && !(node.flags & 16777216)) {
38552
38677
  if (ts.isAsyncFunction(node)) {
38553
38678
  emitFlags |= 2048;
38554
38679
  }
@@ -38561,7 +38686,7 @@ var ts;
38561
38686
  return bindAnonymousDeclaration(node, 16, bindingName);
38562
38687
  }
38563
38688
  function bindPropertyOrMethodOrAccessor(node, symbolFlags, symbolExcludes) {
38564
- if (!file.isDeclarationFile && !(node.flags & 8388608) && ts.isAsyncFunction(node)) {
38689
+ if (!file.isDeclarationFile && !(node.flags & 16777216) && ts.isAsyncFunction(node)) {
38565
38690
  emitFlags |= 2048;
38566
38691
  }
38567
38692
  if (currentFlow && ts.isObjectLiteralOrClassExpressionMethodOrAccessor(node)) {
@@ -38620,7 +38745,7 @@ var ts;
38620
38745
  currentFlow = reportedUnreachableFlow;
38621
38746
  if (!options.allowUnreachableCode) {
38622
38747
  var isError_1 = ts.unreachableCodeIsError(options) &&
38623
- !(node.flags & 8388608) &&
38748
+ !(node.flags & 16777216) &&
38624
38749
  (!ts.isVariableStatement(node) ||
38625
38750
  !!(ts.getCombinedNodeFlags(node.declarationList) & 3) ||
38626
38751
  node.declarationList.declarations.some(function (d) { return !!d.initializer; }));
@@ -39268,7 +39393,7 @@ var ts;
39268
39393
  ts.Debug.assert(!!(getNodeLinks(file).flags & 1));
39269
39394
  diagnostics = ts.addRange(diagnostics, suggestionDiagnostics.getDiagnostics(file.fileName));
39270
39395
  checkUnusedIdentifiers(getPotentiallyUnusedIdentifiers(file), function (containingNode, kind, diag) {
39271
- if (!ts.containsParseError(containingNode) && !unusedIsError(kind, !!(containingNode.flags & 8388608))) {
39396
+ if (!ts.containsParseError(containingNode) && !unusedIsError(kind, !!(containingNode.flags & 16777216))) {
39272
39397
  (diagnostics || (diagnostics = [])).push(__assign(__assign({}, diag), { category: ts.DiagnosticCategory.Suggestion }));
39273
39398
  }
39274
39399
  });
@@ -39699,7 +39824,7 @@ var ts;
39699
39824
  return diagnostic;
39700
39825
  }
39701
39826
  function isDeprecatedSymbol(symbol) {
39702
- return !!(getDeclarationNodeFlagsFromSymbol(symbol) & 134217728);
39827
+ return !!(getDeclarationNodeFlagsFromSymbol(symbol) & 268435456);
39703
39828
  }
39704
39829
  function addDeprecatedSuggestion(location, declarations, deprecatedEntity) {
39705
39830
  var diagnostic = ts.createDiagnosticForNode(location, ts.Diagnostics._0_is_deprecated, deprecatedEntity);
@@ -39910,7 +40035,7 @@ var ts;
39910
40035
  mergeSymbolTable(globals, moduleAugmentation.symbol.exports);
39911
40036
  }
39912
40037
  else {
39913
- var moduleNotFoundError = !(moduleName.parent.parent.flags & 8388608)
40038
+ var moduleNotFoundError = !(moduleName.parent.parent.flags & 16777216)
39914
40039
  ? ts.Diagnostics.Invalid_module_name_in_augmentation_module_0_cannot_be_found
39915
40040
  : undefined;
39916
40041
  var mainModule_1 = resolveExternalModuleNameWorker(moduleName, moduleName, moduleNotFoundError, true);
@@ -40006,7 +40131,7 @@ var ts;
40006
40131
  if ((moduleKind && (declarationFile.externalModuleIndicator || useFile.externalModuleIndicator)) ||
40007
40132
  (!ts.outFile(compilerOptions)) ||
40008
40133
  isInTypeQuery(usage) ||
40009
- declaration.flags & 8388608) {
40134
+ declaration.flags & 16777216) {
40010
40135
  return true;
40011
40136
  }
40012
40137
  if (isUsedInFunctionOrInstanceProperty(usage, declaration)) {
@@ -40046,7 +40171,7 @@ var ts;
40046
40171
  if (usage.kind === 271 && usage.isExportEquals) {
40047
40172
  return true;
40048
40173
  }
40049
- if (!!(usage.flags & 4194304) || isInTypeQuery(usage) || usageInTypeDeclaration()) {
40174
+ if (!!(usage.flags & 8388608) || isInTypeQuery(usage) || usageInTypeDeclaration()) {
40050
40175
  return true;
40051
40176
  }
40052
40177
  if (isUsedInFunctionOrInstanceProperty(usage, declaration)) {
@@ -40269,7 +40394,7 @@ var ts;
40269
40394
  isInExternalModule = true;
40270
40395
  case 261:
40271
40396
  var moduleExports = ((_a = getSymbolOfNode(location)) === null || _a === void 0 ? void 0 : _a.exports) || emptySymbols;
40272
- if (location.kind === 305 || (ts.isModuleDeclaration(location) && location.flags & 8388608 && !ts.isGlobalScopeAugmentation(location))) {
40397
+ if (location.kind === 305 || (ts.isModuleDeclaration(location) && location.flags & 16777216 && !ts.isGlobalScopeAugmentation(location))) {
40273
40398
  if (result = moduleExports.get("default")) {
40274
40399
  var localSymbol = ts.getLocalSymbolForExportDefault(result);
40275
40400
  if (localSymbol && (result.flags & meaning) && localSymbol.escapedName === name) {
@@ -40511,7 +40636,7 @@ var ts;
40511
40636
  checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation);
40512
40637
  }
40513
40638
  }
40514
- if (result && isInExternalModule && (meaning & 111551) === 111551 && !(originalLocation.flags & 4194304)) {
40639
+ if (result && isInExternalModule && (meaning & 111551) === 111551 && !(originalLocation.flags & 8388608)) {
40515
40640
  var merged = getMergedSymbol(result);
40516
40641
  if (ts.length(merged.declarations) && ts.every(merged.declarations, function (d) { return ts.isNamespaceExportDeclaration(d) || ts.isSourceFile(d) && !!d.symbol.globalExports; })) {
40517
40642
  errorOrSuggestion(!compilerOptions.allowUmdGlobalAccess, errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, ts.unescapeLeadingUnderscores(name));
@@ -40751,7 +40876,7 @@ var ts;
40751
40876
  var declaration = (_a = result.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 260); });
40752
40877
  if (declaration === undefined)
40753
40878
  return ts.Debug.fail("checkResolvedBlockScopedVariable could not find block-scoped declaration");
40754
- if (!(declaration.flags & 8388608) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) {
40879
+ if (!(declaration.flags & 16777216) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) {
40755
40880
  var diagnosticMessage = void 0;
40756
40881
  var declarationName = ts.declarationNameToString(ts.getNameOfDeclaration(declaration));
40757
40882
  if (result.flags & 2) {
@@ -41416,7 +41541,7 @@ var ts;
41416
41541
  }
41417
41542
  }
41418
41543
  function getAssignmentDeclarationLocation(node) {
41419
- var typeAlias = ts.findAncestor(node, function (node) { return !(ts.isJSDocNode(node) || node.flags & 4194304) ? "quit" : ts.isJSDocTypeAlias(node); });
41544
+ var typeAlias = ts.findAncestor(node, function (node) { return !(ts.isJSDocNode(node) || node.flags & 8388608) ? "quit" : ts.isJSDocTypeAlias(node); });
41420
41545
  if (typeAlias) {
41421
41546
  return;
41422
41547
  }
@@ -42731,7 +42856,16 @@ var ts;
42731
42856
  if (type.flags & 262144 || objectFlags & 3) {
42732
42857
  if (type.flags & 262144 && ts.contains(context.inferTypeParameters, type)) {
42733
42858
  context.approximateLength += (ts.symbolName(type.symbol).length + 6);
42734
- return ts.factory.createInferTypeNode(typeParameterToDeclarationWithConstraint(type, context, undefined));
42859
+ var constraintNode = void 0;
42860
+ var constraint = getConstraintOfTypeParameter(type);
42861
+ if (constraint) {
42862
+ var inferredConstraint = getInferredTypeParameterConstraint(type, true);
42863
+ if (!(inferredConstraint && isTypeIdenticalTo(constraint, inferredConstraint))) {
42864
+ context.approximateLength += 9;
42865
+ constraintNode = constraint && typeToTypeNodeHelper(constraint, context);
42866
+ }
42867
+ }
42868
+ return ts.factory.createInferTypeNode(typeParameterToDeclarationWithConstraint(type, context, constraintNode));
42735
42869
  }
42736
42870
  if (context.flags & 4 &&
42737
42871
  type.flags & 262144 &&
@@ -44462,7 +44596,7 @@ var ts;
44462
44596
  newModifierFlags |= 1;
44463
44597
  }
44464
44598
  if (addingDeclare && !(newModifierFlags & 1) &&
44465
- (!enclosingDeclaration_1 || !(enclosingDeclaration_1.flags & 8388608)) &&
44599
+ (!enclosingDeclaration_1 || !(enclosingDeclaration_1.flags & 16777216)) &&
44466
44600
  (ts.isEnumDeclaration(node) || ts.isVariableStatement(node) || ts.isFunctionDeclaration(node) || ts.isClassDeclaration(node) || ts.isModuleDeclaration(node))) {
44467
44601
  newModifierFlags |= 2;
44468
44602
  }
@@ -45228,7 +45362,7 @@ var ts;
45228
45362
  }
45229
45363
  var parent = getDeclarationContainer(node);
45230
45364
  if (!(ts.getCombinedModifierFlags(node) & 1) &&
45231
- !(node.kind !== 265 && parent.kind !== 305 && parent.flags & 8388608)) {
45365
+ !(node.kind !== 265 && parent.kind !== 305 && parent.flags & 16777216)) {
45232
45366
  return isGlobalSourceFile(parent);
45233
45367
  }
45234
45368
  return isDeclarationVisible(parent);
@@ -45517,7 +45651,7 @@ var ts;
45517
45651
  return parentType;
45518
45652
  }
45519
45653
  var pattern = declaration.parent;
45520
- if (strictNullChecks && declaration.flags & 8388608 && ts.isParameterDeclaration(declaration)) {
45654
+ if (strictNullChecks && declaration.flags & 16777216 && ts.isParameterDeclaration(declaration)) {
45521
45655
  parentType = getNonNullableType(parentType);
45522
45656
  }
45523
45657
  else if (strictNullChecks && pattern.parent.initializer && !(getTypeFacts(getTypeOfInitializer(pattern.parent.initializer)) & 65536)) {
@@ -45615,7 +45749,7 @@ var ts;
45615
45749
  }
45616
45750
  if ((noImplicitAny || ts.isInJSFile(declaration)) &&
45617
45751
  ts.isVariableDeclaration(declaration) && !ts.isBindingPattern(declaration.name) &&
45618
- !(ts.getCombinedModifierFlags(declaration) & 1) && !(declaration.flags & 8388608)) {
45752
+ !(ts.getCombinedModifierFlags(declaration) & 1) && !(declaration.flags & 16777216)) {
45619
45753
  if (!(ts.getCombinedNodeFlags(declaration) & 2) && (!declaration.initializer || isNullOrUndefined(declaration.initializer))) {
45620
45754
  return autoType;
45621
45755
  }
@@ -46904,7 +47038,7 @@ var ts;
46904
47038
  function isLiteralEnumMember(member) {
46905
47039
  var expr = member.initializer;
46906
47040
  if (!expr) {
46907
- return !(member.flags & 8388608);
47041
+ return !(member.flags & 16777216);
46908
47042
  }
46909
47043
  switch (expr.kind) {
46910
47044
  case 10:
@@ -49187,7 +49321,7 @@ var ts;
49187
49321
  function getConstraintDeclaration(type) {
49188
49322
  return ts.mapDefined(ts.filter(type.symbol && type.symbol.declarations, ts.isTypeParameterDeclaration), ts.getEffectiveConstraintOfTypeParameter)[0];
49189
49323
  }
49190
- function getInferredTypeParameterConstraint(typeParameter) {
49324
+ function getInferredTypeParameterConstraint(typeParameter, omitTypeReferences) {
49191
49325
  var _a;
49192
49326
  var inferences;
49193
49327
  if ((_a = typeParameter.symbol) === null || _a === void 0 ? void 0 : _a.declarations) {
@@ -49195,7 +49329,7 @@ var ts;
49195
49329
  var declaration = _b[_i];
49196
49330
  if (declaration.parent.kind === 190) {
49197
49331
  var _c = ts.walkUpParenthesizedTypesAndGetParentAndChild(declaration.parent.parent), _d = _c[0], childTypeParameter = _d === void 0 ? declaration.parent : _d, grandParent = _c[1];
49198
- if (grandParent.kind === 178) {
49332
+ if (grandParent.kind === 178 && !omitTypeReferences) {
49199
49333
  var typeReference = grandParent;
49200
49334
  var typeParameters = getTypeParametersForTypeReference(typeReference);
49201
49335
  if (typeParameters) {
@@ -49565,7 +49699,7 @@ var ts;
49565
49699
  return constraints ? getSubstitutionType(type, getIntersectionType(ts.append(constraints, type))) : type;
49566
49700
  }
49567
49701
  function isJSDocTypeReference(node) {
49568
- return !!(node.flags & 4194304) && (node.kind === 178 || node.kind === 200);
49702
+ return !!(node.flags & 8388608) && (node.kind === 178 || node.kind === 200);
49569
49703
  }
49570
49704
  function checkNoTypeArguments(node, symbol) {
49571
49705
  if (node.typeArguments) {
@@ -50959,7 +51093,7 @@ var ts;
50959
51093
  if (ts.isCallLikeExpression(parent)) {
50960
51094
  return ts.isCallOrNewExpression(parent) && ts.isIdentifier(node) && hasMatchingArgument(parent, node);
50961
51095
  }
50962
- return ts.every(symbol.declarations, function (d) { return !ts.isFunctionLike(d) || !!(ts.getCombinedNodeFlags(d) & 134217728); });
51096
+ return ts.every(symbol.declarations, function (d) { return !ts.isFunctionLike(d) || !!(ts.getCombinedNodeFlags(d) & 268435456); });
50963
51097
  }
50964
51098
  return true;
50965
51099
  }
@@ -51548,7 +51682,7 @@ var ts;
51548
51682
  links.resolvedSymbol = unknownSymbol;
51549
51683
  return links.resolvedType = errorType;
51550
51684
  }
51551
- var targetMeaning = node.isTypeOf ? 111551 : node.flags & 4194304 ? 111551 | 788968 : 788968;
51685
+ var targetMeaning = node.isTypeOf ? 111551 : node.flags & 8388608 ? 111551 | 788968 : 788968;
51552
51686
  var innerModuleSymbol = resolveExternalModuleName(node, node.argument.literal);
51553
51687
  if (!innerModuleSymbol) {
51554
51688
  links.resolvedSymbol = unknownSymbol;
@@ -51865,7 +51999,7 @@ var ts;
51865
51999
  if (parent && ts.isObjectLiteralExpression(parent) && ts.isBinaryExpression(parent.parent) && ts.getAssignmentDeclarationKind(parent.parent) === 6) {
51866
52000
  return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent.parent.left).parent).thisType;
51867
52001
  }
51868
- var host = node.flags & 4194304 ? ts.getHostSignatureFromJSDoc(node) : undefined;
52002
+ var host = node.flags & 8388608 ? ts.getHostSignatureFromJSDoc(node) : undefined;
51869
52003
  if (host && ts.isFunctionExpression(host) && ts.isBinaryExpression(host.parent) && ts.getAssignmentDeclarationKind(host.parent) === 3) {
51870
52004
  return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(host.parent.left).parent).thisType;
51871
52005
  }
@@ -51938,7 +52072,7 @@ var ts;
51938
52072
  case 143:
51939
52073
  return neverType;
51940
52074
  case 148:
51941
- return node.flags & 131072 && !noImplicitAny ? anyType : nonPrimitiveType;
52075
+ return node.flags & 262144 && !noImplicitAny ? anyType : nonPrimitiveType;
51942
52076
  case 138:
51943
52077
  return intrinsicMarkerType;
51944
52078
  case 192:
@@ -56162,6 +56296,7 @@ var ts;
56162
56296
  var inference = inferences[i];
56163
56297
  if (t === inference.typeParameter) {
56164
56298
  if (fix && !inference.isFixed) {
56299
+ inferFromIntraExpressionSites(context);
56165
56300
  clearCachedInferences(inferences);
56166
56301
  inference.isFixed = true;
56167
56302
  }
@@ -56178,6 +56313,24 @@ var ts;
56178
56313
  }
56179
56314
  }
56180
56315
  }
56316
+ function addIntraExpressionInferenceSite(context, node, type) {
56317
+ var _a;
56318
+ ((_a = context.intraExpressionInferenceSites) !== null && _a !== void 0 ? _a : (context.intraExpressionInferenceSites = [])).push({ node: node, type: type });
56319
+ }
56320
+ function inferFromIntraExpressionSites(context) {
56321
+ if (context.intraExpressionInferenceSites) {
56322
+ for (var _i = 0, _a = context.intraExpressionInferenceSites; _i < _a.length; _i++) {
56323
+ var _b = _a[_i], node = _b.node, type = _b.type;
56324
+ var contextualType = node.kind === 169 ?
56325
+ getContextualTypeForObjectLiteralMethod(node, 2) :
56326
+ getContextualType(node, 2);
56327
+ if (contextualType) {
56328
+ inferTypes(context.inferences, type, contextualType);
56329
+ }
56330
+ }
56331
+ context.intraExpressionInferenceSites = undefined;
56332
+ }
56333
+ }
56181
56334
  function createInferenceInfo(typeParameter) {
56182
56335
  return {
56183
56336
  typeParameter: typeParameter,
@@ -57928,7 +58081,7 @@ var ts;
57928
58081
  }
57929
58082
  }
57930
58083
  function getTypeOfDottedName(node, diagnostic) {
57931
- if (!(node.flags & 16777216)) {
58084
+ if (!(node.flags & 33554432)) {
57932
58085
  switch (node.kind) {
57933
58086
  case 79:
57934
58087
  var symbol = getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(node));
@@ -59133,6 +59286,7 @@ var ts;
59133
59286
  function isConstraintPosition(type, node) {
59134
59287
  var parent = node.parent;
59135
59288
  return parent.kind === 206 ||
59289
+ parent.kind === 161 ||
59136
59290
  parent.kind === 208 && parent.expression === node ||
59137
59291
  parent.kind === 207 && parent.expression === node &&
59138
59292
  !(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent.argumentExpression)));
@@ -59344,7 +59498,7 @@ var ts;
59344
59498
  isInTypeQuery(node) || node.parent.kind === 275) ||
59345
59499
  node.parent.kind === 230 ||
59346
59500
  declaration.kind === 254 && declaration.exclamationToken ||
59347
- declaration.flags & 8388608;
59501
+ declaration.flags & 16777216;
59348
59502
  var initialType = assumeInitialized ? (isParameter ? removeOptionalityFromDeclaredType(type, declaration) : type) :
59349
59503
  type === autoType || type === autoArrayType ? undefinedType :
59350
59504
  getOptionalType(type);
@@ -60179,7 +60333,7 @@ var ts;
60179
60333
  }
60180
60334
  function getContextualTypeForObjectLiteralMethod(node, contextFlags) {
60181
60335
  ts.Debug.assert(ts.isObjectLiteralMethod(node));
60182
- if (node.flags & 16777216) {
60336
+ if (node.flags & 33554432) {
60183
60337
  return undefined;
60184
60338
  }
60185
60339
  return getContextualTypeForObjectLiteralElement(node, contextFlags);
@@ -60317,7 +60471,7 @@ var ts;
60317
60471
  return type;
60318
60472
  }
60319
60473
  function getContextualType(node, contextFlags) {
60320
- if (node.flags & 16777216) {
60474
+ if (node.flags & 33554432) {
60321
60475
  return undefined;
60322
60476
  }
60323
60477
  if (node.contextualType) {
@@ -60688,6 +60842,11 @@ var ts;
60688
60842
  var type = checkExpressionForMutableLocation(e, checkMode, elementContextualType, forceTuple);
60689
60843
  elementTypes.push(addOptionality(type, true, hasOmittedExpression));
60690
60844
  elementFlags.push(hasOmittedExpression ? 2 : 1);
60845
+ if (contextualType && someType(contextualType, isTupleLikeType) && checkMode && checkMode & 2 && !(checkMode & 4) && isContextSensitive(e)) {
60846
+ var inferenceContext = getInferenceContext(node);
60847
+ ts.Debug.assert(inferenceContext);
60848
+ addIntraExpressionInferenceSite(inferenceContext, e, type);
60849
+ }
60691
60850
  }
60692
60851
  }
60693
60852
  if (inDestructuringPattern) {
@@ -60869,6 +61028,13 @@ var ts;
60869
61028
  prop.target = member;
60870
61029
  member = prop;
60871
61030
  allPropertiesTable === null || allPropertiesTable === void 0 ? void 0 : allPropertiesTable.set(prop.escapedName, prop);
61031
+ if (contextualType && checkMode && checkMode & 2 && !(checkMode & 4) &&
61032
+ (memberDecl.kind === 296 || memberDecl.kind === 169) && isContextSensitive(memberDecl)) {
61033
+ var inferenceContext = getInferenceContext(node);
61034
+ ts.Debug.assert(inferenceContext);
61035
+ var inferenceNode = memberDecl.kind === 296 ? memberDecl.initializer : memberDecl;
61036
+ addIntraExpressionInferenceSite(inferenceContext, inferenceNode, type);
61037
+ }
60872
61038
  }
60873
61039
  else if (memberDecl.kind === 298) {
60874
61040
  if (languageVersion < 2) {
@@ -61786,7 +61952,7 @@ var ts;
61786
61952
  if (compilerOptions.noPropertyAccessFromIndexSignature && ts.isPropertyAccessExpression(node)) {
61787
61953
  error(right, ts.Diagnostics.Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0, ts.unescapeLeadingUnderscores(right.escapedText));
61788
61954
  }
61789
- if (indexInfo.declaration && ts.getCombinedNodeFlags(indexInfo.declaration) & 134217728) {
61955
+ if (indexInfo.declaration && ts.getCombinedNodeFlags(indexInfo.declaration) & 268435456) {
61790
61956
  addDeprecatedSuggestion(right, [indexInfo.declaration], right.escapedText);
61791
61957
  }
61792
61958
  }
@@ -61840,7 +62006,7 @@ var ts;
61840
62006
  if (declaration && isPropertyWithoutInitializer(declaration)) {
61841
62007
  if (!ts.isStatic(declaration)) {
61842
62008
  var flowContainer = getControlFlowContainer(node);
61843
- if (flowContainer.kind === 171 && flowContainer.parent === declaration.parent && !(declaration.flags & 8388608)) {
62009
+ if (flowContainer.kind === 171 && flowContainer.parent === declaration.parent && !(declaration.flags & 16777216)) {
61844
62010
  assumeUninitialized = true;
61845
62011
  }
61846
62012
  }
@@ -61876,7 +62042,7 @@ var ts;
61876
62042
  }
61877
62043
  else if (valueDeclaration.kind === 257 &&
61878
62044
  node.parent.kind !== 178 &&
61879
- !(valueDeclaration.flags & 8388608) &&
62045
+ !(valueDeclaration.flags & 16777216) &&
61880
62046
  !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) {
61881
62047
  diagnosticMessage = error(right, ts.Diagnostics.Class_0_used_before_its_declaration, declarationName);
61882
62048
  }
@@ -62441,19 +62607,21 @@ var ts;
62441
62607
  if (node.kind !== 165) {
62442
62608
  var contextualType = getContextualType(node, ts.every(signature.typeParameters, function (p) { return !!getDefaultFromTypeParameter(p); }) ? 8 : 0);
62443
62609
  if (contextualType) {
62444
- var outerContext = getInferenceContext(node);
62445
- var outerMapper = getMapperFromContext(cloneInferenceContext(outerContext, 1));
62446
- var instantiatedType = instantiateType(contextualType, outerMapper);
62447
- var contextualSignature = getSingleCallSignature(instantiatedType);
62448
- var inferenceSourceType = contextualSignature && contextualSignature.typeParameters ?
62449
- getOrCreateTypeFromSignature(getSignatureInstantiationWithoutFillingInTypeArguments(contextualSignature, contextualSignature.typeParameters)) :
62450
- instantiatedType;
62451
62610
  var inferenceTargetType = getReturnTypeOfSignature(signature);
62452
- inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, 128);
62453
- var returnContext = createInferenceContext(signature.typeParameters, signature, context.flags);
62454
- var returnSourceType = instantiateType(contextualType, outerContext && outerContext.returnMapper);
62455
- inferTypes(returnContext.inferences, returnSourceType, inferenceTargetType);
62456
- context.returnMapper = ts.some(returnContext.inferences, hasInferenceCandidates) ? getMapperFromContext(cloneInferredPartOfContext(returnContext)) : undefined;
62611
+ if (couldContainTypeVariables(inferenceTargetType)) {
62612
+ var outerContext = getInferenceContext(node);
62613
+ var outerMapper = getMapperFromContext(cloneInferenceContext(outerContext, 1));
62614
+ var instantiatedType = instantiateType(contextualType, outerMapper);
62615
+ var contextualSignature = getSingleCallSignature(instantiatedType);
62616
+ var inferenceSourceType = contextualSignature && contextualSignature.typeParameters ?
62617
+ getOrCreateTypeFromSignature(getSignatureInstantiationWithoutFillingInTypeArguments(contextualSignature, contextualSignature.typeParameters)) :
62618
+ instantiatedType;
62619
+ inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, 128);
62620
+ var returnContext = createInferenceContext(signature.typeParameters, signature, context.flags);
62621
+ var returnSourceType = instantiateType(contextualType, outerContext && outerContext.returnMapper);
62622
+ inferTypes(returnContext.inferences, returnSourceType, inferenceTargetType);
62623
+ context.returnMapper = ts.some(returnContext.inferences, hasInferenceCandidates) ? getMapperFromContext(cloneInferredPartOfContext(returnContext)) : undefined;
62624
+ }
62457
62625
  }
62458
62626
  }
62459
62627
  var restType = getNonArrayRestType(signature);
@@ -62465,7 +62633,7 @@ var ts;
62465
62633
  }
62466
62634
  }
62467
62635
  var thisType = getThisTypeOfSignature(signature);
62468
- if (thisType) {
62636
+ if (thisType && couldContainTypeVariables(thisType)) {
62469
62637
  var thisArgumentNode = getThisArgumentOfCall(node);
62470
62638
  inferTypes(context.inferences, getThisArgumentType(thisArgumentNode), thisType);
62471
62639
  }
@@ -62473,11 +62641,13 @@ var ts;
62473
62641
  var arg = args[i];
62474
62642
  if (arg.kind !== 227 && !(checkMode & 32 && hasSkipDirectInferenceFlag(arg))) {
62475
62643
  var paramType = getTypeAtPosition(signature, i);
62476
- var argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
62477
- inferTypes(context.inferences, argType, paramType);
62644
+ if (couldContainTypeVariables(paramType)) {
62645
+ var argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
62646
+ inferTypes(context.inferences, argType, paramType);
62647
+ }
62478
62648
  }
62479
62649
  }
62480
- if (restType) {
62650
+ if (restType && couldContainTypeVariables(restType)) {
62481
62651
  var spreadType = getSpreadArgumentType(args, argCount, args.length, restType, context, checkMode);
62482
62652
  inferTypes(context.inferences, spreadType, restType);
62483
62653
  }
@@ -63813,7 +63983,7 @@ var ts;
63813
63983
  return returnType;
63814
63984
  }
63815
63985
  function checkDeprecatedSignature(signature, node) {
63816
- if (signature.declaration && signature.declaration.flags & 134217728) {
63986
+ if (signature.declaration && signature.declaration.flags & 268435456) {
63817
63987
  var suggestionNode = getDeprecatedSuggestionNode(node);
63818
63988
  var name = ts.tryGetPropertyAccessOrIdentifierToString(ts.getInvokedExpression(node));
63819
63989
  addDeprecatedSuggestionWithSignature(suggestionNode, signature.declaration, name, signatureToString(signature));
@@ -63950,7 +64120,7 @@ var ts;
63950
64120
  : 0;
63951
64121
  if (targetDeclarationKind !== 0) {
63952
64122
  var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind);
63953
- return !!decl && !!(decl.flags & 8388608);
64123
+ return !!decl && !!(decl.flags & 16777216);
63954
64124
  }
63955
64125
  return false;
63956
64126
  }
@@ -64145,7 +64315,7 @@ var ts;
64145
64315
  error(node, ts.Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node12_or_nodenext);
64146
64316
  }
64147
64317
  var file = ts.getSourceFileOfNode(node);
64148
- ts.Debug.assert(!!(file.flags & 2097152), "Containing file is missing import meta node flag.");
64318
+ ts.Debug.assert(!!(file.flags & 4194304), "Containing file is missing import meta node flag.");
64149
64319
  return node.name.escapedText === "meta" ? getGlobalImportMetaType() : errorType;
64150
64320
  }
64151
64321
  function getTypeOfParameter(symbol) {
@@ -65943,6 +66113,9 @@ var ts;
65943
66113
  context.contextualType = contextualType;
65944
66114
  context.inferenceContext = inferenceContext;
65945
66115
  var type = checkExpression(node, checkMode | 1 | (inferenceContext ? 2 : 0));
66116
+ if (inferenceContext && inferenceContext.intraExpressionInferenceSites) {
66117
+ inferenceContext.intraExpressionInferenceSites = undefined;
66118
+ }
65946
66119
  var result = maybeTypeOfKind(type, 2944) && isLiteralOfContextualType(type, instantiateContextualType(contextualType, node)) ?
65947
66120
  getRegularTypeOfLiteralType(type) : type;
65948
66121
  return result;
@@ -66190,7 +66363,7 @@ var ts;
66190
66363
  if (quickType) {
66191
66364
  return quickType;
66192
66365
  }
66193
- if (node.flags & 67108864 && flowTypeCache) {
66366
+ if (node.flags & 134217728 && flowTypeCache) {
66194
66367
  var cachedType = flowTypeCache[getNodeId(node)];
66195
66368
  if (cachedType) {
66196
66369
  return cachedType;
@@ -66201,7 +66374,7 @@ var ts;
66201
66374
  if (flowInvocationCount !== startInvocationCount) {
66202
66375
  var cache = flowTypeCache || (flowTypeCache = []);
66203
66376
  cache[getNodeId(node)] = type;
66204
- ts.setNodeFlags(node, node.flags | 67108864);
66377
+ ts.setNodeFlags(node, node.flags | 134217728);
66205
66378
  }
66206
66379
  return type;
66207
66380
  }
@@ -66271,7 +66444,7 @@ var ts;
66271
66444
  if (compilerOptions.isolatedModules) {
66272
66445
  ts.Debug.assert(!!(type.symbol.flags & 128));
66273
66446
  var constEnumDeclaration = type.symbol.valueDeclaration;
66274
- if (constEnumDeclaration.flags & 8388608) {
66447
+ if (constEnumDeclaration.flags & 16777216) {
66275
66448
  error(node, ts.Diagnostics.Cannot_access_ambient_const_enums_when_the_isolatedModules_flag_is_provided);
66276
66449
  }
66277
66450
  }
@@ -66892,7 +67065,7 @@ var ts;
66892
67065
  checkDecorators(node);
66893
67066
  checkSignatureDeclaration(node);
66894
67067
  if (node.kind === 172) {
66895
- if (!(node.flags & 8388608) && ts.nodeIsPresent(node.body) && (node.flags & 256)) {
67068
+ if (!(node.flags & 16777216) && ts.nodeIsPresent(node.body) && (node.flags & 256)) {
66896
67069
  if (!(node.flags & 512)) {
66897
67070
  error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value);
66898
67071
  }
@@ -66982,7 +67155,7 @@ var ts;
66982
67155
  }
66983
67156
  var symbol = getNodeLinks(node).resolvedSymbol;
66984
67157
  if (symbol) {
66985
- if (ts.some(symbol.declarations, function (d) { return isTypeDeclaration(d) && !!(d.flags & 134217728); })) {
67158
+ if (ts.some(symbol.declarations, function (d) { return isTypeDeclaration(d) && !!(d.flags & 268435456); })) {
66986
67159
  addDeprecatedSuggestion(getDeprecatedSuggestionNode(node), symbol.declarations, symbol.escapedName);
66987
67160
  }
66988
67161
  if (type.flags & 32 && symbol.flags & 8) {
@@ -67139,6 +67312,22 @@ var ts;
67139
67312
  grammarErrorOnNode(node, ts.Diagnostics.infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type);
67140
67313
  }
67141
67314
  checkSourceElement(node.typeParameter);
67315
+ var symbol = getSymbolOfNode(node.typeParameter);
67316
+ if (symbol.declarations && symbol.declarations.length > 1) {
67317
+ var links = getSymbolLinks(symbol);
67318
+ if (!links.typeParametersChecked) {
67319
+ links.typeParametersChecked = true;
67320
+ var typeParameter = getDeclaredTypeOfTypeParameter(symbol);
67321
+ var declarations = ts.getDeclarationsOfKind(symbol, 163);
67322
+ if (!areTypeParametersIdentical(declarations, [typeParameter], function (decl) { return [decl]; })) {
67323
+ var name = symbolToString(symbol);
67324
+ for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) {
67325
+ var declaration = declarations_4[_i];
67326
+ error(declaration.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_constraints, name);
67327
+ }
67328
+ }
67329
+ }
67330
+ }
67142
67331
  registerForUnusedIdentifiersCheck(node);
67143
67332
  }
67144
67333
  function checkTemplateLiteralType(node) {
@@ -67176,14 +67365,14 @@ var ts;
67176
67365
  getTypeFromTypeNode(node);
67177
67366
  }
67178
67367
  function isPrivateWithinAmbient(node) {
67179
- return (ts.hasEffectiveModifier(node, 8) || ts.isPrivateIdentifierClassElementDeclaration(node)) && !!(node.flags & 8388608);
67368
+ return (ts.hasEffectiveModifier(node, 8) || ts.isPrivateIdentifierClassElementDeclaration(node)) && !!(node.flags & 16777216);
67180
67369
  }
67181
67370
  function getEffectiveDeclarationFlags(n, flagsToCheck) {
67182
67371
  var flags = ts.getCombinedModifierFlags(n);
67183
67372
  if (n.parent.kind !== 258 &&
67184
67373
  n.parent.kind !== 257 &&
67185
67374
  n.parent.kind !== 226 &&
67186
- n.flags & 8388608) {
67375
+ n.flags & 16777216) {
67187
67376
  if (!(flags & 2) && !(ts.isModuleBlock(n.parent) && ts.isModuleDeclaration(n.parent.parent) && ts.isGlobalScopeAugmentation(n.parent.parent))) {
67188
67377
  flags |= 1;
67189
67378
  }
@@ -67295,10 +67484,10 @@ var ts;
67295
67484
  var hasNonAmbientClass = false;
67296
67485
  var functionDeclarations = [];
67297
67486
  if (declarations) {
67298
- for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) {
67299
- var current = declarations_4[_i];
67487
+ for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) {
67488
+ var current = declarations_5[_i];
67300
67489
  var node = current;
67301
- var inAmbientContext = node.flags & 8388608;
67490
+ var inAmbientContext = node.flags & 16777216;
67302
67491
  var inAmbientContextOrInterface = node.parent && (node.parent.kind === 258 || node.parent.kind === 182) || inAmbientContext;
67303
67492
  if (inAmbientContextOrInterface) {
67304
67493
  previousDeclaration = undefined;
@@ -67932,7 +68121,7 @@ var ts;
67932
68121
  if (hasBindableName(node)) {
67933
68122
  var symbol = getSymbolOfNode(node);
67934
68123
  var localSymbol = node.localSymbol || symbol;
67935
- var firstDeclaration = (_a = localSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (declaration) { return declaration.kind === node.kind && !(declaration.flags & 131072); });
68124
+ var firstDeclaration = (_a = localSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (declaration) { return declaration.kind === node.kind && !(declaration.flags & 262144); });
67936
68125
  if (node === firstDeclaration) {
67937
68126
  checkFunctionOrConstructorSymbol(localSymbol);
67938
68127
  }
@@ -68042,7 +68231,7 @@ var ts;
68042
68231
  var symbol = getSymbolOfNode(member);
68043
68232
  if (!symbol.isReferenced
68044
68233
  && (ts.hasEffectiveModifier(member, 8) || ts.isNamedDeclaration(member) && ts.isPrivateIdentifier(member.name))
68045
- && !(member.flags & 8388608)) {
68234
+ && !(member.flags & 16777216)) {
68046
68235
  addDiagnostic(member, 0, ts.createDiagnosticForNode(member.name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, symbolToString(symbol)));
68047
68236
  }
68048
68237
  break;
@@ -68217,8 +68406,8 @@ var ts;
68217
68406
  : ts.createDiagnosticForNode(declarationList.parent.kind === 237 ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused));
68218
68407
  }
68219
68408
  else {
68220
- for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) {
68221
- var decl = declarations_5[_i];
68409
+ for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) {
68410
+ var decl = declarations_6[_i];
68222
68411
  addDiagnostic(decl, 0, ts.createDiagnosticForNode(decl, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(decl.name)));
68223
68412
  }
68224
68413
  }
@@ -68258,7 +68447,7 @@ var ts;
68258
68447
  }
68259
68448
  }
68260
68449
  function checkCollisionWithArgumentsInGeneratedCode(node) {
68261
- if (languageVersion >= 2 || !ts.hasRestParameter(node) || node.flags & 8388608 || ts.nodeIsMissing(node.body)) {
68450
+ if (languageVersion >= 2 || !ts.hasRestParameter(node) || node.flags & 16777216 || ts.nodeIsMissing(node.body)) {
68262
68451
  return;
68263
68452
  }
68264
68453
  ts.forEach(node.parameters, function (p) {
@@ -68280,7 +68469,7 @@ var ts;
68280
68469
  node.kind === 296) {
68281
68470
  return false;
68282
68471
  }
68283
- if (node.flags & 8388608) {
68472
+ if (node.flags & 16777216) {
68284
68473
  return false;
68285
68474
  }
68286
68475
  if (ts.isImportClause(node) || ts.isImportEqualsDeclaration(node) || ts.isImportSpecifier(node)) {
@@ -68406,7 +68595,7 @@ var ts;
68406
68595
  recordPotentialCollisionWithReflectInGeneratedCode(node, name);
68407
68596
  if (ts.isClassLike(node)) {
68408
68597
  checkTypeNameIsReserved(name, ts.Diagnostics.Class_name_cannot_be_0);
68409
- if (!(node.flags & 8388608)) {
68598
+ if (!(node.flags & 16777216)) {
68410
68599
  checkClassNameCollisionWithObject(name);
68411
68600
  }
68412
68601
  }
@@ -69667,21 +69856,21 @@ var ts;
69667
69856
  return;
69668
69857
  }
69669
69858
  var type = getDeclaredTypeOfSymbol(symbol);
69670
- if (!areTypeParametersIdentical(declarations, type.localTypeParameters)) {
69859
+ if (!areTypeParametersIdentical(declarations, type.localTypeParameters, ts.getEffectiveTypeParameterDeclarations)) {
69671
69860
  var name = symbolToString(symbol);
69672
- for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) {
69673
- var declaration = declarations_6[_i];
69861
+ for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) {
69862
+ var declaration = declarations_7[_i];
69674
69863
  error(declaration.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, name);
69675
69864
  }
69676
69865
  }
69677
69866
  }
69678
69867
  }
69679
- function areTypeParametersIdentical(declarations, targetParameters) {
69868
+ function areTypeParametersIdentical(declarations, targetParameters, getTypeParameterDeclarations) {
69680
69869
  var maxTypeArgumentCount = ts.length(targetParameters);
69681
69870
  var minTypeArgumentCount = getMinTypeArgumentCount(targetParameters);
69682
- for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) {
69683
- var declaration = declarations_7[_i];
69684
- var sourceParameters = ts.getEffectiveTypeParameterDeclarations(declaration);
69871
+ for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) {
69872
+ var declaration = declarations_8[_i];
69873
+ var sourceParameters = getTypeParameterDeclarations(declaration);
69685
69874
  var numTypeParameters = sourceParameters.length;
69686
69875
  if (numTypeParameters < minTypeArgumentCount || numTypeParameters > maxTypeArgumentCount) {
69687
69876
  return false;
@@ -69740,7 +69929,7 @@ var ts;
69740
69929
  checkTypeParameterListsIdentical(symbol);
69741
69930
  checkFunctionOrConstructorSymbol(symbol);
69742
69931
  checkClassForDuplicateDeclarations(node);
69743
- var nodeInAmbientContext = !!(node.flags & 8388608);
69932
+ var nodeInAmbientContext = !!(node.flags & 16777216);
69744
69933
  if (!nodeInAmbientContext) {
69745
69934
  checkClassForStaticPropertyNameConflicts(node);
69746
69935
  }
@@ -69872,7 +70061,7 @@ var ts;
69872
70061
  }
69873
70062
  function checkMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, memberHasOverrideModifier, memberHasAbstractModifier, memberIsStatic, memberIsParameterProperty, memberName, errorNode) {
69874
70063
  var isJs = ts.isInJSFile(node);
69875
- var nodeInAmbientContext = !!(node.flags & 8388608);
70064
+ var nodeInAmbientContext = !!(node.flags & 16777216);
69876
70065
  if (baseWithThis && (memberHasOverrideModifier || compilerOptions.noImplicitOverride)) {
69877
70066
  var memberEscapedName = ts.escapeLeadingUnderscores(memberName);
69878
70067
  var thisType = memberIsStatic ? staticType : typeWithThis;
@@ -70059,7 +70248,7 @@ var ts;
70059
70248
  && !(derived.flags & 33554432)
70060
70249
  && !(baseDeclarationFlags & 128)
70061
70250
  && !(derivedDeclarationFlags & 128)
70062
- && !((_b = derived.declarations) === null || _b === void 0 ? void 0 : _b.some(function (d) { return !!(d.flags & 8388608); }))) {
70251
+ && !((_b = derived.declarations) === null || _b === void 0 ? void 0 : _b.some(function (d) { return !!(d.flags & 16777216); }))) {
70063
70252
  var constructor = findConstructorDeclaration(ts.getClassLikeDeclarationOfSymbol(type.symbol));
70064
70253
  var propName = uninitialized.name;
70065
70254
  if (uninitialized.exclamationToken
@@ -70149,7 +70338,7 @@ var ts;
70149
70338
  return ok;
70150
70339
  }
70151
70340
  function checkPropertyInitialization(node) {
70152
- if (!strictNullChecks || !strictPropertyInitialization || node.flags & 8388608) {
70341
+ if (!strictNullChecks || !strictPropertyInitialization || node.flags & 16777216) {
70153
70342
  return;
70154
70343
  }
70155
70344
  var constructor = findConstructorDeclaration(node);
@@ -70279,7 +70468,7 @@ var ts;
70279
70468
  if (member.initializer) {
70280
70469
  return computeConstantValue(member);
70281
70470
  }
70282
- if (member.parent.flags & 8388608 && !ts.isEnumConst(member.parent) && getEnumKind(getSymbolOfNode(member.parent)) === 0) {
70471
+ if (member.parent.flags & 16777216 && !ts.isEnumConst(member.parent) && getEnumKind(getSymbolOfNode(member.parent)) === 0) {
70283
70472
  return undefined;
70284
70473
  }
70285
70474
  if (autoValue !== undefined) {
@@ -70307,7 +70496,7 @@ var ts;
70307
70496
  else if (isConstEnum) {
70308
70497
  error(initializer, ts.Diagnostics.const_enum_member_initializers_can_only_contain_literal_values_and_other_computed_enum_values);
70309
70498
  }
70310
- else if (member.parent.flags & 8388608) {
70499
+ else if (member.parent.flags & 16777216) {
70311
70500
  error(initializer, ts.Diagnostics.In_ambient_enum_declarations_member_initializer_must_be_constant_expression);
70312
70501
  }
70313
70502
  else {
@@ -70465,11 +70654,11 @@ var ts;
70465
70654
  function getFirstNonAmbientClassOrFunctionDeclaration(symbol) {
70466
70655
  var declarations = symbol.declarations;
70467
70656
  if (declarations) {
70468
- for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) {
70469
- var declaration = declarations_8[_i];
70657
+ for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) {
70658
+ var declaration = declarations_9[_i];
70470
70659
  if ((declaration.kind === 257 ||
70471
70660
  (declaration.kind === 256 && ts.nodeIsPresent(declaration.body))) &&
70472
- !(declaration.flags & 8388608)) {
70661
+ !(declaration.flags & 16777216)) {
70473
70662
  return declaration;
70474
70663
  }
70475
70664
  }
@@ -70499,7 +70688,7 @@ var ts;
70499
70688
  addLazyDiagnostic(checkModuleDeclarationDiagnostics);
70500
70689
  function checkModuleDeclarationDiagnostics() {
70501
70690
  var isGlobalAugmentation = ts.isGlobalScopeAugmentation(node);
70502
- var inAmbientContext = node.flags & 8388608;
70691
+ var inAmbientContext = node.flags & 16777216;
70503
70692
  if (isGlobalAugmentation && !inAmbientContext) {
70504
70693
  error(node.name, ts.Diagnostics.Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context);
70505
70694
  }
@@ -70685,7 +70874,7 @@ var ts;
70685
70874
  }
70686
70875
  if (compilerOptions.isolatedModules
70687
70876
  && !ts.isTypeOnlyImportOrExportDeclaration(node)
70688
- && !(node.flags & 8388608)) {
70877
+ && !(node.flags & 16777216)) {
70689
70878
  var typeOnlyAlias = getTypeOnlyAliasDeclaration(symbol);
70690
70879
  var isType = !(target.flags & 111551);
70691
70880
  if (isType || typeOnlyAlias) {
@@ -70728,7 +70917,7 @@ var ts;
70728
70917
  }
70729
70918
  }
70730
70919
  function isDeprecatedAliasedSymbol(symbol) {
70731
- return !!symbol.declarations && ts.every(symbol.declarations, function (d) { return !!(ts.getCombinedNodeFlags(d) & 134217728); });
70920
+ return !!symbol.declarations && ts.every(symbol.declarations, function (d) { return !!(ts.getCombinedNodeFlags(d) & 268435456); });
70732
70921
  }
70733
70922
  function checkDeprecatedAliasedSymbol(symbol, location) {
70734
70923
  if (!(symbol.flags & 2097152))
@@ -70853,7 +71042,7 @@ var ts;
70853
71042
  }
70854
71043
  }
70855
71044
  else {
70856
- if (moduleKind >= ts.ModuleKind.ES2015 && ts.getSourceFileOfNode(node).impliedNodeFormat === undefined && !node.isTypeOnly && !(node.flags & 8388608)) {
71045
+ if (moduleKind >= ts.ModuleKind.ES2015 && ts.getSourceFileOfNode(node).impliedNodeFormat === undefined && !node.isTypeOnly && !(node.flags & 16777216)) {
70857
71046
  grammarErrorOnNode(node, ts.Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead);
70858
71047
  }
70859
71048
  }
@@ -70875,7 +71064,7 @@ var ts;
70875
71064
  ts.forEach(node.exportClause.elements, checkExportSpecifier);
70876
71065
  var inAmbientExternalModule = node.parent.kind === 262 && ts.isAmbientModule(node.parent.parent);
70877
71066
  var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 262 &&
70878
- !node.moduleSpecifier && node.flags & 8388608;
71067
+ !node.moduleSpecifier && node.flags & 16777216;
70879
71068
  if (node.parent.kind !== 305 && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) {
70880
71069
  error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace);
70881
71070
  }
@@ -71028,10 +71217,10 @@ var ts;
71028
71217
  checkExpressionCached(node.expression);
71029
71218
  }
71030
71219
  checkExternalModuleExports(container);
71031
- if ((node.flags & 8388608) && !ts.isEntityNameExpression(node.expression)) {
71220
+ if ((node.flags & 16777216) && !ts.isEntityNameExpression(node.expression)) {
71032
71221
  grammarErrorOnNode(node.expression, ts.Diagnostics.The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context);
71033
71222
  }
71034
- if (node.isExportEquals && !(node.flags & 8388608)) {
71223
+ if (node.isExportEquals && !(node.flags & 16777216)) {
71035
71224
  if (moduleKind >= ts.ModuleKind.ES2015 && ts.getSourceFileOfNode(node).impliedNodeFormat !== ts.ModuleKind.CommonJS) {
71036
71225
  grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead);
71037
71226
  }
@@ -71429,7 +71618,7 @@ var ts;
71429
71618
  addLazyDiagnostic(function () {
71430
71619
  if (!node.isDeclarationFile && (compilerOptions.noUnusedLocals || compilerOptions.noUnusedParameters)) {
71431
71620
  checkUnusedIdentifiers(getPotentiallyUnusedIdentifiers(node), function (containingNode, kind, diag) {
71432
- if (!ts.containsParseError(containingNode) && unusedIsError(kind, !!(containingNode.flags & 8388608))) {
71621
+ if (!ts.containsParseError(containingNode) && unusedIsError(kind, !!(containingNode.flags & 16777216))) {
71433
71622
  diagnostics.add(diag);
71434
71623
  }
71435
71624
  });
@@ -71510,7 +71699,7 @@ var ts;
71510
71699
  return diagnostics.getGlobalDiagnostics();
71511
71700
  }
71512
71701
  function getSymbolsInScope(location, meaning) {
71513
- if (location.flags & 16777216) {
71702
+ if (location.flags & 33554432) {
71514
71703
  return [];
71515
71704
  }
71516
71705
  var symbols = ts.createSymbolTable();
@@ -71823,7 +72012,7 @@ var ts;
71823
72012
  }
71824
72013
  var parent = node.parent;
71825
72014
  var grandParent = parent.parent;
71826
- if (node.flags & 16777216) {
72015
+ if (node.flags & 33554432) {
71827
72016
  return undefined;
71828
72017
  }
71829
72018
  if (isDeclarationNameOrImportPropertyName(node)) {
@@ -71953,7 +72142,7 @@ var ts;
71953
72142
  if (ts.isSourceFile(node) && !ts.isExternalModule(node)) {
71954
72143
  return errorType;
71955
72144
  }
71956
- if (node.flags & 16777216) {
72145
+ if (node.flags & 33554432) {
71957
72146
  return errorType;
71958
72147
  }
71959
72148
  var classDecl = ts.tryGetClassImplementingOrExtendingExpressionWithTypeArguments(node);
@@ -72867,7 +73056,7 @@ var ts;
72867
73056
  function checkExternalEmitHelpers(location, helpers) {
72868
73057
  if ((requestedExternalEmitHelpers & helpers) !== helpers && compilerOptions.importHelpers) {
72869
73058
  var sourceFile = ts.getSourceFileOfNode(location);
72870
- if (ts.isEffectiveExternalModule(sourceFile, compilerOptions) && !(location.flags & 8388608)) {
73059
+ if (ts.isEffectiveExternalModule(sourceFile, compilerOptions) && !(location.flags & 16777216)) {
72871
73060
  var helpersModule = resolveHelpersModule(sourceFile, location);
72872
73061
  if (helpersModule !== unknownSymbol) {
72873
73062
  var uncheckedHelpers = helpers & ~requestedExternalEmitHelpers;
@@ -73117,7 +73306,7 @@ var ts;
73117
73306
  else if (node.kind === 164) {
73118
73307
  return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare");
73119
73308
  }
73120
- else if ((node.parent.flags & 8388608) && node.parent.kind === 262) {
73309
+ else if ((node.parent.flags & 16777216) && node.parent.kind === 262) {
73121
73310
  return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context);
73122
73311
  }
73123
73312
  else if (ts.isPrivateIdentifierClassElementDeclaration(node)) {
@@ -73163,7 +73352,7 @@ var ts;
73163
73352
  if (flags & 256) {
73164
73353
  return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async");
73165
73354
  }
73166
- else if (flags & 2 || node.parent.flags & 8388608) {
73355
+ else if (flags & 2 || node.parent.flags & 16777216) {
73167
73356
  return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async");
73168
73357
  }
73169
73358
  else if (node.kind === 164) {
@@ -73305,7 +73494,7 @@ var ts;
73305
73494
  if (i !== (parameterCount - 1)) {
73306
73495
  return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list);
73307
73496
  }
73308
- if (!(parameter.flags & 8388608)) {
73497
+ if (!(parameter.flags & 16777216)) {
73309
73498
  checkGrammarForDisallowedTrailingComma(parameters, ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma);
73310
73499
  }
73311
73500
  if (parameter.questionToken) {
@@ -73511,7 +73700,7 @@ var ts;
73511
73700
  ts.Debug.assert(node.kind === 256 ||
73512
73701
  node.kind === 213 ||
73513
73702
  node.kind === 169);
73514
- if (node.flags & 8388608) {
73703
+ if (node.flags & 16777216) {
73515
73704
  return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context);
73516
73705
  }
73517
73706
  if (!node.body) {
@@ -73726,7 +73915,7 @@ var ts;
73726
73915
  return false;
73727
73916
  }
73728
73917
  function checkGrammarAccessor(accessor) {
73729
- if (!(accessor.flags & 8388608) && (accessor.parent.kind !== 182) && (accessor.parent.kind !== 258)) {
73918
+ if (!(accessor.flags & 16777216) && (accessor.parent.kind !== 182) && (accessor.parent.kind !== 258)) {
73730
73919
  if (languageVersion < 1) {
73731
73920
  return grammarErrorOnNode(accessor.name, ts.Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher);
73732
73921
  }
@@ -73856,7 +74045,7 @@ var ts;
73856
74045
  if (languageVersion < 2 && ts.isPrivateIdentifier(node.name)) {
73857
74046
  return grammarErrorOnNode(node.name, ts.Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher);
73858
74047
  }
73859
- if (node.flags & 8388608) {
74048
+ if (node.flags & 16777216) {
73860
74049
  return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_ambient_context_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type);
73861
74050
  }
73862
74051
  else if (node.kind === 169 && !node.body) {
@@ -73967,7 +74156,7 @@ var ts;
73967
74156
  }
73968
74157
  function checkGrammarVariableDeclaration(node) {
73969
74158
  if (node.parent.parent.kind !== 243 && node.parent.parent.kind !== 244) {
73970
- if (node.flags & 8388608) {
74159
+ if (node.flags & 16777216) {
73971
74160
  checkAmbientInitializer(node);
73972
74161
  }
73973
74162
  else if (!node.initializer) {
@@ -73979,7 +74168,7 @@ var ts;
73979
74168
  }
73980
74169
  }
73981
74170
  }
73982
- if (node.exclamationToken && (node.parent.parent.kind !== 237 || !node.type || node.initializer || node.flags & 8388608)) {
74171
+ if (node.exclamationToken && (node.parent.parent.kind !== 237 || !node.type || node.initializer || node.flags & 16777216)) {
73983
74172
  var message = node.initializer
73984
74173
  ? ts.Diagnostics.Declarations_with_initializers_cannot_also_have_definite_assignment_assertions
73985
74174
  : !node.type
@@ -73988,7 +74177,7 @@ var ts;
73988
74177
  return grammarErrorOnNode(node.exclamationToken, message);
73989
74178
  }
73990
74179
  if ((moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS) && moduleKind !== ts.ModuleKind.System &&
73991
- !(node.parent.parent.flags & 8388608) && ts.hasSyntacticModifier(node.parent.parent, 1)) {
74180
+ !(node.parent.parent.flags & 16777216) && ts.hasSyntacticModifier(node.parent.parent, 1)) {
73992
74181
  checkESModuleMarker(node.name);
73993
74182
  }
73994
74183
  var checkLetConstNames = (ts.isLet(node) || ts.isVarConst(node));
@@ -74159,11 +74348,11 @@ var ts;
74159
74348
  return grammarErrorOnNode(node.initializer, ts.Diagnostics.A_type_literal_property_cannot_have_an_initializer);
74160
74349
  }
74161
74350
  }
74162
- if (node.flags & 8388608) {
74351
+ if (node.flags & 16777216) {
74163
74352
  checkAmbientInitializer(node);
74164
74353
  }
74165
74354
  if (ts.isPropertyDeclaration(node) && node.exclamationToken && (!ts.isClassLike(node.parent) || !node.type || node.initializer ||
74166
- node.flags & 8388608 || ts.isStatic(node) || ts.hasAbstractModifier(node))) {
74355
+ node.flags & 16777216 || ts.isStatic(node) || ts.hasAbstractModifier(node))) {
74167
74356
  var message = node.initializer
74168
74357
  ? ts.Diagnostics.Declarations_with_initializers_cannot_also_have_definite_assignment_assertions
74169
74358
  : !node.type
@@ -74197,10 +74386,10 @@ var ts;
74197
74386
  return false;
74198
74387
  }
74199
74388
  function checkGrammarSourceFile(node) {
74200
- return !!(node.flags & 8388608) && checkGrammarTopLevelElementsForRequiredDeclareModifier(node);
74389
+ return !!(node.flags & 16777216) && checkGrammarTopLevelElementsForRequiredDeclareModifier(node);
74201
74390
  }
74202
74391
  function checkGrammarStatementInAmbientContext(node) {
74203
- if (node.flags & 8388608) {
74392
+ if (node.flags & 16777216) {
74204
74393
  var links = getNodeLinks(node);
74205
74394
  if (!links.hasReportedStatementInAmbientContext && (ts.isFunctionLike(node.parent) || ts.isAccessor(node.parent))) {
74206
74395
  return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts);
@@ -77352,7 +77541,7 @@ var ts;
77352
77541
  return !ts.nodeIsMissing(node.body);
77353
77542
  }
77354
77543
  function visitPropertyDeclaration(node) {
77355
- if (node.flags & 8388608 || ts.hasSyntacticModifier(node, 128)) {
77544
+ if (node.flags & 16777216 || ts.hasSyntacticModifier(node, 128)) {
77356
77545
  return undefined;
77357
77546
  }
77358
77547
  var updated = factory.updatePropertyDeclaration(node, undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), visitPropertyNameOfClassElement(node), undefined, undefined, ts.visitNode(node.initializer, visitor));
@@ -82591,8 +82780,8 @@ var ts;
82591
82780
  }
82592
82781
  function getRangeUnion(declarations) {
82593
82782
  var pos = -1, end = -1;
82594
- for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) {
82595
- var node = declarations_9[_i];
82783
+ for (var _i = 0, declarations_10 = declarations; _i < declarations_10.length; _i++) {
82784
+ var node = declarations_10[_i];
82596
82785
  pos = pos === -1 ? node.pos : node.pos === -1 ? pos : Math.min(pos, node.pos);
82597
82786
  end = Math.max(end, node.end);
82598
82787
  }
@@ -88767,7 +88956,7 @@ var ts;
88767
88956
  needsScopeFixMarker = false;
88768
88957
  var statements = ts.visitNodes(inner.statements, visitDeclarationStatements);
88769
88958
  var lateStatements = transformAndReplaceLatePaintedStatements(statements);
88770
- if (input.flags & 8388608) {
88959
+ if (input.flags & 16777216) {
88771
88960
  needsScopeFixMarker = false;
88772
88961
  }
88773
88962
  if (!ts.isGlobalScopeAugmentation(input) && !hasScopeMarker(lateStatements) && !resultHasScopeMarker) {
@@ -90207,6 +90396,9 @@ var ts;
90207
90396
  var currentParenthesizerRule;
90208
90397
  var _c = ts.performance.createTimerIf(extendedDiagnostics, "commentTime", "beforeComment", "afterComment"), enterComment = _c.enter, exitComment = _c.exit;
90209
90398
  var parenthesizer = ts.factory.parenthesizer;
90399
+ var typeArgumentParenthesizerRuleSelector = {
90400
+ select: function (index) { return index === 0 ? parenthesizer.parenthesizeLeadingTypeArgument : undefined; }
90401
+ };
90210
90402
  var emitBinaryExpression = createEmitBinaryExpression();
90211
90403
  reset();
90212
90404
  return {
@@ -91330,7 +91522,7 @@ var ts;
91330
91522
  writePunctuation("}");
91331
91523
  }
91332
91524
  function emitArrayType(node) {
91333
- emit(node.elementType, parenthesizer.parenthesizeElementTypeOfArrayType);
91525
+ emit(node.elementType, parenthesizer.parenthesizeNonArrayTypeOfPostfixType);
91334
91526
  writePunctuation("[");
91335
91527
  writePunctuation("]");
91336
91528
  }
@@ -91341,7 +91533,7 @@ var ts;
91341
91533
  function emitTupleType(node) {
91342
91534
  emitTokenWithComment(22, node.pos, writePunctuation, node);
91343
91535
  var flags = ts.getEmitFlags(node) & 1 ? 528 : 657;
91344
- emitList(node, node.elements, flags | 524288);
91536
+ emitList(node, node.elements, flags | 524288, parenthesizer.parenthesizeElementTypeOfTupleType);
91345
91537
  emitTokenWithComment(23, node.elements.end, writePunctuation, node);
91346
91538
  }
91347
91539
  function emitNamedTupleMember(node) {
@@ -91353,21 +91545,21 @@ var ts;
91353
91545
  emit(node.type);
91354
91546
  }
91355
91547
  function emitOptionalType(node) {
91356
- emit(node.type, parenthesizer.parenthesizeElementTypeOfArrayType);
91548
+ emit(node.type, parenthesizer.parenthesizeTypeOfOptionalType);
91357
91549
  writePunctuation("?");
91358
91550
  }
91359
91551
  function emitUnionType(node) {
91360
- emitList(node, node.types, 516, parenthesizer.parenthesizeMemberOfElementType);
91552
+ emitList(node, node.types, 516, parenthesizer.parenthesizeConstituentTypeOfUnionType);
91361
91553
  }
91362
91554
  function emitIntersectionType(node) {
91363
- emitList(node, node.types, 520, parenthesizer.parenthesizeMemberOfElementType);
91555
+ emitList(node, node.types, 520, parenthesizer.parenthesizeConstituentTypeOfIntersectionType);
91364
91556
  }
91365
91557
  function emitConditionalType(node) {
91366
- emit(node.checkType, parenthesizer.parenthesizeMemberOfConditionalType);
91558
+ emit(node.checkType, parenthesizer.parenthesizeCheckTypeOfConditionalType);
91367
91559
  writeSpace();
91368
91560
  writeKeyword("extends");
91369
91561
  writeSpace();
91370
- emit(node.extendsType, parenthesizer.parenthesizeMemberOfConditionalType);
91562
+ emit(node.extendsType, parenthesizer.parenthesizeExtendsTypeOfConditionalType);
91371
91563
  writeSpace();
91372
91564
  writePunctuation("?");
91373
91565
  writeSpace();
@@ -91393,10 +91585,13 @@ var ts;
91393
91585
  function emitTypeOperator(node) {
91394
91586
  writeTokenText(node.operator, writeKeyword);
91395
91587
  writeSpace();
91396
- emit(node.type, parenthesizer.parenthesizeMemberOfElementType);
91588
+ var parenthesizerRule = node.operator === 145 ?
91589
+ parenthesizer.parenthesizeOperandOfReadonlyTypeOperator :
91590
+ parenthesizer.parenthesizeOperandOfTypeOperator;
91591
+ emit(node.type, parenthesizerRule);
91397
91592
  }
91398
91593
  function emitIndexedAccessType(node) {
91399
- emit(node.objectType, parenthesizer.parenthesizeMemberOfElementType);
91594
+ emit(node.objectType, parenthesizer.parenthesizeNonArrayTypeOfPostfixType);
91400
91595
  writePunctuation("[");
91401
91596
  emit(node.indexType);
91402
91597
  writePunctuation("]");
@@ -93037,7 +93232,7 @@ var ts;
93037
93232
  emitList(parentNode, decorators, 2146305);
93038
93233
  }
93039
93234
  function emitTypeArguments(parentNode, typeArguments) {
93040
- emitList(parentNode, typeArguments, 53776, parenthesizer.parenthesizeMemberOfElementType);
93235
+ emitList(parentNode, typeArguments, 53776, typeArgumentParenthesizerRuleSelector);
93041
93236
  }
93042
93237
  function emitTypeParameters(parentNode, typeParameters) {
93043
93238
  if (ts.isFunctionLike(parentNode) && parentNode.typeArguments) {
@@ -93153,6 +93348,7 @@ var ts;
93153
93348
  if (format & 128) {
93154
93349
  increaseIndent();
93155
93350
  }
93351
+ var emitListItem = getEmitListItem(emit, parenthesizerRule);
93156
93352
  var previousSibling = void 0;
93157
93353
  var previousSourceFileTextKind = void 0;
93158
93354
  var shouldDecreaseIndentAfterEmit = false;
@@ -93190,12 +93386,7 @@ var ts;
93190
93386
  shouldEmitInterveningComments = mayEmitInterveningComments;
93191
93387
  }
93192
93388
  nextListElementPos = child.pos;
93193
- if (emit.length === 1) {
93194
- emit(child);
93195
- }
93196
- else {
93197
- emit(child, parenthesizerRule);
93198
- }
93389
+ emitListItem(child, emit, parenthesizerRule, i);
93199
93390
  if (shouldDecreaseIndentAfterEmit) {
93200
93391
  decreaseIndent();
93201
93392
  shouldDecreaseIndentAfterEmit = false;
@@ -94249,6 +94440,20 @@ var ts;
94249
94440
  function getClosingBracket(format) {
94250
94441
  return brackets[format & 15360][1];
94251
94442
  }
94443
+ function emitListItemNoParenthesizer(node, emit, _parenthesizerRule, _index) {
94444
+ emit(node);
94445
+ }
94446
+ function emitListItemWithParenthesizerRuleSelector(node, emit, parenthesizerRuleSelector, index) {
94447
+ emit(node, parenthesizerRuleSelector.select(index));
94448
+ }
94449
+ function emitListItemWithParenthesizerRule(node, emit, parenthesizerRule, _index) {
94450
+ emit(node, parenthesizerRule);
94451
+ }
94452
+ function getEmitListItem(emit, parenthesizerRule) {
94453
+ return emit.length === 1 ? emitListItemNoParenthesizer :
94454
+ typeof parenthesizerRule === "object" ? emitListItemWithParenthesizerRuleSelector :
94455
+ emitListItemWithParenthesizerRule;
94456
+ }
94252
94457
  })(ts || (ts = {}));
94253
94458
  var ts;
94254
94459
  (function (ts) {
@@ -96045,7 +96250,7 @@ var ts;
96045
96250
  if (!ts.arrayIsEqualTo(oldSourceFile.moduleAugmentations, newSourceFile.moduleAugmentations, moduleNameIsEqualTo)) {
96046
96251
  structureIsReused = 1;
96047
96252
  }
96048
- if ((oldSourceFile.flags & 3145728) !== (newSourceFile.flags & 3145728)) {
96253
+ if ((oldSourceFile.flags & 6291456) !== (newSourceFile.flags & 6291456)) {
96049
96254
  structureIsReused = 1;
96050
96255
  }
96051
96256
  if (!ts.arrayIsEqualTo(oldSourceFile.typeReferenceDirectives, newSourceFile.typeReferenceDirectives, fileReferenceIsEqualTo)) {
@@ -96192,6 +96397,9 @@ var ts;
96192
96397
  return !!sourceFilesFoundSearchingNodeModules.get(file.path);
96193
96398
  }
96194
96399
  function isSourceFileDefaultLibrary(file) {
96400
+ if (!file.isDeclarationFile) {
96401
+ return false;
96402
+ }
96195
96403
  if (file.hasNoDefaultLib) {
96196
96404
  return true;
96197
96405
  }
@@ -96647,7 +96855,7 @@ var ts;
96647
96855
  var node = _a[_i];
96648
96856
  collectModuleReferences(node, false);
96649
96857
  }
96650
- if ((file.flags & 1048576) || isJavaScriptFile) {
96858
+ if ((file.flags & 2097152) || isJavaScriptFile) {
96651
96859
  collectDynamicImportOrRequireCalls(file);
96652
96860
  }
96653
96861
  file.imports = imports || ts.emptyArray;
@@ -97169,7 +97377,7 @@ var ts;
97169
97377
  && index < file.imports.length
97170
97378
  && !elideImport
97171
97379
  && !(isJsFile && !ts.getAllowJSCompilerOption(optionsForFile))
97172
- && (ts.isInJSFile(file.imports[index]) || !(file.imports[index].flags & 4194304));
97380
+ && (ts.isInJSFile(file.imports[index]) || !(file.imports[index].flags & 8388608));
97173
97381
  if (elideImport) {
97174
97382
  modulesWithElidedImports.set(file.path, true);
97175
97383
  }