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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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.20220405";
92
+ ts.version = ts.versionMajorMinor + ".0-dev.20220406";
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) {
@@ -8877,6 +8878,7 @@ var ts;
8877
8878
  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
8879
  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
8880
  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."),
8881
+ 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
8882
  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
8883
  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
8884
  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 +14293,24 @@ var ts;
14291
14293
  // Returns true if this node contains a parse error anywhere underneath it.
14292
14294
  function containsParseError(node) {
14293
14295
  aggregateChildData(node);
14294
- return (node.flags & 262144 /* ThisNodeOrAnySubNodesHasError */) !== 0;
14296
+ return (node.flags & 524288 /* ThisNodeOrAnySubNodesHasError */) !== 0;
14295
14297
  }
14296
14298
  ts.containsParseError = containsParseError;
14297
14299
  function aggregateChildData(node) {
14298
- if (!(node.flags & 524288 /* HasAggregatedChildData */)) {
14300
+ if (!(node.flags & 1048576 /* HasAggregatedChildData */)) {
14299
14301
  // A node is considered to contain a parse error if:
14300
14302
  // a) the parser explicitly marked that it had an error
14301
14303
  // b) any of it's children reported that it had an error.
14302
- var thisNodeOrAnySubNodesHasError = ((node.flags & 65536 /* ThisNodeHasError */) !== 0) ||
14304
+ var thisNodeOrAnySubNodesHasError = ((node.flags & 131072 /* ThisNodeHasError */) !== 0) ||
14303
14305
  ts.forEachChild(node, containsParseError);
14304
14306
  // If so, mark ourselves accordingly.
14305
14307
  if (thisNodeOrAnySubNodesHasError) {
14306
- node.flags |= 262144 /* ThisNodeOrAnySubNodesHasError */;
14308
+ node.flags |= 524288 /* ThisNodeOrAnySubNodesHasError */;
14307
14309
  }
14308
14310
  // Also mark that we've propagated the child information to this node. This way we can
14309
14311
  // always consult the bit directly on this node without needing to check its children
14310
14312
  // again.
14311
- node.flags |= 524288 /* HasAggregatedChildData */;
14313
+ node.flags |= 1048576 /* HasAggregatedChildData */;
14312
14314
  }
14313
14315
  }
14314
14316
  function getSourceFileOfNode(node) {
@@ -16115,11 +16117,11 @@ var ts;
16115
16117
  }
16116
16118
  ts.isSourceFileNotJS = isSourceFileNotJS;
16117
16119
  function isInJSFile(node) {
16118
- return !!node && !!(node.flags & 131072 /* JavaScriptFile */);
16120
+ return !!node && !!(node.flags & 262144 /* JavaScriptFile */);
16119
16121
  }
16120
16122
  ts.isInJSFile = isInJSFile;
16121
16123
  function isInJsonFile(node) {
16122
- return !!node && !!(node.flags & 33554432 /* JsonFile */);
16124
+ return !!node && !!(node.flags & 67108864 /* JsonFile */);
16123
16125
  }
16124
16126
  ts.isInJsonFile = isInJsonFile;
16125
16127
  function isSourceFileNotJson(file) {
@@ -16127,7 +16129,7 @@ var ts;
16127
16129
  }
16128
16130
  ts.isSourceFileNotJson = isSourceFileNotJson;
16129
16131
  function isInJSDoc(node) {
16130
- return !!node && !!(node.flags & 4194304 /* JSDoc */);
16132
+ return !!node && !!(node.flags & 8388608 /* JSDoc */);
16131
16133
  }
16132
16134
  ts.isInJSDoc = isInJSDoc;
16133
16135
  function isJSDocIndexSignature(node) {
@@ -16513,7 +16515,7 @@ var ts;
16513
16515
  function setValueDeclaration(symbol, node) {
16514
16516
  var valueDeclaration = symbol.valueDeclaration;
16515
16517
  if (!valueDeclaration ||
16516
- !(node.flags & 8388608 /* Ambient */ && !(valueDeclaration.flags & 8388608 /* Ambient */)) &&
16518
+ !(node.flags & 16777216 /* Ambient */ && !(valueDeclaration.flags & 16777216 /* Ambient */)) &&
16517
16519
  (isAssignmentDeclaration(valueDeclaration) && !isAssignmentDeclaration(node)) ||
16518
16520
  (valueDeclaration.kind !== node.kind && isEffectiveModuleDeclaration(valueDeclaration))) {
16519
16521
  // other kinds of value declarations take precedence over modules and assignment declarations
@@ -20815,7 +20817,7 @@ var ts;
20815
20817
  }
20816
20818
  ts.pseudoBigIntToString = pseudoBigIntToString;
20817
20819
  function isValidTypeOnlyAliasUseSite(useSite) {
20818
- return !!(useSite.flags & 8388608 /* Ambient */)
20820
+ return !!(useSite.flags & 16777216 /* Ambient */)
20819
20821
  || isPartOfTypeQuery(useSite)
20820
20822
  || isIdentifierInNonEmittingHeritageClause(useSite)
20821
20823
  || isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(useSite)
@@ -21268,11 +21270,20 @@ var ts;
21268
21270
  parenthesizeExpressionForDisallowedComma: parenthesizeExpressionForDisallowedComma,
21269
21271
  parenthesizeExpressionOfExpressionStatement: parenthesizeExpressionOfExpressionStatement,
21270
21272
  parenthesizeConciseBodyOfArrowFunction: parenthesizeConciseBodyOfArrowFunction,
21271
- parenthesizeMemberOfConditionalType: parenthesizeMemberOfConditionalType,
21272
- parenthesizeMemberOfElementType: parenthesizeMemberOfElementType,
21273
- parenthesizeElementTypeOfArrayType: parenthesizeElementTypeOfArrayType,
21274
- parenthesizeConstituentTypesOfUnionOrIntersectionType: parenthesizeConstituentTypesOfUnionOrIntersectionType,
21273
+ parenthesizeCheckTypeOfConditionalType: parenthesizeCheckTypeOfConditionalType,
21274
+ parenthesizeExtendsTypeOfConditionalType: parenthesizeExtendsTypeOfConditionalType,
21275
+ parenthesizeConstituentTypesOfUnionType: parenthesizeConstituentTypesOfUnionType,
21276
+ parenthesizeConstituentTypeOfUnionType: parenthesizeConstituentTypeOfUnionType,
21277
+ parenthesizeConstituentTypesOfIntersectionType: parenthesizeConstituentTypesOfIntersectionType,
21278
+ parenthesizeConstituentTypeOfIntersectionType: parenthesizeConstituentTypeOfIntersectionType,
21279
+ parenthesizeOperandOfTypeOperator: parenthesizeOperandOfTypeOperator,
21280
+ parenthesizeOperandOfReadonlyTypeOperator: parenthesizeOperandOfReadonlyTypeOperator,
21281
+ parenthesizeNonArrayTypeOfPostfixType: parenthesizeNonArrayTypeOfPostfixType,
21282
+ parenthesizeElementTypesOfTupleType: parenthesizeElementTypesOfTupleType,
21283
+ parenthesizeElementTypeOfTupleType: parenthesizeElementTypeOfTupleType,
21284
+ parenthesizeTypeOfOptionalType: parenthesizeTypeOfOptionalType,
21275
21285
  parenthesizeTypeArguments: parenthesizeTypeArguments,
21286
+ parenthesizeLeadingTypeArgument: parenthesizeLeadingTypeArgument,
21276
21287
  };
21277
21288
  function getParenthesizeLeftSideOfBinaryForOperator(operatorKind) {
21278
21289
  binaryLeftOperandParenthesizerCache || (binaryLeftOperandParenthesizerCache = new ts.Map());
@@ -21584,33 +21595,191 @@ var ts;
21584
21595
  }
21585
21596
  return body;
21586
21597
  }
21587
- function parenthesizeMemberOfConditionalType(member) {
21588
- return member.kind === 189 /* ConditionalType */ ? factory.createParenthesizedType(member) : member;
21598
+ // Type[Extends] :
21599
+ // FunctionOrConstructorType
21600
+ // ConditionalType[?Extends]
21601
+ // ConditionalType[Extends] :
21602
+ // UnionType[?Extends]
21603
+ // [~Extends] UnionType[~Extends] `extends` Type[+Extends] `?` Type[~Extends] `:` Type[~Extends]
21604
+ //
21605
+ // - The check type (the `UnionType`, above) does not allow function, constructor, or conditional types (they must be parenthesized)
21606
+ // - The extends type (the first `Type`, above) does not allow conditional types (they must be parenthesized). Function and constructor types are fine.
21607
+ // - The true and false branch types (the second and third `Type` non-terminals, above) allow any type
21608
+ function parenthesizeCheckTypeOfConditionalType(checkType) {
21609
+ switch (checkType.kind) {
21610
+ case 179 /* FunctionType */:
21611
+ case 180 /* ConstructorType */:
21612
+ case 189 /* ConditionalType */:
21613
+ return factory.createParenthesizedType(checkType);
21614
+ }
21615
+ return checkType;
21589
21616
  }
21590
- function parenthesizeMemberOfElementType(member) {
21591
- switch (member.kind) {
21617
+ function parenthesizeExtendsTypeOfConditionalType(extendsType) {
21618
+ switch (extendsType.kind) {
21619
+ case 189 /* ConditionalType */:
21620
+ return factory.createParenthesizedType(extendsType);
21621
+ }
21622
+ return extendsType;
21623
+ }
21624
+ // UnionType[Extends] :
21625
+ // `|`? IntersectionType[?Extends]
21626
+ // UnionType[?Extends] `|` IntersectionType[?Extends]
21627
+ //
21628
+ // - A union type constituent has the same precedence as the check type of a conditional type
21629
+ function parenthesizeConstituentTypeOfUnionType(type) {
21630
+ switch (type.kind) {
21631
+ case 187 /* UnionType */: // Not strictly necessary, but a union containing a union should have been flattened
21632
+ case 188 /* IntersectionType */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests
21633
+ return factory.createParenthesizedType(type);
21634
+ }
21635
+ return parenthesizeCheckTypeOfConditionalType(type);
21636
+ }
21637
+ function parenthesizeConstituentTypesOfUnionType(members) {
21638
+ return factory.createNodeArray(ts.sameMap(members, parenthesizeConstituentTypeOfUnionType));
21639
+ }
21640
+ // IntersectionType[Extends] :
21641
+ // `&`? TypeOperator[?Extends]
21642
+ // IntersectionType[?Extends] `&` TypeOperator[?Extends]
21643
+ //
21644
+ // - An intersection type constituent does not allow function, constructor, conditional, or union types (they must be parenthesized)
21645
+ function parenthesizeConstituentTypeOfIntersectionType(type) {
21646
+ switch (type.kind) {
21592
21647
  case 187 /* UnionType */:
21648
+ case 188 /* IntersectionType */: // Not strictly necessary, but an intersection containing an intersection should have been flattened
21649
+ return factory.createParenthesizedType(type);
21650
+ }
21651
+ return parenthesizeConstituentTypeOfUnionType(type);
21652
+ }
21653
+ function parenthesizeConstituentTypesOfIntersectionType(members) {
21654
+ return factory.createNodeArray(ts.sameMap(members, parenthesizeConstituentTypeOfIntersectionType));
21655
+ }
21656
+ // TypeOperator[Extends] :
21657
+ // PostfixType
21658
+ // InferType[?Extends]
21659
+ // `keyof` TypeOperator[?Extends]
21660
+ // `unique` TypeOperator[?Extends]
21661
+ // `readonly` TypeOperator[?Extends]
21662
+ //
21663
+ function parenthesizeOperandOfTypeOperator(type) {
21664
+ switch (type.kind) {
21593
21665
  case 188 /* IntersectionType */:
21594
- case 179 /* FunctionType */:
21595
- case 180 /* ConstructorType */:
21596
- return factory.createParenthesizedType(member);
21666
+ return factory.createParenthesizedType(type);
21597
21667
  }
21598
- return parenthesizeMemberOfConditionalType(member);
21668
+ return parenthesizeConstituentTypeOfIntersectionType(type);
21599
21669
  }
21600
- function parenthesizeElementTypeOfArrayType(member) {
21601
- switch (member.kind) {
21602
- case 181 /* TypeQuery */:
21670
+ function parenthesizeOperandOfReadonlyTypeOperator(type) {
21671
+ switch (type.kind) {
21603
21672
  case 193 /* TypeOperator */:
21673
+ return factory.createParenthesizedType(type);
21674
+ }
21675
+ return parenthesizeOperandOfTypeOperator(type);
21676
+ }
21677
+ // PostfixType :
21678
+ // NonArrayType
21679
+ // NonArrayType [no LineTerminator here] `!` // JSDoc
21680
+ // NonArrayType [no LineTerminator here] `?` // JSDoc
21681
+ // IndexedAccessType
21682
+ // ArrayType
21683
+ //
21684
+ // IndexedAccessType :
21685
+ // NonArrayType `[` Type[~Extends] `]`
21686
+ //
21687
+ // ArrayType :
21688
+ // NonArrayType `[` `]`
21689
+ //
21690
+ function parenthesizeNonArrayTypeOfPostfixType(type) {
21691
+ switch (type.kind) {
21604
21692
  case 190 /* InferType */:
21605
- return factory.createParenthesizedType(member);
21693
+ case 193 /* TypeOperator */:
21694
+ case 181 /* TypeQuery */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests
21695
+ return factory.createParenthesizedType(type);
21606
21696
  }
21607
- return parenthesizeMemberOfElementType(member);
21697
+ return parenthesizeOperandOfTypeOperator(type);
21698
+ }
21699
+ // TupleType :
21700
+ // `[` Elision? `]`
21701
+ // `[` NamedTupleElementTypes `]`
21702
+ // `[` NamedTupleElementTypes `,` Elision? `]`
21703
+ // `[` TupleElementTypes `]`
21704
+ // `[` TupleElementTypes `,` Elision? `]`
21705
+ //
21706
+ // NamedTupleElementTypes :
21707
+ // Elision? NamedTupleMember
21708
+ // NamedTupleElementTypes `,` Elision? NamedTupleMember
21709
+ //
21710
+ // NamedTupleMember :
21711
+ // Identifier `?`? `:` Type[~Extends]
21712
+ // `...` Identifier `:` Type[~Extends]
21713
+ //
21714
+ // TupleElementTypes :
21715
+ // Elision? TupleElementType
21716
+ // TupleElementTypes `,` Elision? TupleElementType
21717
+ //
21718
+ // TupleElementType :
21719
+ // Type[~Extends] // NOTE: Needs cover grammar to disallow JSDoc postfix-optional
21720
+ // OptionalType
21721
+ // RestType
21722
+ //
21723
+ // OptionalType :
21724
+ // Type[~Extends] `?` // NOTE: Needs cover grammar to disallow JSDoc postfix-optional
21725
+ //
21726
+ // RestType :
21727
+ // `...` Type[~Extends]
21728
+ //
21729
+ function parenthesizeElementTypesOfTupleType(types) {
21730
+ return factory.createNodeArray(ts.sameMap(types, parenthesizeElementTypeOfTupleType));
21731
+ }
21732
+ function parenthesizeElementTypeOfTupleType(type) {
21733
+ if (hasJSDocPostfixQuestion(type))
21734
+ return factory.createParenthesizedType(type);
21735
+ return type;
21736
+ }
21737
+ function hasJSDocPostfixQuestion(type) {
21738
+ if (ts.isJSDocNullableType(type))
21739
+ return type.postfix;
21740
+ if (ts.isNamedTupleMember(type))
21741
+ return hasJSDocPostfixQuestion(type.type);
21742
+ if (ts.isFunctionTypeNode(type) || ts.isConstructorTypeNode(type) || ts.isTypeOperatorNode(type))
21743
+ return hasJSDocPostfixQuestion(type.type);
21744
+ if (ts.isConditionalTypeNode(type))
21745
+ return hasJSDocPostfixQuestion(type.falseType);
21746
+ if (ts.isUnionTypeNode(type))
21747
+ return hasJSDocPostfixQuestion(ts.last(type.types));
21748
+ if (ts.isIntersectionTypeNode(type))
21749
+ return hasJSDocPostfixQuestion(ts.last(type.types));
21750
+ if (ts.isInferTypeNode(type))
21751
+ return !!type.typeParameter.constraint && hasJSDocPostfixQuestion(type.typeParameter.constraint);
21752
+ return false;
21608
21753
  }
21609
- function parenthesizeConstituentTypesOfUnionOrIntersectionType(members) {
21610
- return factory.createNodeArray(ts.sameMap(members, parenthesizeMemberOfElementType));
21754
+ function parenthesizeTypeOfOptionalType(type) {
21755
+ if (hasJSDocPostfixQuestion(type))
21756
+ return factory.createParenthesizedType(type);
21757
+ return parenthesizeNonArrayTypeOfPostfixType(type);
21758
+ }
21759
+ // function parenthesizeMemberOfElementType(member: TypeNode): TypeNode {
21760
+ // switch (member.kind) {
21761
+ // case SyntaxKind.UnionType:
21762
+ // case SyntaxKind.IntersectionType:
21763
+ // case SyntaxKind.FunctionType:
21764
+ // case SyntaxKind.ConstructorType:
21765
+ // return factory.createParenthesizedType(member);
21766
+ // }
21767
+ // return parenthesizeMemberOfConditionalType(member);
21768
+ // }
21769
+ // function parenthesizeElementTypeOfArrayType(member: TypeNode): TypeNode {
21770
+ // switch (member.kind) {
21771
+ // case SyntaxKind.TypeQuery:
21772
+ // case SyntaxKind.TypeOperator:
21773
+ // case SyntaxKind.InferType:
21774
+ // return factory.createParenthesizedType(member);
21775
+ // }
21776
+ // return parenthesizeMemberOfElementType(member);
21777
+ // }
21778
+ function parenthesizeLeadingTypeArgument(node) {
21779
+ return ts.isFunctionOrConstructorTypeNode(node) && node.typeParameters ? factory.createParenthesizedType(node) : node;
21611
21780
  }
21612
21781
  function parenthesizeOrdinalTypeArgument(node, i) {
21613
- return i === 0 && ts.isFunctionOrConstructorTypeNode(node) && node.typeParameters ? factory.createParenthesizedType(node) : node;
21782
+ return i === 0 ? parenthesizeLeadingTypeArgument(node) : node;
21614
21783
  }
21615
21784
  function parenthesizeTypeArguments(typeArguments) {
21616
21785
  if (ts.some(typeArguments)) {
@@ -21636,11 +21805,20 @@ var ts;
21636
21805
  parenthesizeExpressionForDisallowedComma: ts.identity,
21637
21806
  parenthesizeExpressionOfExpressionStatement: ts.identity,
21638
21807
  parenthesizeConciseBodyOfArrowFunction: ts.identity,
21639
- parenthesizeMemberOfConditionalType: ts.identity,
21640
- parenthesizeMemberOfElementType: ts.identity,
21641
- parenthesizeElementTypeOfArrayType: ts.identity,
21642
- parenthesizeConstituentTypesOfUnionOrIntersectionType: function (nodes) { return ts.cast(nodes, ts.isNodeArray); },
21808
+ parenthesizeCheckTypeOfConditionalType: ts.identity,
21809
+ parenthesizeExtendsTypeOfConditionalType: ts.identity,
21810
+ parenthesizeConstituentTypesOfUnionType: function (nodes) { return ts.cast(nodes, ts.isNodeArray); },
21811
+ parenthesizeConstituentTypeOfUnionType: ts.identity,
21812
+ parenthesizeConstituentTypesOfIntersectionType: function (nodes) { return ts.cast(nodes, ts.isNodeArray); },
21813
+ parenthesizeConstituentTypeOfIntersectionType: ts.identity,
21814
+ parenthesizeOperandOfTypeOperator: ts.identity,
21815
+ parenthesizeOperandOfReadonlyTypeOperator: ts.identity,
21816
+ parenthesizeNonArrayTypeOfPostfixType: ts.identity,
21817
+ parenthesizeElementTypesOfTupleType: function (nodes) { return ts.cast(nodes, ts.isNodeArray); },
21818
+ parenthesizeElementTypeOfTupleType: ts.identity,
21819
+ parenthesizeTypeOfOptionalType: ts.identity,
21643
21820
  parenthesizeTypeArguments: function (nodes) { return nodes && ts.cast(nodes, ts.isNodeArray); },
21821
+ parenthesizeLeadingTypeArgument: ts.identity,
21644
21822
  };
21645
21823
  })(ts || (ts = {}));
21646
21824
  /* @internal */
@@ -21780,6 +21958,8 @@ var ts;
21780
21958
  var getJSDocPrimaryTypeCreateFunction = ts.memoizeOne(function (kind) { return function () { return createJSDocPrimaryTypeWorker(kind); }; });
21781
21959
  var getJSDocUnaryTypeCreateFunction = ts.memoizeOne(function (kind) { return function (type) { return createJSDocUnaryTypeWorker(kind, type); }; });
21782
21960
  var getJSDocUnaryTypeUpdateFunction = ts.memoizeOne(function (kind) { return function (node, type) { return updateJSDocUnaryTypeWorker(kind, node, type); }; });
21961
+ var getJSDocPrePostfixUnaryTypeCreateFunction = ts.memoizeOne(function (kind) { return function (type, postfix) { return createJSDocPrePostfixUnaryTypeWorker(kind, type, postfix); }; });
21962
+ var getJSDocPrePostfixUnaryTypeUpdateFunction = ts.memoizeOne(function (kind) { return function (node, type) { return updateJSDocPrePostfixUnaryTypeWorker(kind, node, type); }; });
21783
21963
  var getJSDocSimpleTagCreateFunction = ts.memoizeOne(function (kind) { return function (tagName, comment) { return createJSDocSimpleTagWorker(kind, tagName, comment); }; });
21784
21964
  var getJSDocSimpleTagUpdateFunction = ts.memoizeOne(function (kind) { return function (node, tagName, comment) { return updateJSDocSimpleTagWorker(kind, node, tagName, comment); }; });
21785
21965
  var getJSDocTypeLikeTagCreateFunction = ts.memoizeOne(function (kind) { return function (tagName, typeExpression, comment) { return createJSDocTypeLikeTagWorker(kind, tagName, typeExpression, comment); }; });
@@ -21787,6 +21967,8 @@ var ts;
21787
21967
  var factory = {
21788
21968
  get parenthesizer() { return parenthesizerRules(); },
21789
21969
  get converters() { return converters(); },
21970
+ baseFactory: baseFactory,
21971
+ flags: flags,
21790
21972
  createNodeArray: createNodeArray,
21791
21973
  createNumericLiteral: createNumericLiteral,
21792
21974
  createBigIntLiteral: createBigIntLiteral,
@@ -22062,10 +22244,10 @@ var ts;
22062
22244
  // lazily load factory members for JSDoc types with similar structure
22063
22245
  get createJSDocAllType() { return getJSDocPrimaryTypeCreateFunction(312 /* JSDocAllType */); },
22064
22246
  get createJSDocUnknownType() { return getJSDocPrimaryTypeCreateFunction(313 /* JSDocUnknownType */); },
22065
- get createJSDocNonNullableType() { return getJSDocUnaryTypeCreateFunction(315 /* JSDocNonNullableType */); },
22066
- get updateJSDocNonNullableType() { return getJSDocUnaryTypeUpdateFunction(315 /* JSDocNonNullableType */); },
22067
- get createJSDocNullableType() { return getJSDocUnaryTypeCreateFunction(314 /* JSDocNullableType */); },
22068
- get updateJSDocNullableType() { return getJSDocUnaryTypeUpdateFunction(314 /* JSDocNullableType */); },
22247
+ get createJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(315 /* JSDocNonNullableType */); },
22248
+ get updateJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(315 /* JSDocNonNullableType */); },
22249
+ get createJSDocNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(314 /* JSDocNullableType */); },
22250
+ get updateJSDocNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(314 /* JSDocNullableType */); },
22069
22251
  get createJSDocOptionalType() { return getJSDocUnaryTypeCreateFunction(316 /* JSDocOptionalType */); },
22070
22252
  get updateJSDocOptionalType() { return getJSDocUnaryTypeUpdateFunction(316 /* JSDocOptionalType */); },
22071
22253
  get createJSDocVariadicType() { return getJSDocUnaryTypeCreateFunction(318 /* JSDocVariadicType */); },
@@ -23181,7 +23363,7 @@ var ts;
23181
23363
  // @api
23182
23364
  function createArrayTypeNode(elementType) {
23183
23365
  var node = createBaseNode(183 /* ArrayType */);
23184
- node.elementType = parenthesizerRules().parenthesizeElementTypeOfArrayType(elementType);
23366
+ node.elementType = parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(elementType);
23185
23367
  node.transformFlags = 1 /* ContainsTypeScript */;
23186
23368
  return node;
23187
23369
  }
@@ -23194,7 +23376,7 @@ var ts;
23194
23376
  // @api
23195
23377
  function createTupleTypeNode(elements) {
23196
23378
  var node = createBaseNode(184 /* TupleType */);
23197
- node.elements = createNodeArray(elements);
23379
+ node.elements = createNodeArray(parenthesizerRules().parenthesizeElementTypesOfTupleType(elements));
23198
23380
  node.transformFlags = 1 /* ContainsTypeScript */;
23199
23381
  return node;
23200
23382
  }
@@ -23226,7 +23408,7 @@ var ts;
23226
23408
  // @api
23227
23409
  function createOptionalTypeNode(type) {
23228
23410
  var node = createBaseNode(185 /* OptionalType */);
23229
- node.type = parenthesizerRules().parenthesizeElementTypeOfArrayType(type);
23411
+ node.type = parenthesizerRules().parenthesizeTypeOfOptionalType(type);
23230
23412
  node.transformFlags = 1 /* ContainsTypeScript */;
23231
23413
  return node;
23232
23414
  }
@@ -23249,38 +23431,38 @@ var ts;
23249
23431
  ? update(createRestTypeNode(type), node)
23250
23432
  : node;
23251
23433
  }
23252
- function createUnionOrIntersectionTypeNode(kind, types) {
23434
+ function createUnionOrIntersectionTypeNode(kind, types, parenthesize) {
23253
23435
  var node = createBaseNode(kind);
23254
- node.types = parenthesizerRules().parenthesizeConstituentTypesOfUnionOrIntersectionType(types);
23436
+ node.types = factory.createNodeArray(parenthesize(types));
23255
23437
  node.transformFlags = 1 /* ContainsTypeScript */;
23256
23438
  return node;
23257
23439
  }
23258
- function updateUnionOrIntersectionTypeNode(node, types) {
23440
+ function updateUnionOrIntersectionTypeNode(node, types, parenthesize) {
23259
23441
  return node.types !== types
23260
- ? update(createUnionOrIntersectionTypeNode(node.kind, types), node)
23442
+ ? update(createUnionOrIntersectionTypeNode(node.kind, types, parenthesize), node)
23261
23443
  : node;
23262
23444
  }
23263
23445
  // @api
23264
23446
  function createUnionTypeNode(types) {
23265
- return createUnionOrIntersectionTypeNode(187 /* UnionType */, types);
23447
+ return createUnionOrIntersectionTypeNode(187 /* UnionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType);
23266
23448
  }
23267
23449
  // @api
23268
23450
  function updateUnionTypeNode(node, types) {
23269
- return updateUnionOrIntersectionTypeNode(node, types);
23451
+ return updateUnionOrIntersectionTypeNode(node, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType);
23270
23452
  }
23271
23453
  // @api
23272
23454
  function createIntersectionTypeNode(types) {
23273
- return createUnionOrIntersectionTypeNode(188 /* IntersectionType */, types);
23455
+ return createUnionOrIntersectionTypeNode(188 /* IntersectionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType);
23274
23456
  }
23275
23457
  // @api
23276
23458
  function updateIntersectionTypeNode(node, types) {
23277
- return updateUnionOrIntersectionTypeNode(node, types);
23459
+ return updateUnionOrIntersectionTypeNode(node, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType);
23278
23460
  }
23279
23461
  // @api
23280
23462
  function createConditionalTypeNode(checkType, extendsType, trueType, falseType) {
23281
23463
  var node = createBaseNode(189 /* ConditionalType */);
23282
- node.checkType = parenthesizerRules().parenthesizeMemberOfConditionalType(checkType);
23283
- node.extendsType = parenthesizerRules().parenthesizeMemberOfConditionalType(extendsType);
23464
+ node.checkType = parenthesizerRules().parenthesizeCheckTypeOfConditionalType(checkType);
23465
+ node.extendsType = parenthesizerRules().parenthesizeExtendsTypeOfConditionalType(extendsType);
23284
23466
  node.trueType = trueType;
23285
23467
  node.falseType = falseType;
23286
23468
  node.transformFlags = 1 /* ContainsTypeScript */;
@@ -23375,7 +23557,9 @@ var ts;
23375
23557
  function createTypeOperatorNode(operator, type) {
23376
23558
  var node = createBaseNode(193 /* TypeOperator */);
23377
23559
  node.operator = operator;
23378
- node.type = parenthesizerRules().parenthesizeMemberOfElementType(type);
23560
+ node.type = operator === 145 /* ReadonlyKeyword */ ?
23561
+ parenthesizerRules().parenthesizeOperandOfReadonlyTypeOperator(type) :
23562
+ parenthesizerRules().parenthesizeOperandOfTypeOperator(type);
23379
23563
  node.transformFlags = 1 /* ContainsTypeScript */;
23380
23564
  return node;
23381
23565
  }
@@ -23388,7 +23572,7 @@ var ts;
23388
23572
  // @api
23389
23573
  function createIndexedAccessTypeNode(objectType, indexType) {
23390
23574
  var node = createBaseNode(194 /* IndexedAccessType */);
23391
- node.objectType = parenthesizerRules().parenthesizeMemberOfElementType(objectType);
23575
+ node.objectType = parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(objectType);
23392
23576
  node.indexType = indexType;
23393
23577
  node.transformFlags = 1 /* ContainsTypeScript */;
23394
23578
  return node;
@@ -25124,8 +25308,15 @@ var ts;
25124
25308
  return createBaseNode(kind);
25125
25309
  }
25126
25310
  // @api
25127
- // createJSDocNonNullableType
25128
25311
  // createJSDocNullableType
25312
+ // createJSDocNonNullableType
25313
+ function createJSDocPrePostfixUnaryTypeWorker(kind, type, postfix) {
25314
+ if (postfix === void 0) { postfix = false; }
25315
+ var node = createJSDocUnaryTypeWorker(kind, postfix ? type && parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(type) : type);
25316
+ node.postfix = postfix;
25317
+ return node;
25318
+ }
25319
+ // @api
25129
25320
  // createJSDocOptionalType
25130
25321
  // createJSDocVariadicType
25131
25322
  // createJSDocNamepathType
@@ -25137,6 +25328,12 @@ var ts;
25137
25328
  // @api
25138
25329
  // updateJSDocNonNullableType
25139
25330
  // updateJSDocNullableType
25331
+ function updateJSDocPrePostfixUnaryTypeWorker(kind, node, type) {
25332
+ return node.type !== type
25333
+ ? update(createJSDocPrePostfixUnaryTypeWorker(kind, type, node.postfix), node)
25334
+ : node;
25335
+ }
25336
+ // @api
25140
25337
  // updateJSDocOptionalType
25141
25338
  // updateJSDocVariadicType
25142
25339
  // updateJSDocNamepathType
@@ -30217,7 +30414,7 @@ var ts;
30217
30414
  || ts.isExportDeclaration(node) ? node : undefined;
30218
30415
  }
30219
30416
  function getImportMetaIfNecessary(sourceFile) {
30220
- return sourceFile.flags & 2097152 /* PossiblyContainsImportMeta */ ?
30417
+ return sourceFile.flags & 4194304 /* PossiblyContainsImportMeta */ ?
30221
30418
  walkTreeForImportMeta(sourceFile) :
30222
30419
  undefined;
30223
30420
  }
@@ -30872,7 +31069,7 @@ var ts;
30872
31069
  var newSourceFile = IncrementalParser.updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks);
30873
31070
  // 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.
30874
31071
  // We will manually port the flag to the new source file.
30875
- newSourceFile.flags |= (sourceFile.flags & 3145728 /* PermanentlySetIncrementalFlags */);
31072
+ newSourceFile.flags |= (sourceFile.flags & 6291456 /* PermanentlySetIncrementalFlags */);
30876
31073
  return newSourceFile;
30877
31074
  }
30878
31075
  ts.updateSourceFile = updateSourceFile;
@@ -31156,10 +31353,10 @@ var ts;
31156
31353
  switch (scriptKind) {
31157
31354
  case 1 /* JS */:
31158
31355
  case 2 /* JSX */:
31159
- contextFlags = 131072 /* JavaScriptFile */;
31356
+ contextFlags = 262144 /* JavaScriptFile */;
31160
31357
  break;
31161
31358
  case 6 /* JSON */:
31162
- contextFlags = 131072 /* JavaScriptFile */ | 33554432 /* JsonFile */;
31359
+ contextFlags = 262144 /* JavaScriptFile */ | 67108864 /* JsonFile */;
31163
31360
  break;
31164
31361
  default:
31165
31362
  contextFlags = 0 /* None */;
@@ -31194,7 +31391,7 @@ var ts;
31194
31391
  function parseSourceFileWorker(languageVersion, setParentNodes, scriptKind, setExternalModuleIndicator) {
31195
31392
  var isDeclarationFile = isDeclarationFileName(fileName);
31196
31393
  if (isDeclarationFile) {
31197
- contextFlags |= 8388608 /* Ambient */;
31394
+ contextFlags |= 16777216 /* Ambient */;
31198
31395
  }
31199
31396
  sourceFlags = contextFlags;
31200
31397
  // Prime the scanner.
@@ -31233,7 +31430,7 @@ var ts;
31233
31430
  node.jsDoc = jsDoc;
31234
31431
  if (hasDeprecatedTag) {
31235
31432
  hasDeprecatedTag = false;
31236
- node.flags |= 134217728 /* Deprecated */;
31433
+ node.flags |= 268435456 /* Deprecated */;
31237
31434
  }
31238
31435
  return node;
31239
31436
  }
@@ -31428,6 +31625,12 @@ var ts;
31428
31625
  function disallowInAnd(func) {
31429
31626
  return doInsideOfContext(4096 /* DisallowInContext */, func);
31430
31627
  }
31628
+ function allowConditionalTypesAnd(func) {
31629
+ return doOutsideOfContext(65536 /* DisallowConditionalTypesContext */, func);
31630
+ }
31631
+ function disallowConditionalTypesAnd(func) {
31632
+ return doInsideOfContext(65536 /* DisallowConditionalTypesContext */, func);
31633
+ }
31431
31634
  function doInYieldContext(func) {
31432
31635
  return doInsideOfContext(8192 /* YieldContext */, func);
31433
31636
  }
@@ -31455,6 +31658,9 @@ var ts;
31455
31658
  function inDisallowInContext() {
31456
31659
  return inContext(4096 /* DisallowInContext */);
31457
31660
  }
31661
+ function inDisallowConditionalTypesContext() {
31662
+ return inContext(65536 /* DisallowConditionalTypesContext */);
31663
+ }
31458
31664
  function inDecoratorContext() {
31459
31665
  return inContext(16384 /* DecoratorContext */);
31460
31666
  }
@@ -31839,7 +32045,7 @@ var ts;
31839
32045
  // flag so that we don't mark any subsequent nodes.
31840
32046
  if (parseErrorBeforeNextFinishedNode) {
31841
32047
  parseErrorBeforeNextFinishedNode = false;
31842
- node.flags |= 65536 /* ThisNodeHasError */;
32048
+ node.flags |= 131072 /* ThisNodeHasError */;
31843
32049
  }
31844
32050
  return node;
31845
32051
  }
@@ -32297,7 +32503,7 @@ var ts;
32297
32503
  // differently depending on what mode it is in.
32298
32504
  //
32299
32505
  // This also applies to all our other context flags as well.
32300
- var nodeContextFlags = node.flags & 25358336 /* ContextFlags */;
32506
+ var nodeContextFlags = node.flags & 50720768 /* ContextFlags */;
32301
32507
  if (nodeContextFlags !== contextFlags) {
32302
32508
  return undefined;
32303
32509
  }
@@ -32822,7 +33028,7 @@ var ts;
32822
33028
  function parseJSDocNonNullableType() {
32823
33029
  var pos = getNodePos();
32824
33030
  nextToken();
32825
- return finishNode(factory.createJSDocNonNullableType(parseNonArrayType()), pos);
33031
+ return finishNode(factory.createJSDocNonNullableType(parseNonArrayType(), /*postfix*/ false), pos);
32826
33032
  }
32827
33033
  function parseJSDocUnknownOrNullableType() {
32828
33034
  var pos = getNodePos();
@@ -32846,7 +33052,7 @@ var ts;
32846
33052
  return finishNode(factory.createJSDocUnknownType(), pos);
32847
33053
  }
32848
33054
  else {
32849
- return finishNode(factory.createJSDocNullableType(parseType()), pos);
33055
+ return finishNode(factory.createJSDocNullableType(parseType(), /*postfix*/ false), pos);
32850
33056
  }
32851
33057
  }
32852
33058
  function parseJSDocFunctionType() {
@@ -33018,7 +33224,7 @@ var ts;
33018
33224
  }
33019
33225
  function parseReturnType(returnToken, isType) {
33020
33226
  if (shouldParseReturnType(returnToken, isType)) {
33021
- return parseTypeOrTypePredicate();
33227
+ return allowConditionalTypesAnd(parseTypeOrTypePredicate);
33022
33228
  }
33023
33229
  }
33024
33230
  function shouldParseReturnType(returnToken, isType) {
@@ -33433,7 +33639,7 @@ var ts;
33433
33639
  return finishNode(factory.createImportTypeAssertionContainer(clause, multiLine), pos);
33434
33640
  }
33435
33641
  function parseImportType() {
33436
- sourceFlags |= 1048576 /* PossiblyContainsDynamicImport */;
33642
+ sourceFlags |= 2097152 /* PossiblyContainsDynamicImport */;
33437
33643
  var pos = getNodePos();
33438
33644
  var isTypeOf = parseOptional(112 /* TypeOfKeyword */);
33439
33645
  parseExpected(100 /* ImportKeyword */);
@@ -33583,7 +33789,7 @@ var ts;
33583
33789
  switch (token()) {
33584
33790
  case 53 /* ExclamationToken */:
33585
33791
  nextToken();
33586
- type = finishNode(factory.createJSDocNonNullableType(type), pos);
33792
+ type = finishNode(factory.createJSDocNonNullableType(type, /*postfix*/ true), pos);
33587
33793
  break;
33588
33794
  case 57 /* QuestionToken */:
33589
33795
  // If next token is start of a type we have a conditional type
@@ -33591,7 +33797,7 @@ var ts;
33591
33797
  return type;
33592
33798
  }
33593
33799
  nextToken();
33594
- type = finishNode(factory.createJSDocNullableType(type), pos);
33800
+ type = finishNode(factory.createJSDocNullableType(type, /*postfix*/ true), pos);
33595
33801
  break;
33596
33802
  case 22 /* OpenBracketToken */:
33597
33803
  parseExpected(22 /* OpenBracketToken */);
@@ -33616,12 +33822,20 @@ var ts;
33616
33822
  parseExpected(operator);
33617
33823
  return finishNode(factory.createTypeOperatorNode(operator, parseTypeOperatorOrHigher()), pos);
33618
33824
  }
33825
+ function tryParseConstraintOfInferType() {
33826
+ if (parseOptional(94 /* ExtendsKeyword */)) {
33827
+ var constraint = disallowConditionalTypesAnd(parseType);
33828
+ if (inDisallowConditionalTypesContext() || token() !== 57 /* QuestionToken */) {
33829
+ return constraint;
33830
+ }
33831
+ }
33832
+ }
33619
33833
  function parseTypeParameterOfInferType() {
33620
33834
  var pos = getNodePos();
33621
- return finishNode(factory.createTypeParameterDeclaration(
33622
- /*modifiers*/ undefined, parseIdentifier(),
33623
- /*constraint*/ undefined,
33624
- /*defaultType*/ undefined), pos);
33835
+ var name = parseIdentifier();
33836
+ var constraint = tryParse(tryParseConstraintOfInferType);
33837
+ var node = factory.createTypeParameterDeclaration(/*modifiers*/ undefined, name, constraint);
33838
+ return finishNode(node, pos);
33625
33839
  }
33626
33840
  function parseInferType() {
33627
33841
  var pos = getNodePos();
@@ -33638,7 +33852,7 @@ var ts;
33638
33852
  case 137 /* InferKeyword */:
33639
33853
  return parseInferType();
33640
33854
  }
33641
- return parsePostfixTypeOrHigher();
33855
+ return allowConditionalTypesAnd(parsePostfixTypeOrHigher);
33642
33856
  }
33643
33857
  function parseFunctionOrConstructorTypeToError(isInUnionType) {
33644
33858
  // the function type and constructor type shorthand notation
@@ -33768,23 +33982,21 @@ var ts;
33768
33982
  return finishNode(factory.createTypePredicateNode(assertsModifier, parameterName, type), pos);
33769
33983
  }
33770
33984
  function parseType() {
33771
- // The rules about 'yield' only apply to actual code/expression contexts. They don't
33772
- // apply to 'type' contexts. So we disable these parameters here before moving on.
33773
- return doOutsideOfContext(40960 /* TypeExcludesFlags */, parseTypeWorker);
33774
- }
33775
- function parseTypeWorker(noConditionalTypes) {
33985
+ if (contextFlags & 40960 /* TypeExcludesFlags */) {
33986
+ return doOutsideOfContext(40960 /* TypeExcludesFlags */, parseType);
33987
+ }
33776
33988
  if (isStartOfFunctionTypeOrConstructorType()) {
33777
33989
  return parseFunctionOrConstructorType();
33778
33990
  }
33779
33991
  var pos = getNodePos();
33780
33992
  var type = parseUnionTypeOrHigher();
33781
- if (!noConditionalTypes && !scanner.hasPrecedingLineBreak() && parseOptional(94 /* ExtendsKeyword */)) {
33993
+ if (!inDisallowConditionalTypesContext() && !scanner.hasPrecedingLineBreak() && parseOptional(94 /* ExtendsKeyword */)) {
33782
33994
  // The type following 'extends' is not permitted to be another conditional type
33783
- var extendsType = parseTypeWorker(/*noConditionalTypes*/ true);
33995
+ var extendsType = disallowConditionalTypesAnd(parseType);
33784
33996
  parseExpected(57 /* QuestionToken */);
33785
- var trueType = parseTypeWorker();
33997
+ var trueType = allowConditionalTypesAnd(parseType);
33786
33998
  parseExpected(58 /* ColonToken */);
33787
- var falseType = parseTypeWorker();
33999
+ var falseType = allowConditionalTypesAnd(parseType);
33788
34000
  return finishNode(factory.createConditionalTypeNode(type, extendsType, trueType, falseType), pos);
33789
34001
  }
33790
34002
  return type;
@@ -34621,7 +34833,7 @@ var ts;
34621
34833
  // var foo3 = require("subfolder
34622
34834
  // import * as foo1 from "module-from-node
34623
34835
  // We want this import to be a statement rather than import call expression
34624
- sourceFlags |= 1048576 /* PossiblyContainsDynamicImport */;
34836
+ sourceFlags |= 2097152 /* PossiblyContainsDynamicImport */;
34625
34837
  expression = parseTokenNode();
34626
34838
  }
34627
34839
  else if (lookAhead(nextTokenIsDot)) {
@@ -34629,7 +34841,7 @@ var ts;
34629
34841
  nextToken(); // advance past the 'import'
34630
34842
  nextToken(); // advance past the dot
34631
34843
  expression = finishNode(factory.createMetaProperty(100 /* ImportKeyword */, parseIdentifierName()), pos);
34632
- sourceFlags |= 2097152 /* PossiblyContainsImportMeta */;
34844
+ sourceFlags |= 4194304 /* PossiblyContainsImportMeta */;
34633
34845
  }
34634
34846
  else {
34635
34847
  expression = parseMemberExpressionOrHigher();
@@ -34845,7 +35057,7 @@ var ts;
34845
35057
  return finishNode(factory.createJsxOpeningFragment(), pos);
34846
35058
  }
34847
35059
  var tagName = parseJsxElementName();
34848
- var typeArguments = (contextFlags & 131072 /* JavaScriptFile */) === 0 ? tryParseTypeArguments() : undefined;
35060
+ var typeArguments = (contextFlags & 262144 /* JavaScriptFile */) === 0 ? tryParseTypeArguments() : undefined;
34849
35061
  var attributes = parseJsxAttributes();
34850
35062
  var node;
34851
35063
  if (token() === 31 /* GreaterThanToken */) {
@@ -35123,7 +35335,7 @@ var ts;
35123
35335
  return result;
35124
35336
  }
35125
35337
  function parseTypeArgumentsInExpression() {
35126
- if ((contextFlags & 131072 /* JavaScriptFile */) !== 0) {
35338
+ if ((contextFlags & 262144 /* JavaScriptFile */) !== 0) {
35127
35339
  // TypeArguments must not be parsed in JavaScript files to avoid ambiguity with binary operators.
35128
35340
  return undefined;
35129
35341
  }
@@ -35519,7 +35731,7 @@ var ts;
35519
35731
  var openParenParsed = parseExpected(20 /* OpenParenToken */);
35520
35732
  var expression = allowInAnd(parseExpression);
35521
35733
  parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenParsed, openParenPosition);
35522
- var statement = doInsideOfContext(16777216 /* InWithStatement */, parseStatement);
35734
+ var statement = doInsideOfContext(33554432 /* InWithStatement */, parseStatement);
35523
35735
  return withJSDoc(finishNode(factory.createWithStatement(expression, statement), pos), hasJSDoc);
35524
35736
  }
35525
35737
  function parseCaseClause() {
@@ -35894,16 +36106,16 @@ var ts;
35894
36106
  if (isAmbient) {
35895
36107
  for (var _i = 0, _a = modifiers; _i < _a.length; _i++) {
35896
36108
  var m = _a[_i];
35897
- m.flags |= 8388608 /* Ambient */;
36109
+ m.flags |= 16777216 /* Ambient */;
35898
36110
  }
35899
- return doInsideOfContext(8388608 /* Ambient */, function () { return parseDeclarationWorker(pos, hasJSDoc, decorators, modifiers); });
36111
+ return doInsideOfContext(16777216 /* Ambient */, function () { return parseDeclarationWorker(pos, hasJSDoc, decorators, modifiers); });
35900
36112
  }
35901
36113
  else {
35902
36114
  return parseDeclarationWorker(pos, hasJSDoc, decorators, modifiers);
35903
36115
  }
35904
36116
  }
35905
36117
  function tryReuseAmbientDeclaration() {
35906
- return doInsideOfContext(8388608 /* Ambient */, function () {
36118
+ return doInsideOfContext(16777216 /* Ambient */, function () {
35907
36119
  var node = currentNode(parsingContext);
35908
36120
  if (node) {
35909
36121
  return consumeNode(node);
@@ -36370,9 +36582,9 @@ var ts;
36370
36582
  if (isAmbient) {
36371
36583
  for (var _i = 0, _a = modifiers; _i < _a.length; _i++) {
36372
36584
  var m = _a[_i];
36373
- m.flags |= 8388608 /* Ambient */;
36585
+ m.flags |= 16777216 /* Ambient */;
36374
36586
  }
36375
- return doInsideOfContext(8388608 /* Ambient */, function () { return parsePropertyOrMethodDeclaration(pos, hasJSDoc, decorators, modifiers); });
36587
+ return doInsideOfContext(16777216 /* Ambient */, function () { return parsePropertyOrMethodDeclaration(pos, hasJSDoc, decorators, modifiers); });
36376
36588
  }
36377
36589
  else {
36378
36590
  return parsePropertyOrMethodDeclaration(pos, hasJSDoc, decorators, modifiers);
@@ -36937,7 +37149,7 @@ var ts;
36937
37149
  function parseJSDocTypeExpression(mayOmitBraces) {
36938
37150
  var pos = getNodePos();
36939
37151
  var hasBrace = (mayOmitBraces ? parseOptional : parseExpected)(18 /* OpenBraceToken */);
36940
- var type = doInsideOfContext(4194304 /* JSDoc */, parseJSDocType);
37152
+ var type = doInsideOfContext(8388608 /* JSDoc */, parseJSDocType);
36941
37153
  if (!mayOmitBraces || hasBrace) {
36942
37154
  parseExpectedJSDoc(19 /* CloseBraceToken */);
36943
37155
  }
@@ -36966,7 +37178,7 @@ var ts;
36966
37178
  JSDocParser.parseJSDocNameReference = parseJSDocNameReference;
36967
37179
  function parseIsolatedJSDocComment(content, start, length) {
36968
37180
  initializeState("", content, 99 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);
36969
- var jsDoc = doInsideOfContext(4194304 /* JSDoc */, function () { return parseJSDocCommentWorker(start, length); });
37181
+ var jsDoc = doInsideOfContext(8388608 /* JSDoc */, function () { return parseJSDocCommentWorker(start, length); });
36970
37182
  var sourceFile = { languageVariant: 0 /* Standard */, text: content };
36971
37183
  var diagnostics = ts.attachFileToDiagnostics(parseDiagnostics, sourceFile);
36972
37184
  clearState();
@@ -36977,9 +37189,9 @@ var ts;
36977
37189
  var saveToken = currentToken;
36978
37190
  var saveParseDiagnosticsLength = parseDiagnostics.length;
36979
37191
  var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode;
36980
- var comment = doInsideOfContext(4194304 /* JSDoc */, function () { return parseJSDocCommentWorker(start, length); });
37192
+ var comment = doInsideOfContext(8388608 /* JSDoc */, function () { return parseJSDocCommentWorker(start, length); });
36981
37193
  ts.setParent(comment, parent);
36982
- if (contextFlags & 131072 /* JavaScriptFile */) {
37194
+ if (contextFlags & 262144 /* JavaScriptFile */) {
36983
37195
  if (!jsDocDiagnostics) {
36984
37196
  jsDocDiagnostics = [];
36985
37197
  }
@@ -37795,7 +38007,7 @@ var ts;
37795
38007
  if (isBracketed) {
37796
38008
  skipWhitespace();
37797
38009
  parseExpected(63 /* EqualsToken */);
37798
- defaultType = doInsideOfContext(4194304 /* JSDoc */, parseJSDocType);
38010
+ defaultType = doInsideOfContext(8388608 /* JSDoc */, parseJSDocType);
37799
38011
  parseExpected(23 /* CloseBracketToken */);
37800
38012
  }
37801
38013
  if (ts.nodeIsMissing(name)) {
@@ -45683,7 +45895,7 @@ var ts;
45683
45895
  function setExportContextFlag(node) {
45684
45896
  // A declaration source file or ambient module declaration that contains no export declarations (but possibly regular
45685
45897
  // declarations with export modifiers) is an export context in which declarations are implicitly exported.
45686
- if (node.flags & 8388608 /* Ambient */ && !hasExportDeclarations(node)) {
45898
+ if (node.flags & 16777216 /* Ambient */ && !hasExportDeclarations(node)) {
45687
45899
  node.flags |= 64 /* ExportContext */;
45688
45900
  }
45689
45901
  else {
@@ -45886,8 +46098,8 @@ var ts;
45886
46098
  function checkContextualIdentifier(node) {
45887
46099
  // Report error only if there are no parse errors in file
45888
46100
  if (!file.parseDiagnostics.length &&
45889
- !(node.flags & 8388608 /* Ambient */) &&
45890
- !(node.flags & 4194304 /* JSDoc */) &&
46101
+ !(node.flags & 16777216 /* Ambient */) &&
46102
+ !(node.flags & 8388608 /* JSDoc */) &&
45891
46103
  !ts.isIdentifierName(node)) {
45892
46104
  // strict mode identifiers
45893
46105
  if (inStrictMode &&
@@ -46916,7 +47128,7 @@ var ts;
46916
47128
  if (node.kind === 340 /* JSDocParameterTag */ && container.kind !== 323 /* JSDocSignature */) {
46917
47129
  return;
46918
47130
  }
46919
- if (inStrictMode && !(node.flags & 8388608 /* Ambient */)) {
47131
+ if (inStrictMode && !(node.flags & 16777216 /* Ambient */)) {
46920
47132
  // It is a SyntaxError if the identifier eval or arguments appears within a FormalParameterList of a
46921
47133
  // strict mode FunctionLikeDeclaration or FunctionExpression(13.1)
46922
47134
  checkStrictModeEvalOrArguments(node, node.name);
@@ -46935,7 +47147,7 @@ var ts;
46935
47147
  }
46936
47148
  }
46937
47149
  function bindFunctionDeclaration(node) {
46938
- if (!file.isDeclarationFile && !(node.flags & 8388608 /* Ambient */)) {
47150
+ if (!file.isDeclarationFile && !(node.flags & 16777216 /* Ambient */)) {
46939
47151
  if (ts.isAsyncFunction(node)) {
46940
47152
  emitFlags |= 2048 /* HasAsyncFunctions */;
46941
47153
  }
@@ -46950,7 +47162,7 @@ var ts;
46950
47162
  }
46951
47163
  }
46952
47164
  function bindFunctionExpression(node) {
46953
- if (!file.isDeclarationFile && !(node.flags & 8388608 /* Ambient */)) {
47165
+ if (!file.isDeclarationFile && !(node.flags & 16777216 /* Ambient */)) {
46954
47166
  if (ts.isAsyncFunction(node)) {
46955
47167
  emitFlags |= 2048 /* HasAsyncFunctions */;
46956
47168
  }
@@ -46963,7 +47175,7 @@ var ts;
46963
47175
  return bindAnonymousDeclaration(node, 16 /* Function */, bindingName);
46964
47176
  }
46965
47177
  function bindPropertyOrMethodOrAccessor(node, symbolFlags, symbolExcludes) {
46966
- if (!file.isDeclarationFile && !(node.flags & 8388608 /* Ambient */) && ts.isAsyncFunction(node)) {
47178
+ if (!file.isDeclarationFile && !(node.flags & 16777216 /* Ambient */) && ts.isAsyncFunction(node)) {
46967
47179
  emitFlags |= 2048 /* HasAsyncFunctions */;
46968
47180
  }
46969
47181
  if (currentFlow && ts.isObjectLiteralOrClassExpressionMethodOrAccessor(node)) {
@@ -47036,7 +47248,7 @@ var ts;
47036
47248
  // Rationale: we don't want to report errors on non-initialized var's since they are hoisted
47037
47249
  // On the other side we do want to report errors on non-initialized 'lets' because of TDZ
47038
47250
  var isError_1 = ts.unreachableCodeIsError(options) &&
47039
- !(node.flags & 8388608 /* Ambient */) &&
47251
+ !(node.flags & 16777216 /* Ambient */) &&
47040
47252
  (!ts.isVariableStatement(node) ||
47041
47253
  !!(ts.getCombinedNodeFlags(node.declarationList) & 3 /* BlockScoped */) ||
47042
47254
  node.declarationList.declarations.some(function (d) { return !!d.initializer; }));
@@ -47936,7 +48148,7 @@ var ts;
47936
48148
  ts.Debug.assert(!!(getNodeLinks(file).flags & 1 /* TypeChecked */));
47937
48149
  diagnostics = ts.addRange(diagnostics, suggestionDiagnostics.getDiagnostics(file.fileName));
47938
48150
  checkUnusedIdentifiers(getPotentiallyUnusedIdentifiers(file), function (containingNode, kind, diag) {
47939
- if (!ts.containsParseError(containingNode) && !unusedIsError(kind, !!(containingNode.flags & 8388608 /* Ambient */))) {
48151
+ if (!ts.containsParseError(containingNode) && !unusedIsError(kind, !!(containingNode.flags & 16777216 /* Ambient */))) {
47940
48152
  (diagnostics || (diagnostics = [])).push(__assign(__assign({}, diag), { category: ts.DiagnosticCategory.Suggestion }));
47941
48153
  }
47942
48154
  });
@@ -48387,7 +48599,7 @@ var ts;
48387
48599
  return diagnostic;
48388
48600
  }
48389
48601
  function isDeprecatedSymbol(symbol) {
48390
- return !!(getDeclarationNodeFlagsFromSymbol(symbol) & 134217728 /* Deprecated */);
48602
+ return !!(getDeclarationNodeFlagsFromSymbol(symbol) & 268435456 /* Deprecated */);
48391
48603
  }
48392
48604
  function addDeprecatedSuggestion(location, declarations, deprecatedEntity) {
48393
48605
  var diagnostic = ts.createDiagnosticForNode(location, ts.Diagnostics._0_is_deprecated, deprecatedEntity);
@@ -48615,7 +48827,7 @@ var ts;
48615
48827
  else {
48616
48828
  // find a module that about to be augmented
48617
48829
  // do not validate names of augmentations that are defined in ambient context
48618
- var moduleNotFoundError = !(moduleName.parent.parent.flags & 8388608 /* Ambient */)
48830
+ var moduleNotFoundError = !(moduleName.parent.parent.flags & 16777216 /* Ambient */)
48619
48831
  ? ts.Diagnostics.Invalid_module_name_in_augmentation_module_0_cannot_be_found
48620
48832
  : undefined;
48621
48833
  var mainModule_1 = resolveExternalModuleNameWorker(moduleName, moduleName, moduleNotFoundError, /*isForAugmentation*/ true);
@@ -48729,7 +48941,7 @@ var ts;
48729
48941
  if ((moduleKind && (declarationFile.externalModuleIndicator || useFile.externalModuleIndicator)) ||
48730
48942
  (!ts.outFile(compilerOptions)) ||
48731
48943
  isInTypeQuery(usage) ||
48732
- declaration.flags & 8388608 /* Ambient */) {
48944
+ declaration.flags & 16777216 /* Ambient */) {
48733
48945
  // nodes are in different files and order cannot be determined
48734
48946
  return true;
48735
48947
  }
@@ -48791,7 +49003,7 @@ var ts;
48791
49003
  if (usage.kind === 271 /* ExportAssignment */ && usage.isExportEquals) {
48792
49004
  return true;
48793
49005
  }
48794
- if (!!(usage.flags & 4194304 /* JSDoc */) || isInTypeQuery(usage) || usageInTypeDeclaration()) {
49006
+ if (!!(usage.flags & 8388608 /* JSDoc */) || isInTypeQuery(usage) || usageInTypeDeclaration()) {
48795
49007
  return true;
48796
49008
  }
48797
49009
  if (isUsedInFunctionOrInstanceProperty(usage, declaration)) {
@@ -49056,7 +49268,7 @@ var ts;
49056
49268
  // falls through
49057
49269
  case 261 /* ModuleDeclaration */:
49058
49270
  var moduleExports = ((_a = getSymbolOfNode(location)) === null || _a === void 0 ? void 0 : _a.exports) || emptySymbols;
49059
- if (location.kind === 305 /* SourceFile */ || (ts.isModuleDeclaration(location) && location.flags & 8388608 /* Ambient */ && !ts.isGlobalScopeAugmentation(location))) {
49271
+ if (location.kind === 305 /* SourceFile */ || (ts.isModuleDeclaration(location) && location.flags & 16777216 /* Ambient */ && !ts.isGlobalScopeAugmentation(location))) {
49060
49272
  // It's an external module. First see if the module has an export default and if the local
49061
49273
  // name of that export default matches.
49062
49274
  if (result = moduleExports.get("default" /* Default */)) {
@@ -49379,7 +49591,7 @@ var ts;
49379
49591
  }
49380
49592
  }
49381
49593
  // If we're in an external module, we can't reference value symbols created from UMD export declarations
49382
- if (result && isInExternalModule && (meaning & 111551 /* Value */) === 111551 /* Value */ && !(originalLocation.flags & 4194304 /* JSDoc */)) {
49594
+ if (result && isInExternalModule && (meaning & 111551 /* Value */) === 111551 /* Value */ && !(originalLocation.flags & 8388608 /* JSDoc */)) {
49383
49595
  var merged = getMergedSymbol(result);
49384
49596
  if (ts.length(merged.declarations) && ts.every(merged.declarations, function (d) { return ts.isNamespaceExportDeclaration(d) || ts.isSourceFile(d) && !!d.symbol.globalExports; })) {
49385
49597
  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));
@@ -49634,7 +49846,7 @@ var ts;
49634
49846
  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 */); });
49635
49847
  if (declaration === undefined)
49636
49848
  return ts.Debug.fail("checkResolvedBlockScopedVariable could not find block-scoped declaration");
49637
- if (!(declaration.flags & 8388608 /* Ambient */) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) {
49849
+ if (!(declaration.flags & 16777216 /* Ambient */) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) {
49638
49850
  var diagnosticMessage = void 0;
49639
49851
  var declarationName = ts.declarationNameToString(ts.getNameOfDeclaration(declaration));
49640
49852
  if (result.flags & 2 /* BlockScopedVariable */) {
@@ -50407,7 +50619,7 @@ var ts;
50407
50619
  }
50408
50620
  }
50409
50621
  function getAssignmentDeclarationLocation(node) {
50410
- var typeAlias = ts.findAncestor(node, function (node) { return !(ts.isJSDocNode(node) || node.flags & 4194304 /* JSDoc */) ? "quit" : ts.isJSDocTypeAlias(node); });
50622
+ var typeAlias = ts.findAncestor(node, function (node) { return !(ts.isJSDocNode(node) || node.flags & 8388608 /* JSDoc */) ? "quit" : ts.isJSDocTypeAlias(node); });
50411
50623
  if (typeAlias) {
50412
50624
  return;
50413
50625
  }
@@ -51875,7 +52087,20 @@ var ts;
51875
52087
  if (type.flags & 262144 /* TypeParameter */ || objectFlags & 3 /* ClassOrInterface */) {
51876
52088
  if (type.flags & 262144 /* TypeParameter */ && ts.contains(context.inferTypeParameters, type)) {
51877
52089
  context.approximateLength += (ts.symbolName(type.symbol).length + 6);
51878
- return ts.factory.createInferTypeNode(typeParameterToDeclarationWithConstraint(type, context, /*constraintNode*/ undefined));
52090
+ var constraintNode = void 0;
52091
+ var constraint = getConstraintOfTypeParameter(type);
52092
+ if (constraint) {
52093
+ // If the infer type has a constraint that is not the same as the constraint
52094
+ // we would have normally inferred based on context, we emit the constraint
52095
+ // using `infer T extends ?`. We omit inferred constraints from type references
52096
+ // as they may be elided.
52097
+ var inferredConstraint = getInferredTypeParameterConstraint(type, /*omitTypeReferences*/ true);
52098
+ if (!(inferredConstraint && isTypeIdenticalTo(constraint, inferredConstraint))) {
52099
+ context.approximateLength += 9;
52100
+ constraintNode = constraint && typeToTypeNodeHelper(constraint, context);
52101
+ }
52102
+ }
52103
+ return ts.factory.createInferTypeNode(typeParameterToDeclarationWithConstraint(type, context, constraintNode));
51879
52104
  }
51880
52105
  if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ &&
51881
52106
  type.flags & 262144 /* TypeParameter */ &&
@@ -53831,7 +54056,7 @@ var ts;
53831
54056
  newModifierFlags |= 1 /* Export */;
53832
54057
  }
53833
54058
  if (addingDeclare && !(newModifierFlags & 1 /* Export */) &&
53834
- (!enclosingDeclaration_1 || !(enclosingDeclaration_1.flags & 8388608 /* Ambient */)) &&
54059
+ (!enclosingDeclaration_1 || !(enclosingDeclaration_1.flags & 16777216 /* Ambient */)) &&
53835
54060
  (ts.isEnumDeclaration(node) || ts.isVariableStatement(node) || ts.isFunctionDeclaration(node) || ts.isClassDeclaration(node) || ts.isModuleDeclaration(node))) {
53836
54061
  // Classes, namespaces, variables, enums, and functions all need `declare` modifiers to be valid in a declaration file top-level scope
53837
54062
  newModifierFlags |= 2 /* Ambient */;
@@ -54801,7 +55026,7 @@ var ts;
54801
55026
  var parent = getDeclarationContainer(node);
54802
55027
  // If the node is not exported or it is not ambient module element (except import declaration)
54803
55028
  if (!(ts.getCombinedModifierFlags(node) & 1 /* Export */) &&
54804
- !(node.kind !== 265 /* ImportEqualsDeclaration */ && parent.kind !== 305 /* SourceFile */ && parent.flags & 8388608 /* Ambient */)) {
55029
+ !(node.kind !== 265 /* ImportEqualsDeclaration */ && parent.kind !== 305 /* SourceFile */ && parent.flags & 16777216 /* Ambient */)) {
54805
55030
  return isGlobalSourceFile(parent);
54806
55031
  }
54807
55032
  // Exported members/ambient module elements (exception import declaration) are visible if parent is visible
@@ -55141,7 +55366,7 @@ var ts;
55141
55366
  }
55142
55367
  var pattern = declaration.parent;
55143
55368
  // Relax null check on ambient destructuring parameters, since the parameters have no implementation and are just documentation
55144
- if (strictNullChecks && declaration.flags & 8388608 /* Ambient */ && ts.isParameterDeclaration(declaration)) {
55369
+ if (strictNullChecks && declaration.flags & 16777216 /* Ambient */ && ts.isParameterDeclaration(declaration)) {
55145
55370
  parentType = getNonNullableType(parentType);
55146
55371
  }
55147
55372
  // Filter `undefined` from the type we check against if the parent has an initializer and that initializer is not possibly `undefined`
@@ -55257,7 +55482,7 @@ var ts;
55257
55482
  }
55258
55483
  if ((noImplicitAny || ts.isInJSFile(declaration)) &&
55259
55484
  ts.isVariableDeclaration(declaration) && !ts.isBindingPattern(declaration.name) &&
55260
- !(ts.getCombinedModifierFlags(declaration) & 1 /* Export */) && !(declaration.flags & 8388608 /* Ambient */)) {
55485
+ !(ts.getCombinedModifierFlags(declaration) & 1 /* Export */) && !(declaration.flags & 16777216 /* Ambient */)) {
55261
55486
  // If --noImplicitAny is on or the declaration is in a Javascript file,
55262
55487
  // use control flow tracked 'any' type for non-ambient, non-exported var or let variables with no
55263
55488
  // initializer or a 'null' or 'undefined' initializer.
@@ -56713,7 +56938,7 @@ var ts;
56713
56938
  function isLiteralEnumMember(member) {
56714
56939
  var expr = member.initializer;
56715
56940
  if (!expr) {
56716
- return !(member.flags & 8388608 /* Ambient */);
56941
+ return !(member.flags & 16777216 /* Ambient */);
56717
56942
  }
56718
56943
  switch (expr.kind) {
56719
56944
  case 10 /* StringLiteral */:
@@ -59346,7 +59571,7 @@ var ts;
59346
59571
  function getConstraintDeclaration(type) {
59347
59572
  return ts.mapDefined(ts.filter(type.symbol && type.symbol.declarations, ts.isTypeParameterDeclaration), ts.getEffectiveConstraintOfTypeParameter)[0];
59348
59573
  }
59349
- function getInferredTypeParameterConstraint(typeParameter) {
59574
+ function getInferredTypeParameterConstraint(typeParameter, omitTypeReferences) {
59350
59575
  var _a;
59351
59576
  var inferences;
59352
59577
  if ((_a = typeParameter.symbol) === null || _a === void 0 ? void 0 : _a.declarations) {
@@ -59358,7 +59583,7 @@ var ts;
59358
59583
  // corresponding type parameter in 'Foo'. When multiple 'infer T' declarations are
59359
59584
  // present, we form an intersection of the inferred constraint types.
59360
59585
  var _c = ts.walkUpParenthesizedTypesAndGetParentAndChild(declaration.parent.parent), _d = _c[0], childTypeParameter = _d === void 0 ? declaration.parent : _d, grandParent = _c[1];
59361
- if (grandParent.kind === 178 /* TypeReference */) {
59586
+ if (grandParent.kind === 178 /* TypeReference */ && !omitTypeReferences) {
59362
59587
  var typeReference = grandParent;
59363
59588
  var typeParameters = getTypeParametersForTypeReference(typeReference);
59364
59589
  if (typeParameters) {
@@ -59780,7 +60005,7 @@ var ts;
59780
60005
  return constraints ? getSubstitutionType(type, getIntersectionType(ts.append(constraints, type))) : type;
59781
60006
  }
59782
60007
  function isJSDocTypeReference(node) {
59783
- return !!(node.flags & 4194304 /* JSDoc */) && (node.kind === 178 /* TypeReference */ || node.kind === 200 /* ImportType */);
60008
+ return !!(node.flags & 8388608 /* JSDoc */) && (node.kind === 178 /* TypeReference */ || node.kind === 200 /* ImportType */);
59784
60009
  }
59785
60010
  function checkNoTypeArguments(node, symbol) {
59786
60011
  if (node.typeArguments) {
@@ -61339,7 +61564,7 @@ var ts;
61339
61564
  if (ts.isCallLikeExpression(parent)) {
61340
61565
  return ts.isCallOrNewExpression(parent) && ts.isIdentifier(node) && hasMatchingArgument(parent, node);
61341
61566
  }
61342
- return ts.every(symbol.declarations, function (d) { return !ts.isFunctionLike(d) || !!(ts.getCombinedNodeFlags(d) & 134217728 /* Deprecated */); });
61567
+ return ts.every(symbol.declarations, function (d) { return !ts.isFunctionLike(d) || !!(ts.getCombinedNodeFlags(d) & 268435456 /* Deprecated */); });
61343
61568
  }
61344
61569
  return true;
61345
61570
  }
@@ -62032,7 +62257,7 @@ var ts;
62032
62257
  links.resolvedSymbol = unknownSymbol;
62033
62258
  return links.resolvedType = errorType;
62034
62259
  }
62035
- var targetMeaning = node.isTypeOf ? 111551 /* Value */ : node.flags & 4194304 /* JSDoc */ ? 111551 /* Value */ | 788968 /* Type */ : 788968 /* Type */;
62260
+ var targetMeaning = node.isTypeOf ? 111551 /* Value */ : node.flags & 8388608 /* JSDoc */ ? 111551 /* Value */ | 788968 /* Type */ : 788968 /* Type */;
62036
62261
  // TODO: Future work: support unions/generics/whatever via a deferred import-type
62037
62262
  var innerModuleSymbol = resolveExternalModuleName(node, node.argument.literal);
62038
62263
  if (!innerModuleSymbol) {
@@ -62368,7 +62593,7 @@ var ts;
62368
62593
  }
62369
62594
  // /** @return {this} */
62370
62595
  // x.prototype.m = function() { ... }
62371
- var host = node.flags & 4194304 /* JSDoc */ ? ts.getHostSignatureFromJSDoc(node) : undefined;
62596
+ var host = node.flags & 8388608 /* JSDoc */ ? ts.getHostSignatureFromJSDoc(node) : undefined;
62372
62597
  if (host && ts.isFunctionExpression(host) && ts.isBinaryExpression(host.parent) && ts.getAssignmentDeclarationKind(host.parent) === 3 /* PrototypeProperty */) {
62373
62598
  return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(host.parent.left).parent).thisType;
62374
62599
  }
@@ -62443,7 +62668,7 @@ var ts;
62443
62668
  case 143 /* NeverKeyword */:
62444
62669
  return neverType;
62445
62670
  case 148 /* ObjectKeyword */:
62446
- return node.flags & 131072 /* JavaScriptFile */ && !noImplicitAny ? anyType : nonPrimitiveType;
62671
+ return node.flags & 262144 /* JavaScriptFile */ && !noImplicitAny ? anyType : nonPrimitiveType;
62447
62672
  case 138 /* IntrinsicKeyword */:
62448
62673
  return intrinsicMarkerType;
62449
62674
  case 192 /* ThisType */:
@@ -67320,6 +67545,9 @@ var ts;
67320
67545
  var inference = inferences[i];
67321
67546
  if (t === inference.typeParameter) {
67322
67547
  if (fix && !inference.isFixed) {
67548
+ // Before we commit to a particular inference (and thus lock out any further inferences),
67549
+ // we infer from any intra-expression inference sites we have collected.
67550
+ inferFromIntraExpressionSites(context);
67323
67551
  clearCachedInferences(inferences);
67324
67552
  inference.isFixed = true;
67325
67553
  }
@@ -67336,6 +67564,37 @@ var ts;
67336
67564
  }
67337
67565
  }
67338
67566
  }
67567
+ function addIntraExpressionInferenceSite(context, node, type) {
67568
+ var _a;
67569
+ ((_a = context.intraExpressionInferenceSites) !== null && _a !== void 0 ? _a : (context.intraExpressionInferenceSites = [])).push({ node: node, type: type });
67570
+ }
67571
+ // We collect intra-expression inference sites within object and array literals to handle cases where
67572
+ // inferred types flow between context sensitive element expressions. For example:
67573
+ //
67574
+ // declare function foo<T>(arg: [(n: number) => T, (x: T) => void]): void;
67575
+ // foo([_a => 0, n => n.toFixed()]);
67576
+ //
67577
+ // Above, both arrow functions in the tuple argument are context sensitive, thus both are omitted from the
67578
+ // pass that collects inferences from the non-context sensitive parts of the arguments. In the subsequent
67579
+ // pass where nothing is omitted, we need to commit to an inference for T in order to contextually type the
67580
+ // parameter in the second arrow function, but we want to first infer from the return type of the first
67581
+ // arrow function. This happens automatically when the arrow functions are discrete arguments (because we
67582
+ // infer from each argument before processing the next), but when the arrow functions are elements of an
67583
+ // object or array literal, we need to perform intra-expression inferences early.
67584
+ function inferFromIntraExpressionSites(context) {
67585
+ if (context.intraExpressionInferenceSites) {
67586
+ for (var _i = 0, _a = context.intraExpressionInferenceSites; _i < _a.length; _i++) {
67587
+ var _b = _a[_i], node = _b.node, type = _b.type;
67588
+ var contextualType = node.kind === 169 /* MethodDeclaration */ ?
67589
+ getContextualTypeForObjectLiteralMethod(node, 2 /* NoConstraints */) :
67590
+ getContextualType(node, 2 /* NoConstraints */);
67591
+ if (contextualType) {
67592
+ inferTypes(context.inferences, type, contextualType);
67593
+ }
67594
+ }
67595
+ context.intraExpressionInferenceSites = undefined;
67596
+ }
67597
+ }
67339
67598
  function createInferenceInfo(typeParameter) {
67340
67599
  return {
67341
67600
  typeParameter: typeParameter,
@@ -69318,7 +69577,7 @@ var ts;
69318
69577
  // parameter symbols with declarations that have explicit type annotations. Such references are
69319
69578
  // resolvable with no possibility of triggering circularities in control flow analysis.
69320
69579
  function getTypeOfDottedName(node, diagnostic) {
69321
- if (!(node.flags & 16777216 /* InWithStatement */)) {
69580
+ if (!(node.flags & 33554432 /* InWithStatement */)) {
69322
69581
  switch (node.kind) {
69323
69582
  case 79 /* Identifier */:
69324
69583
  var symbol = getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(node));
@@ -70722,6 +70981,7 @@ var ts;
70722
70981
  // a generic type without a nullable constraint and x is a generic type. This is because when both obj
70723
70982
  // and x are of generic types T and K, we want the resulting type to be T[K].
70724
70983
  return parent.kind === 206 /* PropertyAccessExpression */ ||
70984
+ parent.kind === 161 /* QualifiedName */ ||
70725
70985
  parent.kind === 208 /* CallExpression */ && parent.expression === node ||
70726
70986
  parent.kind === 207 /* ElementAccessExpression */ && parent.expression === node &&
70727
70987
  !(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent.argumentExpression)));
@@ -71015,7 +71275,7 @@ var ts;
71015
71275
  isInTypeQuery(node) || node.parent.kind === 275 /* ExportSpecifier */) ||
71016
71276
  node.parent.kind === 230 /* NonNullExpression */ ||
71017
71277
  declaration.kind === 254 /* VariableDeclaration */ && declaration.exclamationToken ||
71018
- declaration.flags & 8388608 /* Ambient */;
71278
+ declaration.flags & 16777216 /* Ambient */;
71019
71279
  var initialType = assumeInitialized ? (isParameter ? removeOptionalityFromDeclaredType(type, declaration) : type) :
71020
71280
  type === autoType || type === autoArrayType ? undefinedType :
71021
71281
  getOptionalType(type);
@@ -72023,7 +72283,7 @@ var ts;
72023
72283
  // exists. Otherwise, it is the type of the string index signature in T, if one exists.
72024
72284
  function getContextualTypeForObjectLiteralMethod(node, contextFlags) {
72025
72285
  ts.Debug.assert(ts.isObjectLiteralMethod(node));
72026
- if (node.flags & 16777216 /* InWithStatement */) {
72286
+ if (node.flags & 33554432 /* InWithStatement */) {
72027
72287
  // We cannot answer semantic questions within a with block, do not proceed any further
72028
72288
  return undefined;
72029
72289
  }
@@ -72211,7 +72471,7 @@ var ts;
72211
72471
  * @returns the contextual type of an expression.
72212
72472
  */
72213
72473
  function getContextualType(node, contextFlags) {
72214
- if (node.flags & 16777216 /* InWithStatement */) {
72474
+ if (node.flags & 33554432 /* InWithStatement */) {
72215
72475
  // We cannot answer semantic questions within a with block, do not proceed any further
72216
72476
  return undefined;
72217
72477
  }
@@ -72629,6 +72889,11 @@ var ts;
72629
72889
  var type = checkExpressionForMutableLocation(e, checkMode, elementContextualType, forceTuple);
72630
72890
  elementTypes.push(addOptionality(type, /*isProperty*/ true, hasOmittedExpression));
72631
72891
  elementFlags.push(hasOmittedExpression ? 2 /* Optional */ : 1 /* Required */);
72892
+ if (contextualType && someType(contextualType, isTupleLikeType) && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && isContextSensitive(e)) {
72893
+ var inferenceContext = getInferenceContext(node);
72894
+ ts.Debug.assert(inferenceContext); // In CheckMode.Inferential we should always have an inference context
72895
+ addIntraExpressionInferenceSite(inferenceContext, e, type);
72896
+ }
72632
72897
  }
72633
72898
  }
72634
72899
  if (inDestructuringPattern) {
@@ -72830,6 +73095,13 @@ var ts;
72830
73095
  prop.target = member;
72831
73096
  member = prop;
72832
73097
  allPropertiesTable === null || allPropertiesTable === void 0 ? void 0 : allPropertiesTable.set(prop.escapedName, prop);
73098
+ if (contextualType && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) &&
73099
+ (memberDecl.kind === 296 /* PropertyAssignment */ || memberDecl.kind === 169 /* MethodDeclaration */) && isContextSensitive(memberDecl)) {
73100
+ var inferenceContext = getInferenceContext(node);
73101
+ ts.Debug.assert(inferenceContext); // In CheckMode.Inferential we should always have an inference context
73102
+ var inferenceNode = memberDecl.kind === 296 /* PropertyAssignment */ ? memberDecl.initializer : memberDecl;
73103
+ addIntraExpressionInferenceSite(inferenceContext, inferenceNode, type);
73104
+ }
72833
73105
  }
72834
73106
  else if (memberDecl.kind === 298 /* SpreadAssignment */) {
72835
73107
  if (languageVersion < 2 /* ES2015 */) {
@@ -73922,7 +74194,7 @@ var ts;
73922
74194
  if (compilerOptions.noPropertyAccessFromIndexSignature && ts.isPropertyAccessExpression(node)) {
73923
74195
  error(right, ts.Diagnostics.Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0, ts.unescapeLeadingUnderscores(right.escapedText));
73924
74196
  }
73925
- if (indexInfo.declaration && ts.getCombinedNodeFlags(indexInfo.declaration) & 134217728 /* Deprecated */) {
74197
+ if (indexInfo.declaration && ts.getCombinedNodeFlags(indexInfo.declaration) & 268435456 /* Deprecated */) {
73926
74198
  addDeprecatedSuggestion(right, [indexInfo.declaration], right.escapedText);
73927
74199
  }
73928
74200
  }
@@ -73990,7 +74262,7 @@ var ts;
73990
74262
  if (declaration && isPropertyWithoutInitializer(declaration)) {
73991
74263
  if (!ts.isStatic(declaration)) {
73992
74264
  var flowContainer = getControlFlowContainer(node);
73993
- if (flowContainer.kind === 171 /* Constructor */ && flowContainer.parent === declaration.parent && !(declaration.flags & 8388608 /* Ambient */)) {
74265
+ if (flowContainer.kind === 171 /* Constructor */ && flowContainer.parent === declaration.parent && !(declaration.flags & 16777216 /* Ambient */)) {
73994
74266
  assumeUninitialized = true;
73995
74267
  }
73996
74268
  }
@@ -74027,7 +74299,7 @@ var ts;
74027
74299
  }
74028
74300
  else if (valueDeclaration.kind === 257 /* ClassDeclaration */ &&
74029
74301
  node.parent.kind !== 178 /* TypeReference */ &&
74030
- !(valueDeclaration.flags & 8388608 /* Ambient */) &&
74302
+ !(valueDeclaration.flags & 16777216 /* Ambient */) &&
74031
74303
  !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) {
74032
74304
  diagnosticMessage = error(right, ts.Diagnostics.Class_0_used_before_its_declaration, declarationName);
74033
74305
  }
@@ -74692,34 +74964,36 @@ var ts;
74692
74964
  if (node.kind !== 165 /* Decorator */) {
74693
74965
  var contextualType = getContextualType(node, ts.every(signature.typeParameters, function (p) { return !!getDefaultFromTypeParameter(p); }) ? 8 /* SkipBindingPatterns */ : 0 /* None */);
74694
74966
  if (contextualType) {
74695
- // We clone the inference context to avoid disturbing a resolution in progress for an
74696
- // outer call expression. Effectively we just want a snapshot of whatever has been
74697
- // inferred for any outer call expression so far.
74698
- var outerContext = getInferenceContext(node);
74699
- var outerMapper = getMapperFromContext(cloneInferenceContext(outerContext, 1 /* NoDefault */));
74700
- var instantiatedType = instantiateType(contextualType, outerMapper);
74701
- // If the contextual type is a generic function type with a single call signature, we
74702
- // instantiate the type with its own type parameters and type arguments. This ensures that
74703
- // the type parameters are not erased to type any during type inference such that they can
74704
- // be inferred as actual types from the contextual type. For example:
74705
- // declare function arrayMap<T, U>(f: (x: T) => U): (a: T[]) => U[];
74706
- // const boxElements: <A>(a: A[]) => { value: A }[] = arrayMap(value => ({ value }));
74707
- // Above, the type of the 'value' parameter is inferred to be 'A'.
74708
- var contextualSignature = getSingleCallSignature(instantiatedType);
74709
- var inferenceSourceType = contextualSignature && contextualSignature.typeParameters ?
74710
- getOrCreateTypeFromSignature(getSignatureInstantiationWithoutFillingInTypeArguments(contextualSignature, contextualSignature.typeParameters)) :
74711
- instantiatedType;
74712
74967
  var inferenceTargetType = getReturnTypeOfSignature(signature);
74713
- // Inferences made from return types have lower priority than all other inferences.
74714
- inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, 128 /* ReturnType */);
74715
- // Create a type mapper for instantiating generic contextual types using the inferences made
74716
- // from the return type. We need a separate inference pass here because (a) instantiation of
74717
- // the source type uses the outer context's return mapper (which excludes inferences made from
74718
- // outer arguments), and (b) we don't want any further inferences going into this context.
74719
- var returnContext = createInferenceContext(signature.typeParameters, signature, context.flags);
74720
- var returnSourceType = instantiateType(contextualType, outerContext && outerContext.returnMapper);
74721
- inferTypes(returnContext.inferences, returnSourceType, inferenceTargetType);
74722
- context.returnMapper = ts.some(returnContext.inferences, hasInferenceCandidates) ? getMapperFromContext(cloneInferredPartOfContext(returnContext)) : undefined;
74968
+ if (couldContainTypeVariables(inferenceTargetType)) {
74969
+ // We clone the inference context to avoid disturbing a resolution in progress for an
74970
+ // outer call expression. Effectively we just want a snapshot of whatever has been
74971
+ // inferred for any outer call expression so far.
74972
+ var outerContext = getInferenceContext(node);
74973
+ var outerMapper = getMapperFromContext(cloneInferenceContext(outerContext, 1 /* NoDefault */));
74974
+ var instantiatedType = instantiateType(contextualType, outerMapper);
74975
+ // If the contextual type is a generic function type with a single call signature, we
74976
+ // instantiate the type with its own type parameters and type arguments. This ensures that
74977
+ // the type parameters are not erased to type any during type inference such that they can
74978
+ // be inferred as actual types from the contextual type. For example:
74979
+ // declare function arrayMap<T, U>(f: (x: T) => U): (a: T[]) => U[];
74980
+ // const boxElements: <A>(a: A[]) => { value: A }[] = arrayMap(value => ({ value }));
74981
+ // Above, the type of the 'value' parameter is inferred to be 'A'.
74982
+ var contextualSignature = getSingleCallSignature(instantiatedType);
74983
+ var inferenceSourceType = contextualSignature && contextualSignature.typeParameters ?
74984
+ getOrCreateTypeFromSignature(getSignatureInstantiationWithoutFillingInTypeArguments(contextualSignature, contextualSignature.typeParameters)) :
74985
+ instantiatedType;
74986
+ // Inferences made from return types have lower priority than all other inferences.
74987
+ inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, 128 /* ReturnType */);
74988
+ // Create a type mapper for instantiating generic contextual types using the inferences made
74989
+ // from the return type. We need a separate inference pass here because (a) instantiation of
74990
+ // the source type uses the outer context's return mapper (which excludes inferences made from
74991
+ // outer arguments), and (b) we don't want any further inferences going into this context.
74992
+ var returnContext = createInferenceContext(signature.typeParameters, signature, context.flags);
74993
+ var returnSourceType = instantiateType(contextualType, outerContext && outerContext.returnMapper);
74994
+ inferTypes(returnContext.inferences, returnSourceType, inferenceTargetType);
74995
+ context.returnMapper = ts.some(returnContext.inferences, hasInferenceCandidates) ? getMapperFromContext(cloneInferredPartOfContext(returnContext)) : undefined;
74996
+ }
74723
74997
  }
74724
74998
  }
74725
74999
  var restType = getNonArrayRestType(signature);
@@ -74731,7 +75005,7 @@ var ts;
74731
75005
  }
74732
75006
  }
74733
75007
  var thisType = getThisTypeOfSignature(signature);
74734
- if (thisType) {
75008
+ if (thisType && couldContainTypeVariables(thisType)) {
74735
75009
  var thisArgumentNode = getThisArgumentOfCall(node);
74736
75010
  inferTypes(context.inferences, getThisArgumentType(thisArgumentNode), thisType);
74737
75011
  }
@@ -74739,11 +75013,13 @@ var ts;
74739
75013
  var arg = args[i];
74740
75014
  if (arg.kind !== 227 /* OmittedExpression */ && !(checkMode & 32 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) {
74741
75015
  var paramType = getTypeAtPosition(signature, i);
74742
- var argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
74743
- inferTypes(context.inferences, argType, paramType);
75016
+ if (couldContainTypeVariables(paramType)) {
75017
+ var argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
75018
+ inferTypes(context.inferences, argType, paramType);
75019
+ }
74744
75020
  }
74745
75021
  }
74746
- if (restType) {
75022
+ if (restType && couldContainTypeVariables(restType)) {
74747
75023
  var spreadType = getSpreadArgumentType(args, argCount, args.length, restType, context, checkMode);
74748
75024
  inferTypes(context.inferences, spreadType, restType);
74749
75025
  }
@@ -76323,7 +76599,7 @@ var ts;
76323
76599
  return returnType;
76324
76600
  }
76325
76601
  function checkDeprecatedSignature(signature, node) {
76326
- if (signature.declaration && signature.declaration.flags & 134217728 /* Deprecated */) {
76602
+ if (signature.declaration && signature.declaration.flags & 268435456 /* Deprecated */) {
76327
76603
  var suggestionNode = getDeprecatedSuggestionNode(node);
76328
76604
  var name = ts.tryGetPropertyAccessOrIdentifierToString(ts.getInvokedExpression(node));
76329
76605
  addDeprecatedSuggestionWithSignature(suggestionNode, signature.declaration, name, signatureToString(signature));
@@ -76467,7 +76743,7 @@ var ts;
76467
76743
  if (targetDeclarationKind !== 0 /* Unknown */) {
76468
76744
  var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind);
76469
76745
  // function/variable declaration should be ambient
76470
- return !!decl && !!(decl.flags & 8388608 /* Ambient */);
76746
+ return !!decl && !!(decl.flags & 16777216 /* Ambient */);
76471
76747
  }
76472
76748
  return false;
76473
76749
  }
@@ -76662,7 +76938,7 @@ var ts;
76662
76938
  error(node, ts.Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node12_or_nodenext);
76663
76939
  }
76664
76940
  var file = ts.getSourceFileOfNode(node);
76665
- ts.Debug.assert(!!(file.flags & 2097152 /* PossiblyContainsImportMeta */), "Containing file is missing import meta node flag.");
76941
+ ts.Debug.assert(!!(file.flags & 4194304 /* PossiblyContainsImportMeta */), "Containing file is missing import meta node flag.");
76666
76942
  return node.name.escapedText === "meta" ? getGlobalImportMetaType() : errorType;
76667
76943
  }
76668
76944
  function getTypeOfParameter(symbol) {
@@ -78676,6 +78952,11 @@ var ts;
78676
78952
  context.contextualType = contextualType;
78677
78953
  context.inferenceContext = inferenceContext;
78678
78954
  var type = checkExpression(node, checkMode | 1 /* Contextual */ | (inferenceContext ? 2 /* Inferential */ : 0));
78955
+ // In CheckMode.Inferential we collect intra-expression inference sites to process before fixing any type
78956
+ // parameters. This information is no longer needed after the call to checkExpression.
78957
+ if (inferenceContext && inferenceContext.intraExpressionInferenceSites) {
78958
+ inferenceContext.intraExpressionInferenceSites = undefined;
78959
+ }
78679
78960
  // We strip literal freshness when an appropriate contextual type is present such that contextually typed
78680
78961
  // literals always preserve their literal types (otherwise they might widen during type inference). An alternative
78681
78962
  // here would be to not mark contextually typed literals as fresh in the first place.
@@ -78967,7 +79248,7 @@ var ts;
78967
79248
  return quickType;
78968
79249
  }
78969
79250
  // If a type has been cached for the node, return it.
78970
- if (node.flags & 67108864 /* TypeCached */ && flowTypeCache) {
79251
+ if (node.flags & 134217728 /* TypeCached */ && flowTypeCache) {
78971
79252
  var cachedType = flowTypeCache[getNodeId(node)];
78972
79253
  if (cachedType) {
78973
79254
  return cachedType;
@@ -78979,7 +79260,7 @@ var ts;
78979
79260
  if (flowInvocationCount !== startInvocationCount) {
78980
79261
  var cache = flowTypeCache || (flowTypeCache = []);
78981
79262
  cache[getNodeId(node)] = type;
78982
- ts.setNodeFlags(node, node.flags | 67108864 /* TypeCached */);
79263
+ ts.setNodeFlags(node, node.flags | 134217728 /* TypeCached */);
78983
79264
  }
78984
79265
  return type;
78985
79266
  }
@@ -79065,7 +79346,7 @@ var ts;
79065
79346
  if (compilerOptions.isolatedModules) {
79066
79347
  ts.Debug.assert(!!(type.symbol.flags & 128 /* ConstEnum */));
79067
79348
  var constEnumDeclaration = type.symbol.valueDeclaration;
79068
- if (constEnumDeclaration.flags & 8388608 /* Ambient */) {
79349
+ if (constEnumDeclaration.flags & 16777216 /* Ambient */) {
79069
79350
  error(node, ts.Diagnostics.Cannot_access_ambient_const_enums_when_the_isolatedModules_flag_is_provided);
79070
79351
  }
79071
79352
  }
@@ -79758,7 +80039,7 @@ var ts;
79758
80039
  checkDecorators(node);
79759
80040
  checkSignatureDeclaration(node);
79760
80041
  if (node.kind === 172 /* GetAccessor */) {
79761
- if (!(node.flags & 8388608 /* Ambient */) && ts.nodeIsPresent(node.body) && (node.flags & 256 /* HasImplicitReturn */)) {
80042
+ if (!(node.flags & 16777216 /* Ambient */) && ts.nodeIsPresent(node.body) && (node.flags & 256 /* HasImplicitReturn */)) {
79762
80043
  if (!(node.flags & 512 /* HasExplicitReturn */)) {
79763
80044
  error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value);
79764
80045
  }
@@ -79853,7 +80134,7 @@ var ts;
79853
80134
  }
79854
80135
  var symbol = getNodeLinks(node).resolvedSymbol;
79855
80136
  if (symbol) {
79856
- if (ts.some(symbol.declarations, function (d) { return isTypeDeclaration(d) && !!(d.flags & 134217728 /* Deprecated */); })) {
80137
+ if (ts.some(symbol.declarations, function (d) { return isTypeDeclaration(d) && !!(d.flags & 268435456 /* Deprecated */); })) {
79857
80138
  addDeprecatedSuggestion(getDeprecatedSuggestionNode(node), symbol.declarations, symbol.escapedName);
79858
80139
  }
79859
80140
  if (type.flags & 32 /* Enum */ && symbol.flags & 8 /* EnumMember */) {
@@ -80013,6 +80294,23 @@ var ts;
80013
80294
  grammarErrorOnNode(node, ts.Diagnostics.infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type);
80014
80295
  }
80015
80296
  checkSourceElement(node.typeParameter);
80297
+ var symbol = getSymbolOfNode(node.typeParameter);
80298
+ if (symbol.declarations && symbol.declarations.length > 1) {
80299
+ var links = getSymbolLinks(symbol);
80300
+ if (!links.typeParametersChecked) {
80301
+ links.typeParametersChecked = true;
80302
+ var typeParameter = getDeclaredTypeOfTypeParameter(symbol);
80303
+ var declarations = ts.getDeclarationsOfKind(symbol, 163 /* TypeParameter */);
80304
+ if (!areTypeParametersIdentical(declarations, [typeParameter], function (decl) { return [decl]; })) {
80305
+ // Report an error on every conflicting declaration.
80306
+ var name = symbolToString(symbol);
80307
+ for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) {
80308
+ var declaration = declarations_4[_i];
80309
+ error(declaration.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_constraints, name);
80310
+ }
80311
+ }
80312
+ }
80313
+ }
80016
80314
  registerForUnusedIdentifiersCheck(node);
80017
80315
  }
80018
80316
  function checkTemplateLiteralType(node) {
@@ -80050,7 +80348,7 @@ var ts;
80050
80348
  getTypeFromTypeNode(node);
80051
80349
  }
80052
80350
  function isPrivateWithinAmbient(node) {
80053
- return (ts.hasEffectiveModifier(node, 8 /* Private */) || ts.isPrivateIdentifierClassElementDeclaration(node)) && !!(node.flags & 8388608 /* Ambient */);
80351
+ return (ts.hasEffectiveModifier(node, 8 /* Private */) || ts.isPrivateIdentifierClassElementDeclaration(node)) && !!(node.flags & 16777216 /* Ambient */);
80054
80352
  }
80055
80353
  function getEffectiveDeclarationFlags(n, flagsToCheck) {
80056
80354
  var flags = ts.getCombinedModifierFlags(n);
@@ -80059,7 +80357,7 @@ var ts;
80059
80357
  if (n.parent.kind !== 258 /* InterfaceDeclaration */ &&
80060
80358
  n.parent.kind !== 257 /* ClassDeclaration */ &&
80061
80359
  n.parent.kind !== 226 /* ClassExpression */ &&
80062
- n.flags & 8388608 /* Ambient */) {
80360
+ n.flags & 16777216 /* Ambient */) {
80063
80361
  if (!(flags & 2 /* Ambient */) && !(ts.isModuleBlock(n.parent) && ts.isModuleDeclaration(n.parent.parent) && ts.isGlobalScopeAugmentation(n.parent.parent))) {
80064
80362
  // It is nested in an ambient context, which means it is automatically exported
80065
80363
  flags |= 1 /* Export */;
@@ -80192,10 +80490,10 @@ var ts;
80192
80490
  var hasNonAmbientClass = false;
80193
80491
  var functionDeclarations = [];
80194
80492
  if (declarations) {
80195
- for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) {
80196
- var current = declarations_4[_i];
80493
+ for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) {
80494
+ var current = declarations_5[_i];
80197
80495
  var node = current;
80198
- var inAmbientContext = node.flags & 8388608 /* Ambient */;
80496
+ var inAmbientContext = node.flags & 16777216 /* Ambient */;
80199
80497
  var inAmbientContextOrInterface = node.parent && (node.parent.kind === 258 /* InterfaceDeclaration */ || node.parent.kind === 182 /* TypeLiteral */) || inAmbientContext;
80200
80498
  if (inAmbientContextOrInterface) {
80201
80499
  // check if declarations are consecutive only if they are non-ambient
@@ -81047,7 +81345,7 @@ var ts;
81047
81345
  // checkFunctionOrConstructorSymbol wouldn't be called if we didnt ignore javascript function.
81048
81346
  var firstDeclaration = (_a = localSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(
81049
81347
  // Get first non javascript function declaration
81050
- function (declaration) { return declaration.kind === node.kind && !(declaration.flags & 131072 /* JavaScriptFile */); });
81348
+ function (declaration) { return declaration.kind === node.kind && !(declaration.flags & 262144 /* JavaScriptFile */); });
81051
81349
  // Only type check the symbol once
81052
81350
  if (node === firstDeclaration) {
81053
81351
  checkFunctionOrConstructorSymbol(localSymbol);
@@ -81169,7 +81467,7 @@ var ts;
81169
81467
  var symbol = getSymbolOfNode(member);
81170
81468
  if (!symbol.isReferenced
81171
81469
  && (ts.hasEffectiveModifier(member, 8 /* Private */) || ts.isNamedDeclaration(member) && ts.isPrivateIdentifier(member.name))
81172
- && !(member.flags & 8388608 /* Ambient */)) {
81470
+ && !(member.flags & 16777216 /* Ambient */)) {
81173
81471
  addDiagnostic(member, 0 /* Local */, ts.createDiagnosticForNode(member.name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, symbolToString(symbol)));
81174
81472
  }
81175
81473
  break;
@@ -81359,8 +81657,8 @@ var ts;
81359
81657
  : ts.createDiagnosticForNode(declarationList.parent.kind === 237 /* VariableStatement */ ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused));
81360
81658
  }
81361
81659
  else {
81362
- for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) {
81363
- var decl = declarations_5[_i];
81660
+ for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) {
81661
+ var decl = declarations_6[_i];
81364
81662
  addDiagnostic(decl, 0 /* Local */, ts.createDiagnosticForNode(decl, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(decl.name)));
81365
81663
  }
81366
81664
  }
@@ -81402,7 +81700,7 @@ var ts;
81402
81700
  }
81403
81701
  function checkCollisionWithArgumentsInGeneratedCode(node) {
81404
81702
  // no rest parameters \ declaration context \ overload - no codegen impact
81405
- if (languageVersion >= 2 /* ES2015 */ || !ts.hasRestParameter(node) || node.flags & 8388608 /* Ambient */ || ts.nodeIsMissing(node.body)) {
81703
+ if (languageVersion >= 2 /* ES2015 */ || !ts.hasRestParameter(node) || node.flags & 16777216 /* Ambient */ || ts.nodeIsMissing(node.body)) {
81406
81704
  return;
81407
81705
  }
81408
81706
  ts.forEach(node.parameters, function (p) {
@@ -81430,7 +81728,7 @@ var ts;
81430
81728
  // it is ok to have member named '_super', '_this', `Promise`, etc. - member access is always qualified
81431
81729
  return false;
81432
81730
  }
81433
- if (node.flags & 8388608 /* Ambient */) {
81731
+ if (node.flags & 16777216 /* Ambient */) {
81434
81732
  // ambient context - no codegen impact
81435
81733
  return false;
81436
81734
  }
@@ -81569,7 +81867,7 @@ var ts;
81569
81867
  recordPotentialCollisionWithReflectInGeneratedCode(node, name);
81570
81868
  if (ts.isClassLike(node)) {
81571
81869
  checkTypeNameIsReserved(name, ts.Diagnostics.Class_name_cannot_be_0);
81572
- if (!(node.flags & 8388608 /* Ambient */)) {
81870
+ if (!(node.flags & 16777216 /* Ambient */)) {
81573
81871
  checkClassNameCollisionWithObject(name);
81574
81872
  }
81575
81873
  }
@@ -83163,23 +83461,23 @@ var ts;
83163
83461
  return;
83164
83462
  }
83165
83463
  var type = getDeclaredTypeOfSymbol(symbol);
83166
- if (!areTypeParametersIdentical(declarations, type.localTypeParameters)) {
83464
+ if (!areTypeParametersIdentical(declarations, type.localTypeParameters, ts.getEffectiveTypeParameterDeclarations)) {
83167
83465
  // Report an error on every conflicting declaration.
83168
83466
  var name = symbolToString(symbol);
83169
- for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) {
83170
- var declaration = declarations_6[_i];
83467
+ for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) {
83468
+ var declaration = declarations_7[_i];
83171
83469
  error(declaration.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, name);
83172
83470
  }
83173
83471
  }
83174
83472
  }
83175
83473
  }
83176
- function areTypeParametersIdentical(declarations, targetParameters) {
83474
+ function areTypeParametersIdentical(declarations, targetParameters, getTypeParameterDeclarations) {
83177
83475
  var maxTypeArgumentCount = ts.length(targetParameters);
83178
83476
  var minTypeArgumentCount = getMinTypeArgumentCount(targetParameters);
83179
- for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) {
83180
- var declaration = declarations_7[_i];
83477
+ for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) {
83478
+ var declaration = declarations_8[_i];
83181
83479
  // If this declaration has too few or too many type parameters, we report an error
83182
- var sourceParameters = ts.getEffectiveTypeParameterDeclarations(declaration);
83480
+ var sourceParameters = getTypeParameterDeclarations(declaration);
83183
83481
  var numTypeParameters = sourceParameters.length;
83184
83482
  if (numTypeParameters < minTypeArgumentCount || numTypeParameters > maxTypeArgumentCount) {
83185
83483
  return false;
@@ -83247,7 +83545,7 @@ var ts;
83247
83545
  checkFunctionOrConstructorSymbol(symbol);
83248
83546
  checkClassForDuplicateDeclarations(node);
83249
83547
  // Only check for reserved static identifiers on non-ambient context.
83250
- var nodeInAmbientContext = !!(node.flags & 8388608 /* Ambient */);
83548
+ var nodeInAmbientContext = !!(node.flags & 16777216 /* Ambient */);
83251
83549
  if (!nodeInAmbientContext) {
83252
83550
  checkClassForStaticPropertyNameConflicts(node);
83253
83551
  }
@@ -83397,7 +83695,7 @@ var ts;
83397
83695
  */
83398
83696
  function checkMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, memberHasOverrideModifier, memberHasAbstractModifier, memberIsStatic, memberIsParameterProperty, memberName, errorNode) {
83399
83697
  var isJs = ts.isInJSFile(node);
83400
- var nodeInAmbientContext = !!(node.flags & 8388608 /* Ambient */);
83698
+ var nodeInAmbientContext = !!(node.flags & 16777216 /* Ambient */);
83401
83699
  if (baseWithThis && (memberHasOverrideModifier || compilerOptions.noImplicitOverride)) {
83402
83700
  var memberEscapedName = ts.escapeLeadingUnderscores(memberName);
83403
83701
  var thisType = memberIsStatic ? staticType : typeWithThis;
@@ -83625,7 +83923,7 @@ var ts;
83625
83923
  && !(derived.flags & 33554432 /* Transient */)
83626
83924
  && !(baseDeclarationFlags & 128 /* Abstract */)
83627
83925
  && !(derivedDeclarationFlags & 128 /* Abstract */)
83628
- && !((_b = derived.declarations) === null || _b === void 0 ? void 0 : _b.some(function (d) { return !!(d.flags & 8388608 /* Ambient */); }))) {
83926
+ && !((_b = derived.declarations) === null || _b === void 0 ? void 0 : _b.some(function (d) { return !!(d.flags & 16777216 /* Ambient */); }))) {
83629
83927
  var constructor = findConstructorDeclaration(ts.getClassLikeDeclarationOfSymbol(type.symbol));
83630
83928
  var propName = uninitialized.name;
83631
83929
  if (uninitialized.exclamationToken
@@ -83717,7 +84015,7 @@ var ts;
83717
84015
  return ok;
83718
84016
  }
83719
84017
  function checkPropertyInitialization(node) {
83720
- if (!strictNullChecks || !strictPropertyInitialization || node.flags & 8388608 /* Ambient */) {
84018
+ if (!strictNullChecks || !strictPropertyInitialization || node.flags & 16777216 /* Ambient */) {
83721
84019
  return;
83722
84020
  }
83723
84021
  var constructor = findConstructorDeclaration(node);
@@ -83854,7 +84152,7 @@ var ts;
83854
84152
  }
83855
84153
  // In ambient non-const numeric enum declarations, enum members without initializers are
83856
84154
  // considered computed members (as opposed to having auto-incremented values).
83857
- if (member.parent.flags & 8388608 /* Ambient */ && !ts.isEnumConst(member.parent) && getEnumKind(getSymbolOfNode(member.parent)) === 0 /* Numeric */) {
84155
+ if (member.parent.flags & 16777216 /* Ambient */ && !ts.isEnumConst(member.parent) && getEnumKind(getSymbolOfNode(member.parent)) === 0 /* Numeric */) {
83858
84156
  return undefined;
83859
84157
  }
83860
84158
  // If the member declaration specifies no value, the member is considered a constant enum member.
@@ -83886,7 +84184,7 @@ var ts;
83886
84184
  else if (isConstEnum) {
83887
84185
  error(initializer, ts.Diagnostics.const_enum_member_initializers_can_only_contain_literal_values_and_other_computed_enum_values);
83888
84186
  }
83889
- else if (member.parent.flags & 8388608 /* Ambient */) {
84187
+ else if (member.parent.flags & 16777216 /* Ambient */) {
83890
84188
  error(initializer, ts.Diagnostics.In_ambient_enum_declarations_member_initializer_must_be_constant_expression);
83891
84189
  }
83892
84190
  else {
@@ -84054,11 +84352,11 @@ var ts;
84054
84352
  function getFirstNonAmbientClassOrFunctionDeclaration(symbol) {
84055
84353
  var declarations = symbol.declarations;
84056
84354
  if (declarations) {
84057
- for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) {
84058
- var declaration = declarations_8[_i];
84355
+ for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) {
84356
+ var declaration = declarations_9[_i];
84059
84357
  if ((declaration.kind === 257 /* ClassDeclaration */ ||
84060
84358
  (declaration.kind === 256 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) &&
84061
- !(declaration.flags & 8388608 /* Ambient */)) {
84359
+ !(declaration.flags & 16777216 /* Ambient */)) {
84062
84360
  return declaration;
84063
84361
  }
84064
84362
  }
@@ -84089,7 +84387,7 @@ var ts;
84089
84387
  function checkModuleDeclarationDiagnostics() {
84090
84388
  // Grammar checking
84091
84389
  var isGlobalAugmentation = ts.isGlobalScopeAugmentation(node);
84092
- var inAmbientContext = node.flags & 8388608 /* Ambient */;
84390
+ var inAmbientContext = node.flags & 16777216 /* Ambient */;
84093
84391
  if (isGlobalAugmentation && !inAmbientContext) {
84094
84392
  error(node.name, ts.Diagnostics.Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context);
84095
84393
  }
@@ -84307,7 +84605,7 @@ var ts;
84307
84605
  }
84308
84606
  if (compilerOptions.isolatedModules
84309
84607
  && !ts.isTypeOnlyImportOrExportDeclaration(node)
84310
- && !(node.flags & 8388608 /* Ambient */)) {
84608
+ && !(node.flags & 16777216 /* Ambient */)) {
84311
84609
  var typeOnlyAlias = getTypeOnlyAliasDeclaration(symbol);
84312
84610
  var isType = !(target.flags & 111551 /* Value */);
84313
84611
  if (isType || typeOnlyAlias) {
@@ -84353,7 +84651,7 @@ var ts;
84353
84651
  }
84354
84652
  }
84355
84653
  function isDeprecatedAliasedSymbol(symbol) {
84356
- return !!symbol.declarations && ts.every(symbol.declarations, function (d) { return !!(ts.getCombinedNodeFlags(d) & 134217728 /* Deprecated */); });
84654
+ return !!symbol.declarations && ts.every(symbol.declarations, function (d) { return !!(ts.getCombinedNodeFlags(d) & 268435456 /* Deprecated */); });
84357
84655
  }
84358
84656
  function checkDeprecatedAliasedSymbol(symbol, location) {
84359
84657
  if (!(symbol.flags & 2097152 /* Alias */))
@@ -84482,7 +84780,7 @@ var ts;
84482
84780
  }
84483
84781
  }
84484
84782
  else {
84485
- if (moduleKind >= ts.ModuleKind.ES2015 && ts.getSourceFileOfNode(node).impliedNodeFormat === undefined && !node.isTypeOnly && !(node.flags & 8388608 /* Ambient */)) {
84783
+ if (moduleKind >= ts.ModuleKind.ES2015 && ts.getSourceFileOfNode(node).impliedNodeFormat === undefined && !node.isTypeOnly && !(node.flags & 16777216 /* Ambient */)) {
84486
84784
  // Import equals declaration is deprecated in es6 or above
84487
84785
  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);
84488
84786
  }
@@ -84508,7 +84806,7 @@ var ts;
84508
84806
  ts.forEach(node.exportClause.elements, checkExportSpecifier);
84509
84807
  var inAmbientExternalModule = node.parent.kind === 262 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent);
84510
84808
  var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 262 /* ModuleBlock */ &&
84511
- !node.moduleSpecifier && node.flags & 8388608 /* Ambient */;
84809
+ !node.moduleSpecifier && node.flags & 16777216 /* Ambient */;
84512
84810
  if (node.parent.kind !== 305 /* SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) {
84513
84811
  error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace);
84514
84812
  }
@@ -84673,10 +84971,10 @@ var ts;
84673
84971
  checkExpressionCached(node.expression);
84674
84972
  }
84675
84973
  checkExternalModuleExports(container);
84676
- if ((node.flags & 8388608 /* Ambient */) && !ts.isEntityNameExpression(node.expression)) {
84974
+ if ((node.flags & 16777216 /* Ambient */) && !ts.isEntityNameExpression(node.expression)) {
84677
84975
  grammarErrorOnNode(node.expression, ts.Diagnostics.The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context);
84678
84976
  }
84679
- if (node.isExportEquals && !(node.flags & 8388608 /* Ambient */)) {
84977
+ if (node.isExportEquals && !(node.flags & 16777216 /* Ambient */)) {
84680
84978
  if (moduleKind >= ts.ModuleKind.ES2015 && ts.getSourceFileOfNode(node).impliedNodeFormat !== ts.ModuleKind.CommonJS) {
84681
84979
  // export assignment is not supported in es6 modules
84682
84980
  grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead);
@@ -85109,7 +85407,7 @@ var ts;
85109
85407
  // This relies on the results of other lazy diagnostics, so must be computed after them
85110
85408
  if (!node.isDeclarationFile && (compilerOptions.noUnusedLocals || compilerOptions.noUnusedParameters)) {
85111
85409
  checkUnusedIdentifiers(getPotentiallyUnusedIdentifiers(node), function (containingNode, kind, diag) {
85112
- if (!ts.containsParseError(containingNode) && unusedIsError(kind, !!(containingNode.flags & 8388608 /* Ambient */))) {
85410
+ if (!ts.containsParseError(containingNode) && unusedIsError(kind, !!(containingNode.flags & 16777216 /* Ambient */))) {
85113
85411
  diagnostics.add(diag);
85114
85412
  }
85115
85413
  });
@@ -85209,7 +85507,7 @@ var ts;
85209
85507
  }
85210
85508
  // Language service support
85211
85509
  function getSymbolsInScope(location, meaning) {
85212
- if (location.flags & 16777216 /* InWithStatement */) {
85510
+ if (location.flags & 33554432 /* InWithStatement */) {
85213
85511
  // We cannot answer semantic questions within a with block, do not proceed any further
85214
85512
  return [];
85215
85513
  }
@@ -85559,7 +85857,7 @@ var ts;
85559
85857
  }
85560
85858
  var parent = node.parent;
85561
85859
  var grandParent = parent.parent;
85562
- if (node.flags & 16777216 /* InWithStatement */) {
85860
+ if (node.flags & 33554432 /* InWithStatement */) {
85563
85861
  // We cannot answer semantic questions within a with block, do not proceed any further
85564
85862
  return undefined;
85565
85863
  }
@@ -85701,7 +85999,7 @@ var ts;
85701
85999
  if (ts.isSourceFile(node) && !ts.isExternalModule(node)) {
85702
86000
  return errorType;
85703
86001
  }
85704
- if (node.flags & 16777216 /* InWithStatement */) {
86002
+ if (node.flags & 33554432 /* InWithStatement */) {
85705
86003
  // We cannot answer semantic questions within a with block, do not proceed any further
85706
86004
  return errorType;
85707
86005
  }
@@ -86754,7 +87052,7 @@ var ts;
86754
87052
  function checkExternalEmitHelpers(location, helpers) {
86755
87053
  if ((requestedExternalEmitHelpers & helpers) !== helpers && compilerOptions.importHelpers) {
86756
87054
  var sourceFile = ts.getSourceFileOfNode(location);
86757
- if (ts.isEffectiveExternalModule(sourceFile, compilerOptions) && !(location.flags & 8388608 /* Ambient */)) {
87055
+ if (ts.isEffectiveExternalModule(sourceFile, compilerOptions) && !(location.flags & 16777216 /* Ambient */)) {
86758
87056
  var helpersModule = resolveHelpersModule(sourceFile, location);
86759
87057
  if (helpersModule !== unknownSymbol) {
86760
87058
  var uncheckedHelpers = helpers & ~requestedExternalEmitHelpers;
@@ -87007,7 +87305,7 @@ var ts;
87007
87305
  else if (node.kind === 164 /* Parameter */) {
87008
87306
  return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare");
87009
87307
  }
87010
- else if ((node.parent.flags & 8388608 /* Ambient */) && node.parent.kind === 262 /* ModuleBlock */) {
87308
+ else if ((node.parent.flags & 16777216 /* Ambient */) && node.parent.kind === 262 /* ModuleBlock */) {
87011
87309
  return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context);
87012
87310
  }
87013
87311
  else if (ts.isPrivateIdentifierClassElementDeclaration(node)) {
@@ -87053,7 +87351,7 @@ var ts;
87053
87351
  if (flags & 256 /* Async */) {
87054
87352
  return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async");
87055
87353
  }
87056
- else if (flags & 2 /* Ambient */ || node.parent.flags & 8388608 /* Ambient */) {
87354
+ else if (flags & 2 /* Ambient */ || node.parent.flags & 16777216 /* Ambient */) {
87057
87355
  return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async");
87058
87356
  }
87059
87357
  else if (node.kind === 164 /* Parameter */) {
@@ -87199,7 +87497,7 @@ var ts;
87199
87497
  if (i !== (parameterCount - 1)) {
87200
87498
  return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list);
87201
87499
  }
87202
- if (!(parameter.flags & 8388608 /* Ambient */)) { // Allow `...foo,` in ambient declarations; see GH#23070
87500
+ if (!(parameter.flags & 16777216 /* Ambient */)) { // Allow `...foo,` in ambient declarations; see GH#23070
87203
87501
  checkGrammarForDisallowedTrailingComma(parameters, ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma);
87204
87502
  }
87205
87503
  if (parameter.questionToken) {
@@ -87410,7 +87708,7 @@ var ts;
87410
87708
  ts.Debug.assert(node.kind === 256 /* FunctionDeclaration */ ||
87411
87709
  node.kind === 213 /* FunctionExpression */ ||
87412
87710
  node.kind === 169 /* MethodDeclaration */);
87413
- if (node.flags & 8388608 /* Ambient */) {
87711
+ if (node.flags & 16777216 /* Ambient */) {
87414
87712
  return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context);
87415
87713
  }
87416
87714
  if (!node.body) {
@@ -87648,7 +87946,7 @@ var ts;
87648
87946
  return false;
87649
87947
  }
87650
87948
  function checkGrammarAccessor(accessor) {
87651
- if (!(accessor.flags & 8388608 /* Ambient */) && (accessor.parent.kind !== 182 /* TypeLiteral */) && (accessor.parent.kind !== 258 /* InterfaceDeclaration */)) {
87949
+ if (!(accessor.flags & 16777216 /* Ambient */) && (accessor.parent.kind !== 182 /* TypeLiteral */) && (accessor.parent.kind !== 258 /* InterfaceDeclaration */)) {
87652
87950
  if (languageVersion < 1 /* ES5 */) {
87653
87951
  return grammarErrorOnNode(accessor.name, ts.Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher);
87654
87952
  }
@@ -87788,7 +88086,7 @@ var ts;
87788
88086
  // However, property declarations disallow computed names in general,
87789
88087
  // and accessors are not allowed in ambient contexts in general,
87790
88088
  // so this error only really matters for methods.
87791
- if (node.flags & 8388608 /* Ambient */) {
88089
+ if (node.flags & 16777216 /* Ambient */) {
87792
88090
  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);
87793
88091
  }
87794
88092
  else if (node.kind === 169 /* MethodDeclaration */ && !node.body) {
@@ -87904,7 +88202,7 @@ var ts;
87904
88202
  }
87905
88203
  function checkGrammarVariableDeclaration(node) {
87906
88204
  if (node.parent.parent.kind !== 243 /* ForInStatement */ && node.parent.parent.kind !== 244 /* ForOfStatement */) {
87907
- if (node.flags & 8388608 /* Ambient */) {
88205
+ if (node.flags & 16777216 /* Ambient */) {
87908
88206
  checkAmbientInitializer(node);
87909
88207
  }
87910
88208
  else if (!node.initializer) {
@@ -87916,7 +88214,7 @@ var ts;
87916
88214
  }
87917
88215
  }
87918
88216
  }
87919
- if (node.exclamationToken && (node.parent.parent.kind !== 237 /* VariableStatement */ || !node.type || node.initializer || node.flags & 8388608 /* Ambient */)) {
88217
+ if (node.exclamationToken && (node.parent.parent.kind !== 237 /* VariableStatement */ || !node.type || node.initializer || node.flags & 16777216 /* Ambient */)) {
87920
88218
  var message = node.initializer
87921
88219
  ? ts.Diagnostics.Declarations_with_initializers_cannot_also_have_definite_assignment_assertions
87922
88220
  : !node.type
@@ -87925,7 +88223,7 @@ var ts;
87925
88223
  return grammarErrorOnNode(node.exclamationToken, message);
87926
88224
  }
87927
88225
  if ((moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS) && moduleKind !== ts.ModuleKind.System &&
87928
- !(node.parent.parent.flags & 8388608 /* Ambient */) && ts.hasSyntacticModifier(node.parent.parent, 1 /* Export */)) {
88226
+ !(node.parent.parent.flags & 16777216 /* Ambient */) && ts.hasSyntacticModifier(node.parent.parent, 1 /* Export */)) {
87929
88227
  checkESModuleMarker(node.name);
87930
88228
  }
87931
88229
  var checkLetConstNames = (ts.isLet(node) || ts.isVarConst(node));
@@ -88102,11 +88400,11 @@ var ts;
88102
88400
  return grammarErrorOnNode(node.initializer, ts.Diagnostics.A_type_literal_property_cannot_have_an_initializer);
88103
88401
  }
88104
88402
  }
88105
- if (node.flags & 8388608 /* Ambient */) {
88403
+ if (node.flags & 16777216 /* Ambient */) {
88106
88404
  checkAmbientInitializer(node);
88107
88405
  }
88108
88406
  if (ts.isPropertyDeclaration(node) && node.exclamationToken && (!ts.isClassLike(node.parent) || !node.type || node.initializer ||
88109
- node.flags & 8388608 /* Ambient */ || ts.isStatic(node) || ts.hasAbstractModifier(node))) {
88407
+ node.flags & 16777216 /* Ambient */ || ts.isStatic(node) || ts.hasAbstractModifier(node))) {
88110
88408
  var message = node.initializer
88111
88409
  ? ts.Diagnostics.Declarations_with_initializers_cannot_also_have_definite_assignment_assertions
88112
88410
  : !node.type
@@ -88152,10 +88450,10 @@ var ts;
88152
88450
  return false;
88153
88451
  }
88154
88452
  function checkGrammarSourceFile(node) {
88155
- return !!(node.flags & 8388608 /* Ambient */) && checkGrammarTopLevelElementsForRequiredDeclareModifier(node);
88453
+ return !!(node.flags & 16777216 /* Ambient */) && checkGrammarTopLevelElementsForRequiredDeclareModifier(node);
88156
88454
  }
88157
88455
  function checkGrammarStatementInAmbientContext(node) {
88158
- if (node.flags & 8388608 /* Ambient */) {
88456
+ if (node.flags & 16777216 /* Ambient */) {
88159
88457
  // Find containing block which is either Block, ModuleBlock, SourceFile
88160
88458
  var links = getNodeLinks(node);
88161
88459
  if (!links.hasReportedStatementInAmbientContext && (ts.isFunctionLike(node.parent) || ts.isAccessor(node.parent))) {
@@ -92273,7 +92571,7 @@ var ts;
92273
92571
  return !ts.nodeIsMissing(node.body);
92274
92572
  }
92275
92573
  function visitPropertyDeclaration(node) {
92276
- if (node.flags & 8388608 /* Ambient */ || ts.hasSyntacticModifier(node, 128 /* Abstract */)) {
92574
+ if (node.flags & 16777216 /* Ambient */ || ts.hasSyntacticModifier(node, 128 /* Abstract */)) {
92277
92575
  return undefined;
92278
92576
  }
92279
92577
  var updated = factory.updatePropertyDeclaration(node,
@@ -99163,8 +99461,8 @@ var ts;
99163
99461
  // declarations may not be sorted by position.
99164
99462
  // pos should be the minimum* position over all nodes (that's not -1), end should be the maximum end over all nodes.
99165
99463
  var pos = -1, end = -1;
99166
- for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) {
99167
- var node = declarations_9[_i];
99464
+ for (var _i = 0, declarations_10 = declarations; _i < declarations_10.length; _i++) {
99465
+ var node = declarations_10[_i];
99168
99466
  pos = pos === -1 ? node.pos : node.pos === -1 ? pos : Math.min(pos, node.pos);
99169
99467
  end = Math.max(end, node.end);
99170
99468
  }
@@ -108207,7 +108505,7 @@ var ts;
108207
108505
  needsScopeFixMarker = false;
108208
108506
  var statements = ts.visitNodes(inner.statements, visitDeclarationStatements);
108209
108507
  var lateStatements = transformAndReplaceLatePaintedStatements(statements);
108210
- if (input.flags & 8388608 /* Ambient */) {
108508
+ if (input.flags & 16777216 /* Ambient */) {
108211
108509
  needsScopeFixMarker = false; // If it was `declare`'d everything is implicitly exported already, ignore late printed "privates"
108212
108510
  }
108213
108511
  // With the final list of statements, there are 3 possibilities:
@@ -109855,6 +110153,9 @@ var ts;
109855
110153
  var currentParenthesizerRule;
109856
110154
  var _c = ts.performance.createTimerIf(extendedDiagnostics, "commentTime", "beforeComment", "afterComment"), enterComment = _c.enter, exitComment = _c.exit;
109857
110155
  var parenthesizer = ts.factory.parenthesizer;
110156
+ var typeArgumentParenthesizerRuleSelector = {
110157
+ select: function (index) { return index === 0 ? parenthesizer.parenthesizeLeadingTypeArgument : undefined; }
110158
+ };
109858
110159
  var emitBinaryExpression = createEmitBinaryExpression();
109859
110160
  reset();
109860
110161
  return {
@@ -111067,7 +111368,7 @@ var ts;
111067
111368
  writePunctuation("}");
111068
111369
  }
111069
111370
  function emitArrayType(node) {
111070
- emit(node.elementType, parenthesizer.parenthesizeElementTypeOfArrayType);
111371
+ emit(node.elementType, parenthesizer.parenthesizeNonArrayTypeOfPostfixType);
111071
111372
  writePunctuation("[");
111072
111373
  writePunctuation("]");
111073
111374
  }
@@ -111078,7 +111379,7 @@ var ts;
111078
111379
  function emitTupleType(node) {
111079
111380
  emitTokenWithComment(22 /* OpenBracketToken */, node.pos, writePunctuation, node);
111080
111381
  var flags = ts.getEmitFlags(node) & 1 /* SingleLine */ ? 528 /* SingleLineTupleTypeElements */ : 657 /* MultiLineTupleTypeElements */;
111081
- emitList(node, node.elements, flags | 524288 /* NoSpaceIfEmpty */);
111382
+ emitList(node, node.elements, flags | 524288 /* NoSpaceIfEmpty */, parenthesizer.parenthesizeElementTypeOfTupleType);
111082
111383
  emitTokenWithComment(23 /* CloseBracketToken */, node.elements.end, writePunctuation, node);
111083
111384
  }
111084
111385
  function emitNamedTupleMember(node) {
@@ -111090,21 +111391,21 @@ var ts;
111090
111391
  emit(node.type);
111091
111392
  }
111092
111393
  function emitOptionalType(node) {
111093
- emit(node.type, parenthesizer.parenthesizeElementTypeOfArrayType);
111394
+ emit(node.type, parenthesizer.parenthesizeTypeOfOptionalType);
111094
111395
  writePunctuation("?");
111095
111396
  }
111096
111397
  function emitUnionType(node) {
111097
- emitList(node, node.types, 516 /* UnionTypeConstituents */, parenthesizer.parenthesizeMemberOfElementType);
111398
+ emitList(node, node.types, 516 /* UnionTypeConstituents */, parenthesizer.parenthesizeConstituentTypeOfUnionType);
111098
111399
  }
111099
111400
  function emitIntersectionType(node) {
111100
- emitList(node, node.types, 520 /* IntersectionTypeConstituents */, parenthesizer.parenthesizeMemberOfElementType);
111401
+ emitList(node, node.types, 520 /* IntersectionTypeConstituents */, parenthesizer.parenthesizeConstituentTypeOfIntersectionType);
111101
111402
  }
111102
111403
  function emitConditionalType(node) {
111103
- emit(node.checkType, parenthesizer.parenthesizeMemberOfConditionalType);
111404
+ emit(node.checkType, parenthesizer.parenthesizeCheckTypeOfConditionalType);
111104
111405
  writeSpace();
111105
111406
  writeKeyword("extends");
111106
111407
  writeSpace();
111107
- emit(node.extendsType, parenthesizer.parenthesizeMemberOfConditionalType);
111408
+ emit(node.extendsType, parenthesizer.parenthesizeExtendsTypeOfConditionalType);
111108
111409
  writeSpace();
111109
111410
  writePunctuation("?");
111110
111411
  writeSpace();
@@ -111130,10 +111431,13 @@ var ts;
111130
111431
  function emitTypeOperator(node) {
111131
111432
  writeTokenText(node.operator, writeKeyword);
111132
111433
  writeSpace();
111133
- emit(node.type, parenthesizer.parenthesizeMemberOfElementType);
111434
+ var parenthesizerRule = node.operator === 145 /* ReadonlyKeyword */ ?
111435
+ parenthesizer.parenthesizeOperandOfReadonlyTypeOperator :
111436
+ parenthesizer.parenthesizeOperandOfTypeOperator;
111437
+ emit(node.type, parenthesizerRule);
111134
111438
  }
111135
111439
  function emitIndexedAccessType(node) {
111136
- emit(node.objectType, parenthesizer.parenthesizeMemberOfElementType);
111440
+ emit(node.objectType, parenthesizer.parenthesizeNonArrayTypeOfPostfixType);
111137
111441
  writePunctuation("[");
111138
111442
  emit(node.indexType);
111139
111443
  writePunctuation("]");
@@ -112867,7 +113171,7 @@ var ts;
112867
113171
  emitList(parentNode, decorators, 2146305 /* Decorators */);
112868
113172
  }
112869
113173
  function emitTypeArguments(parentNode, typeArguments) {
112870
- emitList(parentNode, typeArguments, 53776 /* TypeArguments */, parenthesizer.parenthesizeMemberOfElementType);
113174
+ emitList(parentNode, typeArguments, 53776 /* TypeArguments */, typeArgumentParenthesizerRuleSelector);
112871
113175
  }
112872
113176
  function emitTypeParameters(parentNode, typeParameters) {
112873
113177
  if (ts.isFunctionLike(parentNode) && parentNode.typeArguments) { // Quick info uses type arguments in place of type parameters on instantiated signatures
@@ -112986,6 +113290,7 @@ var ts;
112986
113290
  if (format & 128 /* Indented */) {
112987
113291
  increaseIndent();
112988
113292
  }
113293
+ var emitListItem = getEmitListItem(emit, parenthesizerRule);
112989
113294
  // Emit each child.
112990
113295
  var previousSibling = void 0;
112991
113296
  var previousSourceFileTextKind = void 0;
@@ -113036,12 +113341,7 @@ var ts;
113036
113341
  shouldEmitInterveningComments = mayEmitInterveningComments;
113037
113342
  }
113038
113343
  nextListElementPos = child.pos;
113039
- if (emit.length === 1) {
113040
- emit(child);
113041
- }
113042
- else {
113043
- emit(child, parenthesizerRule);
113044
- }
113344
+ emitListItem(child, emit, parenthesizerRule, i);
113045
113345
  if (shouldDecreaseIndentAfterEmit) {
113046
113346
  decreaseIndent();
113047
113347
  shouldDecreaseIndentAfterEmit = false;
@@ -114282,6 +114582,20 @@ var ts;
114282
114582
  TempFlags[TempFlags["CountMask"] = 268435455] = "CountMask";
114283
114583
  TempFlags[TempFlags["_i"] = 268435456] = "_i";
114284
114584
  })(TempFlags || (TempFlags = {}));
114585
+ function emitListItemNoParenthesizer(node, emit, _parenthesizerRule, _index) {
114586
+ emit(node);
114587
+ }
114588
+ function emitListItemWithParenthesizerRuleSelector(node, emit, parenthesizerRuleSelector, index) {
114589
+ emit(node, parenthesizerRuleSelector.select(index));
114590
+ }
114591
+ function emitListItemWithParenthesizerRule(node, emit, parenthesizerRule, _index) {
114592
+ emit(node, parenthesizerRule);
114593
+ }
114594
+ function getEmitListItem(emit, parenthesizerRule) {
114595
+ return emit.length === 1 ? emitListItemNoParenthesizer :
114596
+ typeof parenthesizerRule === "object" ? emitListItemWithParenthesizerRuleSelector :
114597
+ emitListItemWithParenthesizerRule;
114598
+ }
114285
114599
  })(ts || (ts = {}));
114286
114600
  /* @internal */
114287
114601
  var ts;
@@ -116348,7 +116662,7 @@ var ts;
116348
116662
  // moduleAugmentations has changed
116349
116663
  structureIsReused = 1 /* SafeModules */;
116350
116664
  }
116351
- if ((oldSourceFile.flags & 3145728 /* PermanentlySetIncrementalFlags */) !== (newSourceFile.flags & 3145728 /* PermanentlySetIncrementalFlags */)) {
116665
+ if ((oldSourceFile.flags & 6291456 /* PermanentlySetIncrementalFlags */) !== (newSourceFile.flags & 6291456 /* PermanentlySetIncrementalFlags */)) {
116352
116666
  // dynamicImport has changed
116353
116667
  structureIsReused = 1 /* SafeModules */;
116354
116668
  }
@@ -116512,6 +116826,9 @@ var ts;
116512
116826
  return !!sourceFilesFoundSearchingNodeModules.get(file.path);
116513
116827
  }
116514
116828
  function isSourceFileDefaultLibrary(file) {
116829
+ if (!file.isDeclarationFile) {
116830
+ return false;
116831
+ }
116515
116832
  if (file.hasNoDefaultLib) {
116516
116833
  return true;
116517
116834
  }
@@ -117023,7 +117340,7 @@ var ts;
117023
117340
  var node = _a[_i];
117024
117341
  collectModuleReferences(node, /*inAmbientModule*/ false);
117025
117342
  }
117026
- if ((file.flags & 1048576 /* PossiblyContainsDynamicImport */) || isJavaScriptFile) {
117343
+ if ((file.flags & 2097152 /* PossiblyContainsDynamicImport */) || isJavaScriptFile) {
117027
117344
  collectDynamicImportOrRequireCalls(file);
117028
117345
  }
117029
117346
  file.imports = imports || ts.emptyArray;
@@ -117621,7 +117938,7 @@ var ts;
117621
117938
  && index < file.imports.length
117622
117939
  && !elideImport
117623
117940
  && !(isJsFile && !ts.getAllowJSCompilerOption(optionsForFile))
117624
- && (ts.isInJSFile(file.imports[index]) || !(file.imports[index].flags & 4194304 /* JSDoc */));
117941
+ && (ts.isInJSFile(file.imports[index]) || !(file.imports[index].flags & 8388608 /* JSDoc */));
117625
117942
  if (elideImport) {
117626
117943
  modulesWithElidedImports.set(file.path, true);
117627
117944
  }