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.
@@ -89,7 +89,7 @@ var ts;
89
89
  // The following is baselined as a literal template type without intervention
90
90
  /** The version of the TypeScript compiler release */
91
91
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
92
- ts.version = ts.versionMajorMinor + ".0-dev.20220404";
92
+ ts.version = ts.versionMajorMinor + ".0-dev.20220408";
93
93
  /* @internal */
94
94
  var Comparison;
95
95
  (function (Comparison) {
@@ -4404,10 +4404,11 @@ var ts;
4404
4404
  NodeFlags[NodeFlags["YieldContext"] = 8192] = "YieldContext";
4405
4405
  NodeFlags[NodeFlags["DecoratorContext"] = 16384] = "DecoratorContext";
4406
4406
  NodeFlags[NodeFlags["AwaitContext"] = 32768] = "AwaitContext";
4407
- NodeFlags[NodeFlags["ThisNodeHasError"] = 65536] = "ThisNodeHasError";
4408
- NodeFlags[NodeFlags["JavaScriptFile"] = 131072] = "JavaScriptFile";
4409
- NodeFlags[NodeFlags["ThisNodeOrAnySubNodesHasError"] = 262144] = "ThisNodeOrAnySubNodesHasError";
4410
- NodeFlags[NodeFlags["HasAggregatedChildData"] = 524288] = "HasAggregatedChildData";
4407
+ NodeFlags[NodeFlags["DisallowConditionalTypesContext"] = 65536] = "DisallowConditionalTypesContext";
4408
+ NodeFlags[NodeFlags["ThisNodeHasError"] = 131072] = "ThisNodeHasError";
4409
+ NodeFlags[NodeFlags["JavaScriptFile"] = 262144] = "JavaScriptFile";
4410
+ NodeFlags[NodeFlags["ThisNodeOrAnySubNodesHasError"] = 524288] = "ThisNodeOrAnySubNodesHasError";
4411
+ NodeFlags[NodeFlags["HasAggregatedChildData"] = 1048576] = "HasAggregatedChildData";
4411
4412
  // These flags will be set when the parser encounters a dynamic import expression or 'import.meta' to avoid
4412
4413
  // walking the tree if the flags are not set. However, these flags are just a approximation
4413
4414
  // (hence why it's named "PossiblyContainsDynamicImport") because once set, the flags never get cleared.
@@ -4417,25 +4418,25 @@ var ts;
4417
4418
  // removal, it is likely that users will add the import anyway.
4418
4419
  // The advantage of this approach is its simplicity. For the case of batch compilation,
4419
4420
  // we guarantee that users won't have to pay the price of walking the tree if a dynamic import isn't used.
4420
- /* @internal */ NodeFlags[NodeFlags["PossiblyContainsDynamicImport"] = 1048576] = "PossiblyContainsDynamicImport";
4421
- /* @internal */ NodeFlags[NodeFlags["PossiblyContainsImportMeta"] = 2097152] = "PossiblyContainsImportMeta";
4422
- NodeFlags[NodeFlags["JSDoc"] = 4194304] = "JSDoc";
4423
- /* @internal */ NodeFlags[NodeFlags["Ambient"] = 8388608] = "Ambient";
4424
- /* @internal */ NodeFlags[NodeFlags["InWithStatement"] = 16777216] = "InWithStatement";
4425
- NodeFlags[NodeFlags["JsonFile"] = 33554432] = "JsonFile";
4426
- /* @internal */ NodeFlags[NodeFlags["TypeCached"] = 67108864] = "TypeCached";
4427
- /* @internal */ NodeFlags[NodeFlags["Deprecated"] = 134217728] = "Deprecated";
4421
+ /* @internal */ NodeFlags[NodeFlags["PossiblyContainsDynamicImport"] = 2097152] = "PossiblyContainsDynamicImport";
4422
+ /* @internal */ NodeFlags[NodeFlags["PossiblyContainsImportMeta"] = 4194304] = "PossiblyContainsImportMeta";
4423
+ NodeFlags[NodeFlags["JSDoc"] = 8388608] = "JSDoc";
4424
+ /* @internal */ NodeFlags[NodeFlags["Ambient"] = 16777216] = "Ambient";
4425
+ /* @internal */ NodeFlags[NodeFlags["InWithStatement"] = 33554432] = "InWithStatement";
4426
+ NodeFlags[NodeFlags["JsonFile"] = 67108864] = "JsonFile";
4427
+ /* @internal */ NodeFlags[NodeFlags["TypeCached"] = 134217728] = "TypeCached";
4428
+ /* @internal */ NodeFlags[NodeFlags["Deprecated"] = 268435456] = "Deprecated";
4428
4429
  NodeFlags[NodeFlags["BlockScoped"] = 3] = "BlockScoped";
4429
4430
  NodeFlags[NodeFlags["ReachabilityCheckFlags"] = 768] = "ReachabilityCheckFlags";
4430
4431
  NodeFlags[NodeFlags["ReachabilityAndEmitFlags"] = 2816] = "ReachabilityAndEmitFlags";
4431
4432
  // Parsing context flags
4432
- NodeFlags[NodeFlags["ContextFlags"] = 25358336] = "ContextFlags";
4433
+ NodeFlags[NodeFlags["ContextFlags"] = 50720768] = "ContextFlags";
4433
4434
  // Exclude these flags when parsing a Type
4434
4435
  NodeFlags[NodeFlags["TypeExcludesFlags"] = 40960] = "TypeExcludesFlags";
4435
4436
  // Represents all flags that are potentially set once and
4436
4437
  // never cleared on SourceFiles which get re-used in between incremental parses.
4437
4438
  // See the comment above on `PossiblyContainsDynamicImport` and `PossiblyContainsImportMeta`.
4438
- /* @internal */ NodeFlags[NodeFlags["PermanentlySetIncrementalFlags"] = 3145728] = "PermanentlySetIncrementalFlags";
4439
+ /* @internal */ NodeFlags[NodeFlags["PermanentlySetIncrementalFlags"] = 6291456] = "PermanentlySetIncrementalFlags";
4439
4440
  })(NodeFlags = ts.NodeFlags || (ts.NodeFlags = {}));
4440
4441
  var ModifierFlags;
4441
4442
  (function (ModifierFlags) {
@@ -8705,6 +8706,7 @@ var ts;
8705
8706
  _0_index_signatures_are_incompatible: diag(2634, ts.DiagnosticCategory.Error, "_0_index_signatures_are_incompatible_2634", "'{0}' index signatures are incompatible."),
8706
8707
  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."),
8707
8708
  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."),
8709
+ 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."),
8708
8710
  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."),
8709
8711
  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."),
8710
8712
  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."),
@@ -8877,6 +8879,7 @@ var ts;
8877
8879
  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}'?"),
8878
8880
  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."),
8879
8881
  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."),
8882
+ 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."),
8880
8883
  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}'."),
8881
8884
  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}'."),
8882
8885
  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}'."),
@@ -14291,24 +14294,24 @@ var ts;
14291
14294
  // Returns true if this node contains a parse error anywhere underneath it.
14292
14295
  function containsParseError(node) {
14293
14296
  aggregateChildData(node);
14294
- return (node.flags & 262144 /* ThisNodeOrAnySubNodesHasError */) !== 0;
14297
+ return (node.flags & 524288 /* ThisNodeOrAnySubNodesHasError */) !== 0;
14295
14298
  }
14296
14299
  ts.containsParseError = containsParseError;
