typescript 4.7.0-dev.20220404 → 4.7.0-dev.20220408

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.20220404";
72
+ ts.version = ts.versionMajorMinor + ".0-dev.20220408";
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  var globals = typeof globalThis !== "undefined" ? globalThis :
@@ -5901,6 +5901,7 @@ var ts;
5901
5901
  _0_index_signatures_are_incompatible: diag(2634, ts.DiagnosticCategory.Error, "_0_index_signatures_are_incompatible_2634", "'{0}' index signatures are incompatible."),
5902
5902
  Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable: diag(2635, ts.DiagnosticCategory.Error, "Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable_2635", "Type '{0}' has no signatures for which the type argument list is applicable."),
5903
5903
  Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation: diag(2636, ts.DiagnosticCategory.Error, "Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation_2636", "Type '{0}' is not assignable to type '{1}' as implied by variance annotation."),
5904
+ Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types: diag(2637, ts.DiagnosticCategory.Error, "Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_t_2637", "Variance annotations are only supported in type aliases for object, function, constructor, and mapped types."),
5904
5905
  Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: diag(2649, ts.DiagnosticCategory.Error, "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", "Cannot augment module '{0}' with value exports because it resolves to a non-module entity."),
5905
5906
  A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: diag(2651, ts.DiagnosticCategory.Error, "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums."),
5906
5907
  Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: diag(2652, ts.DiagnosticCategory.Error, "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead."),
@@ -6073,6 +6074,7 @@ var ts;
6073
6074
  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
6075
  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
6076
  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."),
6077
+ 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
6078
  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
6079
  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
6080
  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 +10884,17 @@ var ts;
10882
10884
  ts.hasChangesInResolutions = hasChangesInResolutions;
10883
10885
  function containsParseError(node) {
10884
10886
  aggregateChildData(node);
10885
- return (node.flags & 262144) !== 0;
10887
+ return (node.flags & 524288) !== 0;
10886
10888
  }
10887
10889
  ts.containsParseError = containsParseError;