14297
14300
  function aggregateChildData(node) {
14298
- if (!(node.flags & 524288 /* HasAggregatedChildData */)) {
14301
+ if (!(node.flags & 1048576 /* HasAggregatedChildData */)) {
14299
14302
  // A node is considered to contain a parse error if:
14300
14303
  // a) the parser explicitly marked that it had an error
14301
14304
  // b) any of it's children reported that it had an error.
14302
- var thisNodeOrAnySubNodesHasError = ((node.flags & 65536 /* ThisNodeHasError */) !== 0) ||
14305
+ var thisNodeOrAnySubNodesHasError = ((node.flags & 131072 /* ThisNodeHasError */) !== 0) ||
14303
14306
  ts.forEachChild(node, containsParseError);
14304
14307
  // If so, mark ourselves accordingly.
14305
14308
  if (thisNodeOrAnySubNodesHasError) {
14306
- node.flags |= 262144 /* ThisNodeOrAnySubNodesHasError */;
14309
+ node.flags |= 524288 /* ThisNodeOrAnySubNodesHasError */;
14307
14310
  }
14308
14311
  // Also mark that we've propagated the child information to this node. This way we can
14309
14312
  // always consult the bit directly on this node without needing to check its children
14310
14313
  // again.
14311
- node.flags |= 524288 /* HasAggregatedChildData */;
14314
+ node.flags |= 1048576 /* HasAggregatedChildData */;
14312
14315
  }
14313
14316
  }
14314
14317
  function getSourceFileOfNode(node) {
@@ -16115,11 +16118,11 @@ var ts;
16115
16118
  }
16116
16119
  ts.isSourceFileNotJS = isSourceFileNotJS;
16117
16120
  function isInJSFile(node) {
16118
- return !!node && !!(node.flags & 131072 /* JavaScriptFile */);
16121
+ return !!node && !!(node.flags & 262144 /* JavaScriptFile */);
16119
16122
  }
16120
16123
  ts.isInJSFile = isInJSFile;
16121
16124
  function isInJsonFile(node) {
16122
- return !!node && !!(node.flags & 33554432 /* JsonFile */);
16125
+ return !!node && !!(node.flags & 67108864 /* JsonFile */);
16123
16126
  }
16124
16127
  ts.isInJsonFile = isInJsonFile;
16125
16128
  function isSourceFileNotJson(file) {
@@ -16127,7 +16130,7 @@ var ts;
16127
16130
  }
16128
16131
  ts.isSourceFileNotJson = isSourceFileNotJson;
16129
16132
  function isInJSDoc(node) {
16130
- return !!node && !!(node.flags & 4194304 /* JSDoc */);
16133
+ return !!node && !!(node.flags & 8388608 /* JSDoc */);
16131
16134
  }
16132
16135
  ts.isInJSDoc = isInJSDoc;
16133
16136
  function isJSDocIndexSignature(node) {
@@ -16513,7 +16516,7 @@ var ts;
16513
16516
  function setValueDeclaration(symbol, node) {
16514
16517
  var valueDeclaration = symbol.valueDeclaration;
16515
16518
  if (!valueDeclaration ||
16516
- !(node.flags & 8388608 /* Ambient */ && !(valueDeclaration.flags & 8388608 /* Ambient */)) &&
16519
+ !(node.flags & 16777216 /* Ambient */ && !(valueDeclaration.flags & 16777216 /* Ambient */)) &&
16517
16520
  (isAssignmentDeclaration(valueDeclaration) && !isAssignmentDeclaration(node)) ||
16518
16521
  (valueDeclaration.kind !== node.kind && isEffectiveModuleDeclaration(valueDeclaration))) {
16519
16522
  // other kinds of value declarations take precedence over modules and assignment declarations
@@ -16786,7 +16789,11 @@ var ts;
16786
16789
  ts.getEffectiveContainerForJSDocTemplateTag = getEffectiveContainerForJSDocTemplateTag;
16787
16790
  function getHostSignatureFromJSDoc(node) {
16788
16791
  var host = getEffectiveJSDocHost(node);
16789
- return host && ts.isFunctionLike(host) ? host : undefined;
16792
+ if (host) {
16793
+ return ts.isPropertySignature(host) && host.type && ts.isFunctionLike(host.type) ? host.type :
16794
+ ts.isFunctionLike(host) ? host : undefined;
16795
+ }
16796
+ return undefined;
16790
16797
  }
16791
16798
  ts.getHostSignatureFromJSDoc = getHostSignatureFromJSDoc;
16792
16799
  function getEffectiveJSDocHost(node) {
@@ -20811,7 +20818,7 @@ var ts;
20811
20818
  }
20812
20819
  ts.pseudoBigIntToString = pseudoBigIntToString;
20813
20820
  function isValidTypeOnlyAliasUseSite(useSite) {
20814
- return !!(useSite.flags & 8388608 /* Ambient */)
20821
+ return !!(useSite.flags & 16777216 /* Ambient */)
20815
20822
  || isPartOfTypeQuery(useSite)
20816
20823
  || isIdentifierInNonEmittingHeritageClause(useSite)
20817
20824
  || isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(useSite)
@@ -21264,11 +21271,20 @@ var ts;
21264
21271
  parenthesizeExpressionForDisallowedComma: parenthesizeExpressionForDisallowedComma,
21265
21272
  parenthesizeExpressionOfExpressionStatement: parenthesizeExpressionOfExpressionStatement,
21266
21273
  parenthesizeConciseBodyOfArrowFunction: parenthesizeConciseBodyOfArrowFunction,
21267
- parenthesizeMemberOfConditionalType: parenthesizeMemberOfConditionalType,
21268
- parenthesizeMemberOfElementType: parenthesizeMemberOfElementType,
21269
- parenthesizeElementTypeOfArrayType: parenthesizeElementTypeOfArrayType,
21270
- parenthesizeConstituentTypesOfUnionOrIntersectionType: parenthesizeConstituentTypesOfUnionOrIntersectionType,
21274
+ parenthesizeCheckTypeOfConditionalType: parenthesizeCheckTypeOfConditionalType,
21275
+ parenthesizeExtendsTypeOfConditionalType: parenthesizeExtendsTypeOfConditionalType,
21276
+ parenthesizeConstituentTypesOfUnionType: parenthesizeConstituentTypesOfUnionType,
21277
+ parenthesizeConstituentTypeOfUnionType: parenthesizeConstituentTypeOfUnionType,
21278
+ parenthesizeConstituentTypesOfIntersectionType: parenthesizeConstituentTypesOfIntersectionType,
21279
+ parenthesizeConstituentTypeOfIntersectionType: parenthesizeConstituentTypeOfIntersectionType,
21280
+ parenthesizeOperandOfTypeOperator: parenthesizeOperandOfTypeOperator,
21281
+ parenthesizeOperandOfReadonlyTypeOperator: parenthesizeOperandOfReadonlyTypeOperator,
21282
+ parenthesizeNonArrayTypeOfPostfixType: parenthesizeNonArrayTypeOfPostfixType,
21283
+ parenthesizeElementTypesOfTupleType: parenthesizeElementTypesOfTupleType,
21284
+ parenthesizeElementTypeOfTupleType: parenthesizeElementTypeOfTupleType,
21285
+ parenthesizeTypeOfOptionalType: parenthesizeTypeOfOptionalType,
21271
21286
  parenthesizeTypeArguments: parenthesizeTypeArguments,
21287
+ parenthesizeLeadingTypeArgument: parenthesizeLeadingTypeArgument,
21272
21288
  };
21273
21289
  function getParenthesizeLeftSideOfBinaryForOperator(operatorKind) {
21274
21290
  binaryLeftOperandParenthesizerCache || (binaryLeftOperandParenthesizerCache = new ts.Map());
@@ -21580,33 +21596,191 @@ var ts;
21580
21596
  }
21581
21597
  return body;
21582
21598
  }
21583
- function parenthesizeMemberOfConditionalType(member) {
21584
- return member.kind === 189 /* ConditionalType */ ? factory.createParenthesizedType(member) : member;
21599
+ // Type[Extends] :
21600
+ // FunctionOrConstructorType
21601
+ // ConditionalType[?Extends]
21602
+ // ConditionalType[Extends] :
21603
+ // UnionType[?Extends]
21604
+ // [~Extends] UnionType[~Extends] `extends` Type[+Extends] `?` Type[~Extends] `:` Type[~Extends]
21605
+ //
21606
+ // - The check type (the `UnionType`, above) does not allow function, constructor, or conditional types (they must be parenthesized)
21607
+ // - The extends type (the first `Type`, above) does not allow conditional types (they must be parenthesized). Function and constructor types are fine.
21608
+ // - The true and false branch types (the second and third `Type` non-terminals, above) allow any type
21609
+ function parenthesizeCheckTypeOfConditionalType(checkType) {
21610
+ switch (checkType.kind) {
21611
+ case 179 /* FunctionType */:
21612
+ case 180 /* ConstructorType */:
21613
+ case 189 /* ConditionalType */:
21614
+ return factory.createParenthesizedType(checkType);
21615
+ }
21616
+ return checkType;
21585
21617
  }
21586
- function parenthesizeMemberOfElementType(member) {
21587
- switch (member.kind) {
21618
+ function parenthesizeExtendsTypeOfConditionalType(extendsType) {
21619
+ switch (extendsType.kind) {
21620
+ case 189 /* ConditionalType */:
21621
+ return factory.createParenthesizedType(extendsType);
21622
+ }
21623
+ return extendsType;
21624
+ }
21625
+ // UnionType[Extends] :
21626
+ // `|`? IntersectionType[?Extends]
21627
+ // UnionType[?Extends] `|` IntersectionType[?Extends]
21628
+ //
21629
+ // - A union type constituent has the same precedence as the check type of a conditional type
21630
+ function parenthesizeConstituentTypeOfUnionType(type) {
21631
+ switch (type.kind) {
21632
+ case 187 /* UnionType */: // Not strictly necessary, but a union containing a union should have been flattened
21633
+ case 188 /* IntersectionType */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests
21634
+ return factory.createParenthesizedType(type);
21635
+ }
21636
+ return parenthesizeCheckTypeOfConditionalType(type);
21637
+ }
21638
+ function parenthesizeConstituentTypesOfUnionType(members) {
21639
+ return factory.createNodeArray(ts.sameMap(members, parenthesizeConstituentTypeOfUnionType));
21640
+ }
21641
+ // IntersectionType[Extends] :
21642
+ // `&`? TypeOperator[?Extends]
21643
+ // IntersectionType[?Extends] `&` TypeOperator[?Extends]
21644
+ //
21645
+ // - An intersection type constituent does not allow function, constructor, conditional, or union types (they must be parenthesized)
21646
+ function parenthesizeConstituentTypeOfIntersectionType(type) {
21647
+ switch (type.kind) {
21588
21648
  case 187 /* UnionType */:
21649
+ case 188 /* IntersectionType */: // Not strictly necessary, but an intersection containing an intersection should have been flattened
21650
+ return factory.createParenthesizedType(type);
21651
+ }
21652
+ return parenthesizeConstituentTypeOfUnionType(type);
21653
+ }
21654
+ function parenthesizeConstituentTypesOfIntersectionType(members) {
21655
+ return factory.createNodeArray(ts.sameMap(members, parenthesizeConstituentTypeOfIntersectionType));
21656
+ }
21657
+ // TypeOperator[Extends] :
21658
+ // PostfixType
21659
+ // InferType[?Extends]
21660
+ // `keyof` TypeOperator[?Extends]
21661
+ // `unique` TypeOperator[?Extends]
21662
+ // `readonly` TypeOperator[?Extends]
21663
+ //
21664
+ function parenthesizeOperandOfTypeOperator(type) {
21665
+ switch (type.kind) {
21589
21666
  case 188 /* IntersectionType */:
21590
- case 179 /* FunctionType */:
21591
- case 180 /* ConstructorType */:
21592
- return factory.createParenthesizedType(member);
21667
+ return factory.createParenthesizedType(type);
21593
21668
  }
21594
- return parenthesizeMemberOfConditionalType(member);
21669
+ return parenthesizeConstituentTypeOfIntersectionType(type);
21595
21670
  }
21596
- function parenthesizeElementTypeOfArrayType(member) {
21597
- switch (member.kind) {
21598
- case 181 /* TypeQuery */:
21671
+ function parenthesizeOperandOfReadonlyTypeOperator(type) {
21672
+ switch (type.kind) {
21599
21673
  case 193 /* TypeOperator */:
21674
+ return factory.createParenthesizedType(type);
21675
+ }
21676
+ return parenthesizeOperandOfTypeOperator(type);
21677
+ }
21678
+ // PostfixType :
21679
+ // NonArrayType
21680
+ // NonArrayType [no LineTerminator here] `!` // JSDoc
21681
+ // NonArrayType [no LineTerminator here] `?` // JSDoc
21682
+ // IndexedAccessType
21683
+ // ArrayType
21684
+ //
21685
+ // IndexedAccessType :
21686
+ // NonArrayType `[` Type[~Extends] `]`
21687
+ //
21688
+ // ArrayType :
21689
+ // NonArrayType `[` `]`
21690
+ //
21691
+ function parenthesizeNonArrayTypeOfPostfixType(type) {
21692
+ switch (type.kind) {
21600
21693
  case 190 /* InferType */:
21601
- return factory.createParenthesizedType(member);
21694
+ case 193 /* TypeOperator */:
21695
+ case 181 /* TypeQuery */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests
21696
+ return factory.createParenthesizedType(type);
21602
21697
  }
21603
- return parenthesizeMemberOfElementType(member);
21698
+ return parenthesizeOperandOfTypeOperator(type);
21699
+ }
21700
+ // TupleType :
21701
+ // `[` Elision? `]`
21702
+ // `[` NamedTupleElementTypes `]`
21703
+ // `[` NamedTupleElementTypes `,` Elision? `]`
21704
+ // `[` TupleElementTypes `]`
21705
+ // `[` TupleElementTypes `,` Elision? `]`
21706
+ //
21707
+ // NamedTupleElementTypes :
21708
+ // Elision? NamedTupleMember
21709
+ // NamedTupleElementTypes `,` Elision? NamedTupleMember
21710
+ //
21711
+ // NamedTupleMember :
21712
+ // Identifier `?`? `:` Type[~Extends]
21713
+ // `...` Identifier `:` Type[~Extends]
21714
+ //
21715
+ // TupleElementTypes :
21716
+ // Elision? TupleElementType
21717
+ // TupleElementTypes `,` Elision? TupleElementType
21718
+ //
21719
+ // TupleElementType :
21720
+ // Type[~Extends] // NOTE: Needs cover grammar to disallow JSDoc postfix-optional
21721
+ // OptionalType
21722
+ // RestType
21723
+ //
21724
+ // OptionalType :
21725
+ // Type[~Extends] `?` // NOTE: Needs cover grammar to disallow JSDoc postfix-optional
21726
+ //
21727
+ // RestType :
21728
+ // `...` Type[~Extends]
21729
+ //
21730
+ function parenthesizeElementTypesOfTupleType(types) {
21731
+ return factory.createNodeArray(ts.sameMap(types, parenthesizeElementTypeOfTupleType));
21732
+ }
21733
+ function parenthesizeElementTypeOfTupleType(type) {
21734
+ if (hasJSDocPostfixQuestion(type))
21735
+ return factory.createParenthesizedType(type);
21736
+ return type;
21604
21737
  }
21605
- function parenthesizeConstituentTypesOfUnionOrIntersectionType(members) {
21606
- return factory.createNodeArray(ts.sameMap(members, parenthesizeMemberOfElementType));
21738
+ function hasJSDocPostfixQuestion(type) {
21739
+ if (ts.isJSDocNullableType(type))
21740
+ return type.postfix;
21741
+ if (ts.isNamedTupleMember(type))
21742
+ return hasJSDocPostfixQuestion(type.type);
21743
+ if (ts.isFunctionTypeNode(type) || ts.isConstructorTypeNode(type) || ts.isTypeOperatorNode(type))
21744
+ return hasJSDocPostfixQuestion(type.type);
21745
+ if (ts.isConditionalTypeNode(type))
21746
+ return hasJSDocPostfixQuestion(type.falseType);
21747
+ if (ts.isUnionTypeNode(type))
21748
+ return hasJSDocPostfixQuestion(ts.last(type.types));
21749
+ if (ts.isIntersectionTypeNode(type))
21750
+ return hasJSDocPostfixQuestion(ts.last(type.types));
21751
+ if (ts.isInferTypeNode(type))
21752
+ return !!type.typeParameter.constraint && hasJSDocPostfixQuestion(type.typeParameter.constraint);
21753
+ return false;
21754
+ }
21755
+ function parenthesizeTypeOfOptionalType(type) {
21756
+ if (hasJSDocPostfixQuestion(type))
21757
+ return factory.createParenthesizedType(type);
21758
+ return parenthesizeNonArrayTypeOfPostfixType(type);
21759
+ }
21760
+ // function parenthesizeMemberOfElementType(member: TypeNode): TypeNode {
21761
+ // switch (member.kind) {
21762
+ // case SyntaxKind.UnionType:
21763
+ // case SyntaxKind.IntersectionType:
21764
+ // case SyntaxKind.FunctionType:
21765
+ // case SyntaxKind.ConstructorType:
21766
+ // return factory.createParenthesizedType(member);
21767
+ // }
21768
+ // return parenthesizeMemberOfConditionalType(member);
21769
+ // }
21770
+ // function parenthesizeElementTypeOfArrayType(member: TypeNode): TypeNode {
21771
+ // switch (member.kind) {
21772
+ // case SyntaxKind.TypeQuery:
21773
+ // case SyntaxKind.TypeOperator:
21774
+ // case SyntaxKind.InferType:
21775
+ // return factory.createParenthesizedType(member);
21776
+ // }
21777
+ // return parenthesizeMemberOfElementType(member);
21778
+ // }
21779
+ function parenthesizeLeadingTypeArgument(node) {
21780
+ return ts.isFunctionOrConstructorTypeNode(node) && node.typeParameters ? factory.createParenthesizedType(node) : node;
21607
21781
  }
21608
21782
  function parenthesizeOrdinalTypeArgument(node, i) {
21609
- return i === 0 && ts.isFunctionOrConstructorTypeNode(node) && node.typeParameters ? factory.createParenthesizedType(node) : node;
21783
+ return i === 0 ? parenthesizeLeadingTypeArgument(node) : node;
21610
21784
  }
21611
21785
  function parenthesizeTypeArguments(typeArguments) {
21612
21786
  if (ts.some(typeArguments)) {
@@ -21632,11 +21806,20 @@ var ts;
21632
21806
  parenthesizeExpressionForDisallowedComma: ts.identity,
21633
21807
  parenthesizeExpressionOfExpressionStatement: ts.identity,
21634
21808
  parenthesizeConciseBodyOfArrowFunction: ts.identity,
21635
- parenthesizeMemberOfConditionalType: ts.identity,
21636
- parenthesizeMemberOfElementType: ts.identity,
21637
- parenthesizeElementTypeOfArrayType: ts.identity,
21638
- parenthesizeConstituentTypesOfUnionOrIntersectionType: function (nodes) { return ts.cast(nodes, ts.isNodeArray); },
21809
+ parenthesizeCheckTypeOfConditionalType: ts.identity,
21810
+ parenthesizeExtendsTypeOfConditionalType: ts.identity,
21811
+ parenthesizeConstituentTypesOfUnionType: function (nodes) { return ts.cast(nodes, ts.isNodeArray); },
21812
+ parenthesizeConstituentTypeOfUnionType: ts.identity,
21813
+ parenthesizeConstituentTypesOfIntersectionType: function (nodes) { return ts.cast(nodes, ts.isNodeArray); },
21814
+ parenthesizeConstituentTypeOfIntersectionType: ts.identity,
21815
+ parenthesizeOperandOfTypeOperator: ts.identity,
21816
+ parenthesizeOperandOfReadonlyTypeOperator: ts.identity,
21817
+ parenthesizeNonArrayTypeOfPostfixType: ts.identity,
21818
+ parenthesizeElementTypesOfTupleType: function (nodes) { return ts.cast(nodes, ts.isNodeArray); },
21819
+ parenthesizeElementTypeOfTupleType: ts.identity,
21820
+ parenthesizeTypeOfOptionalType: ts.identity,
21639
21821
  parenthesizeTypeArguments: function (nodes) { return nodes && ts.cast(nodes, ts.isNodeArray); },
21822
+ parenthesizeLeadingTypeArgument: ts.identity,
21640
21823
  };
21641
21824
  })(ts || (ts = {}));
21642
21825
  /* @internal */
@@ -21776,6 +21959,8 @@ var ts;
21776
21959
  var getJSDocPrimaryTypeCreateFunction = ts.memoizeOne(function (kind) { return function () { return createJSDocPrimaryTypeWorker(kind); }; });
21777
21960
  var getJSDocUnaryTypeCreateFunction = ts.memoizeOne(function (kind) { return function (type) { return createJSDocUnaryTypeWorker(kind, type); }; });
21778
21961
  var getJSDocUnaryTypeUpdateFunction = ts.memoizeOne(function (kind) { return function (node, type) { return updateJSDocUnaryTypeWorker(kind, node, type); }; });
21962
+ var getJSDocPrePostfixUnaryTypeCreateFunction = ts.memoizeOne(function (kind) { return function (type, postfix) { return createJSDocPrePostfixUnaryTypeWorker(kind, type, postfix); }; });
21963
+ var getJSDocPrePostfixUnaryTypeUpdateFunction = ts.memoizeOne(function (kind) { return function (node, type) { return updateJSDocPrePostfixUnaryTypeWorker(kind, node, type); }; });
21779
21964
  var getJSDocSimpleTagCreateFunction = ts.memoizeOne(function (kind) { return function (tagName, comment) { return createJSDocSimpleTagWorker(kind, tagName, comment); }; });
21780
21965
  var getJSDocSimpleTagUpdateFunction = ts.memoizeOne(function (kind) { return function (node, tagName, comment) { return updateJSDocSimpleTagWorker(kind, node, tagName, comment); }; });
21781
21966
  var getJSDocTypeLikeTagCreateFunction = ts.memoizeOne(function (kind) { return function (tagName, typeExpression, comment) { return createJSDocTypeLikeTagWorker(kind, tagName, typeExpression, comment); }; });
@@ -21783,6 +21968,8 @@ var ts;
21783
21968
  var factory = {
21784
21969
  get parenthesizer() { return parenthesizerRules(); },
21785
21970
  get converters() { return converters(); },
21971
+ baseFactory: baseFactory,
21972
+ flags: flags,
21786
21973
  createNodeArray: createNodeArray,
21787
21974
  createNumericLiteral: createNumericLiteral,
21788
21975
  createBigIntLiteral: createBigIntLiteral,
@@ -22058,10 +22245,10 @@ var ts;
22058
22245
  // lazily load factory members for JSDoc types with similar structure
22059
22246
  get createJSDocAllType() { return getJSDocPrimaryTypeCreateFunction(312 /* JSDocAllType */); },
22060
22247
  get createJSDocUnknownType() { return getJSDocPrimaryTypeCreateFunction(313 /* JSDocUnknownType */); },
22061
- get createJSDocNonNullableType() { return getJSDocUnaryTypeCreateFunction(315 /* JSDocNonNullableType */); },
22062
- get updateJSDocNonNullableType() { return getJSDocUnaryTypeUpdateFunction(315 /* JSDocNonNullableType */); },
22063
- get createJSDocNullableType() { return getJSDocUnaryTypeCreateFunction(314 /* JSDocNullableType */); },
22064
- get updateJSDocNullableType() { return getJSDocUnaryTypeUpdateFunction(314 /* JSDocNullableType */); },
22248
+ get createJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(315 /* JSDocNonNullableType */); },
22249
+ get updateJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(315 /* JSDocNonNullableType */); },
22250
+ get createJSDocNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(314 /* JSDocNullableType */); },
22251
+ get updateJSDocNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(314 /* JSDocNullableType */); },
22065
22252
  get createJSDocOptionalType() { return getJSDocUnaryTypeCreateFunction(316 /* JSDocOptionalType */); },
22066
22253
  get updateJSDocOptionalType() { return getJSDocUnaryTypeUpdateFunction(316 /* JSDocOptionalType */); },
22067
22254
  get createJSDocVariadicType() { return getJSDocUnaryTypeCreateFunction(318 /* JSDocVariadicType */); },
@@ -23177,7 +23364,7 @@ var ts;
23177
23364
  // @api
23178
23365
  function createArrayTypeNode(elementType) {
23179
23366
  var node = createBaseNode(183 /* ArrayType */);
23180
- node.elementType = parenthesizerRules().parenthesizeElementTypeOfArrayType(elementType);
23367
+ node.elementType = parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(elementType);
23181
23368
  node.transformFlags = 1 /* ContainsTypeScript */;
23182
23369
  return node;
23183
23370
  }
@@ -23190,7 +23377,7 @@ var ts;
23190
23377
  // @api
23191
23378
  function createTupleTypeNode(elements) {
23192
23379
  var node = createBaseNode(184 /* TupleType */);
23193
- node.elements = createNodeArray(elements);
23380
+ node.elements = createNodeArray(parenthesizerRules().parenthesizeElementTypesOfTupleType(elements));
23194
23381
  node.transformFlags = 1 /* ContainsTypeScript */;
23195
23382
  return node;
23196
23383
  }
@@ -23222,7 +23409,7 @@ var ts;
23222
23409
  // @api
23223
23410
  function createOptionalTypeNode(type) {
23224
23411
  var node = createBaseNode(185 /* OptionalType */);
23225
- node.type = parenthesizerRules().parenthesizeElementTypeOfArrayType(type);
23412
+ node.type = parenthesizerRules().parenthesizeTypeOfOptionalType(type);
23226
23413
  node.transformFlags = 1 /* ContainsTypeScript */;
23227
23414
  return node;
23228
23415
  }
@@ -23245,38 +23432,38 @@ var ts;
23245
23432
  ? update(createRestTypeNode(type), node)
23246
23433
  : node;
23247
23434
  }
23248
- function createUnionOrIntersectionTypeNode(kind, types) {
23435
+ function createUnionOrIntersectionTypeNode(kind, types, parenthesize) {
23249
23436
  var node = createBaseNode(kind);
23250
- node.types = parenthesizerRules().parenthesizeConstituentTypesOfUnionOrIntersectionType(types);
23437
+ node.types = factory.createNodeArray(parenthesize(types));
23251
23438
  node.transformFlags = 1 /* ContainsTypeScript */;
23252
23439
  return node;
23253
23440
  }
23254
- function updateUnionOrIntersectionTypeNode(node, types) {
23441
+ function updateUnionOrIntersectionTypeNode(node, types, parenthesize) {
23255
23442
  return node.types !== types
23256
- ? update(createUnionOrIntersectionTypeNode(node.kind, types), node)
23443
+ ? update(createUnionOrIntersectionTypeNode(node.kind, types, parenthesize), node)
23257
23444
  : node;
23258
23445
  }
23259
23446
  // @api
23260
23447
  function createUnionTypeNode(types) {
23261
- return createUnionOrIntersectionTypeNode(187 /* UnionType */, types);
23448
+ return createUnionOrIntersectionTypeNode(187 /* UnionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType);
23262
23449
  }
23263
23450
  // @api
23264
23451
  function updateUnionTypeNode(node, types) {
23265
- return updateUnionOrIntersectionTypeNode(node, types);
23452
+ return updateUnionOrIntersectionTypeNode(node, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType);
23266
23453
  }
23267
23454
  // @api
23268
23455
  function createIntersectionTypeNode(types) {
23269
- return createUnionOrIntersectionTypeNode(188 /* IntersectionType */, types);
23456
+ return createUnionOrIntersectionTypeNode(188 /* IntersectionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType);
23270
23457
  }
23271
23458
  // @api
23272
23459
  function updateIntersectionTypeNode(node, types) {
23273
- return updateUnionOrIntersectionTypeNode(node, types);
23460
+ return updateUnionOrIntersectionTypeNode(node, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType);
23274
23461
  }
23275
23462
  // @api
23276
23463
  function createConditionalTypeNode(checkType, extendsType, trueType, falseType) {
23277
23464
  var node = createBaseNode(189 /* ConditionalType */);
23278
- node.checkType = parenthesizerRules().parenthesizeMemberOfConditionalType(checkType);
23279
- node.extendsType = parenthesizerRules().parenthesizeMemberOfConditionalType(extendsType);
23465
+ node.checkType = parenthesizerRules().parenthesizeCheckTypeOfConditionalType(checkType);
23466
+ node.extendsType = parenthesizerRules().parenthesizeExtendsTypeOfConditionalType(extendsType);
23280
23467
  node.trueType = trueType;
23281
23468
  node.falseType = falseType;
23282
23469
  node.transformFlags = 1 /* ContainsTypeScript */;
@@ -23371,7 +23558,9 @@ var ts;
23371
23558
  function createTypeOperatorNode(operator, type) {
23372
23559
  var node = createBaseNode(193 /* TypeOperator */);
23373
23560
  node.operator = operator;
23374
- node.type = parenthesizerRules().parenthesizeMemberOfElementType(type);
23561
+ node.type = operator === 145 /* ReadonlyKeyword */ ?
23562
+ parenthesizerRules().parenthesizeOperandOfReadonlyTypeOperator(type) :
23563
+ parenthesizerRules().parenthesizeOperandOfTypeOperator(type);
23375
23564
  node.transformFlags = 1 /* ContainsTypeScript */;
23376
23565
  return node;
23377
23566
  }
@@ -23384,7 +23573,7 @@ var ts;
23384
23573
  // @api
23385
23574
  function createIndexedAccessTypeNode(objectType, indexType) {
23386
23575
  var node = createBaseNode(194 /* IndexedAccessType */);
23387
- node.objectType = parenthesizerRules().parenthesizeMemberOfElementType(objectType);
23576
+ node.objectType = parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(objectType);
23388
23577
  node.indexType = indexType;
23389
23578
  node.transformFlags = 1 /* ContainsTypeScript */;
23390
23579
  return node;
@@ -25120,8 +25309,15 @@ var ts;
25120
25309
  return createBaseNode(kind);
25121
25310
  }
25122
25311
  // @api
25123
- // createJSDocNonNullableType
25124
25312
  // createJSDocNullableType
25313
+ // createJSDocNonNullableType
25314
+ function createJSDocPrePostfixUnaryTypeWorker(kind, type, postfix) {
25315
+ if (postfix === void 0) { postfix = false; }
25316
+ var node = createJSDocUnaryTypeWorker(kind, postfix ? type && parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(type) : type);
25317
+ node.postfix = postfix;
25318
+ return node;
25319
+ }
25320
+ // @api
25125
25321
  // createJSDocOptionalType
25126
25322
  // createJSDocVariadicType
25127
25323
  // createJSDocNamepathType
@@ -25133,6 +25329,12 @@ var ts;
25133
25329
  // @api
25134
25330
  // updateJSDocNonNullableType
25135
25331
  // updateJSDocNullableType
25332
+ function updateJSDocPrePostfixUnaryTypeWorker(kind, node, type) {
25333
+ return node.type !== type
25334
+ ? update(createJSDocPrePostfixUnaryTypeWorker(kind, type, node.postfix), node)
25335
+ : node;
25336
+ }
25337
+ // @api
25136
25338
  // updateJSDocOptionalType
25137
25339
  // updateJSDocVariadicType
25138
25340
  // updateJSDocNamepathType
@@ -30213,7 +30415,7 @@ var ts;
30213
30415
  || ts.isExportDeclaration(node) ? node : undefined;
30214
30416
  }
30215
30417
  function getImportMetaIfNecessary(sourceFile) {
30216
- return sourceFile.flags & 2097152 /* PossiblyContainsImportMeta */ ?
30418
+ return sourceFile.flags & 4194304 /* PossiblyContainsImportMeta */ ?
30217
30419
  walkTreeForImportMeta(sourceFile) :
30218
30420
  undefined;
30219
30421
  }
@@ -30868,7 +31070,7 @@ var ts;
30868
31070
  var newSourceFile = IncrementalParser.updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks);
30869
31071
  // Because new source file node is created, it may not have the flag PossiblyContainDynamicImport. This is the case if there is no new edit to add dynamic import.
30870
31072
  // We will manually port the flag to the new source file.
30871
- newSourceFile.flags |= (sourceFile.flags & 3145728 /* PermanentlySetIncrementalFlags */);
31073
+ newSourceFile.flags |= (sourceFile.flags & 6291456 /* PermanentlySetIncrementalFlags */);
30872
31074
  return newSourceFile;
30873
31075
  }
30874
31076
  ts.updateSourceFile = updateSourceFile;
@@ -31152,10 +31354,10 @@ var ts;
31152
31354
  switch (scriptKind) {
31153
31355
  case 1 /* JS */:
31154
31356
  case 2 /* JSX */:
31155
- contextFlags = 131072 /* JavaScriptFile */;
31357
+ contextFlags = 262144 /* JavaScriptFile */;
31156
31358
  break;
31157
31359
  case 6 /* JSON */:
31158
- contextFlags = 131072 /* JavaScriptFile */ | 33554432 /* JsonFile */;
31360
+ contextFlags = 262144 /* JavaScriptFile */ | 67108864 /* JsonFile */;
31159
31361
  break;
31160
31362
  default:
31161
31363
  contextFlags = 0 /* None */;
@@ -31190,7 +31392,7 @@ var ts;
31190
31392
  function parseSourceFileWorker(languageVersion, setParentNodes, scriptKind, setExternalModuleIndicator) {
31191
31393
  var isDeclarationFile = isDeclarationFileName(fileName);
31192
31394
  if (isDeclarationFile) {
31193
- contextFlags |= 8388608 /* Ambient */;
31395
+ contextFlags |= 16777216 /* Ambient */;
31194
31396
  }
31195
31397
  sourceFlags = contextFlags;
31196
31398
  // Prime the scanner.
@@ -31229,7 +31431,7 @@ var ts;
31229
31431
  node.jsDoc = jsDoc;
31230
31432
  if (hasDeprecatedTag) {
31231
31433
  hasDeprecatedTag = false;
31232
- node.flags |= 134217728 /* Deprecated */;
31434
+ node.flags |= 268435456 /* Deprecated */;
31233
31435
  }
31234
31436
  return node;
31235
31437
  }
@@ -31424,6 +31626,12 @@ var ts;
31424
31626
  function disallowInAnd(func) {
31425
31627
  return doInsideOfContext(4096 /* DisallowInContext */, func);
31426
31628
  }
31629
+ function allowConditionalTypesAnd(func) {
31630
+ return doOutsideOfContext(65536 /* DisallowConditionalTypesContext */, func);
31631
+ }
31632
+ function disallowConditionalTypesAnd(func) {
31633
+ return doInsideOfContext(65536 /* DisallowConditionalTypesContext */, func);
31634
+ }
31427
31635
  function doInYieldContext(func) {
31428
31636
  return doInsideOfContext(8192 /* YieldContext */, func);
31429
31637
  }
@@ -31451,6 +31659,9 @@ var ts;
31451
31659
  function inDisallowInContext() {
31452
31660
  return inContext(4096 /* DisallowInContext */);
31453
31661
  }
31662
+ function inDisallowConditionalTypesContext() {
31663
+ return inContext(65536 /* DisallowConditionalTypesContext */);
31664
+ }
31454
31665
  function inDecoratorContext() {
31455
31666
  return inContext(16384 /* DecoratorContext */);
31456
31667
  }
@@ -31835,7 +32046,7 @@ var ts;
31835
32046
  // flag so that we don't mark any subsequent nodes.
31836
32047
  if (parseErrorBeforeNextFinishedNode) {
31837
32048
  parseErrorBeforeNextFinishedNode = false;
31838
- node.flags |= 65536 /* ThisNodeHasError */;
32049
+ node.flags |= 131072 /* ThisNodeHasError */;
31839
32050
  }
31840
32051
  return node;
31841
32052
  }
@@ -32293,7 +32504,7 @@ var ts;
32293
32504
  // differently depending on what mode it is in.
32294
32505
  //
32295
32506
  // This also applies to all our other context flags as well.
32296
- var nodeContextFlags = node.flags & 25358336 /* ContextFlags */;
32507
+ var nodeContextFlags = node.flags & 50720768 /* ContextFlags */;
32297
32508
  if (nodeContextFlags !== contextFlags) {
32298
32509
  return undefined;
32299
32510
  }
@@ -32552,7 +32763,6 @@ var ts;
32552
32763
  default: return [undefined]; // TODO: GH#18217 `default: Debug.assertNever(context);`
32553
32764
  }
32554
32765
  }
32555
- // Parses a comma-delimited list of elements
32556
32766
  function parseDelimitedList(kind, parseElement, considerSemicolonAsDelimiter) {
32557
32767
  var saveParsingContext = parsingContext;
32558
32768
  parsingContext |= 1 << kind;
@@ -32562,7 +32772,11 @@ var ts;
32562
32772
  while (true) {
32563
32773
  if (isListElement(kind, /*inErrorRecovery*/ false)) {
32564
32774
  var startPos = scanner.getStartPos();
32565
- list.push(parseListElement(kind, parseElement));
32775
+ var result = parseListElement(kind, parseElement);
32776
+ if (!result) {
32777
+ return undefined;
32778
+ }
32779
+ list.push(result);
32566
32780
  commaStart = scanner.getTokenPos();
32567
32781
  if (parseOptional(27 /* CommaToken */)) {
32568
32782
  // No need to check for a zero length node since we know we parsed a comma
@@ -32815,7 +33029,7 @@ var ts;
32815
33029
  function parseJSDocNonNullableType() {
32816
33030
  var pos = getNodePos();
32817
33031
  nextToken();
32818
- return finishNode(factory.createJSDocNonNullableType(parseNonArrayType()), pos);
33032
+ return finishNode(factory.createJSDocNonNullableType(parseNonArrayType(), /*postfix*/ false), pos);
32819
33033
  }
32820
33034
  function parseJSDocUnknownOrNullableType() {
32821
33035
  var pos = getNodePos();
@@ -32839,7 +33053,7 @@ var ts;
32839
33053
  return finishNode(factory.createJSDocUnknownType(), pos);
32840
33054
  }
32841
33055
  else {
32842
- return finishNode(factory.createJSDocNullableType(parseType()), pos);
33056
+ return finishNode(factory.createJSDocNullableType(parseType(), /*postfix*/ false), pos);
32843
33057
  }
32844
33058
  }
32845
33059
  function parseJSDocFunctionType() {
@@ -32967,13 +33181,20 @@ var ts;
32967
33181
  }
32968
33182
  return name;
32969
33183
  }
32970
- function parseParameterInOuterAwaitContext() {
32971
- return parseParameterWorker(/*inOuterAwaitContext*/ true);
33184
+ function isParameterNameStart() {
33185
+ // Be permissive about await and yield by calling isBindingIdentifier instead of isIdentifier; disallowing
33186
+ // them during a speculative parse leads to many more follow-on errors than allowing the function to parse then later
33187
+ // complaining about the use of the keywords.
33188
+ return isBindingIdentifier() || token() === 22 /* OpenBracketToken */ || token() === 18 /* OpenBraceToken */;
32972
33189
  }
32973
- function parseParameter() {
32974
- return parseParameterWorker(/*inOuterAwaitContext*/ false);
33190
+ function parseParameter(inOuterAwaitContext) {
33191
+ return parseParameterWorker(inOuterAwaitContext);
32975
33192
  }
32976
- function parseParameterWorker(inOuterAwaitContext) {
33193
+ function parseParameterForSpeculation(inOuterAwaitContext) {
33194
+ return parseParameterWorker(inOuterAwaitContext, /*allowAmbiguity*/ false);
33195
+ }
33196
+ function parseParameterWorker(inOuterAwaitContext, allowAmbiguity) {
33197
+ if (allowAmbiguity === void 0) { allowAmbiguity = true; }
32977
33198
  var pos = getNodePos();
32978
33199
  var hasJSDoc = hasPrecedingJSDocComment();
32979
33200
  // FormalParameter [Yield,Await]:
@@ -32994,13 +33215,17 @@ var ts;
32994
33215
  var savedTopLevel = topLevel;
32995
33216
  topLevel = false;
32996
33217
  var modifiers = parseModifiers();
32997
- var node = withJSDoc(finishNode(factory.createParameterDeclaration(decorators, modifiers, parseOptionalToken(25 /* DotDotDotToken */), parseNameOfParameter(modifiers), parseOptionalToken(57 /* QuestionToken */), parseTypeAnnotation(), parseInitializer()), pos), hasJSDoc);
33218
+ var dotDotDotToken = parseOptionalToken(25 /* DotDotDotToken */);
33219
+ if (!allowAmbiguity && !isParameterNameStart()) {
33220
+ return undefined;
33221
+ }
33222
+ var node = withJSDoc(finishNode(factory.createParameterDeclaration(decorators, modifiers, dotDotDotToken, parseNameOfParameter(modifiers), parseOptionalToken(57 /* QuestionToken */), parseTypeAnnotation(), parseInitializer()), pos), hasJSDoc);
32998
33223
  topLevel = savedTopLevel;
32999
33224
  return node;
33000
33225
  }
33001
33226
  function parseReturnType(returnToken, isType) {
33002
33227
  if (shouldParseReturnType(returnToken, isType)) {
33003
- return parseTypeOrTypePredicate();
33228
+ return allowConditionalTypesAnd(parseTypeOrTypePredicate);
33004
33229
  }
33005
33230
  }
33006
33231
  function shouldParseReturnType(returnToken, isType) {
@@ -33019,7 +33244,7 @@ var ts;
33019
33244
  }
33020
33245
  return false;
33021
33246
  }
33022
- function parseParametersWorker(flags) {
33247
+ function parseParametersWorker(flags, allowAmbiguity) {
33023
33248
  // FormalParameters [Yield,Await]: (modified)
33024
33249
  // [empty]
33025
33250
  // FormalParameterList[?Yield,Await]
@@ -33039,7 +33264,7 @@ var ts;
33039
33264
  setAwaitContext(!!(flags & 2 /* Await */));
33040
33265
  var parameters = flags & 32 /* JSDoc */ ?
33041
33266
  parseDelimitedList(17 /* JSDocParameters */, parseJSDocParameter) :
33042
- parseDelimitedList(16 /* Parameters */, savedAwaitContext ? parseParameterInOuterAwaitContext : parseParameter);
33267
+ parseDelimitedList(16 /* Parameters */, function () { return allowAmbiguity ? parseParameter(savedAwaitContext) : parseParameterForSpeculation(savedAwaitContext); });
33043
33268
  setYieldContext(savedYieldContext);
33044
33269
  setAwaitContext(savedAwaitContext);
33045
33270
  return parameters;
@@ -33061,7 +33286,7 @@ var ts;
33061
33286
  if (!parseExpected(20 /* OpenParenToken */)) {
33062
33287
  return createMissingList();
33063
33288
  }
33064
- var parameters = parseParametersWorker(flags);
33289
+ var parameters = parseParametersWorker(flags, /*allowAmbiguity*/ true);
33065
33290
  parseExpected(21 /* CloseParenToken */);
33066
33291
  return parameters;
33067
33292
  }
@@ -33143,7 +33368,7 @@ var ts;
33143
33368
  return token() === 58 /* ColonToken */ || token() === 27 /* CommaToken */ || token() === 23 /* CloseBracketToken */;
33144
33369
  }
33145
33370
  function parseIndexSignatureDeclaration(pos, hasJSDoc, decorators, modifiers) {
33146
- var parameters = parseBracketedList(16 /* Parameters */, parseParameter, 22 /* OpenBracketToken */, 23 /* CloseBracketToken */);
33371
+ var parameters = parseBracketedList(16 /* Parameters */, function () { return parseParameter(/*inOuterAwaitContext*/ false); }, 22 /* OpenBracketToken */, 23 /* CloseBracketToken */);
33147
33372
  var type = parseTypeAnnotation();
33148
33373
  parseTypeMemberSemicolon();
33149
33374
  var node = factory.createIndexSignature(decorators, modifiers, parameters, type);
@@ -33415,7 +33640,7 @@ var ts;
33415
33640
  return finishNode(factory.createImportTypeAssertionContainer(clause, multiLine), pos);
33416
33641
  }
33417
33642
  function parseImportType() {
33418
- sourceFlags |= 1048576 /* PossiblyContainsDynamicImport */;
33643
+ sourceFlags |= 2097152 /* PossiblyContainsDynamicImport */;
33419
33644
  var pos = getNodePos();
33420
33645
  var isTypeOf = parseOptional(112 /* TypeOfKeyword */);
33421
33646
  parseExpected(100 /* ImportKeyword */);
@@ -33565,7 +33790,7 @@ var ts;
33565
33790
  switch (token()) {
33566
33791
  case 53 /* ExclamationToken */:
33567
33792
  nextToken();
33568
- type = finishNode(factory.createJSDocNonNullableType(type), pos);
33793
+ type = finishNode(factory.createJSDocNonNullableType(type, /*postfix*/ true), pos);
33569
33794
  break;
33570
33795
  case 57 /* QuestionToken */:
33571
33796
  // If next token is start of a type we have a conditional type
@@ -33573,7 +33798,7 @@ var ts;
33573
33798
  return type;
33574
33799
  }
33575
33800
  nextToken();
33576
- type = finishNode(factory.createJSDocNullableType(type), pos);
33801
+ type = finishNode(factory.createJSDocNullableType(type, /*postfix*/ true), pos);
33577
33802
  break;
33578
33803
  case 22 /* OpenBracketToken */:
33579
33804
  parseExpected(22 /* OpenBracketToken */);
@@ -33598,12 +33823,20 @@ var ts;
33598
33823
  parseExpected(operator);
33599
33824
  return finishNode(factory.createTypeOperatorNode(operator, parseTypeOperatorOrHigher()), pos);
33600
33825
  }
33826
+ function tryParseConstraintOfInferType() {
33827
+ if (parseOptional(94 /* ExtendsKeyword */)) {
33828
+ var constraint = disallowConditionalTypesAnd(parseType);
33829
+ if (inDisallowConditionalTypesContext() || token() !== 57 /* QuestionToken */) {
33830
+ return constraint;
33831
+ }
33832
+ }
33833
+ }
33601
33834
  function parseTypeParameterOfInferType() {
33602
33835
  var pos = getNodePos();
33603
- return finishNode(factory.createTypeParameterDeclaration(
33604
- /*modifiers*/ undefined, parseIdentifier(),
33605
- /*constraint*/ undefined,
33606
- /*defaultType*/ undefined), pos);
33836
+ var name = parseIdentifier();
33837
+ var constraint = tryParse(tryParseConstraintOfInferType);
33838
+ var node = factory.createTypeParameterDeclaration(/*modifiers*/ undefined, name, constraint);
33839
+ return finishNode(node, pos);
33607
33840
  }
33608
33841
  function parseInferType() {
33609
33842
  var pos = getNodePos();
@@ -33620,7 +33853,7 @@ var ts;
33620
33853
  case 137 /* InferKeyword */:
33621
33854
  return parseInferType();
33622
33855
  }
33623
- return parsePostfixTypeOrHigher();
33856
+ return allowConditionalTypesAnd(parsePostfixTypeOrHigher);
33624
33857
  }
33625
33858
  function parseFunctionOrConstructorTypeToError(isInUnionType) {
33626
33859
  // the function type and constructor type shorthand notation
@@ -33750,23 +33983,21 @@ var ts;
33750
33983
  return finishNode(factory.createTypePredicateNode(assertsModifier, parameterName, type), pos);
33751
33984
  }
33752
33985
  function parseType() {
33753
- // The rules about 'yield' only apply to actual code/expression contexts. They don't
33754
- // apply to 'type' contexts. So we disable these parameters here before moving on.
33755
- return doOutsideOfContext(40960 /* TypeExcludesFlags */, parseTypeWorker);
33756
- }
33757
- function parseTypeWorker(noConditionalTypes) {
33986
+ if (contextFlags & 40960 /* TypeExcludesFlags */) {
33987
+ return doOutsideOfContext(40960 /* TypeExcludesFlags */, parseType);
33988
+ }
33758
33989
  if (isStartOfFunctionTypeOrConstructorType()) {
33759
33990
  return parseFunctionOrConstructorType();
33760
33991
  }
33761
33992
  var pos = getNodePos();
33762
33993
  var type = parseUnionTypeOrHigher();
33763
- if (!noConditionalTypes && !scanner.hasPrecedingLineBreak() && parseOptional(94 /* ExtendsKeyword */)) {
33994
+ if (!inDisallowConditionalTypesContext() && !scanner.hasPrecedingLineBreak() && parseOptional(94 /* ExtendsKeyword */)) {
33764
33995
  // The type following 'extends' is not permitted to be another conditional type
33765
- var extendsType = parseTypeWorker(/*noConditionalTypes*/ true);
33996
+ var extendsType = disallowConditionalTypesAnd(parseType);
33766
33997
  parseExpected(57 /* QuestionToken */);
33767
- var trueType = parseTypeWorker();
33998
+ var trueType = allowConditionalTypesAnd(parseType);
33768
33999
  parseExpected(58 /* ColonToken */);
33769
- var falseType = parseTypeWorker();
34000
+ var falseType = allowConditionalTypesAnd(parseType);
33770
34001
  return finishNode(factory.createConditionalTypeNode(type, extendsType, trueType, falseType), pos);
33771
34002
  }
33772
34003
  return type;
@@ -34193,7 +34424,16 @@ var ts;
34193
34424
  parameters = createMissingList();
34194
34425
  }
34195
34426
  else {
34196
- parameters = parseParametersWorker(isAsync);
34427
+ if (!allowAmbiguity) {
34428
+ var maybeParameters = parseParametersWorker(isAsync, allowAmbiguity);
34429
+ if (!maybeParameters) {
34430
+ return undefined;
34431
+ }
34432
+ parameters = maybeParameters;
34433
+ }
34434
+ else {
34435
+ parameters = parseParametersWorker(isAsync, allowAmbiguity);
34436
+ }
34197
34437
  if (!parseExpected(21 /* CloseParenToken */) && !allowAmbiguity) {
34198
34438
  return undefined;
34199
34439
  }
@@ -34594,7 +34834,7 @@ var ts;
34594
34834
  // var foo3 = require("subfolder
34595
34835
  // import * as foo1 from "module-from-node
34596
34836
  // We want this import to be a statement rather than import call expression
34597
- sourceFlags |= 1048576 /* PossiblyContainsDynamicImport */;
34837
+ sourceFlags |= 2097152 /* PossiblyContainsDynamicImport */;
34598
34838
  expression = parseTokenNode();
34599
34839
  }
34600
34840
  else if (lookAhead(nextTokenIsDot)) {
@@ -34602,7 +34842,7 @@ var ts;
34602
34842
  nextToken(); // advance past the 'import'
34603
34843
  nextToken(); // advance past the dot
34604
34844
  expression = finishNode(factory.createMetaProperty(100 /* ImportKeyword */, parseIdentifierName()), pos);
34605
- sourceFlags |= 2097152 /* PossiblyContainsImportMeta */;
34845
+ sourceFlags |= 4194304 /* PossiblyContainsImportMeta */;
34606
34846
  }
34607
34847
  else {
34608
34848
  expression = parseMemberExpressionOrHigher();
@@ -34818,7 +35058,7 @@ var ts;
34818
35058
  return finishNode(factory.createJsxOpeningFragment(), pos);
34819
35059
  }
34820
35060
  var tagName = parseJsxElementName();
34821
- var typeArguments = (contextFlags & 131072 /* JavaScriptFile */) === 0 ? tryParseTypeArguments() : undefined;
35061
+ var typeArguments = (contextFlags & 262144 /* JavaScriptFile */) === 0 ? tryParseTypeArguments() : undefined;
34822
35062
  var attributes = parseJsxAttributes();
34823
35063
  var node;
34824
35064
  if (token() === 31 /* GreaterThanToken */) {
@@ -35096,7 +35336,7 @@ var ts;
35096
35336
  return result;
35097
35337
  }
35098
35338
  function parseTypeArgumentsInExpression() {
35099
- if ((contextFlags & 131072 /* JavaScriptFile */) !== 0) {
35339
+ if ((contextFlags & 262144 /* JavaScriptFile */) !== 0) {
35100
35340
  // TypeArguments must not be parsed in JavaScript files to avoid ambiguity with binary operators.
35101
35341
  return undefined;
35102
35342
  }
@@ -35492,7 +35732,7 @@ var ts;
35492
35732
  var openParenParsed = parseExpected(20 /* OpenParenToken */);
35493
35733
  var expression = allowInAnd(parseExpression);
35494
35734
  parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenParsed, openParenPosition);
35495
- var statement = doInsideOfContext(16777216 /* InWithStatement */, parseStatement);
35735
+ var statement = doInsideOfContext(33554432 /* InWithStatement */, parseStatement);
35496
35736
  return withJSDoc(finishNode(factory.createWithStatement(expression, statement), pos), hasJSDoc);
35497
35737
  }
35498
35738
  function parseCaseClause() {
@@ -35867,16 +36107,16 @@ var ts;
35867
36107
  if (isAmbient) {
35868
36108
  for (var _i = 0, _a = modifiers; _i < _a.length; _i++) {
35869
36109
  var m = _a[_i];
35870
- m.flags |= 8388608 /* Ambient */;
36110
+ m.flags |= 16777216 /* Ambient */;
35871
36111
  }
35872
- return doInsideOfContext(8388608 /* Ambient */, function () { return parseDeclarationWorker(pos, hasJSDoc, decorators, modifiers); });
36112
+ return doInsideOfContext(16777216 /* Ambient */, function () { return parseDeclarationWorker(pos, hasJSDoc, decorators, modifiers); });
35873
36113
  }
35874
36114
  else {
35875
36115
  return parseDeclarationWorker(pos, hasJSDoc, decorators, modifiers);
35876
36116
  }
35877
36117
  }
35878
36118
  function tryReuseAmbientDeclaration() {
35879
- return doInsideOfContext(8388608 /* Ambient */, function () {
36119
+ return doInsideOfContext(16777216 /* Ambient */, function () {
35880
36120
  var node = currentNode(parsingContext);
35881
36121
  if (node) {
35882
36122
  return consumeNode(node);
@@ -36343,9 +36583,9 @@ var ts;
36343
36583
  if (isAmbient) {
36344
36584
  for (var _i = 0, _a = modifiers; _i < _a.length; _i++) {
36345
36585
  var m = _a[_i];
36346
- m.flags |= 8388608 /* Ambient */;
36586
+ m.flags |= 16777216 /* Ambient */;
36347
36587
  }
36348
- return doInsideOfContext(8388608 /* Ambient */, function () { return parsePropertyOrMethodDeclaration(pos, hasJSDoc, decorators, modifiers); });
36588
+ return doInsideOfContext(16777216 /* Ambient */, function () { return parsePropertyOrMethodDeclaration(pos, hasJSDoc, decorators, modifiers); });
36349
36589
  }
36350
36590
  else {
36351
36591
  return parsePropertyOrMethodDeclaration(pos, hasJSDoc, decorators, modifiers);
@@ -36910,7 +37150,7 @@ var ts;
36910
37150
  function parseJSDocTypeExpression(mayOmitBraces) {
36911
37151
  var pos = getNodePos();
36912
37152
  var hasBrace = (mayOmitBraces ? parseOptional : parseExpected)(18 /* OpenBraceToken */);
36913
- var type = doInsideOfContext(4194304 /* JSDoc */, parseJSDocType);
37153
+ var type = doInsideOfContext(8388608 /* JSDoc */, parseJSDocType);
36914
37154
  if (!mayOmitBraces || hasBrace) {
36915
37155
  parseExpectedJSDoc(19 /* CloseBraceToken */);
36916
37156
  }
@@ -36939,7 +37179,7 @@ var ts;
36939
37179
  JSDocParser.parseJSDocNameReference = parseJSDocNameReference;
36940
37180
  function parseIsolatedJSDocComment(content, start, length) {
36941
37181
  initializeState("", content, 99 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);
36942
- var jsDoc = doInsideOfContext(4194304 /* JSDoc */, function () { return parseJSDocCommentWorker(start, length); });
37182
+ var jsDoc = doInsideOfContext(8388608 /* JSDoc */, function () { return parseJSDocCommentWorker(start, length); });
36943
37183
  var sourceFile = { languageVariant: 0 /* Standard */, text: content };
36944
37184
  var diagnostics = ts.attachFileToDiagnostics(parseDiagnostics, sourceFile);
36945
37185
  clearState();
@@ -36950,9 +37190,9 @@ var ts;
36950
37190
  var saveToken = currentToken;
36951
37191
  var saveParseDiagnosticsLength = parseDiagnostics.length;
36952
37192
  var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode;
36953
- var comment = doInsideOfContext(4194304 /* JSDoc */, function () { return parseJSDocCommentWorker(start, length); });
37193
+ var comment = doInsideOfContext(8388608 /* JSDoc */, function () { return parseJSDocCommentWorker(start, length); });
36954
37194
  ts.setParent(comment, parent);
36955
- if (contextFlags & 131072 /* JavaScriptFile */) {
37195
+ if (contextFlags & 262144 /* JavaScriptFile */) {
36956
37196
  if (!jsDocDiagnostics) {
36957
37197
  jsDocDiagnostics = [];
36958
37198
  }
@@ -37768,7 +38008,7 @@ var ts;
37768
38008
  if (isBracketed) {
37769
38009
  skipWhitespace();
37770
38010
  parseExpected(63 /* EqualsToken */);
37771
- defaultType = doInsideOfContext(4194304 /* JSDoc */, parseJSDocType);
38011
+ defaultType = doInsideOfContext(8388608 /* JSDoc */, parseJSDocType);
37772
38012
  parseExpected(23 /* CloseBracketToken */);
37773
38013
  }
37774
38014
  if (ts.nodeIsMissing(name)) {
@@ -45522,6 +45762,7 @@ var ts;
45522
45762
  case 261 /* ModuleDeclaration */:
45523
45763
  case 259 /* TypeAliasDeclaration */:
45524
45764
  case 195 /* MappedType */:
45765
+ case 176 /* IndexSignature */:
45525
45766
  return 1 /* IsContainer */ | 32 /* HasLocals */;
45526
45767
  case 305 /* SourceFile */:
45527
45768
  return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */;
@@ -45540,7 +45781,6 @@ var ts;
45540
45781
  case 317 /* JSDocFunctionType */:
45541
45782
  case 179 /* FunctionType */:
45542
45783
  case 175 /* ConstructSignature */:
45543
- case 176 /* IndexSignature */:
45544
45784
  case 180 /* ConstructorType */:
45545
45785
  case 170 /* ClassStaticBlockDeclaration */:
45546
45786
  return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */;
@@ -45656,7 +45896,7 @@ var ts;
45656
45896
  function setExportContextFlag(node) {
45657
45897
  // A declaration source file or ambient module declaration that contains no export declarations (but possibly regular
45658
45898
  // declarations with export modifiers) is an export context in which declarations are implicitly exported.
45659
- if (node.flags & 8388608 /* Ambient */ && !hasExportDeclarations(node)) {
45899
+ if (node.flags & 16777216 /* Ambient */ && !hasExportDeclarations(node)) {
45660
45900
  node.flags |= 64 /* ExportContext */;
45661
45901
  }
45662
45902
  else {
@@ -45859,8 +46099,8 @@ var ts;
45859
46099
  function checkContextualIdentifier(node) {
45860
46100
  // Report error only if there are no parse errors in file
45861
46101
  if (!file.parseDiagnostics.length &&
45862
- !(node.flags & 8388608 /* Ambient */) &&
45863
- !(node.flags & 4194304 /* JSDoc */) &&
46102
+ !(node.flags & 16777216 /* Ambient */) &&
46103
+ !(node.flags & 8388608 /* JSDoc */) &&
45864
46104
  !ts.isIdentifierName(node)) {
45865
46105
  // strict mode identifiers
45866
46106
  if (inStrictMode &&
@@ -46889,7 +47129,7 @@ var ts;
46889
47129
  if (node.kind === 340 /* JSDocParameterTag */ && container.kind !== 323 /* JSDocSignature */) {
46890
47130
  return;
46891
47131
  }
46892
- if (inStrictMode && !(node.flags & 8388608 /* Ambient */)) {
47132
+ if (inStrictMode && !(node.flags & 16777216 /* Ambient */)) {
46893
47133
  // It is a SyntaxError if the identifier eval or arguments appears within a FormalParameterList of a
46894
47134
  // strict mode FunctionLikeDeclaration or FunctionExpression(13.1)
46895
47135
  checkStrictModeEvalOrArguments(node, node.name);
@@ -46908,7 +47148,7 @@ var ts;
46908
47148
  }
46909
47149
  }
46910
47150
  function bindFunctionDeclaration(node) {
46911
- if (!file.isDeclarationFile && !(node.flags & 8388608 /* Ambient */)) {
47151
+ if (!file.isDeclarationFile && !(node.flags & 16777216 /* Ambient */)) {
46912
47152
  if (ts.isAsyncFunction(node)) {
46913
47153
  emitFlags |= 2048 /* HasAsyncFunctions */;
46914
47154
  }
@@ -46923,7 +47163,7 @@ var ts;
46923
47163
  }
46924
47164
  }
46925
47165
  function bindFunctionExpression(node) {
46926
- if (!file.isDeclarationFile && !(node.flags & 8388608 /* Ambient */)) {
47166
+ if (!file.isDeclarationFile && !(node.flags & 16777216 /* Ambient */)) {
46927
47167
  if (ts.isAsyncFunction(node)) {
46928
47168
  emitFlags |= 2048 /* HasAsyncFunctions */;
46929
47169
  }
@@ -46936,7 +47176,7 @@ var ts;
46936
47176
  return bindAnonymousDeclaration(node, 16 /* Function */, bindingName);
46937
47177
  }
46938
47178
  function bindPropertyOrMethodOrAccessor(node, symbolFlags, symbolExcludes) {
46939
- if (!file.isDeclarationFile && !(node.flags & 8388608 /* Ambient */) && ts.isAsyncFunction(node)) {
47179
+ if (!file.isDeclarationFile && !(node.flags & 16777216 /* Ambient */) && ts.isAsyncFunction(node)) {
46940
47180
  emitFlags |= 2048 /* HasAsyncFunctions */;
46941
47181
  }
46942
47182
  if (currentFlow && ts.isObjectLiteralOrClassExpressionMethodOrAccessor(node)) {
@@ -47009,7 +47249,7 @@ var ts;
47009
47249
  // Rationale: we don't want to report errors on non-initialized var's since they are hoisted
47010
47250
  // On the other side we do want to report errors on non-initialized 'lets' because of TDZ
47011
47251
  var isError_1 = ts.unreachableCodeIsError(options) &&
47012
- !(node.flags & 8388608 /* Ambient */) &&
47252
+ !(node.flags & 16777216 /* Ambient */) &&
47013
47253
  (!ts.isVariableStatement(node) ||
47014
47254
  !!(ts.getCombinedNodeFlags(node.declarationList) & 3 /* BlockScoped */) ||
47015
47255
  node.declarationList.declarations.some(function (d) { return !!d.initializer; }));
@@ -47909,7 +48149,7 @@ var ts;
47909
48149
  ts.Debug.assert(!!(getNodeLinks(file).flags & 1 /* TypeChecked */));
47910
48150
  diagnostics = ts.addRange(diagnostics, suggestionDiagnostics.getDiagnostics(file.fileName));
47911
48151
  checkUnusedIdentifiers(getPotentiallyUnusedIdentifiers(file), function (containingNode, kind, diag) {
47912
- if (!ts.containsParseError(containingNode) && !unusedIsError(kind, !!(containingNode.flags & 8388608 /* Ambient */))) {
48152
+ if (!ts.containsParseError(containingNode) && !unusedIsError(kind, !!(containingNode.flags & 16777216 /* Ambient */))) {
47913
48153
  (diagnostics || (diagnostics = [])).push(__assign(__assign({}, diag), { category: ts.DiagnosticCategory.Suggestion }));
47914
48154
  }
47915
48155
  });
@@ -48360,7 +48600,7 @@ var ts;
48360
48600
  return diagnostic;
48361
48601
  }
48362
48602
  function isDeprecatedSymbol(symbol) {
48363
- return !!(getDeclarationNodeFlagsFromSymbol(symbol) & 134217728 /* Deprecated */);
48603
+ return !!(getDeclarationNodeFlagsFromSymbol(symbol) & 268435456 /* Deprecated */);
48364
48604
  }
48365
48605
  function addDeprecatedSuggestion(location, declarations, deprecatedEntity) {
48366
48606
  var diagnostic = ts.createDiagnosticForNode(location, ts.Diagnostics._0_is_deprecated, deprecatedEntity);
@@ -48588,7 +48828,7 @@ var ts;
48588
48828
  else {
48589
48829
  // find a module that about to be augmented
48590
48830
  // do not validate names of augmentations that are defined in ambient context
48591
- var moduleNotFoundError = !(moduleName.parent.parent.flags & 8388608 /* Ambient */)
48831
+ var moduleNotFoundError = !(moduleName.parent.parent.flags & 16777216 /* Ambient */)
48592
48832
  ? ts.Diagnostics.Invalid_module_name_in_augmentation_module_0_cannot_be_found
48593
48833
  : undefined;
48594
48834
  var mainModule_1 = resolveExternalModuleNameWorker(moduleName, moduleName, moduleNotFoundError, /*isForAugmentation*/ true);
@@ -48702,7 +48942,7 @@ var ts;
48702
48942
  if ((moduleKind && (declarationFile.externalModuleIndicator || useFile.externalModuleIndicator)) ||
48703
48943
  (!ts.outFile(compilerOptions)) ||
48704
48944
  isInTypeQuery(usage) ||
48705
- declaration.flags & 8388608 /* Ambient */) {
48945
+ declaration.flags & 16777216 /* Ambient */) {
48706
48946
  // nodes are in different files and order cannot be determined
48707
48947
  return true;
48708
48948
  }
@@ -48764,7 +49004,7 @@ var ts;
48764
49004
  if (usage.kind === 271 /* ExportAssignment */ && usage.isExportEquals) {
48765
49005
  return true;
48766
49006
  }
48767
- if (!!(usage.flags & 4194304 /* JSDoc */) || isInTypeQuery(usage) || usageInTypeDeclaration()) {
49007
+ if (!!(usage.flags & 8388608 /* JSDoc */) || isInTypeQuery(usage) || usageInTypeDeclaration()) {
48768
49008
  return true;
48769
49009
  }
48770
49010
  if (isUsedInFunctionOrInstanceProperty(usage, declaration)) {
@@ -49029,7 +49269,7 @@ var ts;
49029
49269
  // falls through
49030
49270
  case 261 /* ModuleDeclaration */:
49031
49271
  var moduleExports = ((_a = getSymbolOfNode(location)) === null || _a === void 0 ? void 0 : _a.exports) || emptySymbols;
49032
- if (location.kind === 305 /* SourceFile */ || (ts.isModuleDeclaration(location) && location.flags & 8388608 /* Ambient */ && !ts.isGlobalScopeAugmentation(location))) {
49272
+ if (location.kind === 305 /* SourceFile */ || (ts.isModuleDeclaration(location) && location.flags & 16777216 /* Ambient */ && !ts.isGlobalScopeAugmentation(location))) {
49033
49273
  // It's an external module. First see if the module has an export default and if the local
49034
49274
  // name of that export default matches.
49035
49275
  if (result = moduleExports.get("default" /* Default */)) {
@@ -49352,7 +49592,7 @@ var ts;
49352
49592
  }
49353
49593
  }
49354
49594
  // If we're in an external module, we can't reference value symbols created from UMD export declarations
49355
- if (result && isInExternalModule && (meaning & 111551 /* Value */) === 111551 /* Value */ && !(originalLocation.flags & 4194304 /* JSDoc */)) {
49595
+ if (result && isInExternalModule && (meaning & 111551 /* Value */) === 111551 /* Value */ && !(originalLocation.flags & 8388608 /* JSDoc */)) {
49356
49596
  var merged = getMergedSymbol(result);
49357
49597
  if (ts.length(merged.declarations) && ts.every(merged.declarations, function (d) { return ts.isNamespaceExportDeclaration(d) || ts.isSourceFile(d) && !!d.symbol.globalExports; })) {
49358
49598
  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));
@@ -49607,7 +49847,7 @@ var ts;
49607
49847
  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 /* EnumDeclaration */); });
49608
49848
  if (declaration === undefined)
49609
49849
  return ts.Debug.fail("checkResolvedBlockScopedVariable could not find block-scoped declaration");
49610
- if (!(declaration.flags & 8388608 /* Ambient */) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) {
49850
+ if (!(declaration.flags & 16777216 /* Ambient */) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) {
49611
49851
  var diagnosticMessage = void 0;
49612
49852
  var declarationName = ts.declarationNameToString(ts.getNameOfDeclaration(declaration));
49613
49853
  if (result.flags & 2 /* BlockScopedVariable */) {
@@ -50118,27 +50358,27 @@ var ts;
50118
50358
  function resolveAlias(symbol) {
50119
50359
  ts.Debug.assert((symbol.flags & 2097152 /* Alias */) !== 0, "Should only get Alias here.");
50120
50360
  var links = getSymbolLinks(symbol);
50121
- if (!links.target) {
50122
- links.target = resolvingSymbol;
50361
+ if (!links.aliasTarget) {
50362
+ links.aliasTarget = resolvingSymbol;
50123
50363
  var node = getDeclarationOfAliasSymbol(symbol);
50124
50364
  if (!node)
50125
50365
  return ts.Debug.fail();
50126
50366
  var target = getTargetOfAliasDeclaration(node);
50127
- if (links.target === resolvingSymbol) {
50128
- links.target = target || unknownSymbol;
50367
+ if (links.aliasTarget === resolvingSymbol) {
50368
+ links.aliasTarget = target || unknownSymbol;
50129
50369
  }
50130
50370
  else {
50131
50371
  error(node, ts.Diagnostics.Circular_definition_of_import_alias_0, symbolToString(symbol));
50132
50372
  }
50133
50373
  }
50134
- else if (links.target === resolvingSymbol) {
50135
- links.target = unknownSymbol;
50374
+ else if (links.aliasTarget === resolvingSymbol) {
50375
+ links.aliasTarget = unknownSymbol;
50136
50376
  }
50137
- return links.target;
50377
+ return links.aliasTarget;
50138
50378
  }
50139
50379
  function tryResolveAlias(symbol) {
50140
50380
  var links = getSymbolLinks(symbol);
50141
- if (links.target !== resolvingSymbol) {
50381
+ if (links.aliasTarget !== resolvingSymbol) {
50142
50382
  return resolveAlias(symbol);
50143
50383
  }
50144
50384
  return undefined;
@@ -50380,7 +50620,7 @@ var ts;
50380
50620
  }
50381
50621
  }
50382
50622
  function getAssignmentDeclarationLocation(node) {
50383
- var typeAlias = ts.findAncestor(node, function (node) { return !(ts.isJSDocNode(node) || node.flags & 4194304 /* JSDoc */) ? "quit" : ts.isJSDocTypeAlias(node); });
50623
+ var typeAlias = ts.findAncestor(node, function (node) { return !(ts.isJSDocNode(node) || node.flags & 8388608 /* JSDoc */) ? "quit" : ts.isJSDocTypeAlias(node); });
50384
50624
  if (typeAlias) {
50385
50625
  return;
50386
50626
  }
@@ -51848,7 +52088,20 @@ var ts;
51848
52088
  if (type.flags & 262144 /* TypeParameter */ || objectFlags & 3 /* ClassOrInterface */) {
51849
52089
  if (type.flags & 262144 /* TypeParameter */ && ts.contains(context.inferTypeParameters, type)) {
51850
52090
  context.approximateLength += (ts.symbolName(type.symbol).length + 6);
51851
- return ts.factory.createInferTypeNode(typeParameterToDeclarationWithConstraint(type, context, /*constraintNode*/ undefined));
52091
+ var constraintNode = void 0;
52092
+ var constraint = getConstraintOfTypeParameter(type);
52093
+ if (constraint) {
52094
+ // If the infer type has a constraint that is not the same as the constraint
52095
+ // we would have normally inferred based on context, we emit the constraint
52096
+ // using `infer T extends ?`. We omit inferred constraints from type references
52097
+ // as they may be elided.
52098
+ var inferredConstraint = getInferredTypeParameterConstraint(type, /*omitTypeReferences*/ true);
52099
+ if (!(inferredConstraint && isTypeIdenticalTo(constraint, inferredConstraint))) {
52100
+ context.approximateLength += 9;
52101
+ constraintNode = constraint && typeToTypeNodeHelper(constraint, context);
52102
+ }
52103
+ }
52104
+ return ts.factory.createInferTypeNode(typeParameterToDeclarationWithConstraint(type, context, constraintNode));
51852
52105
  }
51853
52106
  if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ &&
51854
52107
  type.flags & 262144 /* TypeParameter */ &&
@@ -51922,13 +52175,37 @@ var ts;
51922
52175
  return ts.Debug.fail("Should be unreachable.");
51923
52176
  function conditionalTypeToTypeNode(type) {
51924
52177
  var checkTypeNode = typeToTypeNodeHelper(type.checkType, context);
52178
+ context.approximateLength += 15;
52179
+ if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && type.root.isDistributive && !(type.checkType.flags & 262144 /* TypeParameter */)) {
52180
+ var newParam = createTypeParameter(createSymbol(262144 /* TypeParameter */, "T"));
52181
+ var name = typeParameterToName(newParam, context);
52182
+ var newTypeVariable = ts.factory.createTypeReferenceNode(name);
52183
+ context.approximateLength += 37; // 15 each for two added conditionals, 7 for an added infer type
52184
+ var newMapper = prependTypeMapping(type.root.checkType, newParam, type.combinedMapper || type.mapper);
52185
+ var saveInferTypeParameters_1 = context.inferTypeParameters;
52186
+ context.inferTypeParameters = type.root.inferTypeParameters;
52187
+ var extendsTypeNode_1 = typeToTypeNodeHelper(instantiateType(type.root.extendsType, newMapper), context);
52188
+ context.inferTypeParameters = saveInferTypeParameters_1;
52189
+ var trueTypeNode_1 = typeToTypeNodeOrCircularityElision(instantiateType(getTypeFromTypeNode(type.root.node.trueType), newMapper));
52190
+ var falseTypeNode_1 = typeToTypeNodeOrCircularityElision(instantiateType(getTypeFromTypeNode(type.root.node.falseType), newMapper));
52191
+ // outermost conditional makes `T` a type parameter, allowing the inner conditionals to be distributive
52192
+ // second conditional makes `T` have `T & checkType` substitution, so it is correctly usable as the checkType
52193
+ // inner conditional runs the check the user provided on the check type (distributively) and returns the result
52194
+ // checkType extends infer T ? T extends checkType ? T extends extendsType<T> ? trueType<T> : falseType<T> : never : never;
52195
+ // this is potentially simplifiable to
52196
+ // checkType extends infer T ? T extends checkType & extendsType<T> ? trueType<T> : falseType<T> : never;
52197
+ // but that may confuse users who read the output more.
52198
+ // On the other hand,
52199
+ // checkType extends infer T extends checkType ? T extends extendsType<T> ? trueType<T> : falseType<T> : never;
52200
+ // may also work with `infer ... extends ...` in, but would produce declarations only compatible with the latest TS.
52201
+ return ts.factory.createConditionalTypeNode(checkTypeNode, ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ 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 /* NeverKeyword */)), ts.factory.createKeywordTypeNode(143 /* NeverKeyword */));
52202
+ }
51925
52203
  var saveInferTypeParameters = context.inferTypeParameters;
51926
52204
  context.inferTypeParameters = type.root.inferTypeParameters;
51927
52205
  var extendsTypeNode = typeToTypeNodeHelper(type.extendsType, context);
51928
52206
  context.inferTypeParameters = saveInferTypeParameters;
51929
52207
  var trueTypeNode = typeToTypeNodeOrCircularityElision(getTrueTypeFromConditionalType(type));
51930
52208
  var falseTypeNode = typeToTypeNodeOrCircularityElision(getFalseTypeFromConditionalType(type));
51931
- context.approximateLength += 15;
51932
52209
  return ts.factory.createConditionalTypeNode(checkTypeNode, extendsTypeNode, trueTypeNode, falseTypeNode);
51933
52210
  }
51934
52211
  function typeToTypeNodeOrCircularityElision(type) {
@@ -53804,7 +54081,7 @@ var ts;
53804
54081
  newModifierFlags |= 1 /* Export */;
53805
54082
  }
53806
54083
  if (addingDeclare && !(newModifierFlags & 1 /* Export */) &&
53807
- (!enclosingDeclaration_1 || !(enclosingDeclaration_1.flags & 8388608 /* Ambient */)) &&
54084
+ (!enclosingDeclaration_1 || !(enclosingDeclaration_1.flags & 16777216 /* Ambient */)) &&
53808
54085
  (ts.isEnumDeclaration(node) || ts.isVariableStatement(node) || ts.isFunctionDeclaration(node) || ts.isClassDeclaration(node) || ts.isModuleDeclaration(node))) {
53809
54086
  // Classes, namespaces, variables, enums, and functions all need `declare` modifiers to be valid in a declaration file top-level scope
53810
54087
  newModifierFlags |= 2 /* Ambient */;
@@ -54774,7 +55051,7 @@ var ts;
54774
55051
  var parent = getDeclarationContainer(node);
54775
55052
  // If the node is not exported or it is not ambient module element (except import declaration)
54776
55053
  if (!(ts.getCombinedModifierFlags(node) & 1 /* Export */) &&
54777
- !(node.kind !== 265 /* ImportEqualsDeclaration */ && parent.kind !== 305 /* SourceFile */ && parent.flags & 8388608 /* Ambient */)) {
55054
+ !(node.kind !== 265 /* ImportEqualsDeclaration */ && parent.kind !== 305 /* SourceFile */ && parent.flags & 16777216 /* Ambient */)) {
54778
55055
  return isGlobalSourceFile(parent);
54779
55056
  }
54780
55057
  // Exported members/ambient module elements (exception import declaration) are visible if parent is visible
@@ -55114,7 +55391,7 @@ var ts;
55114
55391
  }
55115
55392
  var pattern = declaration.parent;
55116
55393
  // Relax null check on ambient destructuring parameters, since the parameters have no implementation and are just documentation
55117
- if (strictNullChecks && declaration.flags & 8388608 /* Ambient */ && ts.isParameterDeclaration(declaration)) {
55394
+ if (strictNullChecks && declaration.flags & 16777216 /* Ambient */ && ts.isParameterDeclaration(declaration)) {
55118
55395
  parentType = getNonNullableType(parentType);
55119
55396
  }
55120
55397
  // Filter `undefined` from the type we check against if the parent has an initializer and that initializer is not possibly `undefined`
@@ -55230,7 +55507,7 @@ var ts;
55230
55507
  }
55231
55508
  if ((noImplicitAny || ts.isInJSFile(declaration)) &&
55232
55509
  ts.isVariableDeclaration(declaration) && !ts.isBindingPattern(declaration.name) &&
55233
- !(ts.getCombinedModifierFlags(declaration) & 1 /* Export */) && !(declaration.flags & 8388608 /* Ambient */)) {
55510
+ !(ts.getCombinedModifierFlags(declaration) & 1 /* Export */) && !(declaration.flags & 16777216 /* Ambient */)) {
55234
55511
  // If --noImplicitAny is on or the declaration is in a Javascript file,
55235
55512
  // use control flow tracked 'any' type for non-ambient, non-exported var or let variables with no
55236
55513
  // initializer or a 'null' or 'undefined' initializer.
@@ -56686,7 +56963,7 @@ var ts;
56686
56963
  function isLiteralEnumMember(member) {
56687
56964
  var expr = member.initializer;
56688
56965
  if (!expr) {
56689
- return !(member.flags & 8388608 /* Ambient */);
56966
+ return !(member.flags & 16777216 /* Ambient */);
56690
56967
  }
56691
56968
  switch (expr.kind) {
56692
56969
  case 10 /* StringLiteral */:
@@ -59319,7 +59596,7 @@ var ts;
59319
59596
  function getConstraintDeclaration(type) {
59320
59597
  return ts.mapDefined(ts.filter(type.symbol && type.symbol.declarations, ts.isTypeParameterDeclaration), ts.getEffectiveConstraintOfTypeParameter)[0];
59321
59598
  }
59322
- function getInferredTypeParameterConstraint(typeParameter) {
59599
+ function getInferredTypeParameterConstraint(typeParameter, omitTypeReferences) {
59323
59600
  var _a;
59324
59601
  var inferences;
59325
59602
  if ((_a = typeParameter.symbol) === null || _a === void 0 ? void 0 : _a.declarations) {
@@ -59331,7 +59608,7 @@ var ts;
59331
59608
  // corresponding type parameter in 'Foo'. When multiple 'infer T' declarations are
59332
59609
  // present, we form an intersection of the inferred constraint types.
59333
59610
  var _c = ts.walkUpParenthesizedTypesAndGetParentAndChild(declaration.parent.parent), _d = _c[0], childTypeParameter = _d === void 0 ? declaration.parent : _d, grandParent = _c[1];
59334
- if (grandParent.kind === 178 /* TypeReference */) {
59611
+ if (grandParent.kind === 178 /* TypeReference */ && !omitTypeReferences) {
59335
59612
  var typeReference = grandParent;
59336
59613
  var typeParameters = getTypeParametersForTypeReference(typeReference);
59337
59614
  if (typeParameters) {
@@ -59753,7 +60030,7 @@ var ts;
59753
60030
  return constraints ? getSubstitutionType(type, getIntersectionType(ts.append(constraints, type))) : type;
59754
60031
  }
59755
60032
  function isJSDocTypeReference(node) {
59756
- return !!(node.flags & 4194304 /* JSDoc */) && (node.kind === 178 /* TypeReference */ || node.kind === 200 /* ImportType */);
60033
+ return !!(node.flags & 8388608 /* JSDoc */) && (node.kind === 178 /* TypeReference */ || node.kind === 200 /* ImportType */);
59757
60034
  }
59758
60035
  function checkNoTypeArguments(node, symbol) {
59759
60036
  if (node.typeArguments) {
@@ -61312,7 +61589,7 @@ var ts;
61312
61589
  if (ts.isCallLikeExpression(parent)) {
61313
61590
  return ts.isCallOrNewExpression(parent) && ts.isIdentifier(node) && hasMatchingArgument(parent, node);
61314
61591
  }
61315
- return ts.every(symbol.declarations, function (d) { return !ts.isFunctionLike(d) || !!(ts.getCombinedNodeFlags(d) & 134217728 /* Deprecated */); });
61592
+ return ts.every(symbol.declarations, function (d) { return !ts.isFunctionLike(d) || !!(ts.getCombinedNodeFlags(d) & 268435456 /* Deprecated */); });
61316
61593
  }
61317
61594
  return true;
61318
61595
  }
@@ -61753,7 +62030,11 @@ var ts;
61753
62030
  return !root.isDistributive && isSingletonTupleType(root.node.checkType) && isSingletonTupleType(root.node.extendsType);
61754
62031
  }
61755
62032
  function isSingletonTupleType(node) {
61756
- return ts.isTupleTypeNode(node) && ts.length(node.elements) === 1 && !ts.isOptionalTypeNode(node.elements[0]) && !ts.isRestTypeNode(node.elements[0]);
62033
+ return ts.isTupleTypeNode(node) &&
62034
+ ts.length(node.elements) === 1 &&
62035
+ !ts.isOptionalTypeNode(node.elements[0]) &&
62036
+ !ts.isRestTypeNode(node.elements[0]) &&
62037
+ !(ts.isNamedTupleMember(node.elements[0]) && (node.elements[0].questionToken || node.elements[0].dotDotDotToken));
61757
62038
  }
61758
62039
  /**
61759
62040
  * We syntactually check for common nondistributive conditional shapes and unwrap them into
@@ -62001,7 +62282,7 @@ var ts;
62001
62282
  links.resolvedSymbol = unknownSymbol;
62002
62283
  return links.resolvedType = errorType;
62003
62284
  }
62004
- var targetMeaning = node.isTypeOf ? 111551 /* Value */ : node.flags & 4194304 /* JSDoc */ ? 111551 /* Value */ | 788968 /* Type */ : 788968 /* Type */;
62285
+ var targetMeaning = node.isTypeOf ? 111551 /* Value */ : node.flags & 8388608 /* JSDoc */ ? 111551 /* Value */ | 788968 /* Type */ : 788968 /* Type */;
62005
62286
  // TODO: Future work: support unions/generics/whatever via a deferred import-type
62006
62287
  var innerModuleSymbol = resolveExternalModuleName(node, node.argument.literal);
62007
62288
  if (!innerModuleSymbol) {
@@ -62337,7 +62618,7 @@ var ts;
62337
62618
  }
62338
62619
  // /** @return {this} */
62339
62620
  // x.prototype.m = function() { ... }
62340
- var host = node.flags & 4194304 /* JSDoc */ ? ts.getHostSignatureFromJSDoc(node) : undefined;
62621
+ var host = node.flags & 8388608 /* JSDoc */ ? ts.getHostSignatureFromJSDoc(node) : undefined;
62341
62622
  if (host && ts.isFunctionExpression(host) && ts.isBinaryExpression(host.parent) && ts.getAssignmentDeclarationKind(host.parent) === 3 /* PrototypeProperty */) {
62342
62623
  return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(host.parent.left).parent).thisType;
62343
62624
  }
@@ -62412,7 +62693,7 @@ var ts;
62412
62693
  case 143 /* NeverKeyword */:
62413
62694
  return neverType;
62414
62695
  case 148 /* ObjectKeyword */:
62415
- return node.flags & 131072 /* JavaScriptFile */ && !noImplicitAny ? anyType : nonPrimitiveType;
62696
+ return node.flags & 262144 /* JavaScriptFile */ && !noImplicitAny ? anyType : nonPrimitiveType;
62416
62697
  case 138 /* IntrinsicKeyword */:
62417
62698
  return intrinsicMarkerType;
62418
62699
  case 192 /* ThisType */:
@@ -66273,6 +66554,9 @@ var ts;
66273
66554
  function createMarkerType(symbol, source, target) {
66274
66555
  var mapper = makeUnaryTypeMapper(source, target);
66275
66556
  var type = getDeclaredTypeOfSymbol(symbol);
66557
+ if (isErrorType(type)) {
66558
+ return type;
66559
+ }
66276
66560
  var result = symbol.flags & 524288 /* TypeAlias */ ?
66277
66561
  getTypeAliasInstantiation(symbol, instantiateTypes(getSymbolLinks(symbol).typeParameters, mapper)) :
66278
66562
  createTypeReference(type, instantiateTypes(type.typeParameters, mapper));
@@ -67286,6 +67570,9 @@ var ts;
67286
67570
  var inference = inferences[i];
67287
67571
  if (t === inference.typeParameter) {
67288
67572
  if (fix && !inference.isFixed) {
67573
+ // Before we commit to a particular inference (and thus lock out any further inferences),
67574
+ // we infer from any intra-expression inference sites we have collected.
67575
+ inferFromIntraExpressionSites(context);
67289
67576
  clearCachedInferences(inferences);
67290
67577
  inference.isFixed = true;
67291
67578
  }
@@ -67302,6 +67589,37 @@ var ts;
67302
67589
  }
67303
67590
  }
67304
67591
  }
67592
+ function addIntraExpressionInferenceSite(context, node, type) {
67593
+ var _a;
67594
+ ((_a = context.intraExpressionInferenceSites) !== null && _a !== void 0 ? _a : (context.intraExpressionInferenceSites = [])).push({ node: node, type: type });
67595
+ }
67596
+ // We collect intra-expression inference sites within object and array literals to handle cases where
67597
+ // inferred types flow between context sensitive element expressions. For example:
67598
+ //
67599
+ // declare function foo<T>(arg: [(n: number) => T, (x: T) => void]): void;
67600
+ // foo([_a => 0, n => n.toFixed()]);
67601
+ //
67602
+ // Above, both arrow functions in the tuple argument are context sensitive, thus both are omitted from the
67603
+ // pass that collects inferences from the non-context sensitive parts of the arguments. In the subsequent
67604
+ // pass where nothing is omitted, we need to commit to an inference for T in order to contextually type the
67605
+ // parameter in the second arrow function, but we want to first infer from the return type of the first
67606
+ // arrow function. This happens automatically when the arrow functions are discrete arguments (because we
67607
+ // infer from each argument before processing the next), but when the arrow functions are elements of an
67608
+ // object or array literal, we need to perform intra-expression inferences early.
67609
+ function inferFromIntraExpressionSites(context) {
67610
+ if (context.intraExpressionInferenceSites) {
67611
+ for (var _i = 0, _a = context.intraExpressionInferenceSites; _i < _a.length; _i++) {
67612
+ var _b = _a[_i], node = _b.node, type = _b.type;
67613
+ var contextualType = node.kind === 169 /* MethodDeclaration */ ?
67614
+ getContextualTypeForObjectLiteralMethod(node, 2 /* NoConstraints */) :
67615
+ getContextualType(node, 2 /* NoConstraints */);
67616
+ if (contextualType) {
67617
+ inferTypes(context.inferences, type, contextualType);
67618
+ }
67619
+ }
67620
+ context.intraExpressionInferenceSites = undefined;
67621
+ }
67622
+ }
67305
67623
  function createInferenceInfo(typeParameter) {
67306
67624
  return {
67307
67625
  typeParameter: typeParameter,
@@ -69284,7 +69602,7 @@ var ts;
69284
69602
  // parameter symbols with declarations that have explicit type annotations. Such references are
69285
69603
  // resolvable with no possibility of triggering circularities in control flow analysis.
69286
69604
  function getTypeOfDottedName(node, diagnostic) {
69287
- if (!(node.flags & 16777216 /* InWithStatement */)) {
69605
+ if (!(node.flags & 33554432 /* InWithStatement */)) {
69288
69606
  switch (node.kind) {
69289
69607
  case 79 /* Identifier */:
69290
69608
  var symbol = getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(node));
@@ -70688,6 +71006,7 @@ var ts;
70688
71006
  // a generic type without a nullable constraint and x is a generic type. This is because when both obj
70689
71007
  // and x are of generic types T and K, we want the resulting type to be T[K].
70690
71008
  return parent.kind === 206 /* PropertyAccessExpression */ ||
71009
+ parent.kind === 161 /* QualifiedName */ ||
70691
71010
  parent.kind === 208 /* CallExpression */ && parent.expression === node ||
70692
71011
  parent.kind === 207 /* ElementAccessExpression */ && parent.expression === node &&
70693
71012
  !(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent.argumentExpression)));
@@ -70981,7 +71300,7 @@ var ts;
70981
71300
  isInTypeQuery(node) || node.parent.kind === 275 /* ExportSpecifier */) ||
70982
71301
  node.parent.kind === 230 /* NonNullExpression */ ||
70983
71302
  declaration.kind === 254 /* VariableDeclaration */ && declaration.exclamationToken ||
70984
- declaration.flags & 8388608 /* Ambient */;
71303
+ declaration.flags & 16777216 /* Ambient */;
70985
71304
  var initialType = assumeInitialized ? (isParameter ? removeOptionalityFromDeclaredType(type, declaration) : type) :
70986
71305
  type === autoType || type === autoArrayType ? undefinedType :
70987
71306
  getOptionalType(type);
@@ -71989,7 +72308,7 @@ var ts;
71989
72308
  // exists. Otherwise, it is the type of the string index signature in T, if one exists.
71990
72309
  function getContextualTypeForObjectLiteralMethod(node, contextFlags) {
71991
72310
  ts.Debug.assert(ts.isObjectLiteralMethod(node));
71992
- if (node.flags & 16777216 /* InWithStatement */) {
72311
+ if (node.flags & 33554432 /* InWithStatement */) {
71993
72312
  // We cannot answer semantic questions within a with block, do not proceed any further
71994
72313
  return undefined;
71995
72314
  }
@@ -72177,7 +72496,7 @@ var ts;
72177
72496
  * @returns the contextual type of an expression.
72178
72497
  */
72179
72498
  function getContextualType(node, contextFlags) {
72180
- if (node.flags & 16777216 /* InWithStatement */) {
72499
+ if (node.flags & 33554432 /* InWithStatement */) {
72181
72500
  // We cannot answer semantic questions within a with block, do not proceed any further
72182
72501
  return undefined;
72183
72502
  }
@@ -72595,6 +72914,11 @@ var ts;
72595
72914
  var type = checkExpressionForMutableLocation(e, checkMode, elementContextualType, forceTuple);
72596
72915
  elementTypes.push(addOptionality(type, /*isProperty*/ true, hasOmittedExpression));
72597
72916
  elementFlags.push(hasOmittedExpression ? 2 /* Optional */ : 1 /* Required */);
72917
+ if (contextualType && someType(contextualType, isTupleLikeType) && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && isContextSensitive(e)) {
72918
+ var inferenceContext = getInferenceContext(node);
72919
+ ts.Debug.assert(inferenceContext); // In CheckMode.Inferential we should always have an inference context
72920
+ addIntraExpressionInferenceSite(inferenceContext, e, type);
72921
+ }
72598
72922
  }
72599
72923
  }
72600
72924
  if (inDestructuringPattern) {
@@ -72796,6 +73120,13 @@ var ts;
72796
73120
  prop.target = member;
72797
73121
  member = prop;
72798
73122
  allPropertiesTable === null || allPropertiesTable === void 0 ? void 0 : allPropertiesTable.set(prop.escapedName, prop);
73123
+ if (contextualType && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) &&
73124
+ (memberDecl.kind === 296 /* PropertyAssignment */ || memberDecl.kind === 169 /* MethodDeclaration */) && isContextSensitive(memberDecl)) {
73125
+ var inferenceContext = getInferenceContext(node);
73126
+ ts.Debug.assert(inferenceContext); // In CheckMode.Inferential we should always have an inference context
73127
+ var inferenceNode = memberDecl.kind === 296 /* PropertyAssignment */ ? memberDecl.initializer : memberDecl;
73128
+ addIntraExpressionInferenceSite(inferenceContext, inferenceNode, type);
73129
+ }
72799
73130
  }
72800
73131
  else if (memberDecl.kind === 298 /* SpreadAssignment */) {
72801
73132
  if (languageVersion < 2 /* ES2015 */) {
@@ -73888,7 +74219,7 @@ var ts;
73888
74219
  if (compilerOptions.noPropertyAccessFromIndexSignature && ts.isPropertyAccessExpression(node)) {
73889
74220
  error(right, ts.Diagnostics.Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0, ts.unescapeLeadingUnderscores(right.escapedText));
73890
74221
  }
73891
- if (indexInfo.declaration && ts.getCombinedNodeFlags(indexInfo.declaration) & 134217728 /* Deprecated */) {
74222
+ if (indexInfo.declaration && ts.getCombinedNodeFlags(indexInfo.declaration) & 268435456 /* Deprecated */) {
73892
74223
  addDeprecatedSuggestion(right, [indexInfo.declaration], right.escapedText);
73893
74224
  }
73894
74225
  }
@@ -73956,7 +74287,7 @@ var ts;
73956
74287
  if (declaration && isPropertyWithoutInitializer(declaration)) {
73957
74288
  if (!ts.isStatic(declaration)) {
73958
74289
  var flowContainer = getControlFlowContainer(node);
73959
- if (flowContainer.kind === 171 /* Constructor */ && flowContainer.parent === declaration.parent && !(declaration.flags & 8388608 /* Ambient */)) {
74290
+ if (flowContainer.kind === 171 /* Constructor */ && flowContainer.parent === declaration.parent && !(declaration.flags & 16777216 /* Ambient */)) {
73960
74291
  assumeUninitialized = true;
73961
74292
  }
73962
74293
  }
@@ -73993,7 +74324,7 @@ var ts;
73993
74324
  }
73994
74325
  else if (valueDeclaration.kind === 257 /* ClassDeclaration */ &&
73995
74326
  node.parent.kind !== 178 /* TypeReference */ &&
73996
- !(valueDeclaration.flags & 8388608 /* Ambient */) &&
74327
+ !(valueDeclaration.flags & 16777216 /* Ambient */) &&
73997
74328
  !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) {
73998
74329
  diagnosticMessage = error(right, ts.Diagnostics.Class_0_used_before_its_declaration, declarationName);
73999
74330
  }
@@ -74658,34 +74989,36 @@ var ts;
74658
74989
  if (node.kind !== 165 /* Decorator */) {
74659
74990
  var contextualType = getContextualType(node, ts.every(signature.typeParameters, function (p) { return !!getDefaultFromTypeParameter(p); }) ? 8 /* SkipBindingPatterns */ : 0 /* None */);
74660
74991
  if (contextualType) {
74661
- // We clone the inference context to avoid disturbing a resolution in progress for an
74662
- // outer call expression. Effectively we just want a snapshot of whatever has been
74663
- // inferred for any outer call expression so far.
74664
- var outerContext = getInferenceContext(node);
74665
- var outerMapper = getMapperFromContext(cloneInferenceContext(outerContext, 1 /* NoDefault */));
74666
- var instantiatedType = instantiateType(contextualType, outerMapper);
74667
- // If the contextual type is a generic function type with a single call signature, we
74668
- // instantiate the type with its own type parameters and type arguments. This ensures that
74669
- // the type parameters are not erased to type any during type inference such that they can
74670
- // be inferred as actual types from the contextual type. For example:
74671
- // declare function arrayMap<T, U>(f: (x: T) => U): (a: T[]) => U[];
74672
- // const boxElements: <A>(a: A[]) => { value: A }[] = arrayMap(value => ({ value }));
74673
- // Above, the type of the 'value' parameter is inferred to be 'A'.
74674
- var contextualSignature = getSingleCallSignature(instantiatedType);
74675
- var inferenceSourceType = contextualSignature && contextualSignature.typeParameters ?
74676
- getOrCreateTypeFromSignature(getSignatureInstantiationWithoutFillingInTypeArguments(contextualSignature, contextualSignature.typeParameters)) :
74677
- instantiatedType;
74678
74992
  var inferenceTargetType = getReturnTypeOfSignature(signature);
74679
- // Inferences made from return types have lower priority than all other inferences.
74680
- inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, 128 /* ReturnType */);
74681
- // Create a type mapper for instantiating generic contextual types using the inferences made
74682
- // from the return type. We need a separate inference pass here because (a) instantiation of
74683
- // the source type uses the outer context's return mapper (which excludes inferences made from
74684
- // outer arguments), and (b) we don't want any further inferences going into this context.
74685
- var returnContext = createInferenceContext(signature.typeParameters, signature, context.flags);
74686
- var returnSourceType = instantiateType(contextualType, outerContext && outerContext.returnMapper);
74687
- inferTypes(returnContext.inferences, returnSourceType, inferenceTargetType);
74688
- context.returnMapper = ts.some(returnContext.inferences, hasInferenceCandidates) ? getMapperFromContext(cloneInferredPartOfContext(returnContext)) : undefined;
74993
+ if (couldContainTypeVariables(inferenceTargetType)) {
74994
+ // We clone the inference context to avoid disturbing a resolution in progress for an
74995
+ // outer call expression. Effectively we just want a snapshot of whatever has been
74996
+ // inferred for any outer call expression so far.
74997
+ var outerContext = getInferenceContext(node);
74998
+ var outerMapper = getMapperFromContext(cloneInferenceContext(outerContext, 1 /* NoDefault */));
74999
+ var instantiatedType = instantiateType(contextualType, outerMapper);
75000
+ // If the contextual type is a generic function type with a single call signature, we
75001
+ // instantiate the type with its own type parameters and type arguments. This ensures that
75002
+ // the type parameters are not erased to type any during type inference such that they can
75003
+ // be inferred as actual types from the contextual type. For example:
75004
+ // declare function arrayMap<T, U>(f: (x: T) => U): (a: T[]) => U[];
75005
+ // const boxElements: <A>(a: A[]) => { value: A }[] = arrayMap(value => ({ value }));
75006
+ // Above, the type of the 'value' parameter is inferred to be 'A'.
75007
+ var contextualSignature = getSingleCallSignature(instantiatedType);
75008
+ var inferenceSourceType = contextualSignature && contextualSignature.typeParameters ?
75009
+ getOrCreateTypeFromSignature(getSignatureInstantiationWithoutFillingInTypeArguments(contextualSignature, contextualSignature.typeParameters)) :
75010
+ instantiatedType;
75011
+ // Inferences made from return types have lower priority than all other inferences.
75012
+ inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, 128 /* ReturnType */);
75013
+ // Create a type mapper for instantiating generic contextual types using the inferences made
75014
+ // from the return type. We need a separate inference pass here because (a) instantiation of
75015
+ // the source type uses the outer context's return mapper (which excludes inferences made from
75016
+ // outer arguments), and (b) we don't want any further inferences going into this context.
75017
+ var returnContext = createInferenceContext(signature.typeParameters, signature, context.flags);
75018
+ var returnSourceType = instantiateType(contextualType, outerContext && outerContext.returnMapper);
75019
+ inferTypes(returnContext.inferences, returnSourceType, inferenceTargetType);
75020
+ context.returnMapper = ts.some(returnContext.inferences, hasInferenceCandidates) ? getMapperFromContext(cloneInferredPartOfContext(returnContext)) : undefined;
75021
+ }
74689
75022
  }
74690
75023
  }
74691
75024
  var restType = getNonArrayRestType(signature);
@@ -74697,7 +75030,7 @@ var ts;
74697
75030
  }
74698
75031
  }
74699
75032
  var thisType = getThisTypeOfSignature(signature);
74700
- if (thisType) {
75033
+ if (thisType && couldContainTypeVariables(thisType)) {
74701
75034
  var thisArgumentNode = getThisArgumentOfCall(node);
74702
75035
  inferTypes(context.inferences, getThisArgumentType(thisArgumentNode), thisType);
74703
75036
  }
@@ -74705,11 +75038,13 @@ var ts;
74705
75038
  var arg = args[i];
74706
75039
  if (arg.kind !== 227 /* OmittedExpression */ && !(checkMode & 32 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) {
74707
75040
  var paramType = getTypeAtPosition(signature, i);
74708
- var argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
74709
- inferTypes(context.inferences, argType, paramType);
75041
+ if (couldContainTypeVariables(paramType)) {
75042
+ var argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
75043
+ inferTypes(context.inferences, argType, paramType);
75044
+ }
74710
75045
  }
74711
75046
  }
74712
- if (restType) {
75047
+ if (restType && couldContainTypeVariables(restType)) {
74713
75048
  var spreadType = getSpreadArgumentType(args, argCount, args.length, restType, context, checkMode);
74714
75049
  inferTypes(context.inferences, spreadType, restType);
74715
75050
  }
@@ -76289,7 +76624,7 @@ var ts;
76289
76624
  return returnType;
76290
76625
  }
76291
76626
  function checkDeprecatedSignature(signature, node) {
76292
- if (signature.declaration && signature.declaration.flags & 134217728 /* Deprecated */) {
76627
+ if (signature.declaration && signature.declaration.flags & 268435456 /* Deprecated */) {
76293
76628
  var suggestionNode = getDeprecatedSuggestionNode(node);
76294
76629
  var name = ts.tryGetPropertyAccessOrIdentifierToString(ts.getInvokedExpression(node));
76295
76630
  addDeprecatedSuggestionWithSignature(suggestionNode, signature.declaration, name, signatureToString(signature));
@@ -76373,7 +76708,7 @@ var ts;
76373
76708
  var newSymbol = createSymbol(2097152 /* Alias */, "default" /* Default */);
76374
76709
  newSymbol.parent = originalSymbol;
76375
76710
  newSymbol.nameType = getStringLiteralType("default");
76376
- newSymbol.target = resolveSymbol(symbol);
76711
+ newSymbol.aliasTarget = resolveSymbol(symbol);
76377
76712
  memberTable.set("default" /* Default */, newSymbol);
76378
76713
  return createAnonymousType(anonymousSymbol, memberTable, ts.emptyArray, ts.emptyArray, ts.emptyArray);
76379
76714
  }
@@ -76433,7 +76768,7 @@ var ts;
76433
76768
  if (targetDeclarationKind !== 0 /* Unknown */) {
76434
76769
  var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind);
76435
76770
  // function/variable declaration should be ambient
76436
- return !!decl && !!(decl.flags & 8388608 /* Ambient */);
76771
+ return !!decl && !!(decl.flags & 16777216 /* Ambient */);
76437
76772
  }
76438
76773
  return false;
76439
76774
  }
@@ -76628,7 +76963,7 @@ var ts;
76628
76963
  error(node, ts.Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node12_or_nodenext);
76629
76964
  }
76630
76965
  var file = ts.getSourceFileOfNode(node);
76631
- ts.Debug.assert(!!(file.flags & 2097152 /* PossiblyContainsImportMeta */), "Containing file is missing import meta node flag.");
76966
+ ts.Debug.assert(!!(file.flags & 4194304 /* PossiblyContainsImportMeta */), "Containing file is missing import meta node flag.");
76632
76967
  return node.name.escapedText === "meta" ? getGlobalImportMetaType() : errorType;
76633
76968
  }
76634
76969
  function getTypeOfParameter(symbol) {
@@ -78642,6 +78977,11 @@ var ts;
78642
78977
  context.contextualType = contextualType;
78643
78978
  context.inferenceContext = inferenceContext;
78644
78979
  var type = checkExpression(node, checkMode | 1 /* Contextual */ | (inferenceContext ? 2 /* Inferential */ : 0));
78980
+ // In CheckMode.Inferential we collect intra-expression inference sites to process before fixing any type
78981
+ // parameters. This information is no longer needed after the call to checkExpression.
78982
+ if (inferenceContext && inferenceContext.intraExpressionInferenceSites) {
78983
+ inferenceContext.intraExpressionInferenceSites = undefined;
78984
+ }
78645
78985
  // We strip literal freshness when an appropriate contextual type is present such that contextually typed
78646
78986
  // literals always preserve their literal types (otherwise they might widen during type inference). An alternative
78647
78987
  // here would be to not mark contextually typed literals as fresh in the first place.
@@ -78933,7 +79273,7 @@ var ts;
78933
79273
  return quickType;
78934
79274
  }
78935
79275
  // If a type has been cached for the node, return it.
78936
- if (node.flags & 67108864 /* TypeCached */ && flowTypeCache) {
79276
+ if (node.flags & 134217728 /* TypeCached */ && flowTypeCache) {
78937
79277
  var cachedType = flowTypeCache[getNodeId(node)];
78938
79278
  if (cachedType) {
78939
79279
  return cachedType;
@@ -78945,7 +79285,7 @@ var ts;
78945
79285
  if (flowInvocationCount !== startInvocationCount) {
78946
79286
  var cache = flowTypeCache || (flowTypeCache = []);
78947
79287
  cache[getNodeId(node)] = type;
78948
- ts.setNodeFlags(node, node.flags | 67108864 /* TypeCached */);
79288
+ ts.setNodeFlags(node, node.flags | 134217728 /* TypeCached */);
78949
79289
  }
78950
79290
  return type;
78951
79291
  }
@@ -79031,7 +79371,7 @@ var ts;
79031
79371
  if (compilerOptions.isolatedModules) {
79032
79372
  ts.Debug.assert(!!(type.symbol.flags & 128 /* ConstEnum */));
79033
79373
  var constEnumDeclaration = type.symbol.valueDeclaration;
79034
- if (constEnumDeclaration.flags & 8388608 /* Ambient */) {
79374
+ if (constEnumDeclaration.flags & 16777216 /* Ambient */) {
79035
79375
  error(node, ts.Diagnostics.Cannot_access_ambient_const_enums_when_the_isolatedModules_flag_is_provided);
79036
79376
  }
79037
79377
  }
@@ -79182,14 +79522,19 @@ var ts;
79182
79522
  }
79183
79523
  if (node.parent.kind === 258 /* InterfaceDeclaration */ || node.parent.kind === 257 /* ClassDeclaration */ || node.parent.kind === 259 /* TypeAliasDeclaration */) {
79184
79524
  var modifiers = getVarianceModifiers(typeParameter);
79185
- if (modifiers === 32768 /* In */ || modifiers === 65536 /* Out */) {
79525
+ if (modifiers) {
79186
79526
  var symbol = getSymbolOfNode(node.parent);
79187
- var source = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSubType : markerSuperType);
79188
- var target = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSuperType : markerSubType);
79189
- var saveVarianceTypeParameter = typeParameter;
79190
- varianceTypeParameter = typeParameter;
79191
- checkTypeAssignableTo(source, target, node, ts.Diagnostics.Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation);
79192
- varianceTypeParameter = saveVarianceTypeParameter;
79527
+ if (node.parent.kind === 259 /* TypeAliasDeclaration */ && !(ts.getObjectFlags(getDeclaredTypeOfSymbol(symbol)) & (16 /* Anonymous */ | 32 /* Mapped */))) {
79528
+ error(node, ts.Diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types);
79529
+ }
79530
+ else if (modifiers === 32768 /* In */ || modifiers === 65536 /* Out */) {
79531
+ var source = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSubType : markerSuperType);
79532
+ var target = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSuperType : markerSubType);
79533
+ var saveVarianceTypeParameter = typeParameter;
79534
+ varianceTypeParameter = typeParameter;
79535
+ checkTypeAssignableTo(source, target, node, ts.Diagnostics.Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation);
79536
+ varianceTypeParameter = saveVarianceTypeParameter;
79537
+ }
79193
79538
  }
79194
79539
  }
79195
79540
  addLazyDiagnostic(function () { return checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0); });
@@ -79724,7 +80069,7 @@ var ts;
79724
80069
  checkDecorators(node);
79725
80070
  checkSignatureDeclaration(node);
79726
80071
  if (node.kind === 172 /* GetAccessor */) {
79727
- if (!(node.flags & 8388608 /* Ambient */) && ts.nodeIsPresent(node.body) && (node.flags & 256 /* HasImplicitReturn */)) {
80072
+ if (!(node.flags & 16777216 /* Ambient */) && ts.nodeIsPresent(node.body) && (node.flags & 256 /* HasImplicitReturn */)) {
79728
80073
  if (!(node.flags & 512 /* HasExplicitReturn */)) {
79729
80074
  error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value);
79730
80075
  }
@@ -79819,7 +80164,7 @@ var ts;
79819
80164
  }
79820
80165
  var symbol = getNodeLinks(node).resolvedSymbol;
79821
80166
  if (symbol) {
79822
- if (ts.some(symbol.declarations, function (d) { return isTypeDeclaration(d) && !!(d.flags & 134217728 /* Deprecated */); })) {
80167
+ if (ts.some(symbol.declarations, function (d) { return isTypeDeclaration(d) && !!(d.flags & 268435456 /* Deprecated */); })) {
79823
80168
  addDeprecatedSuggestion(getDeprecatedSuggestionNode(node), symbol.declarations, symbol.escapedName);
79824
80169
  }
79825
80170
  if (type.flags & 32 /* Enum */ && symbol.flags & 8 /* EnumMember */) {
@@ -79979,6 +80324,23 @@ var ts;
79979
80324
  grammarErrorOnNode(node, ts.Diagnostics.infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type);
79980
80325
  }
79981
80326
  checkSourceElement(node.typeParameter);
80327
+ var symbol = getSymbolOfNode(node.typeParameter);
80328
+ if (symbol.declarations && symbol.declarations.length > 1) {
80329
+ var links = getSymbolLinks(symbol);
80330
+ if (!links.typeParametersChecked) {
80331
+ links.typeParametersChecked = true;
80332
+ var typeParameter = getDeclaredTypeOfTypeParameter(symbol);
80333
+ var declarations = ts.getDeclarationsOfKind(symbol, 163 /* TypeParameter */);
80334
+ if (!areTypeParametersIdentical(declarations, [typeParameter], function (decl) { return [decl]; })) {
80335
+ // Report an error on every conflicting declaration.
80336
+ var name = symbolToString(symbol);
80337
+ for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) {
80338
+ var declaration = declarations_4[_i];
80339
+ error(declaration.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_constraints, name);
80340
+ }
80341
+ }
80342
+ }
80343
+ }
79982
80344
  registerForUnusedIdentifiersCheck(node);
79983
80345
  }
79984
80346
  function checkTemplateLiteralType(node) {
@@ -80016,7 +80378,7 @@ var ts;
80016
80378
  getTypeFromTypeNode(node);
80017
80379
  }
80018
80380
  function isPrivateWithinAmbient(node) {
80019
- return (ts.hasEffectiveModifier(node, 8 /* Private */) || ts.isPrivateIdentifierClassElementDeclaration(node)) && !!(node.flags & 8388608 /* Ambient */);
80381
+ return (ts.hasEffectiveModifier(node, 8 /* Private */) || ts.isPrivateIdentifierClassElementDeclaration(node)) && !!(node.flags & 16777216 /* Ambient */);
80020
80382
  }
80021
80383
  function getEffectiveDeclarationFlags(n, flagsToCheck) {
80022
80384
  var flags = ts.getCombinedModifierFlags(n);
@@ -80025,7 +80387,7 @@ var ts;
80025
80387
  if (n.parent.kind !== 258 /* InterfaceDeclaration */ &&
80026
80388
  n.parent.kind !== 257 /* ClassDeclaration */ &&
80027
80389
  n.parent.kind !== 226 /* ClassExpression */ &&
80028
- n.flags & 8388608 /* Ambient */) {
80390
+ n.flags & 16777216 /* Ambient */) {
80029
80391
  if (!(flags & 2 /* Ambient */) && !(ts.isModuleBlock(n.parent) && ts.isModuleDeclaration(n.parent.parent) && ts.isGlobalScopeAugmentation(n.parent.parent))) {
80030
80392
  // It is nested in an ambient context, which means it is automatically exported
80031
80393
  flags |= 1 /* Export */;
@@ -80158,10 +80520,10 @@ var ts;
80158
80520
  var hasNonAmbientClass = false;
80159
80521
  var functionDeclarations = [];
80160
80522
  if (declarations) {
80161
- for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) {
80162
- var current = declarations_4[_i];
80523
+ for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) {
80524
+ var current = declarations_5[_i];
80163
80525
  var node = current;
80164
- var inAmbientContext = node.flags & 8388608 /* Ambient */;
80526
+ var inAmbientContext = node.flags & 16777216 /* Ambient */;
80165
80527
  var inAmbientContextOrInterface = node.parent && (node.parent.kind === 258 /* InterfaceDeclaration */ || node.parent.kind === 182 /* TypeLiteral */) || inAmbientContext;
80166
80528
  if (inAmbientContextOrInterface) {
80167
80529
  // check if declarations are consecutive only if they are non-ambient
@@ -81013,7 +81375,7 @@ var ts;
81013
81375
  // checkFunctionOrConstructorSymbol wouldn't be called if we didnt ignore javascript function.
81014
81376
  var firstDeclaration = (_a = localSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(
81015
81377
  // Get first non javascript function declaration
81016
- function (declaration) { return declaration.kind === node.kind && !(declaration.flags & 131072 /* JavaScriptFile */); });
81378
+ function (declaration) { return declaration.kind === node.kind && !(declaration.flags & 262144 /* JavaScriptFile */); });
81017
81379
  // Only type check the symbol once
81018
81380
  if (node === firstDeclaration) {
81019
81381
  checkFunctionOrConstructorSymbol(localSymbol);
@@ -81135,7 +81497,7 @@ var ts;
81135
81497
  var symbol = getSymbolOfNode(member);
81136
81498
  if (!symbol.isReferenced
81137
81499
  && (ts.hasEffectiveModifier(member, 8 /* Private */) || ts.isNamedDeclaration(member) && ts.isPrivateIdentifier(member.name))
81138
- && !(member.flags & 8388608 /* Ambient */)) {
81500
+ && !(member.flags & 16777216 /* Ambient */)) {
81139
81501
  addDiagnostic(member, 0 /* Local */, ts.createDiagnosticForNode(member.name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, symbolToString(symbol)));
81140
81502
  }
81141
81503
  break;
@@ -81325,8 +81687,8 @@ var ts;
81325
81687
  : ts.createDiagnosticForNode(declarationList.parent.kind === 237 /* VariableStatement */ ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused));
81326
81688
  }
81327
81689
  else {
81328
- for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) {
81329
- var decl = declarations_5[_i];
81690
+ for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) {
81691
+ var decl = declarations_6[_i];
81330
81692
  addDiagnostic(decl, 0 /* Local */, ts.createDiagnosticForNode(decl, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(decl.name)));
81331
81693
  }
81332
81694
  }
@@ -81368,7 +81730,7 @@ var ts;
81368
81730
  }
81369
81731
  function checkCollisionWithArgumentsInGeneratedCode(node) {
81370
81732
  // no rest parameters \ declaration context \ overload - no codegen impact
81371
- if (languageVersion >= 2 /* ES2015 */ || !ts.hasRestParameter(node) || node.flags & 8388608 /* Ambient */ || ts.nodeIsMissing(node.body)) {
81733
+ if (languageVersion >= 2 /* ES2015 */ || !ts.hasRestParameter(node) || node.flags & 16777216 /* Ambient */ || ts.nodeIsMissing(node.body)) {
81372
81734
  return;
81373
81735
  }
81374
81736
  ts.forEach(node.parameters, function (p) {
@@ -81396,7 +81758,7 @@ var ts;
81396
81758
  // it is ok to have member named '_super', '_this', `Promise`, etc. - member access is always qualified
81397
81759
  return false;
81398
81760
  }
81399
- if (node.flags & 8388608 /* Ambient */) {
81761
+ if (node.flags & 16777216 /* Ambient */) {
81400
81762
  // ambient context - no codegen impact
81401
81763
  return false;
81402
81764
  }
@@ -81535,7 +81897,7 @@ var ts;
81535
81897
  recordPotentialCollisionWithReflectInGeneratedCode(node, name);
81536
81898
  if (ts.isClassLike(node)) {
81537
81899
  checkTypeNameIsReserved(name, ts.Diagnostics.Class_name_cannot_be_0);
81538
- if (!(node.flags & 8388608 /* Ambient */)) {
81900
+ if (!(node.flags & 16777216 /* Ambient */)) {
81539
81901
  checkClassNameCollisionWithObject(name);
81540
81902
  }
81541
81903
  }
@@ -83129,23 +83491,23 @@ var ts;
83129
83491
  return;
83130
83492
  }
83131
83493
  var type = getDeclaredTypeOfSymbol(symbol);
83132
- if (!areTypeParametersIdentical(declarations, type.localTypeParameters)) {
83494
+ if (!areTypeParametersIdentical(declarations, type.localTypeParameters, ts.getEffectiveTypeParameterDeclarations)) {
83133
83495
  // Report an error on every conflicting declaration.
83134
83496
  var name = symbolToString(symbol);
83135
- for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) {
83136
- var declaration = declarations_6[_i];
83497
+ for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) {
83498
+ var declaration = declarations_7[_i];
83137
83499
  error(declaration.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, name);
83138
83500
  }
83139
83501
  }
83140
83502
  }
83141
83503
  }
83142
- function areTypeParametersIdentical(declarations, targetParameters) {
83504
+ function areTypeParametersIdentical(declarations, targetParameters, getTypeParameterDeclarations) {
83143
83505
  var maxTypeArgumentCount = ts.length(targetParameters);
83144
83506
  var minTypeArgumentCount = getMinTypeArgumentCount(targetParameters);
83145
- for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) {
83146
- var declaration = declarations_7[_i];
83507
+ for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) {
83508
+ var declaration = declarations_8[_i];
83147
83509
  // If this declaration has too few or too many type parameters, we report an error
83148
- var sourceParameters = ts.getEffectiveTypeParameterDeclarations(declaration);
83510
+ var sourceParameters = getTypeParameterDeclarations(declaration);
83149
83511
  var numTypeParameters = sourceParameters.length;
83150
83512
  if (numTypeParameters < minTypeArgumentCount || numTypeParameters > maxTypeArgumentCount) {
83151
83513
  return false;
@@ -83213,7 +83575,7 @@ var ts;
83213
83575
  checkFunctionOrConstructorSymbol(symbol);
83214
83576
  checkClassForDuplicateDeclarations(node);
83215
83577
  // Only check for reserved static identifiers on non-ambient context.
83216
- var nodeInAmbientContext = !!(node.flags & 8388608 /* Ambient */);
83578
+ var nodeInAmbientContext = !!(node.flags & 16777216 /* Ambient */);
83217
83579
  if (!nodeInAmbientContext) {
83218
83580
  checkClassForStaticPropertyNameConflicts(node);
83219
83581
  }
@@ -83363,7 +83725,7 @@ var ts;
83363
83725
  */
83364
83726
  function checkMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, memberHasOverrideModifier, memberHasAbstractModifier, memberIsStatic, memberIsParameterProperty, memberName, errorNode) {
83365
83727
  var isJs = ts.isInJSFile(node);
83366
- var nodeInAmbientContext = !!(node.flags & 8388608 /* Ambient */);
83728
+ var nodeInAmbientContext = !!(node.flags & 16777216 /* Ambient */);
83367
83729
  if (baseWithThis && (memberHasOverrideModifier || compilerOptions.noImplicitOverride)) {
83368
83730
  var memberEscapedName = ts.escapeLeadingUnderscores(memberName);
83369
83731
  var thisType = memberIsStatic ? staticType : typeWithThis;
@@ -83591,7 +83953,7 @@ var ts;
83591
83953
  && !(derived.flags & 33554432 /* Transient */)
83592
83954
  && !(baseDeclarationFlags & 128 /* Abstract */)
83593
83955
  && !(derivedDeclarationFlags & 128 /* Abstract */)
83594
- && !((_b = derived.declarations) === null || _b === void 0 ? void 0 : _b.some(function (d) { return !!(d.flags & 8388608 /* Ambient */); }))) {
83956
+ && !((_b = derived.declarations) === null || _b === void 0 ? void 0 : _b.some(function (d) { return !!(d.flags & 16777216 /* Ambient */); }))) {
83595
83957
  var constructor = findConstructorDeclaration(ts.getClassLikeDeclarationOfSymbol(type.symbol));
83596
83958
  var propName = uninitialized.name;
83597
83959
  if (uninitialized.exclamationToken
@@ -83683,7 +84045,7 @@ var ts;
83683
84045
  return ok;
83684
84046
  }
83685
84047
  function checkPropertyInitialization(node) {
83686
- if (!strictNullChecks || !strictPropertyInitialization || node.flags & 8388608 /* Ambient */) {
84048
+ if (!strictNullChecks || !strictPropertyInitialization || node.flags & 16777216 /* Ambient */) {
83687
84049
  return;
83688
84050
  }
83689
84051
  var constructor = findConstructorDeclaration(node);
@@ -83820,7 +84182,7 @@ var ts;
83820
84182
  }
83821
84183
  // In ambient non-const numeric enum declarations, enum members without initializers are
83822
84184
  // considered computed members (as opposed to having auto-incremented values).
83823
- if (member.parent.flags & 8388608 /* Ambient */ && !ts.isEnumConst(member.parent) && getEnumKind(getSymbolOfNode(member.parent)) === 0 /* Numeric */) {
84185
+ if (member.parent.flags & 16777216 /* Ambient */ && !ts.isEnumConst(member.parent) && getEnumKind(getSymbolOfNode(member.parent)) === 0 /* Numeric */) {
83824
84186
  return undefined;
83825
84187
  }
83826
84188
  // If the member declaration specifies no value, the member is considered a constant enum member.
@@ -83852,7 +84214,7 @@ var ts;
83852
84214
  else if (isConstEnum) {
83853
84215
  error(initializer, ts.Diagnostics.const_enum_member_initializers_can_only_contain_literal_values_and_other_computed_enum_values);
83854
84216
  }
83855
- else if (member.parent.flags & 8388608 /* Ambient */) {
84217
+ else if (member.parent.flags & 16777216 /* Ambient */) {
83856
84218
  error(initializer, ts.Diagnostics.In_ambient_enum_declarations_member_initializer_must_be_constant_expression);
83857
84219
  }
83858
84220
  else {
@@ -84020,11 +84382,11 @@ var ts;
84020
84382
  function getFirstNonAmbientClassOrFunctionDeclaration(symbol) {
84021
84383
  var declarations = symbol.declarations;
84022
84384
  if (declarations) {
84023
- for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) {
84024
- var declaration = declarations_8[_i];
84385
+ for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) {
84386
+ var declaration = declarations_9[_i];
84025
84387
  if ((declaration.kind === 257 /* ClassDeclaration */ ||
84026
84388
  (declaration.kind === 256 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) &&
84027
- !(declaration.flags & 8388608 /* Ambient */)) {
84389
+ !(declaration.flags & 16777216 /* Ambient */)) {
84028
84390
  return declaration;
84029
84391
  }
84030
84392
  }
@@ -84055,7 +84417,7 @@ var ts;
84055
84417
  function checkModuleDeclarationDiagnostics() {
84056
84418
  // Grammar checking
84057
84419
  var isGlobalAugmentation = ts.isGlobalScopeAugmentation(node);
84058
- var inAmbientContext = node.flags & 8388608 /* Ambient */;
84420
+ var inAmbientContext = node.flags & 16777216 /* Ambient */;
84059
84421
  if (isGlobalAugmentation && !inAmbientContext) {
84060
84422
  error(node.name, ts.Diagnostics.Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context);
84061
84423
  }
@@ -84273,7 +84635,7 @@ var ts;
84273
84635
  }
84274
84636
  if (compilerOptions.isolatedModules
84275
84637
  && !ts.isTypeOnlyImportOrExportDeclaration(node)
84276
- && !(node.flags & 8388608 /* Ambient */)) {
84638
+ && !(node.flags & 16777216 /* Ambient */)) {
84277
84639
  var typeOnlyAlias = getTypeOnlyAliasDeclaration(symbol);
84278
84640
  var isType = !(target.flags & 111551 /* Value */);
84279
84641
  if (isType || typeOnlyAlias) {
@@ -84319,7 +84681,7 @@ var ts;
84319
84681
  }
84320
84682
  }
84321
84683
  function isDeprecatedAliasedSymbol(symbol) {
84322
- return !!symbol.declarations && ts.every(symbol.declarations, function (d) { return !!(ts.getCombinedNodeFlags(d) & 134217728 /* Deprecated */); });
84684
+ return !!symbol.declarations && ts.every(symbol.declarations, function (d) { return !!(ts.getCombinedNodeFlags(d) & 268435456 /* Deprecated */); });
84323
84685
  }
84324
84686
  function checkDeprecatedAliasedSymbol(symbol, location) {
84325
84687
  if (!(symbol.flags & 2097152 /* Alias */))
@@ -84448,7 +84810,7 @@ var ts;
84448
84810
  }
84449
84811
  }
84450
84812
  else {
84451
- if (moduleKind >= ts.ModuleKind.ES2015 && ts.getSourceFileOfNode(node).impliedNodeFormat === undefined && !node.isTypeOnly && !(node.flags & 8388608 /* Ambient */)) {
84813
+ if (moduleKind >= ts.ModuleKind.ES2015 && ts.getSourceFileOfNode(node).impliedNodeFormat === undefined && !node.isTypeOnly && !(node.flags & 16777216 /* Ambient */)) {
84452
84814
  // Import equals declaration is deprecated in es6 or above
84453
84815
  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);
84454
84816
  }
@@ -84474,7 +84836,7 @@ var ts;
84474
84836
  ts.forEach(node.exportClause.elements, checkExportSpecifier);
84475
84837
  var inAmbientExternalModule = node.parent.kind === 262 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent);
84476
84838
  var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 262 /* ModuleBlock */ &&
84477
- !node.moduleSpecifier && node.flags & 8388608 /* Ambient */;
84839
+ !node.moduleSpecifier && node.flags & 16777216 /* Ambient */;
84478
84840
  if (node.parent.kind !== 305 /* SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) {
84479
84841
  error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace);
84480
84842
  }
@@ -84639,10 +85001,10 @@ var ts;
84639
85001
  checkExpressionCached(node.expression);
84640
85002
  }
84641
85003
  checkExternalModuleExports(container);
84642
- if ((node.flags & 8388608 /* Ambient */) && !ts.isEntityNameExpression(node.expression)) {
85004
+ if ((node.flags & 16777216 /* Ambient */) && !ts.isEntityNameExpression(node.expression)) {
84643
85005
  grammarErrorOnNode(node.expression, ts.Diagnostics.The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context);
84644
85006
  }
84645
- if (node.isExportEquals && !(node.flags & 8388608 /* Ambient */)) {
85007
+ if (node.isExportEquals && !(node.flags & 16777216 /* Ambient */)) {
84646
85008
  if (moduleKind >= ts.ModuleKind.ES2015 && ts.getSourceFileOfNode(node).impliedNodeFormat !== ts.ModuleKind.CommonJS) {
84647
85009
  // export assignment is not supported in es6 modules
84648
85010
  grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead);
@@ -85075,7 +85437,7 @@ var ts;
85075
85437
  // This relies on the results of other lazy diagnostics, so must be computed after them
85076
85438
  if (!node.isDeclarationFile && (compilerOptions.noUnusedLocals || compilerOptions.noUnusedParameters)) {
85077
85439
  checkUnusedIdentifiers(getPotentiallyUnusedIdentifiers(node), function (containingNode, kind, diag) {
85078
- if (!ts.containsParseError(containingNode) && unusedIsError(kind, !!(containingNode.flags & 8388608 /* Ambient */))) {
85440
+ if (!ts.containsParseError(containingNode) && unusedIsError(kind, !!(containingNode.flags & 16777216 /* Ambient */))) {
85079
85441
  diagnostics.add(diag);
85080
85442
  }
85081
85443
  });
@@ -85175,7 +85537,7 @@ var ts;
85175
85537
  }
85176
85538
  // Language service support
85177
85539
  function getSymbolsInScope(location, meaning) {
85178
- if (location.flags & 16777216 /* InWithStatement */) {
85540
+ if (location.flags & 33554432 /* InWithStatement */) {
85179
85541
  // We cannot answer semantic questions within a with block, do not proceed any further
85180
85542
  return [];
85181
85543
  }
@@ -85525,7 +85887,7 @@ var ts;
85525
85887
  }
85526
85888
  var parent = node.parent;
85527
85889
  var grandParent = parent.parent;
85528
- if (node.flags & 16777216 /* InWithStatement */) {
85890
+ if (node.flags & 33554432 /* InWithStatement */) {
85529
85891
  // We cannot answer semantic questions within a with block, do not proceed any further
85530
85892
  return undefined;
85531
85893
  }
@@ -85667,7 +86029,7 @@ var ts;
85667
86029
  if (ts.isSourceFile(node) && !ts.isExternalModule(node)) {
85668
86030
  return errorType;
85669
86031
  }
85670
- if (node.flags & 16777216 /* InWithStatement */) {
86032
+ if (node.flags & 33554432 /* InWithStatement */) {
85671
86033
  // We cannot answer semantic questions within a with block, do not proceed any further
85672
86034
  return errorType;
85673
86035
  }
@@ -85832,11 +86194,11 @@ var ts;
85832
86194
  var _a = symbol, leftSpread = _a.leftSpread, rightSpread = _a.rightSpread, syntheticOrigin = _a.syntheticOrigin;
85833
86195
  return leftSpread ? [leftSpread, rightSpread]
85834
86196
  : syntheticOrigin ? [syntheticOrigin]
85835
- : ts.singleElementArray(tryGetAliasTarget(symbol));
86197
+ : ts.singleElementArray(tryGetTarget(symbol));
85836
86198
  }
85837
86199
  return undefined;
85838
86200
  }
85839
- function tryGetAliasTarget(symbol) {
86201
+ function tryGetTarget(symbol) {
85840
86202
  var target;
85841
86203
  var next = symbol;
85842
86204
  while (next = getSymbolLinks(next).target) {
@@ -86066,7 +86428,7 @@ var ts;
86066
86428
  if (links === null || links === void 0 ? void 0 : links.referenced) {
86067
86429
  return true;
86068
86430
  }
86069
- var target = getSymbolLinks(symbol).target; // TODO: GH#18217
86431
+ var target = getSymbolLinks(symbol).aliasTarget; // TODO: GH#18217
86070
86432
  if (target && ts.getEffectiveModifierFlags(node) & 1 /* Export */ &&
86071
86433
  target.flags & 111551 /* Value */ &&
86072
86434
  (ts.shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target))) {
@@ -86720,7 +87082,7 @@ var ts;
86720
87082
  function checkExternalEmitHelpers(location, helpers) {
86721
87083
  if ((requestedExternalEmitHelpers & helpers) !== helpers && compilerOptions.importHelpers) {
86722
87084
  var sourceFile = ts.getSourceFileOfNode(location);
86723
- if (ts.isEffectiveExternalModule(sourceFile, compilerOptions) && !(location.flags & 8388608 /* Ambient */)) {
87085
+ if (ts.isEffectiveExternalModule(sourceFile, compilerOptions) && !(location.flags & 16777216 /* Ambient */)) {
86724
87086
  var helpersModule = resolveHelpersModule(sourceFile, location);
86725
87087
  if (helpersModule !== unknownSymbol) {
86726
87088
  var uncheckedHelpers = helpers & ~requestedExternalEmitHelpers;
@@ -86973,7 +87335,7 @@ var ts;
86973
87335
  else if (node.kind === 164 /* Parameter */) {
86974
87336
  return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare");
86975
87337
  }
86976
- else if ((node.parent.flags & 8388608 /* Ambient */) && node.parent.kind === 262 /* ModuleBlock */) {
87338
+ else if ((node.parent.flags & 16777216 /* Ambient */) && node.parent.kind === 262 /* ModuleBlock */) {
86977
87339
  return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context);
86978
87340
  }
86979
87341
  else if (ts.isPrivateIdentifierClassElementDeclaration(node)) {
@@ -87019,7 +87381,7 @@ var ts;
87019
87381
  if (flags & 256 /* Async */) {
87020
87382
  return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async");
87021
87383
  }
87022
- else if (flags & 2 /* Ambient */ || node.parent.flags & 8388608 /* Ambient */) {
87384
+ else if (flags & 2 /* Ambient */ || node.parent.flags & 16777216 /* Ambient */) {
87023
87385
  return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async");
87024
87386
  }
87025
87387
  else if (node.kind === 164 /* Parameter */) {
@@ -87165,7 +87527,7 @@ var ts;
87165
87527
  if (i !== (parameterCount - 1)) {
87166
87528
  return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list);
87167
87529
  }
87168
- if (!(parameter.flags & 8388608 /* Ambient */)) { // Allow `...foo,` in ambient declarations; see GH#23070
87530
+ if (!(parameter.flags & 16777216 /* Ambient */)) { // Allow `...foo,` in ambient declarations; see GH#23070
87169
87531
  checkGrammarForDisallowedTrailingComma(parameters, ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma);
87170
87532
  }
87171
87533
  if (parameter.questionToken) {
@@ -87376,7 +87738,7 @@ var ts;
87376
87738
  ts.Debug.assert(node.kind === 256 /* FunctionDeclaration */ ||
87377
87739
  node.kind === 213 /* FunctionExpression */ ||
87378
87740
  node.kind === 169 /* MethodDeclaration */);
87379
- if (node.flags & 8388608 /* Ambient */) {
87741
+ if (node.flags & 16777216 /* Ambient */) {
87380
87742
  return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context);
87381
87743
  }
87382
87744
  if (!node.body) {
@@ -87614,7 +87976,7 @@ var ts;
87614
87976
  return false;
87615
87977
  }
87616
87978
  function checkGrammarAccessor(accessor) {
87617
- if (!(accessor.flags & 8388608 /* Ambient */) && (accessor.parent.kind !== 182 /* TypeLiteral */) && (accessor.parent.kind !== 258 /* InterfaceDeclaration */)) {
87979
+ if (!(accessor.flags & 16777216 /* Ambient */) && (accessor.parent.kind !== 182 /* TypeLiteral */) && (accessor.parent.kind !== 258 /* InterfaceDeclaration */)) {
87618
87980
  if (languageVersion < 1 /* ES5 */) {
87619
87981
  return grammarErrorOnNode(accessor.name, ts.Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher);
87620
87982
  }
@@ -87754,7 +88116,7 @@ var ts;
87754
88116
  // However, property declarations disallow computed names in general,
87755
88117
  // and accessors are not allowed in ambient contexts in general,
87756
88118
  // so this error only really matters for methods.
87757
- if (node.flags & 8388608 /* Ambient */) {
88119
+ if (node.flags & 16777216 /* Ambient */) {
87758
88120
  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);
87759
88121
  }
87760
88122
  else if (node.kind === 169 /* MethodDeclaration */ && !node.body) {
@@ -87870,7 +88232,7 @@ var ts;
87870
88232
  }
87871
88233
  function checkGrammarVariableDeclaration(node) {
87872
88234
  if (node.parent.parent.kind !== 243 /* ForInStatement */ && node.parent.parent.kind !== 244 /* ForOfStatement */) {
87873
- if (node.flags & 8388608 /* Ambient */) {
88235
+ if (node.flags & 16777216 /* Ambient */) {
87874
88236
  checkAmbientInitializer(node);
87875
88237
  }
87876
88238
  else if (!node.initializer) {
@@ -87882,7 +88244,7 @@ var ts;
87882
88244
  }
87883
88245
  }
87884
88246
  }
87885
- if (node.exclamationToken && (node.parent.parent.kind !== 237 /* VariableStatement */ || !node.type || node.initializer || node.flags & 8388608 /* Ambient */)) {
88247
+ if (node.exclamationToken && (node.parent.parent.kind !== 237 /* VariableStatement */ || !node.type || node.initializer || node.flags & 16777216 /* Ambient */)) {
87886
88248
  var message = node.initializer
87887
88249
  ? ts.Diagnostics.Declarations_with_initializers_cannot_also_have_definite_assignment_assertions
87888
88250
  : !node.type
@@ -87891,7 +88253,7 @@ var ts;
87891
88253
  return grammarErrorOnNode(node.exclamationToken, message);
87892
88254
  }
87893
88255
  if ((moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS) && moduleKind !== ts.ModuleKind.System &&
87894
- !(node.parent.parent.flags & 8388608 /* Ambient */) && ts.hasSyntacticModifier(node.parent.parent, 1 /* Export */)) {
88256
+ !(node.parent.parent.flags & 16777216 /* Ambient */) && ts.hasSyntacticModifier(node.parent.parent, 1 /* Export */)) {
87895
88257
  checkESModuleMarker(node.name);
87896
88258
  }
87897
88259
  var checkLetConstNames = (ts.isLet(node) || ts.isVarConst(node));
@@ -88068,11 +88430,11 @@ var ts;
88068
88430
  return grammarErrorOnNode(node.initializer, ts.Diagnostics.A_type_literal_property_cannot_have_an_initializer);
88069
88431
  }
88070
88432
  }
88071
- if (node.flags & 8388608 /* Ambient */) {
88433
+ if (node.flags & 16777216 /* Ambient */) {
88072
88434
  checkAmbientInitializer(node);
88073
88435
  }
88074
88436
  if (ts.isPropertyDeclaration(node) && node.exclamationToken && (!ts.isClassLike(node.parent) || !node.type || node.initializer ||
88075
- node.flags & 8388608 /* Ambient */ || ts.isStatic(node) || ts.hasAbstractModifier(node))) {
88437
+ node.flags & 16777216 /* Ambient */ || ts.isStatic(node) || ts.hasAbstractModifier(node))) {
88076
88438
  var message = node.initializer
88077
88439
  ? ts.Diagnostics.Declarations_with_initializers_cannot_also_have_definite_assignment_assertions
88078
88440
  : !node.type
@@ -88118,10 +88480,10 @@ var ts;
88118
88480
  return false;
88119
88481
  }
88120
88482
  function checkGrammarSourceFile(node) {
88121
- return !!(node.flags & 8388608 /* Ambient */) && checkGrammarTopLevelElementsForRequiredDeclareModifier(node);
88483
+ return !!(node.flags & 16777216 /* Ambient */) && checkGrammarTopLevelElementsForRequiredDeclareModifier(node);
88122
88484
  }
88123
88485
  function checkGrammarStatementInAmbientContext(node) {
88124
- if (node.flags & 8388608 /* Ambient */) {
88486
+ if (node.flags & 16777216 /* Ambient */) {
88125
88487
  // Find containing block which is either Block, ModuleBlock, SourceFile
88126
88488
  var links = getNodeLinks(node);
88127
88489
  if (!links.hasReportedStatementInAmbientContext && (ts.isFunctionLike(node.parent) || ts.isAccessor(node.parent))) {
@@ -92239,7 +92601,7 @@ var ts;
92239
92601
  return !ts.nodeIsMissing(node.body);
92240
92602
  }
92241
92603
  function visitPropertyDeclaration(node) {
92242
- if (node.flags & 8388608 /* Ambient */ || ts.hasSyntacticModifier(node, 128 /* Abstract */)) {
92604
+ if (node.flags & 16777216 /* Ambient */ || ts.hasSyntacticModifier(node, 128 /* Abstract */)) {
92243
92605
  return undefined;
92244
92606
  }
92245
92607
  var updated = factory.updatePropertyDeclaration(node,
@@ -99129,8 +99491,8 @@ var ts;
99129
99491
  // declarations may not be sorted by position.
99130
99492
  // pos should be the minimum* position over all nodes (that's not -1), end should be the maximum end over all nodes.
99131
99493
  var pos = -1, end = -1;
99132
- for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) {
99133
- var node = declarations_9[_i];
99494
+ for (var _i = 0, declarations_10 = declarations; _i < declarations_10.length; _i++) {
99495
+ var node = declarations_10[_i];
99134
99496
  pos = pos === -1 ? node.pos : node.pos === -1 ? pos : Math.min(pos, node.pos);
99135
99497
  end = Math.max(end, node.end);
99136
99498
  }
@@ -108062,6 +108424,10 @@ var ts;
108062
108424
  return factory.updateModifiers(statement, modifiers);
108063
108425
  }
108064
108426
  function transformTopLevelDeclaration(input) {
108427
+ if (lateMarkedStatements) {
108428
+ while (ts.orderedRemoveItem(lateMarkedStatements, input))
108429
+ ;
108430
+ }
108065
108431
  if (shouldStripInternal(input))
108066
108432
  return;
108067
108433
  switch (input.kind) {
@@ -108173,7 +108539,7 @@ var ts;
108173
108539
  needsScopeFixMarker = false;
108174
108540
  var statements = ts.visitNodes(inner.statements, visitDeclarationStatements);
108175
108541
  var lateStatements = transformAndReplaceLatePaintedStatements(statements);
108176
- if (input.flags & 8388608 /* Ambient */) {
108542
+ if (input.flags & 16777216 /* Ambient */) {
108177
108543
  needsScopeFixMarker = false; // If it was `declare`'d everything is implicitly exported already, ignore late printed "privates"
108178
108544
  }
108179
108545
  // With the final list of statements, there are 3 possibilities:
@@ -109821,6 +110187,9 @@ var ts;
109821
110187
  var currentParenthesizerRule;
109822
110188
  var _c = ts.performance.createTimerIf(extendedDiagnostics, "commentTime", "beforeComment", "afterComment"), enterComment = _c.enter, exitComment = _c.exit;
109823
110189
  var parenthesizer = ts.factory.parenthesizer;
110190
+ var typeArgumentParenthesizerRuleSelector = {
110191
+ select: function (index) { return index === 0 ? parenthesizer.parenthesizeLeadingTypeArgument : undefined; }
110192
+ };
109824
110193
  var emitBinaryExpression = createEmitBinaryExpression();
109825
110194
  reset();
109826
110195
  return {
@@ -111033,7 +111402,7 @@ var ts;
111033
111402
  writePunctuation("}");
111034
111403
  }
111035
111404
  function emitArrayType(node) {
111036
- emit(node.elementType, parenthesizer.parenthesizeElementTypeOfArrayType);
111405
+ emit(node.elementType, parenthesizer.parenthesizeNonArrayTypeOfPostfixType);
111037
111406
  writePunctuation("[");
111038
111407
  writePunctuation("]");
111039
111408
  }
@@ -111044,7 +111413,7 @@ var ts;
111044
111413
  function emitTupleType(node) {
111045
111414
  emitTokenWithComment(22 /* OpenBracketToken */, node.pos, writePunctuation, node);
111046
111415
  var flags = ts.getEmitFlags(node) & 1 /* SingleLine */ ? 528 /* SingleLineTupleTypeElements */ : 657 /* MultiLineTupleTypeElements */;
111047
- emitList(node, node.elements, flags | 524288 /* NoSpaceIfEmpty */);
111416
+ emitList(node, node.elements, flags | 524288 /* NoSpaceIfEmpty */, parenthesizer.parenthesizeElementTypeOfTupleType);
111048
111417
  emitTokenWithComment(23 /* CloseBracketToken */, node.elements.end, writePunctuation, node);
111049
111418
  }
111050
111419
  function emitNamedTupleMember(node) {
@@ -111056,21 +111425,21 @@ var ts;
111056
111425
  emit(node.type);
111057
111426
  }
111058
111427
  function emitOptionalType(node) {
111059
- emit(node.type, parenthesizer.parenthesizeElementTypeOfArrayType);
111428
+ emit(node.type, parenthesizer.parenthesizeTypeOfOptionalType);
111060
111429
  writePunctuation("?");
111061
111430
  }
111062
111431
  function emitUnionType(node) {
111063
- emitList(node, node.types, 516 /* UnionTypeConstituents */, parenthesizer.parenthesizeMemberOfElementType);
111432
+ emitList(node, node.types, 516 /* UnionTypeConstituents */, parenthesizer.parenthesizeConstituentTypeOfUnionType);
111064
111433
  }
111065
111434
  function emitIntersectionType(node) {
111066
- emitList(node, node.types, 520 /* IntersectionTypeConstituents */, parenthesizer.parenthesizeMemberOfElementType);
111435
+ emitList(node, node.types, 520 /* IntersectionTypeConstituents */, parenthesizer.parenthesizeConstituentTypeOfIntersectionType);
111067
111436
  }
111068
111437
  function emitConditionalType(node) {
111069
- emit(node.checkType, parenthesizer.parenthesizeMemberOfConditionalType);
111438
+ emit(node.checkType, parenthesizer.parenthesizeCheckTypeOfConditionalType);
111070
111439
  writeSpace();
111071
111440
  writeKeyword("extends");
111072
111441
  writeSpace();
111073
- emit(node.extendsType, parenthesizer.parenthesizeMemberOfConditionalType);
111442
+ emit(node.extendsType, parenthesizer.parenthesizeExtendsTypeOfConditionalType);
111074
111443
  writeSpace();
111075
111444
  writePunctuation("?");
111076
111445
  writeSpace();
@@ -111096,10 +111465,13 @@ var ts;
111096
111465
  function emitTypeOperator(node) {
111097
111466
  writeTokenText(node.operator, writeKeyword);
111098
111467
  writeSpace();
111099
- emit(node.type, parenthesizer.parenthesizeMemberOfElementType);
111468
+ var parenthesizerRule = node.operator === 145 /* ReadonlyKeyword */ ?
111469
+ parenthesizer.parenthesizeOperandOfReadonlyTypeOperator :
111470
+ parenthesizer.parenthesizeOperandOfTypeOperator;
111471
+ emit(node.type, parenthesizerRule);
111100
111472
  }
111101
111473
  function emitIndexedAccessType(node) {
111102
- emit(node.objectType, parenthesizer.parenthesizeMemberOfElementType);
111474
+ emit(node.objectType, parenthesizer.parenthesizeNonArrayTypeOfPostfixType);
111103
111475
  writePunctuation("[");
111104
111476
  emit(node.indexType);
111105
111477
  writePunctuation("]");
@@ -112833,7 +113205,7 @@ var ts;
112833
113205
  emitList(parentNode, decorators, 2146305 /* Decorators */);
112834
113206
  }
112835
113207
  function emitTypeArguments(parentNode, typeArguments) {
112836
- emitList(parentNode, typeArguments, 53776 /* TypeArguments */, parenthesizer.parenthesizeMemberOfElementType);
113208
+ emitList(parentNode, typeArguments, 53776 /* TypeArguments */, typeArgumentParenthesizerRuleSelector);
112837
113209
  }
112838
113210
  function emitTypeParameters(parentNode, typeParameters) {
112839
113211
  if (ts.isFunctionLike(parentNode) && parentNode.typeArguments) { // Quick info uses type arguments in place of type parameters on instantiated signatures
@@ -112952,6 +113324,7 @@ var ts;
112952
113324
  if (format & 128 /* Indented */) {
112953
113325
  increaseIndent();
112954
113326
  }
113327
+ var emitListItem = getEmitListItem(emit, parenthesizerRule);
112955
113328
  // Emit each child.
112956
113329
  var previousSibling = void 0;
112957
113330
  var previousSourceFileTextKind = void 0;
@@ -113002,12 +113375,7 @@ var ts;
113002
113375
  shouldEmitInterveningComments = mayEmitInterveningComments;
113003
113376
  }
113004
113377
  nextListElementPos = child.pos;
113005
- if (emit.length === 1) {
113006
- emit(child);
113007
- }
113008
- else {
113009
- emit(child, parenthesizerRule);
113010
- }
113378
+ emitListItem(child, emit, parenthesizerRule, i);
113011
113379
  if (shouldDecreaseIndentAfterEmit) {
113012
113380
  decreaseIndent();
113013
113381
  shouldDecreaseIndentAfterEmit = false;
@@ -114248,6 +114616,20 @@ var ts;
114248
114616
  TempFlags[TempFlags["CountMask"] = 268435455] = "CountMask";
114249
114617
  TempFlags[TempFlags["_i"] = 268435456] = "_i";
114250
114618
  })(TempFlags || (TempFlags = {}));
114619
+ function emitListItemNoParenthesizer(node, emit, _parenthesizerRule, _index) {
114620
+ emit(node);
114621
+ }
114622
+ function emitListItemWithParenthesizerRuleSelector(node, emit, parenthesizerRuleSelector, index) {
114623
+ emit(node, parenthesizerRuleSelector.select(index));
114624
+ }
114625
+ function emitListItemWithParenthesizerRule(node, emit, parenthesizerRule, _index) {
114626
+ emit(node, parenthesizerRule);
114627
+ }
114628
+ function getEmitListItem(emit, parenthesizerRule) {
114629
+ return emit.length === 1 ? emitListItemNoParenthesizer :
114630
+ typeof parenthesizerRule === "object" ? emitListItemWithParenthesizerRuleSelector :
114631
+ emitListItemWithParenthesizerRule;
114632
+ }
114251
114633
  })(ts || (ts = {}));
114252
114634
  /* @internal */
114253
114635
  var ts;
@@ -116314,7 +116696,7 @@ var ts;
116314
116696
  // moduleAugmentations has changed
116315
116697
  structureIsReused = 1 /* SafeModules */;
116316
116698
  }
116317
- if ((oldSourceFile.flags & 3145728 /* PermanentlySetIncrementalFlags */) !== (newSourceFile.flags & 3145728 /* PermanentlySetIncrementalFlags */)) {
116699
+ if ((oldSourceFile.flags & 6291456 /* PermanentlySetIncrementalFlags */) !== (newSourceFile.flags & 6291456 /* PermanentlySetIncrementalFlags */)) {
116318
116700
  // dynamicImport has changed
116319
116701
  structureIsReused = 1 /* SafeModules */;
116320
116702
  }
@@ -116478,6 +116860,9 @@ var ts;
116478
116860
  return !!sourceFilesFoundSearchingNodeModules.get(file.path);
116479
116861
  }
116480
116862
  function isSourceFileDefaultLibrary(file) {
116863
+ if (!file.isDeclarationFile) {
116864
+ return false;
116865
+ }
116481
116866
  if (file.hasNoDefaultLib) {
116482
116867
  return true;
116483
116868
  }
@@ -116989,7 +117374,7 @@ var ts;
116989
117374
  var node = _a[_i];
116990
117375
  collectModuleReferences(node, /*inAmbientModule*/ false);
116991
117376
  }
116992
- if ((file.flags & 1048576 /* PossiblyContainsDynamicImport */) || isJavaScriptFile) {
117377
+ if ((file.flags & 2097152 /* PossiblyContainsDynamicImport */) || isJavaScriptFile) {
116993
117378
  collectDynamicImportOrRequireCalls(file);
116994
117379
  }
116995
117380
  file.imports = imports || ts.emptyArray;
@@ -117587,7 +117972,7 @@ var ts;
117587
117972
  && index < file.imports.length
117588
117973
  && !elideImport
117589
117974
  && !(isJsFile && !ts.getAllowJSCompilerOption(optionsForFile))
117590
- && (ts.isInJSFile(file.imports[index]) || !(file.imports[index].flags & 4194304 /* JSDoc */));
117975
+ && (ts.isInJSFile(file.imports[index]) || !(file.imports[index].flags & 8388608 /* JSDoc */));
117591
117976
  if (elideImport) {
117592
117977
  modulesWithElidedImports.set(file.path, true);
117593
117978
  }
@@ -117668,21 +118053,6 @@ var ts;
117668
118053
  return resolvedRef;
117669
118054
  }
117670
118055
  function verifyCompilerOptions() {
117671
- var isNightly = ts.stringContains(ts.version, "-dev") || ts.stringContains(ts.version, "-insiders");
117672
- if (!isNightly) {
117673
- if (ts.getEmitModuleKind(options) === ts.ModuleKind.Node12) {
117674
- 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");
117675
- }
117676
- else if (ts.getEmitModuleKind(options) === ts.ModuleKind.NodeNext) {
117677
- 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");
117678
- }
117679
- else if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node12) {
117680
- 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");
117681
- }
117682
- else if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) {
117683
- 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");
117684
- }
117685
- }
117686
118056
  if (options.strictPropertyInitialization && !ts.getStrictOptionValue(options, "strictNullChecks")) {
117687
118057
  createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "strictPropertyInitialization", "strictNullChecks");
117688
118058
  }