10888
10890
  function aggregateChildData(node) {
10889
- if (!(node.flags & 524288)) {
10890
- var thisNodeOrAnySubNodesHasError = ((node.flags & 65536) !== 0) ||
10891
+ if (!(node.flags & 1048576)) {
10892
+ var thisNodeOrAnySubNodesHasError = ((node.flags & 131072) !== 0) ||
10891
10893
  ts.forEachChild(node, containsParseError);
10892
10894
  if (thisNodeOrAnySubNodesHasError) {
10893
- node.flags |= 262144;
10895
+ node.flags |= 524288;
10894
10896
  }
10895
- node.flags |= 524288;
10897
+ node.flags |= 1048576;
10896
10898
  }
10897
10899
  }
10898
10900
  function getSourceFileOfNode(node) {
@@ -12516,11 +12518,11 @@ var ts;
12516
12518
  }
12517
12519
  ts.isSourceFileNotJS = isSourceFileNotJS;
12518
12520
  function isInJSFile(node) {
12519
- return !!node && !!(node.flags & 131072);
12521
+ return !!node && !!(node.flags & 262144);
12520
12522
  }
12521
12523
  ts.isInJSFile = isInJSFile;
12522
12524
  function isInJsonFile(node) {
12523
- return !!node && !!(node.flags & 33554432);
12525
+ return !!node && !!(node.flags & 67108864);
12524
12526
  }
12525
12527
  ts.isInJsonFile = isInJsonFile;
12526
12528
  function isSourceFileNotJson(file) {
@@ -12528,7 +12530,7 @@ var ts;
12528
12530
  }
12529
12531
  ts.isSourceFileNotJson = isSourceFileNotJson;
12530
12532
  function isInJSDoc(node) {
12531
- return !!node && !!(node.flags & 4194304);
12533
+ return !!node && !!(node.flags & 8388608);
12532
12534
  }
12533
12535
  ts.isInJSDoc = isInJSDoc;
12534
12536
  function isJSDocIndexSignature(node) {
@@ -12856,7 +12858,7 @@ var ts;
12856
12858
  function setValueDeclaration(symbol, node) {
12857
12859
  var valueDeclaration = symbol.valueDeclaration;
12858
12860
  if (!valueDeclaration ||
12859
- !(node.flags & 8388608 && !(valueDeclaration.flags & 8388608)) &&
12861
+ !(node.flags & 16777216 && !(valueDeclaration.flags & 16777216)) &&
12860
12862
  (isAssignmentDeclaration(valueDeclaration) && !isAssignmentDeclaration(node)) ||
12861
12863
  (valueDeclaration.kind !== node.kind && isEffectiveModuleDeclaration(valueDeclaration))) {
12862
12864
  symbol.valueDeclaration = node;
@@ -13114,7 +13116,11 @@ var ts;
13114
13116
  ts.getEffectiveContainerForJSDocTemplateTag = getEffectiveContainerForJSDocTemplateTag;
13115
13117
  function getHostSignatureFromJSDoc(node) {
13116
13118
  var host = getEffectiveJSDocHost(node);
13117
- return host && ts.isFunctionLike(host) ? host : undefined;
13119
+ if (host) {
13120
+ return ts.isPropertySignature(host) && host.type && ts.isFunctionLike(host.type) ? host.type :
13121
+ ts.isFunctionLike(host) ? host : undefined;
13122
+ }
13123
+ return undefined;
13118
13124
  }
13119
13125
  ts.getHostSignatureFromJSDoc = getHostSignatureFromJSDoc;
13120
13126
  function getEffectiveJSDocHost(node) {
@@ -16558,7 +16564,7 @@ var ts;
16558
16564
  }
16559
16565
  ts.pseudoBigIntToString = pseudoBigIntToString;
16560
16566
  function isValidTypeOnlyAliasUseSite(useSite) {
16561
- return !!(useSite.flags & 8388608)
16567
+ return !!(useSite.flags & 16777216)
16562
16568
  || isPartOfTypeQuery(useSite)
16563
16569
  || isIdentifierInNonEmittingHeritageClause(useSite)
16564
16570
  || isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(useSite)
@@ -16936,11 +16942,20 @@ var ts;
16936
16942
  parenthesizeExpressionForDisallowedComma: parenthesizeExpressionForDisallowedComma,
16937
16943
  parenthesizeExpressionOfExpressionStatement: parenthesizeExpressionOfExpressionStatement,
16938
16944
  parenthesizeConciseBodyOfArrowFunction: parenthesizeConciseBodyOfArrowFunction,
16939
- parenthesizeMemberOfConditionalType: parenthesizeMemberOfConditionalType,
16940
- parenthesizeMemberOfElementType: parenthesizeMemberOfElementType,
16941
- parenthesizeElementTypeOfArrayType: parenthesizeElementTypeOfArrayType,
16942
- parenthesizeConstituentTypesOfUnionOrIntersectionType: parenthesizeConstituentTypesOfUnionOrIntersectionType,
16945
+ parenthesizeCheckTypeOfConditionalType: parenthesizeCheckTypeOfConditionalType,
16946
+ parenthesizeExtendsTypeOfConditionalType: parenthesizeExtendsTypeOfConditionalType,
16947
+ parenthesizeConstituentTypesOfUnionType: parenthesizeConstituentTypesOfUnionType,
16948
+ parenthesizeConstituentTypeOfUnionType: parenthesizeConstituentTypeOfUnionType,
16949
+ parenthesizeConstituentTypesOfIntersectionType: parenthesizeConstituentTypesOfIntersectionType,
16950
+ parenthesizeConstituentTypeOfIntersectionType: parenthesizeConstituentTypeOfIntersectionType,
16951
+ parenthesizeOperandOfTypeOperator: parenthesizeOperandOfTypeOperator,
16952
+ parenthesizeOperandOfReadonlyTypeOperator: parenthesizeOperandOfReadonlyTypeOperator,
16953
+ parenthesizeNonArrayTypeOfPostfixType: parenthesizeNonArrayTypeOfPostfixType,
16954
+ parenthesizeElementTypesOfTupleType: parenthesizeElementTypesOfTupleType,
16955
+ parenthesizeElementTypeOfTupleType: parenthesizeElementTypeOfTupleType,
16956
+ parenthesizeTypeOfOptionalType: parenthesizeTypeOfOptionalType,
16943
16957
  parenthesizeTypeArguments: parenthesizeTypeArguments,
16958
+ parenthesizeLeadingTypeArgument: parenthesizeLeadingTypeArgument,
16944
16959
  };
16945
16960
  function getParenthesizeLeftSideOfBinaryForOperator(operatorKind) {
16946
16961
  binaryLeftOperandParenthesizerCache || (binaryLeftOperandParenthesizerCache = new ts.Map());
@@ -17128,33 +17143,102 @@ var ts;
17128
17143
  }
17129
17144
  return body;
17130
17145
  }
17131
- function parenthesizeMemberOfConditionalType(member) {
17132
- return member.kind === 189 ? factory.createParenthesizedType(member) : member;
17146
+ function parenthesizeCheckTypeOfConditionalType(checkType) {
17147
+ switch (checkType.kind) {
17148
+ case 179:
17149
+ case 180:
17150
+ case 189:
17151
+ return factory.createParenthesizedType(checkType);
17152
+ }
17153
+ return checkType;
17133
17154
  }
17134
- function parenthesizeMemberOfElementType(member) {
17135
- switch (member.kind) {
17155
+ function parenthesizeExtendsTypeOfConditionalType(extendsType) {
17156
+ switch (extendsType.kind) {
17157
+ case 189:
17158
+ return factory.createParenthesizedType(extendsType);
17159
+ }
17160
+ return extendsType;
17161
+ }
17162
+ function parenthesizeConstituentTypeOfUnionType(type) {
17163
+ switch (type.kind) {
17136
17164
  case 187:
17137
17165
  case 188:
17138
- case 179:
17139
- case 180:
17140
- return factory.createParenthesizedType(member);
17166
+ return factory.createParenthesizedType(type);
17141
17167
  }
17142
- return parenthesizeMemberOfConditionalType(member);
17168
+ return parenthesizeCheckTypeOfConditionalType(type);
17143
17169
  }
17144
- function parenthesizeElementTypeOfArrayType(member) {
17145
- switch (member.kind) {
17146
- case 181:
17170
+ function parenthesizeConstituentTypesOfUnionType(members) {
17171
+ return factory.createNodeArray(ts.sameMap(members, parenthesizeConstituentTypeOfUnionType));
17172
+ }
17173
+ function parenthesizeConstituentTypeOfIntersectionType(type) {
17174
+ switch (type.kind) {
17175
+ case 187:
17176
+ case 188:
17177
+ return factory.createParenthesizedType(type);
17178
+ }
17179
+ return parenthesizeConstituentTypeOfUnionType(type);
17180
+ }
17181
+ function parenthesizeConstituentTypesOfIntersectionType(members) {
17182
+ return factory.createNodeArray(ts.sameMap(members, parenthesizeConstituentTypeOfIntersectionType));
17183
+ }
17184
+ function parenthesizeOperandOfTypeOperator(type) {
17185
+ switch (type.kind) {
17186
+ case 188:
17187
+ return factory.createParenthesizedType(type);
17188
+ }
17189
+ return parenthesizeConstituentTypeOfIntersectionType(type);
17190
+ }
17191
+ function parenthesizeOperandOfReadonlyTypeOperator(type) {
17192
+ switch (type.kind) {
17147
17193
  case 193:
17194
+ return factory.createParenthesizedType(type);
17195
+ }
17196
+ return parenthesizeOperandOfTypeOperator(type);
17197
+ }
17198
+ function parenthesizeNonArrayTypeOfPostfixType(type) {
17199
+ switch (type.kind) {
17148
17200
  case 190:
17149
- return factory.createParenthesizedType(member);
17201
+ case 193:
17202
+ case 181:
17203
+ return factory.createParenthesizedType(type);
17150
17204
  }
17151
- return parenthesizeMemberOfElementType(member);
17205
+ return parenthesizeOperandOfTypeOperator(type);
17206
+ }
17207
+ function parenthesizeElementTypesOfTupleType(types) {
17208
+ return factory.createNodeArray(ts.sameMap(types, parenthesizeElementTypeOfTupleType));
17209
+ }
17210
+ function parenthesizeElementTypeOfTupleType(type) {
17211
+ if (hasJSDocPostfixQuestion(type))
17212
+ return factory.createParenthesizedType(type);
17213
+ return type;
17152
17214
  }
17153
- function parenthesizeConstituentTypesOfUnionOrIntersectionType(members) {
17154
- return factory.createNodeArray(ts.sameMap(members, parenthesizeMemberOfElementType));
17215
+ function hasJSDocPostfixQuestion(type) {
17216
+ if (ts.isJSDocNullableType(type))
17217
+ return type.postfix;
17218
+ if (ts.isNamedTupleMember(type))
17219
+ return hasJSDocPostfixQuestion(type.type);
17220
+ if (ts.isFunctionTypeNode(type) || ts.isConstructorTypeNode(type) || ts.isTypeOperatorNode(type))
17221
+ return hasJSDocPostfixQuestion(type.type);
17222
+ if (ts.isConditionalTypeNode(type))
17223
+ return hasJSDocPostfixQuestion(type.falseType);
17224
+ if (ts.isUnionTypeNode(type))
17225
+ return hasJSDocPostfixQuestion(ts.last(type.types));
17226
+ if (ts.isIntersectionTypeNode(type))
17227
+ return hasJSDocPostfixQuestion(ts.last(type.types));
17228
+ if (ts.isInferTypeNode(type))
17229
+ return !!type.typeParameter.constraint && hasJSDocPostfixQuestion(type.typeParameter.constraint);
17230
+ return false;
17231
+ }
17232
+ function parenthesizeTypeOfOptionalType(type) {
17233
+ if (hasJSDocPostfixQuestion(type))
17234
+ return factory.createParenthesizedType(type);
17235
+ return parenthesizeNonArrayTypeOfPostfixType(type);
17236
+ }
17237
+ function parenthesizeLeadingTypeArgument(node) {
17238
+ return ts.isFunctionOrConstructorTypeNode(node) && node.typeParameters ? factory.createParenthesizedType(node) : node;
17155
17239
  }
17156
17240
  function parenthesizeOrdinalTypeArgument(node, i) {
17157
- return i === 0 && ts.isFunctionOrConstructorTypeNode(node) && node.typeParameters ? factory.createParenthesizedType(node) : node;
17241
+ return i === 0 ? parenthesizeLeadingTypeArgument(node) : node;
17158
17242
  }
17159
17243
  function parenthesizeTypeArguments(typeArguments) {
17160
17244
  if (ts.some(typeArguments)) {
@@ -17180,11 +17264,20 @@ var ts;
17180
17264
  parenthesizeExpressionForDisallowedComma: ts.identity,
17181
17265
  parenthesizeExpressionOfExpressionStatement: ts.identity,
17182
17266
  parenthesizeConciseBodyOfArrowFunction: ts.identity,
17183
- parenthesizeMemberOfConditionalType: ts.identity,
17184
- parenthesizeMemberOfElementType: ts.identity,
17185
- parenthesizeElementTypeOfArrayType: ts.identity,
17186
- parenthesizeConstituentTypesOfUnionOrIntersectionType: function (nodes) { return ts.cast(nodes, ts.isNodeArray); },
17267
+ parenthesizeCheckTypeOfConditionalType: ts.identity,
17268
+ parenthesizeExtendsTypeOfConditionalType: ts.identity,
17269
+ parenthesizeConstituentTypesOfUnionType: function (nodes) { return ts.cast(nodes, ts.isNodeArray); },
17270
+ parenthesizeConstituentTypeOfUnionType: ts.identity,
17271
+ parenthesizeConstituentTypesOfIntersectionType: function (nodes) { return ts.cast(nodes, ts.isNodeArray); },
17272
+ parenthesizeConstituentTypeOfIntersectionType: ts.identity,
17273
+ parenthesizeOperandOfTypeOperator: ts.identity,
17274
+ parenthesizeOperandOfReadonlyTypeOperator: ts.identity,
17275
+ parenthesizeNonArrayTypeOfPostfixType: ts.identity,
17276
+ parenthesizeElementTypesOfTupleType: function (nodes) { return ts.cast(nodes, ts.isNodeArray); },
17277
+ parenthesizeElementTypeOfTupleType: ts.identity,
17278
+ parenthesizeTypeOfOptionalType: ts.identity,
17187
17279
  parenthesizeTypeArguments: function (nodes) { return nodes && ts.cast(nodes, ts.isNodeArray); },
17280
+ parenthesizeLeadingTypeArgument: ts.identity,
17188
17281
  };
17189
17282
  })(ts || (ts = {}));
17190
17283
  var ts;
@@ -17302,6 +17395,8 @@ var ts;
17302
17395
  var getJSDocPrimaryTypeCreateFunction = ts.memoizeOne(function (kind) { return function () { return createJSDocPrimaryTypeWorker(kind); }; });
17303
17396
  var getJSDocUnaryTypeCreateFunction = ts.memoizeOne(function (kind) { return function (type) { return createJSDocUnaryTypeWorker(kind, type); }; });
17304
17397
  var getJSDocUnaryTypeUpdateFunction = ts.memoizeOne(function (kind) { return function (node, type) { return updateJSDocUnaryTypeWorker(kind, node, type); }; });
17398
+ var getJSDocPrePostfixUnaryTypeCreateFunction = ts.memoizeOne(function (kind) { return function (type, postfix) { return createJSDocPrePostfixUnaryTypeWorker(kind, type, postfix); }; });
17399
+ var getJSDocPrePostfixUnaryTypeUpdateFunction = ts.memoizeOne(function (kind) { return function (node, type) { return updateJSDocPrePostfixUnaryTypeWorker(kind, node, type); }; });
17305
17400
  var getJSDocSimpleTagCreateFunction = ts.memoizeOne(function (kind) { return function (tagName, comment) { return createJSDocSimpleTagWorker(kind, tagName, comment); }; });
17306
17401
  var getJSDocSimpleTagUpdateFunction = ts.memoizeOne(function (kind) { return function (node, tagName, comment) { return updateJSDocSimpleTagWorker(kind, node, tagName, comment); }; });
17307
17402
  var getJSDocTypeLikeTagCreateFunction = ts.memoizeOne(function (kind) { return function (tagName, typeExpression, comment) { return createJSDocTypeLikeTagWorker(kind, tagName, typeExpression, comment); }; });
@@ -17309,6 +17404,8 @@ var ts;
17309
17404
  var factory = {
17310
17405
  get parenthesizer() { return parenthesizerRules(); },
17311
17406
  get converters() { return converters(); },
17407
+ baseFactory: baseFactory,
17408
+ flags: flags,
17312
17409
  createNodeArray: createNodeArray,
17313
17410
  createNumericLiteral: createNumericLiteral,
17314
17411
  createBigIntLiteral: createBigIntLiteral,
@@ -17583,10 +17680,10 @@ var ts;
17583
17680
  updateExternalModuleReference: updateExternalModuleReference,
17584
17681
  get createJSDocAllType() { return getJSDocPrimaryTypeCreateFunction(312); },
17585
17682
  get createJSDocUnknownType() { return getJSDocPrimaryTypeCreateFunction(313); },
17586
- get createJSDocNonNullableType() { return getJSDocUnaryTypeCreateFunction(315); },
17587
- get updateJSDocNonNullableType() { return getJSDocUnaryTypeUpdateFunction(315); },
17588
- get createJSDocNullableType() { return getJSDocUnaryTypeCreateFunction(314); },
17589
- get updateJSDocNullableType() { return getJSDocUnaryTypeUpdateFunction(314); },
17683
+ get createJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(315); },
17684
+ get updateJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(315); },
17685
+ get createJSDocNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(314); },
17686
+ get updateJSDocNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(314); },
17590
17687
  get createJSDocOptionalType() { return getJSDocUnaryTypeCreateFunction(316); },
17591
17688
  get updateJSDocOptionalType() { return getJSDocUnaryTypeUpdateFunction(316); },
17592
17689
  get createJSDocVariadicType() { return getJSDocUnaryTypeCreateFunction(318); },
@@ -18560,7 +18657,7 @@ var ts;
18560
18657
  }
18561
18658
  function createArrayTypeNode(elementType) {
18562
18659
  var node = createBaseNode(183);
18563
- node.elementType = parenthesizerRules().parenthesizeElementTypeOfArrayType(elementType);
18660
+ node.elementType = parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(elementType);
18564
18661
  node.transformFlags = 1;
18565
18662
  return node;
18566
18663
  }
@@ -18571,7 +18668,7 @@ var ts;
18571
18668
  }
18572
18669
  function createTupleTypeNode(elements) {
18573
18670
  var node = createBaseNode(184);
18574
- node.elements = createNodeArray(elements);
18671
+ node.elements = createNodeArray(parenthesizerRules().parenthesizeElementTypesOfTupleType(elements));
18575
18672
  node.transformFlags = 1;
18576
18673
  return node;
18577
18674
  }
@@ -18599,7 +18696,7 @@ var ts;
18599
18696
  }
18600
18697
  function createOptionalTypeNode(type) {
18601
18698
  var node = createBaseNode(185);
18602
- node.type = parenthesizerRules().parenthesizeElementTypeOfArrayType(type);
18699
+ node.type = parenthesizerRules().parenthesizeTypeOfOptionalType(type);
18603
18700
  node.transformFlags = 1;
18604
18701
  return node;
18605
18702
  }
@@ -18619,33 +18716,33 @@ var ts;
18619
18716
  ? update(createRestTypeNode(type), node)
18620
18717
  : node;
18621
18718
  }
18622
- function createUnionOrIntersectionTypeNode(kind, types) {
18719
+ function createUnionOrIntersectionTypeNode(kind, types, parenthesize) {
18623
18720
  var node = createBaseNode(kind);
18624
- node.types = parenthesizerRules().parenthesizeConstituentTypesOfUnionOrIntersectionType(types);
18721
+ node.types = factory.createNodeArray(parenthesize(types));
18625
18722
  node.transformFlags = 1;
18626
18723
  return node;
18627
18724
  }
18628
- function updateUnionOrIntersectionTypeNode(node, types) {
18725
+ function updateUnionOrIntersectionTypeNode(node, types, parenthesize) {
18629
18726
  return node.types !== types
18630
- ? update(createUnionOrIntersectionTypeNode(node.kind, types), node)
18727
+ ? update(createUnionOrIntersectionTypeNode(node.kind, types, parenthesize), node)
18631
18728
  : node;
18632
18729
  }
18633
18730
  function createUnionTypeNode(types) {
18634
- return createUnionOrIntersectionTypeNode(187, types);
18731
+ return createUnionOrIntersectionTypeNode(187, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType);
18635
18732
  }
18636
18733
  function updateUnionTypeNode(node, types) {
18637
- return updateUnionOrIntersectionTypeNode(node, types);
18734
+ return updateUnionOrIntersectionTypeNode(node, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType);
18638
18735
  }
18639
18736
  function createIntersectionTypeNode(types) {
18640
- return createUnionOrIntersectionTypeNode(188, types);
18737
+ return createUnionOrIntersectionTypeNode(188, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType);
18641
18738
  }
18642
18739
  function updateIntersectionTypeNode(node, types) {
18643
- return updateUnionOrIntersectionTypeNode(node, types);
18740
+ return updateUnionOrIntersectionTypeNode(node, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType);
18644
18741
  }
18645
18742
  function createConditionalTypeNode(checkType, extendsType, trueType, falseType) {
18646
18743
  var node = createBaseNode(189);
18647
- node.checkType = parenthesizerRules().parenthesizeMemberOfConditionalType(checkType);
18648
- node.extendsType = parenthesizerRules().parenthesizeMemberOfConditionalType(extendsType);
18744
+ node.checkType = parenthesizerRules().parenthesizeCheckTypeOfConditionalType(checkType);
18745
+ node.extendsType = parenthesizerRules().parenthesizeExtendsTypeOfConditionalType(extendsType);
18649
18746
  node.trueType = trueType;
18650
18747
  node.falseType = falseType;
18651
18748
  node.transformFlags = 1;
@@ -18731,7 +18828,9 @@ var ts;
18731
18828
  function createTypeOperatorNode(operator, type) {
18732
18829
  var node = createBaseNode(193);
18733
18830
  node.operator = operator;
18734
- node.type = parenthesizerRules().parenthesizeMemberOfElementType(type);
18831
+ node.type = operator === 145 ?
18832
+ parenthesizerRules().parenthesizeOperandOfReadonlyTypeOperator(type) :
18833
+ parenthesizerRules().parenthesizeOperandOfTypeOperator(type);
18735
18834
  node.transformFlags = 1;
18736
18835
  return node;
18737
18836
  }
@@ -18742,7 +18841,7 @@ var ts;
18742
18841
  }
18743
18842
  function createIndexedAccessTypeNode(objectType, indexType) {
18744
18843
  var node = createBaseNode(194);
18745
- node.objectType = parenthesizerRules().parenthesizeMemberOfElementType(objectType);
18844
+ node.objectType = parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(objectType);
18746
18845
  node.indexType = indexType;
18747
18846
  node.transformFlags = 1;
18748
18847
  return node;
@@ -20253,11 +20352,22 @@ var ts;
20253
20352
  function createJSDocPrimaryTypeWorker(kind) {
20254
20353
  return createBaseNode(kind);
20255
20354
  }
20355
+ function createJSDocPrePostfixUnaryTypeWorker(kind, type, postfix) {
20356
+ if (postfix === void 0) { postfix = false; }
20357
+ var node = createJSDocUnaryTypeWorker(kind, postfix ? type && parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(type) : type);
20358
+ node.postfix = postfix;
20359
+ return node;
20360
+ }
20256
20361
  function createJSDocUnaryTypeWorker(kind, type) {
20257
20362
  var node = createBaseNode(kind);
20258
20363
  node.type = type;
20259
20364
  return node;
20260
20365
  }
20366
+ function updateJSDocPrePostfixUnaryTypeWorker(kind, node, type) {
20367
+ return node.type !== type
20368
+ ? update(createJSDocPrePostfixUnaryTypeWorker(kind, type, node.postfix), node)
20369
+ : node;
20370
+ }
20261
20371
  function updateJSDocUnaryTypeWorker(kind, node, type) {
20262
20372
  return node.type !== type
20263
20373
  ? update(createJSDocUnaryTypeWorker(kind, type), node)
@@ -24325,7 +24435,7 @@ var ts;
24325
24435
  || ts.isExportDeclaration(node) ? node : undefined;
24326
24436
  }
24327
24437
  function getImportMetaIfNecessary(sourceFile) {
24328
- return sourceFile.flags & 2097152 ?
24438
+ return sourceFile.flags & 4194304 ?
24329
24439
  walkTreeForImportMeta(sourceFile) :
24330
24440
  undefined;
24331
24441
  }
@@ -24934,7 +25044,7 @@ var ts;
24934
25044
  function updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks) {
24935
25045
  if (aggressiveChecks === void 0) { aggressiveChecks = false; }
24936
25046
  var newSourceFile = IncrementalParser.updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks);
24937
- newSourceFile.flags |= (sourceFile.flags & 3145728);
25047
+ newSourceFile.flags |= (sourceFile.flags & 6291456);
24938
25048
  return newSourceFile;
24939
25049
  }
24940
25050
  ts.updateSourceFile = updateSourceFile;
@@ -25121,10 +25231,10 @@ var ts;
25121
25231
  switch (scriptKind) {
25122
25232
  case 1:
25123
25233
  case 2:
25124
- contextFlags = 131072;
25234
+ contextFlags = 262144;
25125
25235
  break;
25126
25236
  case 6:
25127
- contextFlags = 131072 | 33554432;
25237
+ contextFlags = 262144 | 67108864;
25128
25238
  break;
25129
25239
  default:
25130
25240
  contextFlags = 0;
@@ -25156,7 +25266,7 @@ var ts;
25156
25266
  function parseSourceFileWorker(languageVersion, setParentNodes, scriptKind, setExternalModuleIndicator) {
25157
25267
  var isDeclarationFile = isDeclarationFileName(fileName);
25158
25268
  if (isDeclarationFile) {
25159
- contextFlags |= 8388608;
25269
+ contextFlags |= 16777216;
25160
25270
  }
25161
25271
  sourceFlags = contextFlags;
25162
25272
  nextToken();
@@ -25193,7 +25303,7 @@ var ts;
25193
25303
  node.jsDoc = jsDoc;
25194
25304
  if (hasDeprecatedTag) {
25195
25305
  hasDeprecatedTag = false;
25196
- node.flags |= 134217728;
25306
+ node.flags |= 268435456;
25197
25307
  }
25198
25308
  return node;
25199
25309
  }
@@ -25355,6 +25465,12 @@ var ts;
25355
25465
  function disallowInAnd(func) {
25356
25466
  return doInsideOfContext(4096, func);
25357
25467
  }
25468
+ function allowConditionalTypesAnd(func) {
25469
+ return doOutsideOfContext(65536, func);
25470
+ }
25471
+ function disallowConditionalTypesAnd(func) {
25472
+ return doInsideOfContext(65536, func);
25473
+ }
25358
25474
  function doInYieldContext(func) {
25359
25475
  return doInsideOfContext(8192, func);
25360
25476
  }
@@ -25382,6 +25498,9 @@ var ts;
25382
25498
  function inDisallowInContext() {
25383
25499
  return inContext(4096);
25384
25500
  }
25501
+ function inDisallowConditionalTypesContext() {
25502
+ return inContext(65536);
25503
+ }
25385
25504
  function inDecoratorContext() {
25386
25505
  return inContext(16384);
25387
25506
  }
@@ -25700,7 +25819,7 @@ var ts;
25700
25819
  }
25701
25820
  if (parseErrorBeforeNextFinishedNode) {
25702
25821
  parseErrorBeforeNextFinishedNode = false;
25703
- node.flags |= 65536;
25822
+ node.flags |= 131072;
25704
25823
  }
25705
25824
  return node;
25706
25825
  }
@@ -26078,7 +26197,7 @@ var ts;
26078
26197
  if (ts.nodeIsMissing(node) || node.intersectsChange || ts.containsParseError(node)) {
26079
26198
  return undefined;
26080
26199
  }
26081
- var nodeContextFlags = node.flags & 25358336;
26200
+ var nodeContextFlags = node.flags & 50720768;
26082
26201
  if (nodeContextFlags !== contextFlags) {
26083
26202
  return undefined;
26084
26203
  }
@@ -26284,7 +26403,11 @@ var ts;
26284
26403
  while (true) {
26285
26404
  if (isListElement(kind, false)) {
26286
26405
  var startPos = scanner.getStartPos();
26287
- list.push(parseListElement(kind, parseElement));
26406
+ var result = parseListElement(kind, parseElement);
26407
+ if (!result) {
26408
+ return undefined;
26409
+ }
26410
+ list.push(result);
26288
26411
  commaStart = scanner.getTokenPos();
26289
26412
  if (parseOptional(27)) {
26290
26413
  continue;
@@ -26487,7 +26610,7 @@ var ts;
26487
26610
  function parseJSDocNonNullableType() {
26488
26611
  var pos = getNodePos();
26489
26612
  nextToken();
26490
- return finishNode(factory.createJSDocNonNullableType(parseNonArrayType()), pos);
26613
+ return finishNode(factory.createJSDocNonNullableType(parseNonArrayType(), false), pos);
26491
26614
  }
26492
26615
  function parseJSDocUnknownOrNullableType() {
26493
26616
  var pos = getNodePos();
@@ -26501,7 +26624,7 @@ var ts;
26501
26624
  return finishNode(factory.createJSDocUnknownType(), pos);
26502
26625
  }
26503
26626
  else {
26504
- return finishNode(factory.createJSDocNullableType(parseType()), pos);
26627
+ return finishNode(factory.createJSDocNullableType(parseType(), false), pos);
26505
26628
  }
26506
26629
  }
26507
26630
  function parseJSDocFunctionType() {
@@ -26600,13 +26723,17 @@ var ts;
26600
26723
  }
26601
26724
  return name;
26602
26725
  }
26603
- function parseParameterInOuterAwaitContext() {
26604
- return parseParameterWorker(true);
26726
+ function isParameterNameStart() {
26727
+ return isBindingIdentifier() || token() === 22 || token() === 18;
26605
26728
  }
26606
- function parseParameter() {
26607
- return parseParameterWorker(false);
26729
+ function parseParameter(inOuterAwaitContext) {
26730
+ return parseParameterWorker(inOuterAwaitContext);
26608
26731
  }
26609
- function parseParameterWorker(inOuterAwaitContext) {
26732
+ function parseParameterForSpeculation(inOuterAwaitContext) {
26733
+ return parseParameterWorker(inOuterAwaitContext, false);
26734
+ }
26735
+ function parseParameterWorker(inOuterAwaitContext, allowAmbiguity) {
26736
+ if (allowAmbiguity === void 0) { allowAmbiguity = true; }
26610
26737
  var pos = getNodePos();
26611
26738
  var hasJSDoc = hasPrecedingJSDocComment();
26612
26739
  var decorators = inOuterAwaitContext ? doInAwaitContext(parseDecorators) : parseDecorators();
@@ -26620,13 +26747,17 @@ var ts;
26620
26747
  var savedTopLevel = topLevel;
26621
26748
  topLevel = false;
26622
26749
  var modifiers = parseModifiers();
26623
- var node = withJSDoc(finishNode(factory.createParameterDeclaration(decorators, modifiers, parseOptionalToken(25), parseNameOfParameter(modifiers), parseOptionalToken(57), parseTypeAnnotation(), parseInitializer()), pos), hasJSDoc);
26750
+ var dotDotDotToken = parseOptionalToken(25);
26751
+ if (!allowAmbiguity && !isParameterNameStart()) {
26752
+ return undefined;
26753
+ }
26754
+ var node = withJSDoc(finishNode(factory.createParameterDeclaration(decorators, modifiers, dotDotDotToken, parseNameOfParameter(modifiers), parseOptionalToken(57), parseTypeAnnotation(), parseInitializer()), pos), hasJSDoc);
26624
26755
  topLevel = savedTopLevel;
26625
26756
  return node;
26626
26757
  }
26627
26758
  function parseReturnType(returnToken, isType) {
26628
26759
  if (shouldParseReturnType(returnToken, isType)) {
26629
- return parseTypeOrTypePredicate();
26760
+ return allowConditionalTypesAnd(parseTypeOrTypePredicate);
26630
26761
  }
26631
26762
  }
26632
26763
  function shouldParseReturnType(returnToken, isType) {
@@ -26644,14 +26775,14 @@ var ts;
26644
26775
  }
26645
26776
  return false;
26646
26777
  }
26647
- function parseParametersWorker(flags) {
26778
+ function parseParametersWorker(flags, allowAmbiguity) {
26648
26779
  var savedYieldContext = inYieldContext();
26649
26780
  var savedAwaitContext = inAwaitContext();
26650
26781
  setYieldContext(!!(flags & 1));
26651
26782
  setAwaitContext(!!(flags & 2));
26652
26783
  var parameters = flags & 32 ?
26653
26784
  parseDelimitedList(17, parseJSDocParameter) :
26654
- parseDelimitedList(16, savedAwaitContext ? parseParameterInOuterAwaitContext : parseParameter);
26785
+ parseDelimitedList(16, function () { return allowAmbiguity ? parseParameter(savedAwaitContext) : parseParameterForSpeculation(savedAwaitContext); });
26655
26786
  setYieldContext(savedYieldContext);
26656
26787
  setAwaitContext(savedAwaitContext);
26657
26788
  return parameters;
@@ -26660,7 +26791,7 @@ var ts;
26660
26791
  if (!parseExpected(20)) {
26661
26792
  return createMissingList();
26662
26793
  }
26663
- var parameters = parseParametersWorker(flags);
26794
+ var parameters = parseParametersWorker(flags, true);
26664
26795
  parseExpected(21);
26665
26796
  return parameters;
26666
26797
  }
@@ -26715,7 +26846,7 @@ var ts;
26715
26846
  return token() === 58 || token() === 27 || token() === 23;
26716
26847
  }
26717
26848
  function parseIndexSignatureDeclaration(pos, hasJSDoc, decorators, modifiers) {
26718
- var parameters = parseBracketedList(16, parseParameter, 22, 23);
26849
+ var parameters = parseBracketedList(16, function () { return parseParameter(false); }, 22, 23);
26719
26850
  var type = parseTypeAnnotation();
26720
26851
  parseTypeMemberSemicolon();
26721
26852
  var node = factory.createIndexSignature(decorators, modifiers, parameters, type);
@@ -26976,7 +27107,7 @@ var ts;
26976
27107
  return finishNode(factory.createImportTypeAssertionContainer(clause, multiLine), pos);
26977
27108
  }
26978
27109
  function parseImportType() {
26979
- sourceFlags |= 1048576;
27110
+ sourceFlags |= 2097152;
26980
27111
  var pos = getNodePos();
26981
27112
  var isTypeOf = parseOptional(112);
26982
27113
  parseExpected(100);
@@ -27119,14 +27250,14 @@ var ts;
27119
27250
  switch (token()) {
27120
27251
  case 53:
27121
27252
  nextToken();
27122
- type = finishNode(factory.createJSDocNonNullableType(type), pos);
27253
+ type = finishNode(factory.createJSDocNonNullableType(type, true), pos);
27123
27254
  break;
27124
27255
  case 57:
27125
27256
  if (lookAhead(nextTokenIsStartOfType)) {
27126
27257
  return type;
27127
27258
  }
27128
27259
  nextToken();
27129
- type = finishNode(factory.createJSDocNullableType(type), pos);
27260
+ type = finishNode(factory.createJSDocNullableType(type, true), pos);
27130
27261
  break;
27131
27262
  case 22:
27132
27263
  parseExpected(22);
@@ -27151,9 +27282,20 @@ var ts;
27151
27282
  parseExpected(operator);
27152
27283
  return finishNode(factory.createTypeOperatorNode(operator, parseTypeOperatorOrHigher()), pos);
27153
27284
  }
27285
+ function tryParseConstraintOfInferType() {
27286
+ if (parseOptional(94)) {
27287
+ var constraint = disallowConditionalTypesAnd(parseType);
27288
+ if (inDisallowConditionalTypesContext() || token() !== 57) {
27289
+ return constraint;
27290
+ }
27291
+ }
27292
+ }
27154
27293
  function parseTypeParameterOfInferType() {
27155
27294
  var pos = getNodePos();
27156
- return finishNode(factory.createTypeParameterDeclaration(undefined, parseIdentifier(), undefined, undefined), pos);
27295
+ var name = parseIdentifier();
27296
+ var constraint = tryParse(tryParseConstraintOfInferType);
27297
+ var node = factory.createTypeParameterDeclaration(undefined, name, constraint);
27298
+ return finishNode(node, pos);
27157
27299
  }
27158
27300
  function parseInferType() {
27159
27301
  var pos = getNodePos();
@@ -27170,7 +27312,7 @@ var ts;
27170
27312
  case 137:
27171
27313
  return parseInferType();
27172
27314
  }
27173
- return parsePostfixTypeOrHigher();
27315
+ return allowConditionalTypesAnd(parsePostfixTypeOrHigher);
27174
27316
  }
27175
27317
  function parseFunctionOrConstructorTypeToError(isInUnionType) {
27176
27318
  if (isStartOfFunctionTypeOrConstructorType()) {
@@ -27286,20 +27428,20 @@ var ts;
27286
27428
  return finishNode(factory.createTypePredicateNode(assertsModifier, parameterName, type), pos);
27287
27429
  }
27288
27430
  function parseType() {
27289
- return doOutsideOfContext(40960, parseTypeWorker);
27290
- }
27291
- function parseTypeWorker(noConditionalTypes) {
27431
+ if (contextFlags & 40960) {
27432
+ return doOutsideOfContext(40960, parseType);
27433
+ }
27292
27434
  if (isStartOfFunctionTypeOrConstructorType()) {
27293
27435
  return parseFunctionOrConstructorType();
27294
27436
  }
27295
27437
  var pos = getNodePos();
27296
27438
  var type = parseUnionTypeOrHigher();
27297
- if (!noConditionalTypes && !scanner.hasPrecedingLineBreak() && parseOptional(94)) {
27298
- var extendsType = parseTypeWorker(true);
27439
+ if (!inDisallowConditionalTypesContext() && !scanner.hasPrecedingLineBreak() && parseOptional(94)) {
27440
+ var extendsType = disallowConditionalTypesAnd(parseType);
27299
27441
  parseExpected(57);
27300
- var trueType = parseTypeWorker();
27442
+ var trueType = allowConditionalTypesAnd(parseType);
27301
27443
  parseExpected(58);
27302
- var falseType = parseTypeWorker();
27444
+ var falseType = allowConditionalTypesAnd(parseType);
27303
27445
  return finishNode(factory.createConditionalTypeNode(type, extendsType, trueType, falseType), pos);
27304
27446
  }
27305
27447
  return type;
@@ -27589,7 +27731,16 @@ var ts;
27589
27731
  parameters = createMissingList();
27590
27732
  }
27591
27733
  else {
27592
- parameters = parseParametersWorker(isAsync);
27734
+ if (!allowAmbiguity) {
27735
+ var maybeParameters = parseParametersWorker(isAsync, allowAmbiguity);
27736
+ if (!maybeParameters) {
27737
+ return undefined;
27738
+ }
27739
+ parameters = maybeParameters;
27740
+ }
27741
+ else {
27742
+ parameters = parseParametersWorker(isAsync, allowAmbiguity);
27743
+ }
27593
27744
  if (!parseExpected(21) && !allowAmbiguity) {
27594
27745
  return undefined;
27595
27746
  }
@@ -27809,14 +27960,14 @@ var ts;
27809
27960
  var expression;
27810
27961
  if (token() === 100) {
27811
27962
  if (lookAhead(nextTokenIsOpenParenOrLessThan)) {
27812
- sourceFlags |= 1048576;
27963
+ sourceFlags |= 2097152;
27813
27964
  expression = parseTokenNode();
27814
27965
  }
27815
27966
  else if (lookAhead(nextTokenIsDot)) {
27816
27967
  nextToken();
27817
27968
  nextToken();
27818
27969
  expression = finishNode(factory.createMetaProperty(100, parseIdentifierName()), pos);
27819
- sourceFlags |= 2097152;
27970
+ sourceFlags |= 4194304;
27820
27971
  }
27821
27972
  else {
27822
27973
  expression = parseMemberExpressionOrHigher();
@@ -27960,7 +28111,7 @@ var ts;
27960
28111
  return finishNode(factory.createJsxOpeningFragment(), pos);
27961
28112
  }
27962
28113
  var tagName = parseJsxElementName();
27963
- var typeArguments = (contextFlags & 131072) === 0 ? tryParseTypeArguments() : undefined;
28114
+ var typeArguments = (contextFlags & 262144) === 0 ? tryParseTypeArguments() : undefined;
27964
28115
  var attributes = parseJsxAttributes();
27965
28116
  var node;
27966
28117
  if (token() === 31) {
@@ -28218,7 +28369,7 @@ var ts;
28218
28369
  return result;
28219
28370
  }
28220
28371
  function parseTypeArgumentsInExpression() {
28221
- if ((contextFlags & 131072) !== 0) {
28372
+ if ((contextFlags & 262144) !== 0) {
28222
28373
  return undefined;
28223
28374
  }
28224
28375
  if (reScanLessThanToken() !== 29) {
@@ -28577,7 +28728,7 @@ var ts;
28577
28728
  var openParenParsed = parseExpected(20);
28578
28729
  var expression = allowInAnd(parseExpression);
28579
28730
  parseExpectedMatchingBrackets(20, 21, openParenParsed, openParenPosition);
28580
- var statement = doInsideOfContext(16777216, parseStatement);
28731
+ var statement = doInsideOfContext(33554432, parseStatement);
28581
28732
  return withJSDoc(finishNode(factory.createWithStatement(expression, statement), pos), hasJSDoc);
28582
28733
  }
28583
28734
  function parseCaseClause() {
@@ -28899,16 +29050,16 @@ var ts;
28899
29050
  if (isAmbient) {
28900
29051
  for (var _i = 0, _a = modifiers; _i < _a.length; _i++) {
28901
29052
  var m = _a[_i];
28902
- m.flags |= 8388608;
29053
+ m.flags |= 16777216;
28903
29054
  }
28904
- return doInsideOfContext(8388608, function () { return parseDeclarationWorker(pos, hasJSDoc, decorators, modifiers); });
29055
+ return doInsideOfContext(16777216, function () { return parseDeclarationWorker(pos, hasJSDoc, decorators, modifiers); });
28905
29056
  }
28906
29057
  else {
28907
29058
  return parseDeclarationWorker(pos, hasJSDoc, decorators, modifiers);
28908
29059
  }
28909
29060
  }
28910
29061
  function tryReuseAmbientDeclaration() {
28911
- return doInsideOfContext(8388608, function () {
29062
+ return doInsideOfContext(16777216, function () {
28912
29063
  var node = currentNode(parsingContext);
28913
29064
  if (node) {
28914
29065
  return consumeNode(node);
@@ -29324,9 +29475,9 @@ var ts;
29324
29475
  if (isAmbient) {
29325
29476
  for (var _i = 0, _a = modifiers; _i < _a.length; _i++) {
29326
29477
  var m = _a[_i];
29327
- m.flags |= 8388608;
29478
+ m.flags |= 16777216;
29328
29479
  }
29329
- return doInsideOfContext(8388608, function () { return parsePropertyOrMethodDeclaration(pos, hasJSDoc, decorators, modifiers); });
29480
+ return doInsideOfContext(16777216, function () { return parsePropertyOrMethodDeclaration(pos, hasJSDoc, decorators, modifiers); });
29330
29481
  }
29331
29482
  else {
29332
29483
  return parsePropertyOrMethodDeclaration(pos, hasJSDoc, decorators, modifiers);
@@ -29784,7 +29935,7 @@ var ts;
29784
29935
  function parseJSDocTypeExpression(mayOmitBraces) {
29785
29936
  var pos = getNodePos();
29786
29937
  var hasBrace = (mayOmitBraces ? parseOptional : parseExpected)(18);
29787
- var type = doInsideOfContext(4194304, parseJSDocType);
29938
+ var type = doInsideOfContext(8388608, parseJSDocType);
29788
29939
  if (!mayOmitBraces || hasBrace) {
29789
29940
  parseExpectedJSDoc(19);
29790
29941
  }
@@ -29813,7 +29964,7 @@ var ts;
29813
29964
  JSDocParser.parseJSDocNameReference = parseJSDocNameReference;
29814
29965
  function parseIsolatedJSDocComment(content, start, length) {
29815
29966
  initializeState("", content, 99, undefined, 1);
29816
- var jsDoc = doInsideOfContext(4194304, function () { return parseJSDocCommentWorker(start, length); });
29967
+ var jsDoc = doInsideOfContext(8388608, function () { return parseJSDocCommentWorker(start, length); });
29817
29968
  var sourceFile = { languageVariant: 0, text: content };
29818
29969
  var diagnostics = ts.attachFileToDiagnostics(parseDiagnostics, sourceFile);
29819
29970
  clearState();
@@ -29824,9 +29975,9 @@ var ts;
29824
29975
  var saveToken = currentToken;
29825
29976
  var saveParseDiagnosticsLength = parseDiagnostics.length;
29826
29977
  var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode;
29827
- var comment = doInsideOfContext(4194304, function () { return parseJSDocCommentWorker(start, length); });
29978
+ var comment = doInsideOfContext(8388608, function () { return parseJSDocCommentWorker(start, length); });
29828
29979
  ts.setParent(comment, parent);
29829
- if (contextFlags & 131072) {
29980
+ if (contextFlags & 262144) {
29830
29981
  if (!jsDocDiagnostics) {
29831
29982
  jsDocDiagnostics = [];
29832
29983
  }
@@ -30595,7 +30746,7 @@ var ts;
30595
30746
  if (isBracketed) {
30596
30747
  skipWhitespace();
30597
30748
  parseExpected(63);
30598
- defaultType = doInsideOfContext(4194304, parseJSDocType);
30749
+ defaultType = doInsideOfContext(8388608, parseJSDocType);
30599
30750
  parseExpected(23);
30600
30751
  }
30601
30752
  if (ts.nodeIsMissing(name)) {
@@ -37342,6 +37493,7 @@ var ts;
37342
37493
  case 261:
37343
37494
  case 259:
37344
37495
  case 195:
37496
+ case 176:
37345
37497
  return 1 | 32;
37346
37498
  case 305:
37347
37499
  return 1 | 4 | 32;
@@ -37359,7 +37511,6 @@ var ts;
37359
37511
  case 317:
37360
37512
  case 179:
37361
37513
  case 175:
37362
- case 176:
37363
37514
  case 180:
37364
37515
  case 170:
37365
37516
  return 1 | 4 | 32 | 8;
@@ -37442,7 +37593,7 @@ var ts;
37442
37593
  return !!body && body.statements.some(function (s) { return ts.isExportDeclaration(s) || ts.isExportAssignment(s); });
37443
37594
  }
37444
37595
  function setExportContextFlag(node) {
37445
- if (node.flags & 8388608 && !hasExportDeclarations(node)) {
37596
+ if (node.flags & 16777216 && !hasExportDeclarations(node)) {
37446
37597
  node.flags |= 64;
37447
37598
  }
37448
37599
  else {
@@ -37617,8 +37768,8 @@ var ts;
37617
37768
  }
37618
37769
  function checkContextualIdentifier(node) {
37619
37770
  if (!file.parseDiagnostics.length &&
37771
+ !(node.flags & 16777216) &&
37620
37772
  !(node.flags & 8388608) &&
37621
- !(node.flags & 4194304) &&
37622
37773
  !ts.isIdentifierName(node)) {
37623
37774
  if (inStrictMode &&
37624
37775
  node.originalKeywordKind >= 117 &&
@@ -38493,7 +38644,7 @@ var ts;
38493
38644
  if (node.kind === 340 && container.kind !== 323) {
38494
38645
  return;
38495
38646
  }
38496
- if (inStrictMode && !(node.flags & 8388608)) {
38647
+ if (inStrictMode && !(node.flags & 16777216)) {
38497
38648
  checkStrictModeEvalOrArguments(node, node.name);
38498
38649
  }
38499
38650
  if (ts.isBindingPattern(node.name)) {
@@ -38508,7 +38659,7 @@ var ts;
38508
38659
  }
38509
38660
  }
38510
38661
  function bindFunctionDeclaration(node) {
38511
- if (!file.isDeclarationFile && !(node.flags & 8388608)) {
38662
+ if (!file.isDeclarationFile && !(node.flags & 16777216)) {
38512
38663
  if (ts.isAsyncFunction(node)) {
38513
38664
  emitFlags |= 2048;
38514
38665
  }
@@ -38523,7 +38674,7 @@ var ts;
38523
38674
  }
38524
38675
  }
38525
38676
  function bindFunctionExpression(node) {
38526
- if (!file.isDeclarationFile && !(node.flags & 8388608)) {
38677
+ if (!file.isDeclarationFile && !(node.flags & 16777216)) {
38527
38678
  if (ts.isAsyncFunction(node)) {
38528
38679
  emitFlags |= 2048;
38529
38680
  }
@@ -38536,7 +38687,7 @@ var ts;
38536
38687
  return bindAnonymousDeclaration(node, 16, bindingName);
38537
38688
  }
38538
38689
  function bindPropertyOrMethodOrAccessor(node, symbolFlags, symbolExcludes) {
38539
- if (!file.isDeclarationFile && !(node.flags & 8388608) && ts.isAsyncFunction(node)) {
38690
+ if (!file.isDeclarationFile && !(node.flags & 16777216) && ts.isAsyncFunction(node)) {
38540
38691
  emitFlags |= 2048;
38541
38692
  }
38542
38693
  if (currentFlow && ts.isObjectLiteralOrClassExpressionMethodOrAccessor(node)) {
@@ -38595,7 +38746,7 @@ var ts;
38595
38746
  currentFlow = reportedUnreachableFlow;
38596
38747
  if (!options.allowUnreachableCode) {
38597
38748
  var isError_1 = ts.unreachableCodeIsError(options) &&
38598
- !(node.flags & 8388608) &&
38749
+ !(node.flags & 16777216) &&
38599
38750
  (!ts.isVariableStatement(node) ||
38600
38751
  !!(ts.getCombinedNodeFlags(node.declarationList) & 3) ||
38601
38752
  node.declarationList.declarations.some(function (d) { return !!d.initializer; }));
@@ -39243,7 +39394,7 @@ var ts;
39243
39394
  ts.Debug.assert(!!(getNodeLinks(file).flags & 1));
39244
39395
  diagnostics = ts.addRange(diagnostics, suggestionDiagnostics.getDiagnostics(file.fileName));
39245
39396
  checkUnusedIdentifiers(getPotentiallyUnusedIdentifiers(file), function (containingNode, kind, diag) {
39246
- if (!ts.containsParseError(containingNode) && !unusedIsError(kind, !!(containingNode.flags & 8388608))) {
39397
+ if (!ts.containsParseError(containingNode) && !unusedIsError(kind, !!(containingNode.flags & 16777216))) {
39247
39398
  (diagnostics || (diagnostics = [])).push(__assign(__assign({}, diag), { category: ts.DiagnosticCategory.Suggestion }));
39248
39399
  }
39249
39400
  });
@@ -39674,7 +39825,7 @@ var ts;
39674
39825
  return diagnostic;
39675
39826
  }
39676
39827
  function isDeprecatedSymbol(symbol) {
39677
- return !!(getDeclarationNodeFlagsFromSymbol(symbol) & 134217728);
39828
+ return !!(getDeclarationNodeFlagsFromSymbol(symbol) & 268435456);
39678
39829
  }
39679
39830
  function addDeprecatedSuggestion(location, declarations, deprecatedEntity) {
39680
39831
  var diagnostic = ts.createDiagnosticForNode(location, ts.Diagnostics._0_is_deprecated, deprecatedEntity);
@@ -39885,7 +40036,7 @@ var ts;
39885
40036
  mergeSymbolTable(globals, moduleAugmentation.symbol.exports);
39886
40037
  }
39887
40038
  else {
39888
- var moduleNotFoundError = !(moduleName.parent.parent.flags & 8388608)
40039
+ var moduleNotFoundError = !(moduleName.parent.parent.flags & 16777216)
39889
40040
  ? ts.Diagnostics.Invalid_module_name_in_augmentation_module_0_cannot_be_found
39890
40041
  : undefined;
39891
40042
  var mainModule_1 = resolveExternalModuleNameWorker(moduleName, moduleName, moduleNotFoundError, true);
@@ -39981,7 +40132,7 @@ var ts;
39981
40132
  if ((moduleKind && (declarationFile.externalModuleIndicator || useFile.externalModuleIndicator)) ||
39982
40133
  (!ts.outFile(compilerOptions)) ||
39983
40134
  isInTypeQuery(usage) ||
39984
- declaration.flags & 8388608) {
40135
+ declaration.flags & 16777216) {
39985
40136
  return true;
39986
40137
  }
39987
40138
  if (isUsedInFunctionOrInstanceProperty(usage, declaration)) {
@@ -40021,7 +40172,7 @@ var ts;
40021
40172
  if (usage.kind === 271 && usage.isExportEquals) {
40022
40173
  return true;
40023
40174
  }
40024
- if (!!(usage.flags & 4194304) || isInTypeQuery(usage) || usageInTypeDeclaration()) {
40175
+ if (!!(usage.flags & 8388608) || isInTypeQuery(usage) || usageInTypeDeclaration()) {
40025
40176
  return true;
40026
40177
  }
40027
40178
  if (isUsedInFunctionOrInstanceProperty(usage, declaration)) {
@@ -40244,7 +40395,7 @@ var ts;
40244
40395
  isInExternalModule = true;
40245
40396
  case 261:
40246
40397
  var moduleExports = ((_a = getSymbolOfNode(location)) === null || _a === void 0 ? void 0 : _a.exports) || emptySymbols;
40247
- if (location.kind === 305 || (ts.isModuleDeclaration(location) && location.flags & 8388608 && !ts.isGlobalScopeAugmentation(location))) {
40398
+ if (location.kind === 305 || (ts.isModuleDeclaration(location) && location.flags & 16777216 && !ts.isGlobalScopeAugmentation(location))) {
40248
40399
  if (result = moduleExports.get("default")) {
40249
40400
  var localSymbol = ts.getLocalSymbolForExportDefault(result);
40250
40401
  if (localSymbol && (result.flags & meaning) && localSymbol.escapedName === name) {
@@ -40486,7 +40637,7 @@ var ts;
40486
40637
  checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation);
40487
40638
  }
40488
40639
  }
40489
- if (result && isInExternalModule && (meaning & 111551) === 111551 && !(originalLocation.flags & 4194304)) {
40640
+ if (result && isInExternalModule && (meaning & 111551) === 111551 && !(originalLocation.flags & 8388608)) {
40490
40641
  var merged = getMergedSymbol(result);
40491
40642
  if (ts.length(merged.declarations) && ts.every(merged.declarations, function (d) { return ts.isNamespaceExportDeclaration(d) || ts.isSourceFile(d) && !!d.symbol.globalExports; })) {
40492
40643
  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));
@@ -40726,7 +40877,7 @@ var ts;
40726
40877
  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); });
40727
40878
  if (declaration === undefined)
40728
40879
  return ts.Debug.fail("checkResolvedBlockScopedVariable could not find block-scoped declaration");
40729
- if (!(declaration.flags & 8388608) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) {
40880
+ if (!(declaration.flags & 16777216) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) {
40730
40881
  var diagnosticMessage = void 0;
40731
40882
  var declarationName = ts.declarationNameToString(ts.getNameOfDeclaration(declaration));
40732
40883
  if (result.flags & 2) {
@@ -41180,27 +41331,27 @@ var ts;
41180
41331
  function resolveAlias(symbol) {
41181
41332
  ts.Debug.assert((symbol.flags & 2097152) !== 0, "Should only get Alias here.");
41182
41333
  var links = getSymbolLinks(symbol);
41183
- if (!links.target) {
41184
- links.target = resolvingSymbol;
41334
+ if (!links.aliasTarget) {
41335
+ links.aliasTarget = resolvingSymbol;
41185
41336
  var node = getDeclarationOfAliasSymbol(symbol);
41186
41337
  if (!node)
41187
41338
  return ts.Debug.fail();
41188
41339
  var target = getTargetOfAliasDeclaration(node);
41189
- if (links.target === resolvingSymbol) {
41190
- links.target = target || unknownSymbol;
41340
+ if (links.aliasTarget === resolvingSymbol) {
41341
+ links.aliasTarget = target || unknownSymbol;
41191
41342
  }
41192
41343
  else {
41193
41344
  error(node, ts.Diagnostics.Circular_definition_of_import_alias_0, symbolToString(symbol));
41194
41345
  }
41195
41346
  }
41196
- else if (links.target === resolvingSymbol) {
41197
- links.target = unknownSymbol;
41347
+ else if (links.aliasTarget === resolvingSymbol) {
41348
+ links.aliasTarget = unknownSymbol;
41198
41349
  }
41199
- return links.target;
41350
+ return links.aliasTarget;
41200
41351
  }
41201
41352
  function tryResolveAlias(symbol) {
41202
41353
  var links = getSymbolLinks(symbol);
41203
- if (links.target !== resolvingSymbol) {
41354
+ if (links.aliasTarget !== resolvingSymbol) {
41204
41355
  return resolveAlias(symbol);
41205
41356
  }
41206
41357
  return undefined;
@@ -41391,7 +41542,7 @@ var ts;
41391
41542
  }
41392
41543
  }
41393
41544
  function getAssignmentDeclarationLocation(node) {
41394
- var typeAlias = ts.findAncestor(node, function (node) { return !(ts.isJSDocNode(node) || node.flags & 4194304) ? "quit" : ts.isJSDocTypeAlias(node); });
41545
+ var typeAlias = ts.findAncestor(node, function (node) { return !(ts.isJSDocNode(node) || node.flags & 8388608) ? "quit" : ts.isJSDocTypeAlias(node); });
41395
41546
  if (typeAlias) {
41396
41547
  return;
41397
41548
  }
@@ -42706,7 +42857,16 @@ var ts;
42706
42857
  if (type.flags & 262144 || objectFlags & 3) {
42707
42858
  if (type.flags & 262144 && ts.contains(context.inferTypeParameters, type)) {
42708
42859
  context.approximateLength += (ts.symbolName(type.symbol).length + 6);
42709
- return ts.factory.createInferTypeNode(typeParameterToDeclarationWithConstraint(type, context, undefined));
42860
+ var constraintNode = void 0;
42861
+ var constraint = getConstraintOfTypeParameter(type);
42862
+ if (constraint) {
42863
+ var inferredConstraint = getInferredTypeParameterConstraint(type, true);
42864
+ if (!(inferredConstraint && isTypeIdenticalTo(constraint, inferredConstraint))) {
42865
+ context.approximateLength += 9;
42866
+ constraintNode = constraint && typeToTypeNodeHelper(constraint, context);
42867
+ }
42868
+ }
42869
+ return ts.factory.createInferTypeNode(typeParameterToDeclarationWithConstraint(type, context, constraintNode));
42710
42870
  }
42711
42871
  if (context.flags & 4 &&
42712
42872
  type.flags & 262144 &&
@@ -42778,13 +42938,27 @@ var ts;
42778
42938
  return ts.Debug.fail("Should be unreachable.");
42779
42939
  function conditionalTypeToTypeNode(type) {
42780
42940
  var checkTypeNode = typeToTypeNodeHelper(type.checkType, context);
42941
+ context.approximateLength += 15;
42942
+ if (context.flags & 4 && type.root.isDistributive && !(type.checkType.flags & 262144)) {
42943
+ var newParam = createTypeParameter(createSymbol(262144, "T"));
42944
+ var name = typeParameterToName(newParam, context);
42945
+ var newTypeVariable = ts.factory.createTypeReferenceNode(name);
42946
+ context.approximateLength += 37;
42947
+ var newMapper = prependTypeMapping(type.root.checkType, newParam, type.combinedMapper || type.mapper);
42948
+ var saveInferTypeParameters_1 = context.inferTypeParameters;
42949
+ context.inferTypeParameters = type.root.inferTypeParameters;
42950
+ var extendsTypeNode_1 = typeToTypeNodeHelper(instantiateType(type.root.extendsType, newMapper), context);
42951
+ context.inferTypeParameters = saveInferTypeParameters_1;
42952
+ var trueTypeNode_1 = typeToTypeNodeOrCircularityElision(instantiateType(getTypeFromTypeNode(type.root.node.trueType), newMapper));
42953
+ var falseTypeNode_1 = typeToTypeNodeOrCircularityElision(instantiateType(getTypeFromTypeNode(type.root.node.falseType), newMapper));
42954
+ return ts.factory.createConditionalTypeNode(checkTypeNode, ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(undefined, ts.factory.cloneNode(newTypeVariable.typeName))), ts.factory.createConditionalTypeNode(ts.factory.createTypeReferenceNode(ts.factory.cloneNode(name)), typeToTypeNodeHelper(type.checkType, context), ts.factory.createConditionalTypeNode(newTypeVariable, extendsTypeNode_1, trueTypeNode_1, falseTypeNode_1), ts.factory.createKeywordTypeNode(143)), ts.factory.createKeywordTypeNode(143));
42955
+ }
42781
42956
  var saveInferTypeParameters = context.inferTypeParameters;
42782
42957
  context.inferTypeParameters = type.root.inferTypeParameters;
42783
42958
  var extendsTypeNode = typeToTypeNodeHelper(type.extendsType, context);
42784
42959
  context.inferTypeParameters = saveInferTypeParameters;
42785
42960
  var trueTypeNode = typeToTypeNodeOrCircularityElision(getTrueTypeFromConditionalType(type));
42786
42961
  var falseTypeNode = typeToTypeNodeOrCircularityElision(getFalseTypeFromConditionalType(type));
42787
- context.approximateLength += 15;
42788
42962
  return ts.factory.createConditionalTypeNode(checkTypeNode, extendsTypeNode, trueTypeNode, falseTypeNode);
42789
42963
  }
42790
42964
  function typeToTypeNodeOrCircularityElision(type) {
@@ -44437,7 +44611,7 @@ var ts;
44437
44611
  newModifierFlags |= 1;
44438
44612
  }
44439
44613
  if (addingDeclare && !(newModifierFlags & 1) &&
44440
- (!enclosingDeclaration_1 || !(enclosingDeclaration_1.flags & 8388608)) &&
44614
+ (!enclosingDeclaration_1 || !(enclosingDeclaration_1.flags & 16777216)) &&
44441
44615
  (ts.isEnumDeclaration(node) || ts.isVariableStatement(node) || ts.isFunctionDeclaration(node) || ts.isClassDeclaration(node) || ts.isModuleDeclaration(node))) {
44442
44616
  newModifierFlags |= 2;
44443
44617
  }
@@ -45203,7 +45377,7 @@ var ts;
45203
45377
  }
45204
45378
  var parent = getDeclarationContainer(node);
45205
45379
  if (!(ts.getCombinedModifierFlags(node) & 1) &&
45206
- !(node.kind !== 265 && parent.kind !== 305 && parent.flags & 8388608)) {
45380
+ !(node.kind !== 265 && parent.kind !== 305 && parent.flags & 16777216)) {
45207
45381
  return isGlobalSourceFile(parent);
45208
45382
  }
45209
45383
  return isDeclarationVisible(parent);
@@ -45492,7 +45666,7 @@ var ts;
45492
45666
  return parentType;
45493
45667
  }
45494
45668
  var pattern = declaration.parent;
45495
- if (strictNullChecks && declaration.flags & 8388608 && ts.isParameterDeclaration(declaration)) {
45669
+ if (strictNullChecks && declaration.flags & 16777216 && ts.isParameterDeclaration(declaration)) {
45496
45670
  parentType = getNonNullableType(parentType);
45497
45671
  }
45498
45672
  else if (strictNullChecks && pattern.parent.initializer && !(getTypeFacts(getTypeOfInitializer(pattern.parent.initializer)) & 65536)) {
@@ -45590,7 +45764,7 @@ var ts;
45590
45764
  }
45591
45765
  if ((noImplicitAny || ts.isInJSFile(declaration)) &&
45592
45766
  ts.isVariableDeclaration(declaration) && !ts.isBindingPattern(declaration.name) &&
45593
- !(ts.getCombinedModifierFlags(declaration) & 1) && !(declaration.flags & 8388608)) {
45767
+ !(ts.getCombinedModifierFlags(declaration) & 1) && !(declaration.flags & 16777216)) {
45594
45768
  if (!(ts.getCombinedNodeFlags(declaration) & 2) && (!declaration.initializer || isNullOrUndefined(declaration.initializer))) {
45595
45769
  return autoType;
45596
45770
  }
@@ -46879,7 +47053,7 @@ var ts;
46879
47053
  function isLiteralEnumMember(member) {
46880
47054
  var expr = member.initializer;
46881
47055
  if (!expr) {
46882
- return !(member.flags & 8388608);
47056
+ return !(member.flags & 16777216);
46883
47057
  }
46884
47058
  switch (expr.kind) {
46885
47059
  case 10:
@@ -49162,7 +49336,7 @@ var ts;
49162
49336
  function getConstraintDeclaration(type) {
49163
49337
  return ts.mapDefined(ts.filter(type.symbol && type.symbol.declarations, ts.isTypeParameterDeclaration), ts.getEffectiveConstraintOfTypeParameter)[0];
49164
49338
  }
49165
- function getInferredTypeParameterConstraint(typeParameter) {
49339
+ function getInferredTypeParameterConstraint(typeParameter, omitTypeReferences) {
49166
49340
  var _a;
49167
49341
  var inferences;
49168
49342
  if ((_a = typeParameter.symbol) === null || _a === void 0 ? void 0 : _a.declarations) {
@@ -49170,7 +49344,7 @@ var ts;
49170
49344
  var declaration = _b[_i];
49171
49345
  if (declaration.parent.kind === 190) {
49172
49346
  var _c = ts.walkUpParenthesizedTypesAndGetParentAndChild(declaration.parent.parent), _d = _c[0], childTypeParameter = _d === void 0 ? declaration.parent : _d, grandParent = _c[1];
49173
- if (grandParent.kind === 178) {
49347
+ if (grandParent.kind === 178 && !omitTypeReferences) {
49174
49348
  var typeReference = grandParent;
49175
49349
  var typeParameters = getTypeParametersForTypeReference(typeReference);
49176
49350
  if (typeParameters) {
@@ -49540,7 +49714,7 @@ var ts;
49540
49714
  return constraints ? getSubstitutionType(type, getIntersectionType(ts.append(constraints, type))) : type;
49541
49715
  }
49542
49716
  function isJSDocTypeReference(node) {
49543
- return !!(node.flags & 4194304) && (node.kind === 178 || node.kind === 200);
49717
+ return !!(node.flags & 8388608) && (node.kind === 178 || node.kind === 200);
49544
49718
  }
49545
49719
  function checkNoTypeArguments(node, symbol) {
49546
49720
  if (node.typeArguments) {
@@ -50934,7 +51108,7 @@ var ts;
50934
51108
  if (ts.isCallLikeExpression(parent)) {
50935
51109
  return ts.isCallOrNewExpression(parent) && ts.isIdentifier(node) && hasMatchingArgument(parent, node);
50936
51110
  }
50937
- return ts.every(symbol.declarations, function (d) { return !ts.isFunctionLike(d) || !!(ts.getCombinedNodeFlags(d) & 134217728); });
51111
+ return ts.every(symbol.declarations, function (d) { return !ts.isFunctionLike(d) || !!(ts.getCombinedNodeFlags(d) & 268435456); });
50938
51112
  }
50939
51113
  return true;
50940
51114
  }
@@ -51327,7 +51501,11 @@ var ts;
51327
51501
  return !root.isDistributive && isSingletonTupleType(root.node.checkType) && isSingletonTupleType(root.node.extendsType);
51328
51502
  }
51329
51503
  function isSingletonTupleType(node) {
51330
- return ts.isTupleTypeNode(node) && ts.length(node.elements) === 1 && !ts.isOptionalTypeNode(node.elements[0]) && !ts.isRestTypeNode(node.elements[0]);
51504
+ return ts.isTupleTypeNode(node) &&
51505
+ ts.length(node.elements) === 1 &&
51506
+ !ts.isOptionalTypeNode(node.elements[0]) &&
51507
+ !ts.isRestTypeNode(node.elements[0]) &&
51508
+ !(ts.isNamedTupleMember(node.elements[0]) && (node.elements[0].questionToken || node.elements[0].dotDotDotToken));
51331
51509
  }
51332
51510
  function unwrapNondistributiveConditionalTuple(root, type) {
51333
51511
  return isTypicalNondistributiveConditional(root) && isTupleType(type) ? getTypeArguments(type)[0] : type;
@@ -51519,7 +51697,7 @@ var ts;
51519
51697
  links.resolvedSymbol = unknownSymbol;
51520
51698
  return links.resolvedType = errorType;
51521
51699
  }
51522
- var targetMeaning = node.isTypeOf ? 111551 : node.flags & 4194304 ? 111551 | 788968 : 788968;
51700
+ var targetMeaning = node.isTypeOf ? 111551 : node.flags & 8388608 ? 111551 | 788968 : 788968;
51523
51701
  var innerModuleSymbol = resolveExternalModuleName(node, node.argument.literal);
51524
51702
  if (!innerModuleSymbol) {
51525
51703
  links.resolvedSymbol = unknownSymbol;
@@ -51836,7 +52014,7 @@ var ts;
51836
52014
  if (parent && ts.isObjectLiteralExpression(parent) && ts.isBinaryExpression(parent.parent) && ts.getAssignmentDeclarationKind(parent.parent) === 6) {
51837
52015
  return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent.parent.left).parent).thisType;
51838
52016
  }
51839
- var host = node.flags & 4194304 ? ts.getHostSignatureFromJSDoc(node) : undefined;
52017
+ var host = node.flags & 8388608 ? ts.getHostSignatureFromJSDoc(node) : undefined;
51840
52018
  if (host && ts.isFunctionExpression(host) && ts.isBinaryExpression(host.parent) && ts.getAssignmentDeclarationKind(host.parent) === 3) {
51841
52019
  return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(host.parent.left).parent).thisType;
51842
52020
  }
@@ -51909,7 +52087,7 @@ var ts;
51909
52087
  case 143:
51910
52088
  return neverType;
51911
52089
  case 148:
51912
- return node.flags & 131072 && !noImplicitAny ? anyType : nonPrimitiveType;
52090
+ return node.flags & 262144 && !noImplicitAny ? anyType : nonPrimitiveType;
51913
52091
  case 138:
51914
52092
  return intrinsicMarkerType;
51915
52093
  case 192:
@@ -55251,6 +55429,9 @@ var ts;
55251
55429
  function createMarkerType(symbol, source, target) {
55252
55430
  var mapper = makeUnaryTypeMapper(source, target);
55253
55431
  var type = getDeclaredTypeOfSymbol(symbol);
55432
+ if (isErrorType(type)) {
55433
+ return type;
55434
+ }
55254
55435
  var result = symbol.flags & 524288 ?
55255
55436
  getTypeAliasInstantiation(symbol, instantiateTypes(getSymbolLinks(symbol).typeParameters, mapper)) :
55256
55437
  createTypeReference(type, instantiateTypes(type.typeParameters, mapper));
@@ -56130,6 +56311,7 @@ var ts;
56130
56311
  var inference = inferences[i];
56131
56312
  if (t === inference.typeParameter) {
56132
56313
  if (fix && !inference.isFixed) {
56314
+ inferFromIntraExpressionSites(context);
56133
56315
  clearCachedInferences(inferences);
56134
56316
  inference.isFixed = true;
56135
56317
  }
@@ -56146,6 +56328,24 @@ var ts;
56146
56328
  }
56147
56329
  }
56148
56330
  }
56331
+ function addIntraExpressionInferenceSite(context, node, type) {
56332
+ var _a;
56333
+ ((_a = context.intraExpressionInferenceSites) !== null && _a !== void 0 ? _a : (context.intraExpressionInferenceSites = [])).push({ node: node, type: type });
56334
+ }
56335
+ function inferFromIntraExpressionSites(context) {
56336
+ if (context.intraExpressionInferenceSites) {
56337
+ for (var _i = 0, _a = context.intraExpressionInferenceSites; _i < _a.length; _i++) {
56338
+ var _b = _a[_i], node = _b.node, type = _b.type;
56339
+ var contextualType = node.kind === 169 ?
56340
+ getContextualTypeForObjectLiteralMethod(node, 2) :
56341
+ getContextualType(node, 2);
56342
+ if (contextualType) {
56343
+ inferTypes(context.inferences, type, contextualType);
56344
+ }
56345
+ }
56346
+ context.intraExpressionInferenceSites = undefined;
56347
+ }
56348
+ }
56149
56349
  function createInferenceInfo(typeParameter) {
56150
56350
  return {
56151
56351
  typeParameter: typeParameter,
@@ -57896,7 +58096,7 @@ var ts;
57896
58096
  }
57897
58097
  }
57898
58098
  function getTypeOfDottedName(node, diagnostic) {
57899
- if (!(node.flags & 16777216)) {
58099
+ if (!(node.flags & 33554432)) {
57900
58100
  switch (node.kind) {
57901
58101
  case 79:
57902
58102
  var symbol = getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(node));
@@ -59101,6 +59301,7 @@ var ts;
59101
59301
  function isConstraintPosition(type, node) {
59102
59302
  var parent = node.parent;
59103
59303
  return parent.kind === 206 ||
59304
+ parent.kind === 161 ||
59104
59305
  parent.kind === 208 && parent.expression === node ||
59105
59306
  parent.kind === 207 && parent.expression === node &&
59106
59307
  !(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent.argumentExpression)));
@@ -59312,7 +59513,7 @@ var ts;
59312
59513
  isInTypeQuery(node) || node.parent.kind === 275) ||
59313
59514
  node.parent.kind === 230 ||
59314
59515
  declaration.kind === 254 && declaration.exclamationToken ||
59315
- declaration.flags & 8388608;
59516
+ declaration.flags & 16777216;
59316
59517
  var initialType = assumeInitialized ? (isParameter ? removeOptionalityFromDeclaredType(type, declaration) : type) :
59317
59518
  type === autoType || type === autoArrayType ? undefinedType :
59318
59519
  getOptionalType(type);
@@ -60147,7 +60348,7 @@ var ts;
60147
60348
  }
60148
60349
  function getContextualTypeForObjectLiteralMethod(node, contextFlags) {
60149
60350
  ts.Debug.assert(ts.isObjectLiteralMethod(node));
60150
- if (node.flags & 16777216) {
60351
+ if (node.flags & 33554432) {
60151
60352
  return undefined;
60152
60353
  }
60153
60354
  return getContextualTypeForObjectLiteralElement(node, contextFlags);
@@ -60285,7 +60486,7 @@ var ts;
60285
60486
  return type;
60286
60487
  }
60287
60488
  function getContextualType(node, contextFlags) {
60288
- if (node.flags & 16777216) {
60489
+ if (node.flags & 33554432) {
60289
60490
  return undefined;
60290
60491
  }
60291
60492
  if (node.contextualType) {
@@ -60656,6 +60857,11 @@ var ts;
60656
60857
  var type = checkExpressionForMutableLocation(e, checkMode, elementContextualType, forceTuple);
60657
60858
  elementTypes.push(addOptionality(type, true, hasOmittedExpression));
60658
60859
  elementFlags.push(hasOmittedExpression ? 2 : 1);
60860
+ if (contextualType && someType(contextualType, isTupleLikeType) && checkMode && checkMode & 2 && !(checkMode & 4) && isContextSensitive(e)) {
60861
+ var inferenceContext = getInferenceContext(node);
60862
+ ts.Debug.assert(inferenceContext);
60863
+ addIntraExpressionInferenceSite(inferenceContext, e, type);
60864
+ }
60659
60865
  }
60660
60866
  }
60661
60867
  if (inDestructuringPattern) {
@@ -60837,6 +61043,13 @@ var ts;
60837
61043
  prop.target = member;
60838
61044
  member = prop;
60839
61045
  allPropertiesTable === null || allPropertiesTable === void 0 ? void 0 : allPropertiesTable.set(prop.escapedName, prop);
61046
+ if (contextualType && checkMode && checkMode & 2 && !(checkMode & 4) &&
61047
+ (memberDecl.kind === 296 || memberDecl.kind === 169) && isContextSensitive(memberDecl)) {
61048
+ var inferenceContext = getInferenceContext(node);
61049
+ ts.Debug.assert(inferenceContext);
61050
+ var inferenceNode = memberDecl.kind === 296 ? memberDecl.initializer : memberDecl;
61051
+ addIntraExpressionInferenceSite(inferenceContext, inferenceNode, type);
61052
+ }
60840
61053
  }
60841
61054
  else if (memberDecl.kind === 298) {
60842
61055
  if (languageVersion < 2) {
@@ -61754,7 +61967,7 @@ var ts;
61754
61967
  if (compilerOptions.noPropertyAccessFromIndexSignature && ts.isPropertyAccessExpression(node)) {
61755
61968
  error(right, ts.Diagnostics.Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0, ts.unescapeLeadingUnderscores(right.escapedText));
61756
61969
  }
61757
- if (indexInfo.declaration && ts.getCombinedNodeFlags(indexInfo.declaration) & 134217728) {
61970
+ if (indexInfo.declaration && ts.getCombinedNodeFlags(indexInfo.declaration) & 268435456) {
61758
61971
  addDeprecatedSuggestion(right, [indexInfo.declaration], right.escapedText);
61759
61972
  }
61760
61973
  }
@@ -61808,7 +62021,7 @@ var ts;
61808
62021
  if (declaration && isPropertyWithoutInitializer(declaration)) {
61809
62022
  if (!ts.isStatic(declaration)) {
61810
62023
  var flowContainer = getControlFlowContainer(node);
61811
- if (flowContainer.kind === 171 && flowContainer.parent === declaration.parent && !(declaration.flags & 8388608)) {
62024
+ if (flowContainer.kind === 171 && flowContainer.parent === declaration.parent && !(declaration.flags & 16777216)) {
61812
62025
  assumeUninitialized = true;
61813
62026
  }
61814
62027
  }
@@ -61844,7 +62057,7 @@ var ts;
61844
62057
  }
61845
62058
  else if (valueDeclaration.kind === 257 &&
61846
62059
  node.parent.kind !== 178 &&
61847
- !(valueDeclaration.flags & 8388608) &&
62060
+ !(valueDeclaration.flags & 16777216) &&
61848
62061
  !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) {
61849
62062
  diagnosticMessage = error(right, ts.Diagnostics.Class_0_used_before_its_declaration, declarationName);
61850
62063
  }
@@ -62409,19 +62622,21 @@ var ts;
62409
62622
  if (node.kind !== 165) {
62410
62623
  var contextualType = getContextualType(node, ts.every(signature.typeParameters, function (p) { return !!getDefaultFromTypeParameter(p); }) ? 8 : 0);
62411
62624
  if (contextualType) {
62412
- var outerContext = getInferenceContext(node);
62413
- var outerMapper = getMapperFromContext(cloneInferenceContext(outerContext, 1));
62414
- var instantiatedType = instantiateType(contextualType, outerMapper);
62415
- var contextualSignature = getSingleCallSignature(instantiatedType);
62416
- var inferenceSourceType = contextualSignature && contextualSignature.typeParameters ?
62417
- getOrCreateTypeFromSignature(getSignatureInstantiationWithoutFillingInTypeArguments(contextualSignature, contextualSignature.typeParameters)) :
62418
- instantiatedType;
62419
62625
  var inferenceTargetType = getReturnTypeOfSignature(signature);
62420
- inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, 128);
62421
- var returnContext = createInferenceContext(signature.typeParameters, signature, context.flags);
62422
- var returnSourceType = instantiateType(contextualType, outerContext && outerContext.returnMapper);
62423
- inferTypes(returnContext.inferences, returnSourceType, inferenceTargetType);
62424
- context.returnMapper = ts.some(returnContext.inferences, hasInferenceCandidates) ? getMapperFromContext(cloneInferredPartOfContext(returnContext)) : undefined;
62626
+ if (couldContainTypeVariables(inferenceTargetType)) {
62627
+ var outerContext = getInferenceContext(node);
62628
+ var outerMapper = getMapperFromContext(cloneInferenceContext(outerContext, 1));
62629
+ var instantiatedType = instantiateType(contextualType, outerMapper);
62630
+ var contextualSignature = getSingleCallSignature(instantiatedType);
62631
+ var inferenceSourceType = contextualSignature && contextualSignature.typeParameters ?
62632
+ getOrCreateTypeFromSignature(getSignatureInstantiationWithoutFillingInTypeArguments(contextualSignature, contextualSignature.typeParameters)) :
62633
+ instantiatedType;
62634
+ inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, 128);
62635
+ var returnContext = createInferenceContext(signature.typeParameters, signature, context.flags);
62636
+ var returnSourceType = instantiateType(contextualType, outerContext && outerContext.returnMapper);
62637
+ inferTypes(returnContext.inferences, returnSourceType, inferenceTargetType);
62638
+ context.returnMapper = ts.some(returnContext.inferences, hasInferenceCandidates) ? getMapperFromContext(cloneInferredPartOfContext(returnContext)) : undefined;
62639
+ }
62425
62640
  }
62426
62641
  }
62427
62642
  var restType = getNonArrayRestType(signature);
@@ -62433,7 +62648,7 @@ var ts;
62433
62648
  }
62434
62649
  }
62435
62650
  var thisType = getThisTypeOfSignature(signature);
62436
- if (thisType) {
62651
+ if (thisType && couldContainTypeVariables(thisType)) {
62437
62652
  var thisArgumentNode = getThisArgumentOfCall(node);
62438
62653
  inferTypes(context.inferences, getThisArgumentType(thisArgumentNode), thisType);
62439
62654
  }
@@ -62441,11 +62656,13 @@ var ts;
62441
62656
  var arg = args[i];
62442
62657
  if (arg.kind !== 227 && !(checkMode & 32 && hasSkipDirectInferenceFlag(arg))) {
62443
62658
  var paramType = getTypeAtPosition(signature, i);
62444
- var argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
62445
- inferTypes(context.inferences, argType, paramType);
62659
+ if (couldContainTypeVariables(paramType)) {
62660
+ var argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
62661
+ inferTypes(context.inferences, argType, paramType);
62662
+ }
62446
62663
  }
62447
62664
  }
62448
- if (restType) {
62665
+ if (restType && couldContainTypeVariables(restType)) {
62449
62666
  var spreadType = getSpreadArgumentType(args, argCount, args.length, restType, context, checkMode);
62450
62667
  inferTypes(context.inferences, spreadType, restType);
62451
62668
  }
@@ -63781,7 +63998,7 @@ var ts;
63781
63998
  return returnType;
63782
63999
  }
63783
64000
  function checkDeprecatedSignature(signature, node) {
63784
- if (signature.declaration && signature.declaration.flags & 134217728) {
64001
+ if (signature.declaration && signature.declaration.flags & 268435456) {
63785
64002
  var suggestionNode = getDeprecatedSuggestionNode(node);
63786
64003
  var name = ts.tryGetPropertyAccessOrIdentifierToString(ts.getInvokedExpression(node));
63787
64004
  addDeprecatedSuggestionWithSignature(suggestionNode, signature.declaration, name, signatureToString(signature));
@@ -63861,7 +64078,7 @@ var ts;
63861
64078
  var newSymbol = createSymbol(2097152, "default");
63862
64079
  newSymbol.parent = originalSymbol;
63863
64080
  newSymbol.nameType = getStringLiteralType("default");
63864
- newSymbol.target = resolveSymbol(symbol);
64081
+ newSymbol.aliasTarget = resolveSymbol(symbol);
63865
64082
  memberTable.set("default", newSymbol);
63866
64083
  return createAnonymousType(anonymousSymbol, memberTable, ts.emptyArray, ts.emptyArray, ts.emptyArray);
63867
64084
  }
@@ -63918,7 +64135,7 @@ var ts;
63918
64135
  : 0;
63919
64136
  if (targetDeclarationKind !== 0) {
63920
64137
  var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind);
63921
- return !!decl && !!(decl.flags & 8388608);
64138
+ return !!decl && !!(decl.flags & 16777216);
63922
64139
  }
63923
64140
  return false;
63924
64141
  }
@@ -64113,7 +64330,7 @@ var ts;
64113
64330
  error(node, ts.Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node12_or_nodenext);
64114
64331
  }
64115
64332
  var file = ts.getSourceFileOfNode(node);
64116
- ts.Debug.assert(!!(file.flags & 2097152), "Containing file is missing import meta node flag.");
64333
+ ts.Debug.assert(!!(file.flags & 4194304), "Containing file is missing import meta node flag.");
64117
64334
  return node.name.escapedText === "meta" ? getGlobalImportMetaType() : errorType;
64118
64335
  }
64119
64336
  function getTypeOfParameter(symbol) {
@@ -65911,6 +66128,9 @@ var ts;
65911
66128
  context.contextualType = contextualType;
65912
66129
  context.inferenceContext = inferenceContext;
65913
66130
  var type = checkExpression(node, checkMode | 1 | (inferenceContext ? 2 : 0));
66131
+ if (inferenceContext && inferenceContext.intraExpressionInferenceSites) {
66132
+ inferenceContext.intraExpressionInferenceSites = undefined;
66133
+ }
65914
66134
  var result = maybeTypeOfKind(type, 2944) && isLiteralOfContextualType(type, instantiateContextualType(contextualType, node)) ?
65915
66135
  getRegularTypeOfLiteralType(type) : type;
65916
66136
  return result;
@@ -66158,7 +66378,7 @@ var ts;
66158
66378
  if (quickType) {
66159
66379
  return quickType;
66160
66380
  }
66161
- if (node.flags & 67108864 && flowTypeCache) {
66381
+ if (node.flags & 134217728 && flowTypeCache) {
66162
66382
  var cachedType = flowTypeCache[getNodeId(node)];
66163
66383
  if (cachedType) {
66164
66384
  return cachedType;
@@ -66169,7 +66389,7 @@ var ts;
66169
66389
  if (flowInvocationCount !== startInvocationCount) {
66170
66390
  var cache = flowTypeCache || (flowTypeCache = []);
66171
66391
  cache[getNodeId(node)] = type;
66172
- ts.setNodeFlags(node, node.flags | 67108864);
66392
+ ts.setNodeFlags(node, node.flags | 134217728);
66173
66393
  }
66174
66394
  return type;
66175
66395
  }
@@ -66239,7 +66459,7 @@ var ts;
66239
66459
  if (compilerOptions.isolatedModules) {
66240
66460
  ts.Debug.assert(!!(type.symbol.flags & 128));
66241
66461
  var constEnumDeclaration = type.symbol.valueDeclaration;
66242
- if (constEnumDeclaration.flags & 8388608) {
66462
+ if (constEnumDeclaration.flags & 16777216) {
66243
66463
  error(node, ts.Diagnostics.Cannot_access_ambient_const_enums_when_the_isolatedModules_flag_is_provided);
66244
66464
  }
66245
66465
  }
@@ -66384,14 +66604,19 @@ var ts;
66384
66604
  }
66385
66605
  if (node.parent.kind === 258 || node.parent.kind === 257 || node.parent.kind === 259) {
66386
66606
  var modifiers = getVarianceModifiers(typeParameter);
66387
- if (modifiers === 32768 || modifiers === 65536) {
66607
+ if (modifiers) {
66388
66608
  var symbol = getSymbolOfNode(node.parent);
66389
- var source = createMarkerType(symbol, typeParameter, modifiers === 65536 ? markerSubType : markerSuperType);
66390
- var target = createMarkerType(symbol, typeParameter, modifiers === 65536 ? markerSuperType : markerSubType);
66391
- var saveVarianceTypeParameter = typeParameter;
66392
- varianceTypeParameter = typeParameter;
66393
- checkTypeAssignableTo(source, target, node, ts.Diagnostics.Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation);
66394
- varianceTypeParameter = saveVarianceTypeParameter;
66609
+ if (node.parent.kind === 259 && !(ts.getObjectFlags(getDeclaredTypeOfSymbol(symbol)) & (16 | 32))) {
66610
+ error(node, ts.Diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types);
66611
+ }
66612
+ else if (modifiers === 32768 || modifiers === 65536) {
66613
+ var source = createMarkerType(symbol, typeParameter, modifiers === 65536 ? markerSubType : markerSuperType);
66614
+ var target = createMarkerType(symbol, typeParameter, modifiers === 65536 ? markerSuperType : markerSubType);
66615
+ var saveVarianceTypeParameter = typeParameter;
66616
+ varianceTypeParameter = typeParameter;
66617
+ checkTypeAssignableTo(source, target, node, ts.Diagnostics.Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation);
66618
+ varianceTypeParameter = saveVarianceTypeParameter;
66619
+ }
66395
66620
  }
66396
66621
  }
66397
66622
  addLazyDiagnostic(function () { return checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0); });
@@ -66860,7 +67085,7 @@ var ts;
66860
67085
  checkDecorators(node);
66861
67086
  checkSignatureDeclaration(node);
66862
67087
  if (node.kind === 172) {
66863
- if (!(node.flags & 8388608) && ts.nodeIsPresent(node.body) && (node.flags & 256)) {
67088
+ if (!(node.flags & 16777216) && ts.nodeIsPresent(node.body) && (node.flags & 256)) {
66864
67089
  if (!(node.flags & 512)) {
66865
67090
  error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value);
66866
67091
  }
@@ -66950,7 +67175,7 @@ var ts;
66950
67175
  }
66951
67176
  var symbol = getNodeLinks(node).resolvedSymbol;
66952
67177
  if (symbol) {
66953
- if (ts.some(symbol.declarations, function (d) { return isTypeDeclaration(d) && !!(d.flags & 134217728); })) {
67178
+ if (ts.some(symbol.declarations, function (d) { return isTypeDeclaration(d) && !!(d.flags & 268435456); })) {
66954
67179
  addDeprecatedSuggestion(getDeprecatedSuggestionNode(node), symbol.declarations, symbol.escapedName);
66955
67180
  }
66956
67181
  if (type.flags & 32 && symbol.flags & 8) {
@@ -67107,6 +67332,22 @@ var ts;
67107
67332
  grammarErrorOnNode(node, ts.Diagnostics.infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type);
67108
67333
  }
67109
67334
  checkSourceElement(node.typeParameter);
67335
+ var symbol = getSymbolOfNode(node.typeParameter);
67336
+ if (symbol.declarations && symbol.declarations.length > 1) {
67337
+ var links = getSymbolLinks(symbol);
67338
+ if (!links.typeParametersChecked) {
67339
+ links.typeParametersChecked = true;
67340
+ var typeParameter = getDeclaredTypeOfTypeParameter(symbol);
67341
+ var declarations = ts.getDeclarationsOfKind(symbol, 163);
67342
+ if (!areTypeParametersIdentical(declarations, [typeParameter], function (decl) { return [decl]; })) {
67343
+ var name = symbolToString(symbol);
67344
+ for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) {
67345
+ var declaration = declarations_4[_i];
67346
+ error(declaration.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_constraints, name);
67347
+ }
67348
+ }
67349
+ }
67350
+ }
67110
67351
  registerForUnusedIdentifiersCheck(node);
67111
67352
  }
67112
67353
  function checkTemplateLiteralType(node) {
@@ -67144,14 +67385,14 @@ var ts;
67144
67385
  getTypeFromTypeNode(node);
67145
67386
  }
67146
67387
  function isPrivateWithinAmbient(node) {
67147
- return (ts.hasEffectiveModifier(node, 8) || ts.isPrivateIdentifierClassElementDeclaration(node)) && !!(node.flags & 8388608);
67388
+ return (ts.hasEffectiveModifier(node, 8) || ts.isPrivateIdentifierClassElementDeclaration(node)) && !!(node.flags & 16777216);
67148
67389
  }
67149
67390
  function getEffectiveDeclarationFlags(n, flagsToCheck) {
67150
67391
  var flags = ts.getCombinedModifierFlags(n);
67151
67392
  if (n.parent.kind !== 258 &&
67152
67393
  n.parent.kind !== 257 &&
67153
67394
  n.parent.kind !== 226 &&
67154
- n.flags & 8388608) {
67395
+ n.flags & 16777216) {
67155
67396
  if (!(flags & 2) && !(ts.isModuleBlock(n.parent) && ts.isModuleDeclaration(n.parent.parent) && ts.isGlobalScopeAugmentation(n.parent.parent))) {
67156
67397
  flags |= 1;
67157
67398
  }
@@ -67263,10 +67504,10 @@ var ts;
67263
67504
  var hasNonAmbientClass = false;
67264
67505
  var functionDeclarations = [];
67265
67506
  if (declarations) {
67266
- for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) {
67267
- var current = declarations_4[_i];
67507
+ for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) {
67508
+ var current = declarations_5[_i];
67268
67509
  var node = current;
67269
- var inAmbientContext = node.flags & 8388608;
67510
+ var inAmbientContext = node.flags & 16777216;
67270
67511
  var inAmbientContextOrInterface = node.parent && (node.parent.kind === 258 || node.parent.kind === 182) || inAmbientContext;
67271
67512
  if (inAmbientContextOrInterface) {
67272
67513
  previousDeclaration = undefined;
@@ -67900,7 +68141,7 @@ var ts;
67900
68141
  if (hasBindableName(node)) {
67901
68142
  var symbol = getSymbolOfNode(node);
67902
68143
  var localSymbol = node.localSymbol || symbol;
67903
- var firstDeclaration = (_a = localSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (declaration) { return declaration.kind === node.kind && !(declaration.flags & 131072); });
68144
+ var firstDeclaration = (_a = localSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (declaration) { return declaration.kind === node.kind && !(declaration.flags & 262144); });
67904
68145
  if (node === firstDeclaration) {
67905
68146
  checkFunctionOrConstructorSymbol(localSymbol);
67906
68147
  }
@@ -68010,7 +68251,7 @@ var ts;
68010
68251
  var symbol = getSymbolOfNode(member);
68011
68252
  if (!symbol.isReferenced
68012
68253
  && (ts.hasEffectiveModifier(member, 8) || ts.isNamedDeclaration(member) && ts.isPrivateIdentifier(member.name))
68013
- && !(member.flags & 8388608)) {
68254
+ && !(member.flags & 16777216)) {
68014
68255
  addDiagnostic(member, 0, ts.createDiagnosticForNode(member.name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, symbolToString(symbol)));
68015
68256
  }
68016
68257
  break;
@@ -68185,8 +68426,8 @@ var ts;
68185
68426
  : ts.createDiagnosticForNode(declarationList.parent.kind === 237 ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused));
68186
68427
  }
68187
68428
  else {
68188
- for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) {
68189
- var decl = declarations_5[_i];
68429
+ for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) {
68430
+ var decl = declarations_6[_i];
68190
68431
  addDiagnostic(decl, 0, ts.createDiagnosticForNode(decl, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(decl.name)));
68191
68432
  }
68192
68433
  }
@@ -68226,7 +68467,7 @@ var ts;
68226
68467
  }
68227
68468
  }
68228
68469
  function checkCollisionWithArgumentsInGeneratedCode(node) {
68229
- if (languageVersion >= 2 || !ts.hasRestParameter(node) || node.flags & 8388608 || ts.nodeIsMissing(node.body)) {
68470
+ if (languageVersion >= 2 || !ts.hasRestParameter(node) || node.flags & 16777216 || ts.nodeIsMissing(node.body)) {
68230
68471
  return;
68231
68472
  }
68232
68473
  ts.forEach(node.parameters, function (p) {
@@ -68248,7 +68489,7 @@ var ts;
68248
68489
  node.kind === 296) {
68249
68490
  return false;
68250
68491
  }
68251
- if (node.flags & 8388608) {
68492
+ if (node.flags & 16777216) {
68252
68493
  return false;
68253
68494
  }
68254
68495
  if (ts.isImportClause(node) || ts.isImportEqualsDeclaration(node) || ts.isImportSpecifier(node)) {
@@ -68374,7 +68615,7 @@ var ts;
68374
68615
  recordPotentialCollisionWithReflectInGeneratedCode(node, name);
68375
68616
  if (ts.isClassLike(node)) {
68376
68617
  checkTypeNameIsReserved(name, ts.Diagnostics.Class_name_cannot_be_0);
68377
- if (!(node.flags & 8388608)) {
68618
+ if (!(node.flags & 16777216)) {
68378
68619
  checkClassNameCollisionWithObject(name);
68379
68620
  }
68380
68621
  }
@@ -69635,21 +69876,21 @@ var ts;
69635
69876
  return;
69636
69877
  }
69637
69878
  var type = getDeclaredTypeOfSymbol(symbol);
69638
- if (!areTypeParametersIdentical(declarations, type.localTypeParameters)) {
69879
+ if (!areTypeParametersIdentical(declarations, type.localTypeParameters, ts.getEffectiveTypeParameterDeclarations)) {
69639
69880
  var name = symbolToString(symbol);
69640
- for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) {
69641
- var declaration = declarations_6[_i];
69881
+ for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) {
69882
+ var declaration = declarations_7[_i];
69642
69883
  error(declaration.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, name);
69643
69884
  }
69644
69885
  }
69645
69886
  }
69646
69887
  }
69647
- function areTypeParametersIdentical(declarations, targetParameters) {
69888
+ function areTypeParametersIdentical(declarations, targetParameters, getTypeParameterDeclarations) {
69648
69889
  var maxTypeArgumentCount = ts.length(targetParameters);
69649
69890
  var minTypeArgumentCount = getMinTypeArgumentCount(targetParameters);
69650
- for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) {
69651
- var declaration = declarations_7[_i];
69652
- var sourceParameters = ts.getEffectiveTypeParameterDeclarations(declaration);
69891
+ for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) {
69892
+ var declaration = declarations_8[_i];
69893
+ var sourceParameters = getTypeParameterDeclarations(declaration);
69653
69894
  var numTypeParameters = sourceParameters.length;
69654
69895
  if (numTypeParameters < minTypeArgumentCount || numTypeParameters > maxTypeArgumentCount) {
69655
69896
  return false;
@@ -69708,7 +69949,7 @@ var ts;
69708
69949
  checkTypeParameterListsIdentical(symbol);
69709
69950
  checkFunctionOrConstructorSymbol(symbol);
69710
69951
  checkClassForDuplicateDeclarations(node);
69711
- var nodeInAmbientContext = !!(node.flags & 8388608);
69952
+ var nodeInAmbientContext = !!(node.flags & 16777216);
69712
69953
  if (!nodeInAmbientContext) {
69713
69954
  checkClassForStaticPropertyNameConflicts(node);
69714
69955
  }
@@ -69840,7 +70081,7 @@ var ts;
69840
70081
  }
69841
70082
  function checkMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, memberHasOverrideModifier, memberHasAbstractModifier, memberIsStatic, memberIsParameterProperty, memberName, errorNode) {
69842
70083
  var isJs = ts.isInJSFile(node);
69843
- var nodeInAmbientContext = !!(node.flags & 8388608);
70084
+ var nodeInAmbientContext = !!(node.flags & 16777216);
69844
70085
  if (baseWithThis && (memberHasOverrideModifier || compilerOptions.noImplicitOverride)) {
69845
70086
  var memberEscapedName = ts.escapeLeadingUnderscores(memberName);
69846
70087
  var thisType = memberIsStatic ? staticType : typeWithThis;
@@ -70027,7 +70268,7 @@ var ts;
70027
70268
  && !(derived.flags & 33554432)
70028
70269
  && !(baseDeclarationFlags & 128)
70029
70270
  && !(derivedDeclarationFlags & 128)
70030
- && !((_b = derived.declarations) === null || _b === void 0 ? void 0 : _b.some(function (d) { return !!(d.flags & 8388608); }))) {
70271
+ && !((_b = derived.declarations) === null || _b === void 0 ? void 0 : _b.some(function (d) { return !!(d.flags & 16777216); }))) {
70031
70272
  var constructor = findConstructorDeclaration(ts.getClassLikeDeclarationOfSymbol(type.symbol));
70032
70273
  var propName = uninitialized.name;
70033
70274
  if (uninitialized.exclamationToken
@@ -70117,7 +70358,7 @@ var ts;
70117
70358
  return ok;
70118
70359
  }
70119
70360
  function checkPropertyInitialization(node) {
70120
- if (!strictNullChecks || !strictPropertyInitialization || node.flags & 8388608) {
70361
+ if (!strictNullChecks || !strictPropertyInitialization || node.flags & 16777216) {
70121
70362
  return;
70122
70363
  }
70123
70364
  var constructor = findConstructorDeclaration(node);
@@ -70247,7 +70488,7 @@ var ts;
70247
70488
  if (member.initializer) {
70248
70489
  return computeConstantValue(member);
70249
70490
  }
70250
- if (member.parent.flags & 8388608 && !ts.isEnumConst(member.parent) && getEnumKind(getSymbolOfNode(member.parent)) === 0) {
70491
+ if (member.parent.flags & 16777216 && !ts.isEnumConst(member.parent) && getEnumKind(getSymbolOfNode(member.parent)) === 0) {
70251
70492
  return undefined;
70252
70493
  }
70253
70494
  if (autoValue !== undefined) {
@@ -70275,7 +70516,7 @@ var ts;
70275
70516
  else if (isConstEnum) {
70276
70517
  error(initializer, ts.Diagnostics.const_enum_member_initializers_can_only_contain_literal_values_and_other_computed_enum_values);
70277
70518
  }
70278
- else if (member.parent.flags & 8388608) {
70519
+ else if (member.parent.flags & 16777216) {
70279
70520
  error(initializer, ts.Diagnostics.In_ambient_enum_declarations_member_initializer_must_be_constant_expression);
70280
70521
  }
70281
70522
  else {
@@ -70433,11 +70674,11 @@ var ts;
70433
70674
  function getFirstNonAmbientClassOrFunctionDeclaration(symbol) {
70434
70675
  var declarations = symbol.declarations;
70435
70676
  if (declarations) {
70436
- for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) {
70437
- var declaration = declarations_8[_i];
70677
+ for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) {
70678
+ var declaration = declarations_9[_i];
70438
70679
  if ((declaration.kind === 257 ||
70439
70680
  (declaration.kind === 256 && ts.nodeIsPresent(declaration.body))) &&
70440
- !(declaration.flags & 8388608)) {
70681
+ !(declaration.flags & 16777216)) {
70441
70682
  return declaration;
70442
70683
  }
70443
70684
  }
@@ -70467,7 +70708,7 @@ var ts;
70467
70708
  addLazyDiagnostic(checkModuleDeclarationDiagnostics);
70468
70709
  function checkModuleDeclarationDiagnostics() {
70469
70710
  var isGlobalAugmentation = ts.isGlobalScopeAugmentation(node);
70470
- var inAmbientContext = node.flags & 8388608;
70711
+ var inAmbientContext = node.flags & 16777216;
70471
70712
  if (isGlobalAugmentation && !inAmbientContext) {
70472
70713
  error(node.name, ts.Diagnostics.Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context);
70473
70714
  }
@@ -70653,7 +70894,7 @@ var ts;
70653
70894
  }
70654
70895
  if (compilerOptions.isolatedModules
70655
70896
  && !ts.isTypeOnlyImportOrExportDeclaration(node)
70656
- && !(node.flags & 8388608)) {
70897
+ && !(node.flags & 16777216)) {
70657
70898
  var typeOnlyAlias = getTypeOnlyAliasDeclaration(symbol);
70658
70899
  var isType = !(target.flags & 111551);
70659
70900
  if (isType || typeOnlyAlias) {
@@ -70696,7 +70937,7 @@ var ts;
70696
70937
  }
70697
70938
  }
70698
70939
  function isDeprecatedAliasedSymbol(symbol) {
70699
- return !!symbol.declarations && ts.every(symbol.declarations, function (d) { return !!(ts.getCombinedNodeFlags(d) & 134217728); });
70940
+ return !!symbol.declarations && ts.every(symbol.declarations, function (d) { return !!(ts.getCombinedNodeFlags(d) & 268435456); });
70700
70941
  }
70701
70942
  function checkDeprecatedAliasedSymbol(symbol, location) {
70702
70943
  if (!(symbol.flags & 2097152))
@@ -70821,7 +71062,7 @@ var ts;
70821
71062
  }
70822
71063
  }
70823
71064
  else {
70824
- if (moduleKind >= ts.ModuleKind.ES2015 && ts.getSourceFileOfNode(node).impliedNodeFormat === undefined && !node.isTypeOnly && !(node.flags & 8388608)) {
71065
+ if (moduleKind >= ts.ModuleKind.ES2015 && ts.getSourceFileOfNode(node).impliedNodeFormat === undefined && !node.isTypeOnly && !(node.flags & 16777216)) {
70825
71066
  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);
70826
71067
  }
70827
71068
  }
@@ -70843,7 +71084,7 @@ var ts;
70843
71084
  ts.forEach(node.exportClause.elements, checkExportSpecifier);
70844
71085
  var inAmbientExternalModule = node.parent.kind === 262 && ts.isAmbientModule(node.parent.parent);
70845
71086
  var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 262 &&
70846
- !node.moduleSpecifier && node.flags & 8388608;
71087
+ !node.moduleSpecifier && node.flags & 16777216;
70847
71088
  if (node.parent.kind !== 305 && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) {
70848
71089
  error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace);
70849
71090
  }
@@ -70996,10 +71237,10 @@ var ts;
70996
71237
  checkExpressionCached(node.expression);
70997
71238
  }
70998
71239
  checkExternalModuleExports(container);
70999
- if ((node.flags & 8388608) && !ts.isEntityNameExpression(node.expression)) {
71240
+ if ((node.flags & 16777216) && !ts.isEntityNameExpression(node.expression)) {
71000
71241
  grammarErrorOnNode(node.expression, ts.Diagnostics.The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context);
71001
71242
  }
71002
- if (node.isExportEquals && !(node.flags & 8388608)) {
71243
+ if (node.isExportEquals && !(node.flags & 16777216)) {
71003
71244
  if (moduleKind >= ts.ModuleKind.ES2015 && ts.getSourceFileOfNode(node).impliedNodeFormat !== ts.ModuleKind.CommonJS) {
71004
71245
  grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead);
71005
71246
  }
@@ -71397,7 +71638,7 @@ var ts;
71397
71638
  addLazyDiagnostic(function () {
71398
71639
  if (!node.isDeclarationFile && (compilerOptions.noUnusedLocals || compilerOptions.noUnusedParameters)) {
71399
71640
  checkUnusedIdentifiers(getPotentiallyUnusedIdentifiers(node), function (containingNode, kind, diag) {
71400
- if (!ts.containsParseError(containingNode) && unusedIsError(kind, !!(containingNode.flags & 8388608))) {
71641
+ if (!ts.containsParseError(containingNode) && unusedIsError(kind, !!(containingNode.flags & 16777216))) {
71401
71642
  diagnostics.add(diag);
71402
71643
  }
71403
71644
  });
@@ -71478,7 +71719,7 @@ var ts;
71478
71719
  return diagnostics.getGlobalDiagnostics();
71479
71720
  }
71480
71721
  function getSymbolsInScope(location, meaning) {
71481
- if (location.flags & 16777216) {
71722
+ if (location.flags & 33554432) {
71482
71723
  return [];
71483
71724
  }
71484
71725
  var symbols = ts.createSymbolTable();
@@ -71791,7 +72032,7 @@ var ts;
71791
72032
  }
71792
72033
  var parent = node.parent;
71793
72034
  var grandParent = parent.parent;
71794
- if (node.flags & 16777216) {
72035
+ if (node.flags & 33554432) {
71795
72036
  return undefined;
71796
72037
  }
71797
72038
  if (isDeclarationNameOrImportPropertyName(node)) {
@@ -71921,7 +72162,7 @@ var ts;
71921
72162
  if (ts.isSourceFile(node) && !ts.isExternalModule(node)) {
71922
72163
  return errorType;
71923
72164
  }
71924
- if (node.flags & 16777216) {
72165
+ if (node.flags & 33554432) {
71925
72166
  return errorType;
71926
72167
  }
71927
72168
  var classDecl = ts.tryGetClassImplementingOrExtendingExpressionWithTypeArguments(node);
@@ -72053,11 +72294,11 @@ var ts;
72053
72294
  var _a = symbol, leftSpread = _a.leftSpread, rightSpread = _a.rightSpread, syntheticOrigin = _a.syntheticOrigin;
72054
72295
  return leftSpread ? [leftSpread, rightSpread]
72055
72296
  : syntheticOrigin ? [syntheticOrigin]
72056
- : ts.singleElementArray(tryGetAliasTarget(symbol));
72297
+ : ts.singleElementArray(tryGetTarget(symbol));
72057
72298
  }
72058
72299
  return undefined;
72059
72300
  }
72060
- function tryGetAliasTarget(symbol) {
72301
+ function tryGetTarget(symbol) {
72061
72302
  var target;
72062
72303
  var next = symbol;
72063
72304
  while (next = getSymbolLinks(next).target) {
@@ -72242,7 +72483,7 @@ var ts;
72242
72483
  if (links === null || links === void 0 ? void 0 : links.referenced) {
72243
72484
  return true;
72244
72485
  }
72245
- var target = getSymbolLinks(symbol).target;
72486
+ var target = getSymbolLinks(symbol).aliasTarget;
72246
72487
  if (target && ts.getEffectiveModifierFlags(node) & 1 &&
72247
72488
  target.flags & 111551 &&
72248
72489
  (ts.shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target))) {
@@ -72835,7 +73076,7 @@ var ts;
72835
73076
  function checkExternalEmitHelpers(location, helpers) {
72836
73077
  if ((requestedExternalEmitHelpers & helpers) !== helpers && compilerOptions.importHelpers) {
72837
73078
  var sourceFile = ts.getSourceFileOfNode(location);
72838
- if (ts.isEffectiveExternalModule(sourceFile, compilerOptions) && !(location.flags & 8388608)) {
73079
+ if (ts.isEffectiveExternalModule(sourceFile, compilerOptions) && !(location.flags & 16777216)) {
72839
73080
  var helpersModule = resolveHelpersModule(sourceFile, location);
72840
73081
  if (helpersModule !== unknownSymbol) {
72841
73082
  var uncheckedHelpers = helpers & ~requestedExternalEmitHelpers;
@@ -73085,7 +73326,7 @@ var ts;
73085
73326
  else if (node.kind === 164) {
73086
73327
  return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare");
73087
73328
  }
73088
- else if ((node.parent.flags & 8388608) && node.parent.kind === 262) {
73329
+ else if ((node.parent.flags & 16777216) && node.parent.kind === 262) {
73089
73330
  return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context);
73090
73331
  }
73091
73332
  else if (ts.isPrivateIdentifierClassElementDeclaration(node)) {
@@ -73131,7 +73372,7 @@ var ts;
73131
73372
  if (flags & 256) {
73132
73373
  return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async");
73133
73374
  }
73134
- else if (flags & 2 || node.parent.flags & 8388608) {
73375
+ else if (flags & 2 || node.parent.flags & 16777216) {
73135
73376
  return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async");
73136
73377
  }
73137
73378
  else if (node.kind === 164) {
@@ -73273,7 +73514,7 @@ var ts;
73273
73514
  if (i !== (parameterCount - 1)) {
73274
73515
  return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list);
73275
73516
  }
73276
- if (!(parameter.flags & 8388608)) {
73517
+ if (!(parameter.flags & 16777216)) {
73277
73518
  checkGrammarForDisallowedTrailingComma(parameters, ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma);
73278
73519
  }
73279
73520
  if (parameter.questionToken) {
@@ -73479,7 +73720,7 @@ var ts;
73479
73720
  ts.Debug.assert(node.kind === 256 ||
73480
73721
  node.kind === 213 ||
73481
73722
  node.kind === 169);
73482
- if (node.flags & 8388608) {
73723
+ if (node.flags & 16777216) {
73483
73724
  return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context);
73484
73725
  }
73485
73726
  if (!node.body) {
@@ -73694,7 +73935,7 @@ var ts;
73694
73935
  return false;
73695
73936
  }
73696
73937
  function checkGrammarAccessor(accessor) {
73697
- if (!(accessor.flags & 8388608) && (accessor.parent.kind !== 182) && (accessor.parent.kind !== 258)) {
73938
+ if (!(accessor.flags & 16777216) && (accessor.parent.kind !== 182) && (accessor.parent.kind !== 258)) {
73698
73939
  if (languageVersion < 1) {
73699
73940
  return grammarErrorOnNode(accessor.name, ts.Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher);
73700
73941
  }
@@ -73824,7 +74065,7 @@ var ts;
73824
74065
  if (languageVersion < 2 && ts.isPrivateIdentifier(node.name)) {
73825
74066
  return grammarErrorOnNode(node.name, ts.Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher);
73826
74067
  }
73827
- if (node.flags & 8388608) {
74068
+ if (node.flags & 16777216) {
73828
74069
  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);
73829
74070
  }
73830
74071
  else if (node.kind === 169 && !node.body) {
@@ -73935,7 +74176,7 @@ var ts;
73935
74176
  }
73936
74177
  function checkGrammarVariableDeclaration(node) {
73937
74178
  if (node.parent.parent.kind !== 243 && node.parent.parent.kind !== 244) {
73938
- if (node.flags & 8388608) {
74179
+ if (node.flags & 16777216) {
73939
74180
  checkAmbientInitializer(node);
73940
74181
  }
73941
74182
  else if (!node.initializer) {
@@ -73947,7 +74188,7 @@ var ts;
73947
74188
  }
73948
74189
  }
73949
74190
  }
73950
- if (node.exclamationToken && (node.parent.parent.kind !== 237 || !node.type || node.initializer || node.flags & 8388608)) {
74191
+ if (node.exclamationToken && (node.parent.parent.kind !== 237 || !node.type || node.initializer || node.flags & 16777216)) {
73951
74192
  var message = node.initializer
73952
74193
  ? ts.Diagnostics.Declarations_with_initializers_cannot_also_have_definite_assignment_assertions
73953
74194
  : !node.type
@@ -73956,7 +74197,7 @@ var ts;
73956
74197
  return grammarErrorOnNode(node.exclamationToken, message);
73957
74198
  }
73958
74199
  if ((moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS) && moduleKind !== ts.ModuleKind.System &&
73959
- !(node.parent.parent.flags & 8388608) && ts.hasSyntacticModifier(node.parent.parent, 1)) {
74200
+ !(node.parent.parent.flags & 16777216) && ts.hasSyntacticModifier(node.parent.parent, 1)) {
73960
74201
  checkESModuleMarker(node.name);
73961
74202
  }
73962
74203
  var checkLetConstNames = (ts.isLet(node) || ts.isVarConst(node));
@@ -74127,11 +74368,11 @@ var ts;
74127
74368
  return grammarErrorOnNode(node.initializer, ts.Diagnostics.A_type_literal_property_cannot_have_an_initializer);
74128
74369
  }
74129
74370
  }
74130
- if (node.flags & 8388608) {
74371
+ if (node.flags & 16777216) {
74131
74372
  checkAmbientInitializer(node);
74132
74373
  }
74133
74374
  if (ts.isPropertyDeclaration(node) && node.exclamationToken && (!ts.isClassLike(node.parent) || !node.type || node.initializer ||
74134
- node.flags & 8388608 || ts.isStatic(node) || ts.hasAbstractModifier(node))) {
74375
+ node.flags & 16777216 || ts.isStatic(node) || ts.hasAbstractModifier(node))) {
74135
74376
  var message = node.initializer
74136
74377
  ? ts.Diagnostics.Declarations_with_initializers_cannot_also_have_definite_assignment_assertions
74137
74378
  : !node.type
@@ -74165,10 +74406,10 @@ var ts;
74165
74406
  return false;
74166
74407
  }
74167
74408
  function checkGrammarSourceFile(node) {
74168
- return !!(node.flags & 8388608) && checkGrammarTopLevelElementsForRequiredDeclareModifier(node);
74409
+ return !!(node.flags & 16777216) && checkGrammarTopLevelElementsForRequiredDeclareModifier(node);
74169
74410
  }
74170
74411
  function checkGrammarStatementInAmbientContext(node) {
74171
- if (node.flags & 8388608) {
74412
+ if (node.flags & 16777216) {
74172
74413
  var links = getNodeLinks(node);
74173
74414
  if (!links.hasReportedStatementInAmbientContext && (ts.isFunctionLike(node.parent) || ts.isAccessor(node.parent))) {
74174
74415
  return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts);
@@ -77320,7 +77561,7 @@ var ts;
77320
77561
  return !ts.nodeIsMissing(node.body);
77321
77562
  }
77322
77563
  function visitPropertyDeclaration(node) {
77323
- if (node.flags & 8388608 || ts.hasSyntacticModifier(node, 128)) {
77564
+ if (node.flags & 16777216 || ts.hasSyntacticModifier(node, 128)) {
77324
77565
  return undefined;
77325
77566
  }
77326
77567
  var updated = factory.updatePropertyDeclaration(node, undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), visitPropertyNameOfClassElement(node), undefined, undefined, ts.visitNode(node.initializer, visitor));
@@ -82559,8 +82800,8 @@ var ts;
82559
82800
  }
82560
82801
  function getRangeUnion(declarations) {
82561
82802
  var pos = -1, end = -1;
82562
- for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) {
82563
- var node = declarations_9[_i];
82803
+ for (var _i = 0, declarations_10 = declarations; _i < declarations_10.length; _i++) {
82804
+ var node = declarations_10[_i];
82564
82805
  pos = pos === -1 ? node.pos : node.pos === -1 ? pos : Math.min(pos, node.pos);
82565
82806
  end = Math.max(end, node.end);
82566
82807
  }
@@ -88642,6 +88883,10 @@ var ts;
88642
88883
  return factory.updateModifiers(statement, modifiers);
88643
88884
  }
88644
88885
  function transformTopLevelDeclaration(input) {
88886
+ if (lateMarkedStatements) {
88887
+ while (ts.orderedRemoveItem(lateMarkedStatements, input))
88888
+ ;
88889
+ }
88645
88890
  if (shouldStripInternal(input))
88646
88891
  return;
88647
88892
  switch (input.kind) {
@@ -88735,7 +88980,7 @@ var ts;
88735
88980
  needsScopeFixMarker = false;
88736
88981
  var statements = ts.visitNodes(inner.statements, visitDeclarationStatements);
88737
88982
  var lateStatements = transformAndReplaceLatePaintedStatements(statements);
88738
- if (input.flags & 8388608) {
88983
+ if (input.flags & 16777216) {
88739
88984
  needsScopeFixMarker = false;
88740
88985
  }
88741
88986
  if (!ts.isGlobalScopeAugmentation(input) && !hasScopeMarker(lateStatements) && !resultHasScopeMarker) {
@@ -90175,6 +90420,9 @@ var ts;
90175
90420
  var currentParenthesizerRule;
90176
90421
  var _c = ts.performance.createTimerIf(extendedDiagnostics, "commentTime", "beforeComment", "afterComment"), enterComment = _c.enter, exitComment = _c.exit;
90177
90422
  var parenthesizer = ts.factory.parenthesizer;
90423
+ var typeArgumentParenthesizerRuleSelector = {
90424
+ select: function (index) { return index === 0 ? parenthesizer.parenthesizeLeadingTypeArgument : undefined; }
90425
+ };
90178
90426
  var emitBinaryExpression = createEmitBinaryExpression();
90179
90427
  reset();
90180
90428
  return {
@@ -91298,7 +91546,7 @@ var ts;
91298
91546
  writePunctuation("}");
91299
91547
  }
91300
91548
  function emitArrayType(node) {
91301
- emit(node.elementType, parenthesizer.parenthesizeElementTypeOfArrayType);
91549
+ emit(node.elementType, parenthesizer.parenthesizeNonArrayTypeOfPostfixType);
91302
91550
  writePunctuation("[");
91303
91551
  writePunctuation("]");
91304
91552
  }
@@ -91309,7 +91557,7 @@ var ts;
91309
91557
  function emitTupleType(node) {
91310
91558
  emitTokenWithComment(22, node.pos, writePunctuation, node);
91311
91559
  var flags = ts.getEmitFlags(node) & 1 ? 528 : 657;
91312
- emitList(node, node.elements, flags | 524288);
91560
+ emitList(node, node.elements, flags | 524288, parenthesizer.parenthesizeElementTypeOfTupleType);
91313
91561
  emitTokenWithComment(23, node.elements.end, writePunctuation, node);
91314
91562
  }
91315
91563
  function emitNamedTupleMember(node) {
@@ -91321,21 +91569,21 @@ var ts;
91321
91569
  emit(node.type);
91322
91570
  }
91323
91571
  function emitOptionalType(node) {
91324
- emit(node.type, parenthesizer.parenthesizeElementTypeOfArrayType);
91572
+ emit(node.type, parenthesizer.parenthesizeTypeOfOptionalType);
91325
91573
  writePunctuation("?");
91326
91574
  }
91327
91575
  function emitUnionType(node) {
91328
- emitList(node, node.types, 516, parenthesizer.parenthesizeMemberOfElementType);
91576
+ emitList(node, node.types, 516, parenthesizer.parenthesizeConstituentTypeOfUnionType);
91329
91577
  }
91330
91578
  function emitIntersectionType(node) {
91331
- emitList(node, node.types, 520, parenthesizer.parenthesizeMemberOfElementType);
91579
+ emitList(node, node.types, 520, parenthesizer.parenthesizeConstituentTypeOfIntersectionType);
91332
91580
  }
91333
91581
  function emitConditionalType(node) {
91334
- emit(node.checkType, parenthesizer.parenthesizeMemberOfConditionalType);
91582
+ emit(node.checkType, parenthesizer.parenthesizeCheckTypeOfConditionalType);
91335
91583
  writeSpace();
91336
91584
  writeKeyword("extends");
91337
91585
  writeSpace();
91338
- emit(node.extendsType, parenthesizer.parenthesizeMemberOfConditionalType);
91586
+ emit(node.extendsType, parenthesizer.parenthesizeExtendsTypeOfConditionalType);
91339
91587
  writeSpace();
91340
91588
  writePunctuation("?");
91341
91589
  writeSpace();
@@ -91361,10 +91609,13 @@ var ts;
91361
91609
  function emitTypeOperator(node) {
91362
91610
  writeTokenText(node.operator, writeKeyword);
91363
91611
  writeSpace();
91364
- emit(node.type, parenthesizer.parenthesizeMemberOfElementType);
91612
+ var parenthesizerRule = node.operator === 145 ?
91613
+ parenthesizer.parenthesizeOperandOfReadonlyTypeOperator :
91614
+ parenthesizer.parenthesizeOperandOfTypeOperator;
91615
+ emit(node.type, parenthesizerRule);
91365
91616
  }
91366
91617
  function emitIndexedAccessType(node) {
91367
- emit(node.objectType, parenthesizer.parenthesizeMemberOfElementType);
91618
+ emit(node.objectType, parenthesizer.parenthesizeNonArrayTypeOfPostfixType);
91368
91619
  writePunctuation("[");
91369
91620
  emit(node.indexType);
91370
91621
  writePunctuation("]");
@@ -93005,7 +93256,7 @@ var ts;
93005
93256
  emitList(parentNode, decorators, 2146305);
93006
93257
  }
93007
93258
  function emitTypeArguments(parentNode, typeArguments) {
93008
- emitList(parentNode, typeArguments, 53776, parenthesizer.parenthesizeMemberOfElementType);
93259
+ emitList(parentNode, typeArguments, 53776, typeArgumentParenthesizerRuleSelector);
93009
93260
  }
93010
93261
  function emitTypeParameters(parentNode, typeParameters) {
93011
93262
  if (ts.isFunctionLike(parentNode) && parentNode.typeArguments) {
@@ -93121,6 +93372,7 @@ var ts;
93121
93372
  if (format & 128) {
93122
93373
  increaseIndent();
93123
93374
  }
93375
+ var emitListItem = getEmitListItem(emit, parenthesizerRule);
93124
93376
  var previousSibling = void 0;
93125
93377
  var previousSourceFileTextKind = void 0;
93126
93378
  var shouldDecreaseIndentAfterEmit = false;
@@ -93158,12 +93410,7 @@ var ts;
93158
93410
  shouldEmitInterveningComments = mayEmitInterveningComments;
93159
93411
  }
93160
93412
  nextListElementPos = child.pos;
93161
- if (emit.length === 1) {
93162
- emit(child);
93163
- }
93164
- else {
93165
- emit(child, parenthesizerRule);
93166
- }
93413
+ emitListItem(child, emit, parenthesizerRule, i);
93167
93414
  if (shouldDecreaseIndentAfterEmit) {
93168
93415
  decreaseIndent();
93169
93416
  shouldDecreaseIndentAfterEmit = false;
@@ -94217,6 +94464,20 @@ var ts;
94217
94464
  function getClosingBracket(format) {
94218
94465
  return brackets[format & 15360][1];
94219
94466
  }
94467
+ function emitListItemNoParenthesizer(node, emit, _parenthesizerRule, _index) {
94468
+ emit(node);
94469
+ }
94470
+ function emitListItemWithParenthesizerRuleSelector(node, emit, parenthesizerRuleSelector, index) {
94471
+ emit(node, parenthesizerRuleSelector.select(index));
94472
+ }
94473
+ function emitListItemWithParenthesizerRule(node, emit, parenthesizerRule, _index) {
94474
+ emit(node, parenthesizerRule);
94475
+ }
94476
+ function getEmitListItem(emit, parenthesizerRule) {
94477
+ return emit.length === 1 ? emitListItemNoParenthesizer :
94478
+ typeof parenthesizerRule === "object" ? emitListItemWithParenthesizerRuleSelector :
94479
+ emitListItemWithParenthesizerRule;
94480
+ }
94220
94481
  })(ts || (ts = {}));
94221
94482
  var ts;
94222
94483
  (function (ts) {
@@ -96013,7 +96274,7 @@ var ts;
96013
96274
  if (!ts.arrayIsEqualTo(oldSourceFile.moduleAugmentations, newSourceFile.moduleAugmentations, moduleNameIsEqualTo)) {
96014
96275
  structureIsReused = 1;
96015
96276
  }
96016
- if ((oldSourceFile.flags & 3145728) !== (newSourceFile.flags & 3145728)) {
96277
+ if ((oldSourceFile.flags & 6291456) !== (newSourceFile.flags & 6291456)) {
96017
96278
  structureIsReused = 1;
96018
96279
  }
96019
96280
  if (!ts.arrayIsEqualTo(oldSourceFile.typeReferenceDirectives, newSourceFile.typeReferenceDirectives, fileReferenceIsEqualTo)) {
@@ -96160,6 +96421,9 @@ var ts;
96160
96421
  return !!sourceFilesFoundSearchingNodeModules.get(file.path);
96161
96422
  }
96162
96423
  function isSourceFileDefaultLibrary(file) {
96424
+ if (!file.isDeclarationFile) {
96425
+ return false;
96426
+ }
96163
96427
  if (file.hasNoDefaultLib) {
96164
96428
  return true;
96165
96429
  }
@@ -96615,7 +96879,7 @@ var ts;
96615
96879
  var node = _a[_i];
96616
96880
  collectModuleReferences(node, false);
96617
96881
  }
96618
- if ((file.flags & 1048576) || isJavaScriptFile) {
96882
+ if ((file.flags & 2097152) || isJavaScriptFile) {
96619
96883
  collectDynamicImportOrRequireCalls(file);
96620
96884
  }
96621
96885
  file.imports = imports || ts.emptyArray;
@@ -97137,7 +97401,7 @@ var ts;
97137
97401
  && index < file.imports.length
97138
97402
  && !elideImport
97139
97403
  && !(isJsFile && !ts.getAllowJSCompilerOption(optionsForFile))
97140
- && (ts.isInJSFile(file.imports[index]) || !(file.imports[index].flags & 4194304));
97404
+ && (ts.isInJSFile(file.imports[index]) || !(file.imports[index].flags & 8388608));
97141
97405
  if (elideImport) {
97142
97406
  modulesWithElidedImports.set(file.path, true);
97143
97407
  }
@@ -97213,21 +97477,6 @@ var ts;
97213
97477
  return resolvedRef;
97214
97478
  }
97215
97479
  function verifyCompilerOptions() {
97216
- var isNightly = ts.stringContains(ts.version, "-dev") || ts.stringContains(ts.version, "-insiders");
97217
- if (!isNightly) {
97218
- if (ts.getEmitModuleKind(options) === ts.ModuleKind.Node12) {
97219
- createOptionValueDiagnostic("module", ts.Diagnostics.Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next, "module", "node12");
97220
- }
97221
- else if (ts.getEmitModuleKind(options) === ts.ModuleKind.NodeNext) {
97222
- createOptionValueDiagnostic("module", ts.Diagnostics.Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next, "module", "nodenext");
97223
- }
97224
- else if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node12) {
97225
- createOptionValueDiagnostic("moduleResolution", ts.Diagnostics.Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next, "moduleResolution", "node12");
97226
- }
97227
- else if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) {
97228
- createOptionValueDiagnostic("moduleResolution", ts.Diagnostics.Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next, "moduleResolution", "nodenext");
97229
- }
97230
- }
97231
97480
  if (options.strictPropertyInitialization && !ts.getStrictOptionValue(options, "strictNullChecks")) {
97232
97481
  createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "strictPropertyInitialization", "strictNullChecks");
97233
97482
  }