typescript 4.7.0-dev.20220405 → 4.7.0-dev.20220415

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsc.js CHANGED
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
69
69
  var ts;
70
70
  (function (ts) {
71
71
  ts.versionMajorMinor = "4.7";
72
- ts.version = ts.versionMajorMinor + ".0-dev.20220405";
72
+ ts.version = ts.versionMajorMinor + ".0-dev.20220415";
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  var globals = typeof globalThis !== "undefined" ? globalThis :
@@ -5901,6 +5901,7 @@ var ts;
5901
5901
  _0_index_signatures_are_incompatible: diag(2634, ts.DiagnosticCategory.Error, "_0_index_signatures_are_incompatible_2634", "'{0}' index signatures are incompatible."),
5902
5902
  Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable: diag(2635, ts.DiagnosticCategory.Error, "Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable_2635", "Type '{0}' has no signatures for which the type argument list is applicable."),
5903
5903
  Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation: diag(2636, ts.DiagnosticCategory.Error, "Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation_2636", "Type '{0}' is not assignable to type '{1}' as implied by variance annotation."),
5904
+ Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types: diag(2637, ts.DiagnosticCategory.Error, "Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_t_2637", "Variance annotations are only supported in type aliases for object, function, constructor, and mapped types."),
5904
5905
  Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: diag(2649, ts.DiagnosticCategory.Error, "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", "Cannot augment module '{0}' with value exports because it resolves to a non-module entity."),
5905
5906
  A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: diag(2651, ts.DiagnosticCategory.Error, "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums."),
5906
5907
  Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: diag(2652, ts.DiagnosticCategory.Error, "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead."),
@@ -6073,6 +6074,7 @@ var ts;
6073
6074
  Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node12_or_nodenext_Did_you_mean_0: diag(2835, ts.DiagnosticCategory.Error, "Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2835", "Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean '{0}'?"),
6074
6075
  Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls: diag(2836, ts.DiagnosticCategory.Error, "Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls_2836", "Import assertions are not allowed on statements that transpile to commonjs 'require' calls."),
6075
6076
  Import_assertion_values_must_be_string_literal_expressions: diag(2837, ts.DiagnosticCategory.Error, "Import_assertion_values_must_be_string_literal_expressions_2837", "Import assertion values must be string literal expressions."),
6077
+ All_declarations_of_0_must_have_identical_constraints: diag(2838, ts.DiagnosticCategory.Error, "All_declarations_of_0_must_have_identical_constraints_2838", "All declarations of '{0}' must have identical constraints."),
6076
6078
  Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
6077
6079
  Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
6078
6080
  Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
@@ -10882,17 +10884,17 @@ var ts;
10882
10884
  ts.hasChangesInResolutions = hasChangesInResolutions;
10883
10885
  function containsParseError(node) {
10884
10886
  aggregateChildData(node);
10885
- return (node.flags & 262144) !== 0;
10887
+ return (node.flags & 524288) !== 0;
10886
10888
  }
10887
10889
  ts.containsParseError = containsParseError;
10888
10890
  function aggregateChildData(node) {
10889
- if (!(node.flags & 524288)) {
10890
- var thisNodeOrAnySubNodesHasError = ((node.flags & 65536) !== 0) ||
10891
+ if (!(node.flags & 1048576)) {
10892
+ var thisNodeOrAnySubNodesHasError = ((node.flags & 131072) !== 0) ||
10891
10893
  ts.forEachChild(node, containsParseError);
10892
10894
  if (thisNodeOrAnySubNodesHasError) {
10893
- node.flags |= 262144;
10895
+ node.flags |= 524288;
10894
10896
  }
10895
- node.flags |= 524288;
10897
+ node.flags |= 1048576;
10896
10898
  }
10897
10899
  }
10898
10900
  function getSourceFileOfNode(node) {
@@ -11442,6 +11444,10 @@ var ts;
11442
11444
  }
11443
11445
  }
11444
11446
  ts.isAnyImportSyntax = isAnyImportSyntax;
11447
+ function isAnyImportOrBareOrAccessedRequire(node) {
11448
+ return isAnyImportSyntax(node) || isVariableDeclarationInitializedToBareOrAccessedRequire(node);
11449
+ }
11450
+ ts.isAnyImportOrBareOrAccessedRequire = isAnyImportOrBareOrAccessedRequire;
11445
11451
  function isLateVisibilityPaintedStatement(node) {
11446
11452
  switch (node.kind) {
11447
11453
  case 266:
@@ -12516,11 +12522,11 @@ var ts;
12516
12522
  }
12517
12523
  ts.isSourceFileNotJS = isSourceFileNotJS;
12518
12524
  function isInJSFile(node) {
12519
- return !!node && !!(node.flags & 131072);
12525
+ return !!node && !!(node.flags & 262144);
12520
12526
  }
12521
12527
  ts.isInJSFile = isInJSFile;
12522
12528
  function isInJsonFile(node) {
12523
- return !!node && !!(node.flags & 33554432);
12529
+ return !!node && !!(node.flags & 67108864);
12524
12530
  }
12525
12531
  ts.isInJsonFile = isInJsonFile;
12526
12532
  function isSourceFileNotJson(file) {
@@ -12528,7 +12534,7 @@ var ts;
12528
12534
  }
12529
12535
  ts.isSourceFileNotJson = isSourceFileNotJson;
12530
12536
  function isInJSDoc(node) {
12531
- return !!node && !!(node.flags & 4194304);
12537
+ return !!node && !!(node.flags & 8388608);
12532
12538
  }
12533
12539
  ts.isInJSDoc = isInJSDoc;
12534
12540
  function isJSDocIndexSignature(node) {
@@ -12672,17 +12678,13 @@ var ts;
12672
12678
  if (isPropertyNameLiteral(name) && isPropertyNameLiteral(initializer)) {
12673
12679
  return getTextOfIdentifierOrLiteral(name) === getTextOfIdentifierOrLiteral(initializer);
12674
12680
  }
12675
- if (ts.isIdentifier(name) && isLiteralLikeAccess(initializer) &&
12681
+ if (ts.isMemberName(name) && isLiteralLikeAccess(initializer) &&
12676
12682
  (initializer.expression.kind === 108 ||
12677
12683
  ts.isIdentifier(initializer.expression) &&
12678
12684
  (initializer.expression.escapedText === "window" ||
12679
12685
  initializer.expression.escapedText === "self" ||
12680
12686
  initializer.expression.escapedText === "global"))) {
12681
- var nameOrArgument = getNameOrArgument(initializer);
12682
- if (ts.isPrivateIdentifier(nameOrArgument)) {
12683
- ts.Debug.fail("Unexpected PrivateIdentifier in name expression with literal-like access.");
12684
- }
12685
- return isSameEntityName(name, nameOrArgument);
12687
+ return isSameEntityName(name, getNameOrArgument(initializer));
12686
12688
  }
12687
12689
  if (isLiteralLikeAccess(name) && isLiteralLikeAccess(initializer)) {
12688
12690
  return getElementOrPropertyAccessName(name) === getElementOrPropertyAccessName(initializer)
@@ -12856,7 +12858,7 @@ var ts;
12856
12858
  function setValueDeclaration(symbol, node) {
12857
12859
  var valueDeclaration = symbol.valueDeclaration;
12858
12860
  if (!valueDeclaration ||
12859
- !(node.flags & 8388608 && !(valueDeclaration.flags & 8388608)) &&
12861
+ !(node.flags & 16777216 && !(valueDeclaration.flags & 16777216)) &&
12860
12862
  (isAssignmentDeclaration(valueDeclaration) && !isAssignmentDeclaration(node)) ||
12861
12863
  (valueDeclaration.kind !== node.kind && isEffectiveModuleDeclaration(valueDeclaration))) {
12862
12864
  symbol.valueDeclaration = node;
@@ -12872,14 +12874,14 @@ var ts;
12872
12874
  }
12873
12875
  ts.isFunctionSymbol = isFunctionSymbol;
12874
12876
  function tryGetModuleSpecifierFromDeclaration(node) {
12875
- var _a, _b, _c;
12877
+ var _a, _b;
12876
12878
  switch (node.kind) {
12877
12879
  case 254:
12878
- return node.initializer.arguments[0].text;
12880
+ return (_a = ts.findAncestor(node.initializer, function (node) { return isRequireCall(node, true); })) === null || _a === void 0 ? void 0 : _a.arguments[0];
12879
12881
  case 266:
12880
- return (_a = ts.tryCast(node.moduleSpecifier, ts.isStringLiteralLike)) === null || _a === void 0 ? void 0 : _a.text;
12882
+ return ts.tryCast(node.moduleSpecifier, ts.isStringLiteralLike);
12881
12883
  case 265:
12882
- return (_c = ts.tryCast((_b = ts.tryCast(node.moduleReference, ts.isExternalModuleReference)) === null || _b === void 0 ? void 0 : _b.expression, ts.isStringLiteralLike)) === null || _c === void 0 ? void 0 : _c.text;
12884
+ return ts.tryCast((_b = ts.tryCast(node.moduleReference, ts.isExternalModuleReference)) === null || _b === void 0 ? void 0 : _b.expression, ts.isStringLiteralLike);
12883
12885
  default:
12884
12886
  ts.Debug.assertNever(node);
12885
12887
  }
@@ -13352,24 +13354,31 @@ var ts;
13352
13354
  return parent.propertyName === node;
13353
13355
  case 275:
13354
13356
  case 285:
13357
+ case 279:
13358
+ case 280:
13359
+ case 281:
13355
13360
  return true;
13356
13361
  }
13357
13362
  return false;
13358
13363
  }
13359
13364
  ts.isIdentifierName = isIdentifierName;
13360
13365
  function isAliasSymbolDeclaration(node) {
13361
- return node.kind === 265 ||
13366
+ if (node.kind === 265 ||
13362
13367
  node.kind === 264 ||
13363
13368
  node.kind === 267 && !!node.name ||
13364
13369
  node.kind === 268 ||
13365
13370
  node.kind === 274 ||
13366
13371
  node.kind === 270 ||
13367
13372
  node.kind === 275 ||
13368
- node.kind === 271 && exportAssignmentIsAlias(node) ||
13369
- ts.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 && exportAssignmentIsAlias(node) ||
13370
- ts.isPropertyAccessExpression(node) && ts.isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 63 && isAliasableExpression(node.parent.right) ||
13371
- node.kind === 297 ||
13372
- node.kind === 296 && isAliasableExpression(node.initializer);
13373
+ node.kind === 271 && exportAssignmentIsAlias(node)) {
13374
+ return true;
13375
+ }
13376
+ return isInJSFile(node) && (ts.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 && exportAssignmentIsAlias(node) ||
13377
+ ts.isPropertyAccessExpression(node)
13378
+ && ts.isBinaryExpression(node.parent)
13379
+ && node.parent.left === node
13380
+ && node.parent.operatorToken.kind === 63
13381
+ && isAliasableExpression(node.parent.right));
13373
13382
  }
13374
13383
  ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration;
13375
13384
  function getAliasDeclarationFromName(node) {
@@ -13380,6 +13389,7 @@ var ts;
13380
13389
  case 275:
13381
13390
  case 271:
13382
13391
  case 265:
13392
+ case 274:
13383
13393
  return node.parent;
13384
13394
  case 161:
13385
13395
  do {
@@ -14879,6 +14889,11 @@ var ts;
14879
14889
  (node.parent.kind === 206 && node.parent.name === node);
14880
14890
  }
14881
14891
  ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess;
14892
+ function isRightSideOfAccessExpression(node) {
14893
+ return ts.isPropertyAccessExpression(node.parent) && node.parent.name === node
14894
+ || ts.isElementAccessExpression(node.parent) && node.parent.argumentExpression === node;
14895
+ }
14896
+ ts.isRightSideOfAccessExpression = isRightSideOfAccessExpression;
14882
14897
  function isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName(node) {
14883
14898
  return ts.isQualifiedName(node.parent) && node.parent.right === node
14884
14899
  || ts.isPropertyAccessExpression(node.parent) && node.parent.name === node
@@ -15439,6 +15454,38 @@ var ts;
15439
15454
  return expr;
15440
15455
  }
15441
15456
  ts.getLeftmostAccessExpression = getLeftmostAccessExpression;
15457
+ function forEachNameInAccessChainWalkingLeft(name, action) {
15458
+ if (isAccessExpression(name.parent) && isRightSideOfAccessExpression(name)) {
15459
+ return walkAccessExpression(name.parent);
15460
+ }
15461
+ function walkAccessExpression(access) {
15462
+ if (access.kind === 206) {
15463
+ var res = action(access.name);
15464
+ if (res !== undefined) {
15465
+ return res;
15466
+ }
15467
+ }
15468
+ else if (access.kind === 207) {
15469
+ if (ts.isIdentifier(access.argumentExpression) || ts.isStringLiteralLike(access.argumentExpression)) {
15470
+ var res = action(access.argumentExpression);
15471
+ if (res !== undefined) {
15472
+ return res;
15473
+ }
15474
+ }
15475
+ else {
15476
+ return undefined;
15477
+ }
15478
+ }
15479
+ if (isAccessExpression(access.expression)) {
15480
+ return walkAccessExpression(access.expression);
15481
+ }
15482
+ if (ts.isIdentifier(access.expression)) {
15483
+ return action(access.expression);
15484
+ }
15485
+ return undefined;
15486
+ }
15487
+ }
15488
+ ts.forEachNameInAccessChainWalkingLeft = forEachNameInAccessChainWalkingLeft;
15442
15489
  function getLeftmostExpression(node, stopAtCallExpressions) {
15443
15490
  while (true) {
15444
15491
  switch (node.kind) {
@@ -16296,6 +16343,7 @@ var ts;
16296
16343
  ts.supportedJSExtensionsFlat = ts.flatten(ts.supportedJSExtensions);
16297
16344
  var allSupportedExtensions = [[".ts", ".tsx", ".d.ts", ".js", ".jsx"], [".cts", ".d.cts", ".cjs"], [".mts", ".d.mts", ".mjs"]];
16298
16345
  var allSupportedExtensionsWithJson = __spreadArray(__spreadArray([], allSupportedExtensions, true), [[".json"]], false);
16346
+ ts.supportedDeclarationExtensions = [".d.ts", ".d.cts", ".d.mts"];
16299
16347
  function getSupportedExtensions(options, extraFileExtensions) {
16300
16348
  var needJsExtensions = options && getAllowJSCompilerOption(options);
16301
16349
  if (!extraFileExtensions || extraFileExtensions.length === 0) {
@@ -16562,7 +16610,7 @@ var ts;
16562
16610
  }
16563
16611
  ts.pseudoBigIntToString = pseudoBigIntToString;
16564
16612
  function isValidTypeOnlyAliasUseSite(useSite) {
16565
- return !!(useSite.flags & 8388608)
16613
+ return !!(useSite.flags & 16777216)
16566
16614
  || isPartOfTypeQuery(useSite)
16567
16615
  || isIdentifierInNonEmittingHeritageClause(useSite)
16568
16616
  || isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(useSite)
@@ -16884,6 +16932,11 @@ var ts;
16884
16932
  return state > 1 ? { topLevelNodeModulesIndex: topLevelNodeModulesIndex, topLevelPackageNameIndex: topLevelPackageNameIndex, packageRootIndex: packageRootIndex, fileNameIndex: fileNameIndex } : undefined;
16885
16933
  }
16886
16934
  ts.getNodeModulePathParts = getNodeModulePathParts;
16935
+ function getParameterTypeNode(parameter) {
16936
+ var _a;
16937
+ return parameter.kind === 340 ? (_a = parameter.typeExpression) === null || _a === void 0 ? void 0 : _a.type : parameter.type;
16938
+ }
16939
+ ts.getParameterTypeNode = getParameterTypeNode;
16887
16940
  })(ts || (ts = {}));
16888
16941
  var ts;
16889
16942
  (function (ts) {
@@ -16940,11 +16993,20 @@ var ts;
16940
16993
  parenthesizeExpressionForDisallowedComma: parenthesizeExpressionForDisallowedComma,
16941
16994
  parenthesizeExpressionOfExpressionStatement: parenthesizeExpressionOfExpressionStatement,
16942
16995
  parenthesizeConciseBodyOfArrowFunction: parenthesizeConciseBodyOfArrowFunction,
16943
- parenthesizeMemberOfConditionalType: parenthesizeMemberOfConditionalType,
16944
- parenthesizeMemberOfElementType: parenthesizeMemberOfElementType,
16945
- parenthesizeElementTypeOfArrayType: parenthesizeElementTypeOfArrayType,
16946
- parenthesizeConstituentTypesOfUnionOrIntersectionType: parenthesizeConstituentTypesOfUnionOrIntersectionType,
16996
+ parenthesizeCheckTypeOfConditionalType: parenthesizeCheckTypeOfConditionalType,
16997
+ parenthesizeExtendsTypeOfConditionalType: parenthesizeExtendsTypeOfConditionalType,
16998
+ parenthesizeConstituentTypesOfUnionType: parenthesizeConstituentTypesOfUnionType,
16999
+ parenthesizeConstituentTypeOfUnionType: parenthesizeConstituentTypeOfUnionType,
17000
+ parenthesizeConstituentTypesOfIntersectionType: parenthesizeConstituentTypesOfIntersectionType,
17001
+ parenthesizeConstituentTypeOfIntersectionType: parenthesizeConstituentTypeOfIntersectionType,
17002
+ parenthesizeOperandOfTypeOperator: parenthesizeOperandOfTypeOperator,
17003
+ parenthesizeOperandOfReadonlyTypeOperator: parenthesizeOperandOfReadonlyTypeOperator,
17004
+ parenthesizeNonArrayTypeOfPostfixType: parenthesizeNonArrayTypeOfPostfixType,
17005
+ parenthesizeElementTypesOfTupleType: parenthesizeElementTypesOfTupleType,
17006
+ parenthesizeElementTypeOfTupleType: parenthesizeElementTypeOfTupleType,
17007
+ parenthesizeTypeOfOptionalType: parenthesizeTypeOfOptionalType,
16947
17008
  parenthesizeTypeArguments: parenthesizeTypeArguments,
17009
+ parenthesizeLeadingTypeArgument: parenthesizeLeadingTypeArgument,
16948
17010
  };
16949
17011
  function getParenthesizeLeftSideOfBinaryForOperator(operatorKind) {
16950
17012
  binaryLeftOperandParenthesizerCache || (binaryLeftOperandParenthesizerCache = new ts.Map());
@@ -17132,33 +17194,102 @@ var ts;
17132
17194
  }
17133
17195
  return body;
17134
17196
  }
17135
- function parenthesizeMemberOfConditionalType(member) {
17136
- return member.kind === 189 ? factory.createParenthesizedType(member) : member;
17197
+ function parenthesizeCheckTypeOfConditionalType(checkType) {
17198
+ switch (checkType.kind) {
17199
+ case 179:
17200
+ case 180:
17201
+ case 189:
17202
+ return factory.createParenthesizedType(checkType);
17203
+ }
17204
+ return checkType;
17137
17205
  }
17138
- function parenthesizeMemberOfElementType(member) {
17139
- switch (member.kind) {
17206
+ function parenthesizeExtendsTypeOfConditionalType(extendsType) {
17207
+ switch (extendsType.kind) {
17208
+ case 189:
17209
+ return factory.createParenthesizedType(extendsType);
17210
+ }
17211
+ return extendsType;
17212
+ }
17213
+ function parenthesizeConstituentTypeOfUnionType(type) {
17214
+ switch (type.kind) {
17140
17215
  case 187:
17141
17216
  case 188:
17142
- case 179:
17143
- case 180:
17144
- return factory.createParenthesizedType(member);
17217
+ return factory.createParenthesizedType(type);
17145
17218
  }
17146
- return parenthesizeMemberOfConditionalType(member);
17219
+ return parenthesizeCheckTypeOfConditionalType(type);
17147
17220
  }
17148
- function parenthesizeElementTypeOfArrayType(member) {
17149
- switch (member.kind) {
17150
- case 181:
17221
+ function parenthesizeConstituentTypesOfUnionType(members) {
17222
+ return factory.createNodeArray(ts.sameMap(members, parenthesizeConstituentTypeOfUnionType));
17223
+ }
17224
+ function parenthesizeConstituentTypeOfIntersectionType(type) {
17225
+ switch (type.kind) {
17226
+ case 187:
17227
+ case 188:
17228
+ return factory.createParenthesizedType(type);
17229
+ }
17230
+ return parenthesizeConstituentTypeOfUnionType(type);
17231
+ }
17232
+ function parenthesizeConstituentTypesOfIntersectionType(members) {
17233
+ return factory.createNodeArray(ts.sameMap(members, parenthesizeConstituentTypeOfIntersectionType));
17234
+ }
17235
+ function parenthesizeOperandOfTypeOperator(type) {
17236
+ switch (type.kind) {
17237
+ case 188:
17238
+ return factory.createParenthesizedType(type);
17239
+ }
17240
+ return parenthesizeConstituentTypeOfIntersectionType(type);
17241
+ }
17242
+ function parenthesizeOperandOfReadonlyTypeOperator(type) {
17243
+ switch (type.kind) {
17151
17244
  case 193:
17245
+ return factory.createParenthesizedType(type);
17246
+ }
17247
+ return parenthesizeOperandOfTypeOperator(type);
17248
+ }
17249
+ function parenthesizeNonArrayTypeOfPostfixType(type) {
17250
+ switch (type.kind) {
17152
17251
  case 190:
17153
- return factory.createParenthesizedType(member);
17252
+ case 193:
17253
+ case 181:
17254
+ return factory.createParenthesizedType(type);
17154
17255
  }
17155
- return parenthesizeMemberOfElementType(member);
17256
+ return parenthesizeOperandOfTypeOperator(type);
17257
+ }
17258
+ function parenthesizeElementTypesOfTupleType(types) {
17259
+ return factory.createNodeArray(ts.sameMap(types, parenthesizeElementTypeOfTupleType));
17260
+ }
17261
+ function parenthesizeElementTypeOfTupleType(type) {
17262
+ if (hasJSDocPostfixQuestion(type))
17263
+ return factory.createParenthesizedType(type);
17264
+ return type;
17156
17265
  }
17157
- function parenthesizeConstituentTypesOfUnionOrIntersectionType(members) {
17158
- return factory.createNodeArray(ts.sameMap(members, parenthesizeMemberOfElementType));
17266
+ function hasJSDocPostfixQuestion(type) {
17267
+ if (ts.isJSDocNullableType(type))
17268
+ return type.postfix;
17269
+ if (ts.isNamedTupleMember(type))
17270
+ return hasJSDocPostfixQuestion(type.type);
17271
+ if (ts.isFunctionTypeNode(type) || ts.isConstructorTypeNode(type) || ts.isTypeOperatorNode(type))
17272
+ return hasJSDocPostfixQuestion(type.type);
17273
+ if (ts.isConditionalTypeNode(type))
17274
+ return hasJSDocPostfixQuestion(type.falseType);
17275
+ if (ts.isUnionTypeNode(type))
17276
+ return hasJSDocPostfixQuestion(ts.last(type.types));
17277
+ if (ts.isIntersectionTypeNode(type))
17278
+ return hasJSDocPostfixQuestion(ts.last(type.types));
17279
+ if (ts.isInferTypeNode(type))
17280
+ return !!type.typeParameter.constraint && hasJSDocPostfixQuestion(type.typeParameter.constraint);
17281
+ return false;
17282
+ }
17283
+ function parenthesizeTypeOfOptionalType(type) {
17284
+ if (hasJSDocPostfixQuestion(type))
17285
+ return factory.createParenthesizedType(type);
17286
+ return parenthesizeNonArrayTypeOfPostfixType(type);
17287
+ }
17288
+ function parenthesizeLeadingTypeArgument(node) {
17289
+ return ts.isFunctionOrConstructorTypeNode(node) && node.typeParameters ? factory.createParenthesizedType(node) : node;
17159
17290
  }
17160
17291
  function parenthesizeOrdinalTypeArgument(node, i) {
17161
- return i === 0 && ts.isFunctionOrConstructorTypeNode(node) && node.typeParameters ? factory.createParenthesizedType(node) : node;
17292
+ return i === 0 ? parenthesizeLeadingTypeArgument(node) : node;
17162
17293
  }
17163
17294
  function parenthesizeTypeArguments(typeArguments) {
17164
17295
  if (ts.some(typeArguments)) {
@@ -17184,11 +17315,20 @@ var ts;
17184
17315
  parenthesizeExpressionForDisallowedComma: ts.identity,
17185
17316
  parenthesizeExpressionOfExpressionStatement: ts.identity,
17186
17317
  parenthesizeConciseBodyOfArrowFunction: ts.identity,
17187
- parenthesizeMemberOfConditionalType: ts.identity,
17188
- parenthesizeMemberOfElementType: ts.identity,
17189
- parenthesizeElementTypeOfArrayType: ts.identity,
17190
- parenthesizeConstituentTypesOfUnionOrIntersectionType: function (nodes) { return ts.cast(nodes, ts.isNodeArray); },
17318
+ parenthesizeCheckTypeOfConditionalType: ts.identity,
17319
+ parenthesizeExtendsTypeOfConditionalType: ts.identity,
17320
+ parenthesizeConstituentTypesOfUnionType: function (nodes) { return ts.cast(nodes, ts.isNodeArray); },
17321
+ parenthesizeConstituentTypeOfUnionType: ts.identity,
17322
+ parenthesizeConstituentTypesOfIntersectionType: function (nodes) { return ts.cast(nodes, ts.isNodeArray); },
17323
+ parenthesizeConstituentTypeOfIntersectionType: ts.identity,
17324
+ parenthesizeOperandOfTypeOperator: ts.identity,
17325
+ parenthesizeOperandOfReadonlyTypeOperator: ts.identity,
17326
+ parenthesizeNonArrayTypeOfPostfixType: ts.identity,
17327
+ parenthesizeElementTypesOfTupleType: function (nodes) { return ts.cast(nodes, ts.isNodeArray); },
17328
+ parenthesizeElementTypeOfTupleType: ts.identity,
17329
+ parenthesizeTypeOfOptionalType: ts.identity,
17191
17330
  parenthesizeTypeArguments: function (nodes) { return nodes && ts.cast(nodes, ts.isNodeArray); },
17331
+ parenthesizeLeadingTypeArgument: ts.identity,
17192
17332
  };
17193
17333
  })(ts || (ts = {}));
17194
17334
  var ts;
@@ -17306,6 +17446,8 @@ var ts;
17306
17446
  var getJSDocPrimaryTypeCreateFunction = ts.memoizeOne(function (kind) { return function () { return createJSDocPrimaryTypeWorker(kind); }; });
17307
17447
  var getJSDocUnaryTypeCreateFunction = ts.memoizeOne(function (kind) { return function (type) { return createJSDocUnaryTypeWorker(kind, type); }; });
17308
17448
  var getJSDocUnaryTypeUpdateFunction = ts.memoizeOne(function (kind) { return function (node, type) { return updateJSDocUnaryTypeWorker(kind, node, type); }; });
17449
+ var getJSDocPrePostfixUnaryTypeCreateFunction = ts.memoizeOne(function (kind) { return function (type, postfix) { return createJSDocPrePostfixUnaryTypeWorker(kind, type, postfix); }; });
17450
+ var getJSDocPrePostfixUnaryTypeUpdateFunction = ts.memoizeOne(function (kind) { return function (node, type) { return updateJSDocPrePostfixUnaryTypeWorker(kind, node, type); }; });
17309
17451
  var getJSDocSimpleTagCreateFunction = ts.memoizeOne(function (kind) { return function (tagName, comment) { return createJSDocSimpleTagWorker(kind, tagName, comment); }; });
17310
17452
  var getJSDocSimpleTagUpdateFunction = ts.memoizeOne(function (kind) { return function (node, tagName, comment) { return updateJSDocSimpleTagWorker(kind, node, tagName, comment); }; });
17311
17453
  var getJSDocTypeLikeTagCreateFunction = ts.memoizeOne(function (kind) { return function (tagName, typeExpression, comment) { return createJSDocTypeLikeTagWorker(kind, tagName, typeExpression, comment); }; });
@@ -17313,6 +17455,8 @@ var ts;
17313
17455
  var factory = {
17314
17456
  get parenthesizer() { return parenthesizerRules(); },
17315
17457
  get converters() { return converters(); },
17458
+ baseFactory: baseFactory,
17459
+ flags: flags,
17316
17460
  createNodeArray: createNodeArray,
17317
17461
  createNumericLiteral: createNumericLiteral,
17318
17462
  createBigIntLiteral: createBigIntLiteral,
@@ -17587,10 +17731,10 @@ var ts;
17587
17731
  updateExternalModuleReference: updateExternalModuleReference,
17588
17732
  get createJSDocAllType() { return getJSDocPrimaryTypeCreateFunction(312); },
17589
17733
  get createJSDocUnknownType() { return getJSDocPrimaryTypeCreateFunction(313); },
17590
- get createJSDocNonNullableType() { return getJSDocUnaryTypeCreateFunction(315); },
17591
- get updateJSDocNonNullableType() { return getJSDocUnaryTypeUpdateFunction(315); },
17592
- get createJSDocNullableType() { return getJSDocUnaryTypeCreateFunction(314); },
17593
- get updateJSDocNullableType() { return getJSDocUnaryTypeUpdateFunction(314); },
17734
+ get createJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(315); },
17735
+ get updateJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(315); },
17736
+ get createJSDocNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(314); },
17737
+ get updateJSDocNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(314); },
17594
17738
  get createJSDocOptionalType() { return getJSDocUnaryTypeCreateFunction(316); },
17595
17739
  get updateJSDocOptionalType() { return getJSDocUnaryTypeUpdateFunction(316); },
17596
17740
  get createJSDocVariadicType() { return getJSDocUnaryTypeCreateFunction(318); },
@@ -18564,7 +18708,7 @@ var ts;
18564
18708
  }
18565
18709
  function createArrayTypeNode(elementType) {
18566
18710
  var node = createBaseNode(183);
18567
- node.elementType = parenthesizerRules().parenthesizeElementTypeOfArrayType(elementType);
18711
+ node.elementType = parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(elementType);
18568
18712
  node.transformFlags = 1;
18569
18713
  return node;
18570
18714
  }
@@ -18575,7 +18719,7 @@ var ts;
18575
18719
  }
18576
18720
  function createTupleTypeNode(elements) {
18577
18721
  var node = createBaseNode(184);
18578
- node.elements = createNodeArray(elements);
18722
+ node.elements = createNodeArray(parenthesizerRules().parenthesizeElementTypesOfTupleType(elements));
18579
18723
  node.transformFlags = 1;
18580
18724
  return node;
18581
18725
  }
@@ -18603,7 +18747,7 @@ var ts;
18603
18747
  }
18604
18748
  function createOptionalTypeNode(type) {
18605
18749
  var node = createBaseNode(185);
18606
- node.type = parenthesizerRules().parenthesizeElementTypeOfArrayType(type);
18750
+ node.type = parenthesizerRules().parenthesizeTypeOfOptionalType(type);
18607
18751
  node.transformFlags = 1;
18608
18752
  return node;
18609
18753
  }
@@ -18623,33 +18767,33 @@ var ts;
18623
18767
  ? update(createRestTypeNode(type), node)
18624
18768
  : node;
18625
18769
  }
18626
- function createUnionOrIntersectionTypeNode(kind, types) {
18770
+ function createUnionOrIntersectionTypeNode(kind, types, parenthesize) {
18627
18771
  var node = createBaseNode(kind);
18628
- node.types = parenthesizerRules().parenthesizeConstituentTypesOfUnionOrIntersectionType(types);
18772
+ node.types = factory.createNodeArray(parenthesize(types));
18629
18773
  node.transformFlags = 1;
18630
18774
  return node;
18631
18775
  }
18632
- function updateUnionOrIntersectionTypeNode(node, types) {
18776
+ function updateUnionOrIntersectionTypeNode(node, types, parenthesize) {
18633
18777
  return node.types !== types
18634
- ? update(createUnionOrIntersectionTypeNode(node.kind, types), node)
18778
+ ? update(createUnionOrIntersectionTypeNode(node.kind, types, parenthesize), node)
18635
18779
  : node;
18636
18780
  }
18637
18781
  function createUnionTypeNode(types) {
18638
- return createUnionOrIntersectionTypeNode(187, types);
18782
+ return createUnionOrIntersectionTypeNode(187, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType);
18639
18783
  }
18640
18784
  function updateUnionTypeNode(node, types) {
18641
- return updateUnionOrIntersectionTypeNode(node, types);
18785
+ return updateUnionOrIntersectionTypeNode(node, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType);
18642
18786
  }
18643
18787
  function createIntersectionTypeNode(types) {
18644
- return createUnionOrIntersectionTypeNode(188, types);
18788
+ return createUnionOrIntersectionTypeNode(188, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType);
18645
18789
  }
18646
18790
  function updateIntersectionTypeNode(node, types) {
18647
- return updateUnionOrIntersectionTypeNode(node, types);
18791
+ return updateUnionOrIntersectionTypeNode(node, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType);
18648
18792
  }
18649
18793
  function createConditionalTypeNode(checkType, extendsType, trueType, falseType) {
18650
18794
  var node = createBaseNode(189);
18651
- node.checkType = parenthesizerRules().parenthesizeMemberOfConditionalType(checkType);
18652
- node.extendsType = parenthesizerRules().parenthesizeMemberOfConditionalType(extendsType);
18795
+ node.checkType = parenthesizerRules().parenthesizeCheckTypeOfConditionalType(checkType);
18796
+ node.extendsType = parenthesizerRules().parenthesizeExtendsTypeOfConditionalType(extendsType);
18653
18797
  node.trueType = trueType;
18654
18798
  node.falseType = falseType;
18655
18799
  node.transformFlags = 1;
@@ -18735,7 +18879,9 @@ var ts;
18735
18879
  function createTypeOperatorNode(operator, type) {
18736
18880
  var node = createBaseNode(193);
18737
18881
  node.operator = operator;
18738
- node.type = parenthesizerRules().parenthesizeMemberOfElementType(type);
18882
+ node.type = operator === 145 ?
18883
+ parenthesizerRules().parenthesizeOperandOfReadonlyTypeOperator(type) :
18884
+ parenthesizerRules().parenthesizeOperandOfTypeOperator(type);
18739
18885
  node.transformFlags = 1;
18740
18886
  return node;
18741
18887
  }
@@ -18746,7 +18892,7 @@ var ts;
18746
18892
  }
18747
18893
  function createIndexedAccessTypeNode(objectType, indexType) {
18748
18894
  var node = createBaseNode(194);
18749
- node.objectType = parenthesizerRules().parenthesizeMemberOfElementType(objectType);
18895
+ node.objectType = parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(objectType);
18750
18896
  node.indexType = indexType;
18751
18897
  node.transformFlags = 1;
18752
18898
  return node;
@@ -20257,11 +20403,22 @@ var ts;
20257
20403
  function createJSDocPrimaryTypeWorker(kind) {
20258
20404
  return createBaseNode(kind);
20259
20405
  }
20406
+ function createJSDocPrePostfixUnaryTypeWorker(kind, type, postfix) {
20407
+ if (postfix === void 0) { postfix = false; }
20408
+ var node = createJSDocUnaryTypeWorker(kind, postfix ? type && parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(type) : type);
20409
+ node.postfix = postfix;
20410
+ return node;
20411
+ }
20260
20412
  function createJSDocUnaryTypeWorker(kind, type) {
20261
20413
  var node = createBaseNode(kind);
20262
20414
  node.type = type;
20263
20415
  return node;
20264
20416
  }
20417
+ function updateJSDocPrePostfixUnaryTypeWorker(kind, node, type) {
20418
+ return node.type !== type
20419
+ ? update(createJSDocPrePostfixUnaryTypeWorker(kind, type, node.postfix), node)
20420
+ : node;
20421
+ }
20265
20422
  function updateJSDocUnaryTypeWorker(kind, node, type) {
20266
20423
  return node.type !== type
20267
20424
  ? update(createJSDocUnaryTypeWorker(kind, type), node)
@@ -24329,7 +24486,7 @@ var ts;
24329
24486
  || ts.isExportDeclaration(node) ? node : undefined;
24330
24487
  }
24331
24488
  function getImportMetaIfNecessary(sourceFile) {
24332
- return sourceFile.flags & 2097152 ?
24489
+ return sourceFile.flags & 4194304 ?
24333
24490
  walkTreeForImportMeta(sourceFile) :
24334
24491
  undefined;
24335
24492
  }
@@ -24938,7 +25095,7 @@ var ts;
24938
25095
  function updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks) {
24939
25096
  if (aggressiveChecks === void 0) { aggressiveChecks = false; }
24940
25097
  var newSourceFile = IncrementalParser.updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks);
24941
- newSourceFile.flags |= (sourceFile.flags & 3145728);
25098
+ newSourceFile.flags |= (sourceFile.flags & 6291456);
24942
25099
  return newSourceFile;
24943
25100
  }
24944
25101
  ts.updateSourceFile = updateSourceFile;
@@ -25125,10 +25282,10 @@ var ts;
25125
25282
  switch (scriptKind) {
25126
25283
  case 1:
25127
25284
  case 2:
25128
- contextFlags = 131072;
25285
+ contextFlags = 262144;
25129
25286
  break;
25130
25287
  case 6:
25131
- contextFlags = 131072 | 33554432;
25288
+ contextFlags = 262144 | 67108864;
25132
25289
  break;
25133
25290
  default:
25134
25291
  contextFlags = 0;
@@ -25160,7 +25317,7 @@ var ts;
25160
25317
  function parseSourceFileWorker(languageVersion, setParentNodes, scriptKind, setExternalModuleIndicator) {
25161
25318
  var isDeclarationFile = isDeclarationFileName(fileName);
25162
25319
  if (isDeclarationFile) {
25163
- contextFlags |= 8388608;
25320
+ contextFlags |= 16777216;
25164
25321
  }
25165
25322
  sourceFlags = contextFlags;
25166
25323
  nextToken();
@@ -25197,7 +25354,7 @@ var ts;
25197
25354
  node.jsDoc = jsDoc;
25198
25355
  if (hasDeprecatedTag) {
25199
25356
  hasDeprecatedTag = false;
25200
- node.flags |= 134217728;
25357
+ node.flags |= 268435456;
25201
25358
  }
25202
25359
  return node;
25203
25360
  }
@@ -25359,6 +25516,12 @@ var ts;
25359
25516
  function disallowInAnd(func) {
25360
25517
  return doInsideOfContext(4096, func);
25361
25518
  }
25519
+ function allowConditionalTypesAnd(func) {
25520
+ return doOutsideOfContext(65536, func);
25521
+ }
25522
+ function disallowConditionalTypesAnd(func) {
25523
+ return doInsideOfContext(65536, func);
25524
+ }
25362
25525
  function doInYieldContext(func) {
25363
25526
  return doInsideOfContext(8192, func);
25364
25527
  }
@@ -25386,6 +25549,9 @@ var ts;
25386
25549
  function inDisallowInContext() {
25387
25550
  return inContext(4096);
25388
25551
  }
25552
+ function inDisallowConditionalTypesContext() {
25553
+ return inContext(65536);
25554
+ }
25389
25555
  function inDecoratorContext() {
25390
25556
  return inContext(16384);
25391
25557
  }
@@ -25704,7 +25870,7 @@ var ts;
25704
25870
  }
25705
25871
  if (parseErrorBeforeNextFinishedNode) {
25706
25872
  parseErrorBeforeNextFinishedNode = false;
25707
- node.flags |= 65536;
25873
+ node.flags |= 131072;
25708
25874
  }
25709
25875
  return node;
25710
25876
  }
@@ -26082,7 +26248,7 @@ var ts;
26082
26248
  if (ts.nodeIsMissing(node) || node.intersectsChange || ts.containsParseError(node)) {
26083
26249
  return undefined;
26084
26250
  }
26085
- var nodeContextFlags = node.flags & 25358336;
26251
+ var nodeContextFlags = node.flags & 50720768;
26086
26252
  if (nodeContextFlags !== contextFlags) {
26087
26253
  return undefined;
26088
26254
  }
@@ -26495,7 +26661,7 @@ var ts;
26495
26661
  function parseJSDocNonNullableType() {
26496
26662
  var pos = getNodePos();
26497
26663
  nextToken();
26498
- return finishNode(factory.createJSDocNonNullableType(parseNonArrayType()), pos);
26664
+ return finishNode(factory.createJSDocNonNullableType(parseNonArrayType(), false), pos);
26499
26665
  }
26500
26666
  function parseJSDocUnknownOrNullableType() {
26501
26667
  var pos = getNodePos();
@@ -26509,7 +26675,7 @@ var ts;
26509
26675
  return finishNode(factory.createJSDocUnknownType(), pos);
26510
26676
  }
26511
26677
  else {
26512
- return finishNode(factory.createJSDocNullableType(parseType()), pos);
26678
+ return finishNode(factory.createJSDocNullableType(parseType(), false), pos);
26513
26679
  }
26514
26680
  }
26515
26681
  function parseJSDocFunctionType() {
@@ -26642,7 +26808,7 @@ var ts;
26642
26808
  }
26643
26809
  function parseReturnType(returnToken, isType) {
26644
26810
  if (shouldParseReturnType(returnToken, isType)) {
26645
- return parseTypeOrTypePredicate();
26811
+ return allowConditionalTypesAnd(parseTypeOrTypePredicate);
26646
26812
  }
26647
26813
  }
26648
26814
  function shouldParseReturnType(returnToken, isType) {
@@ -26992,7 +27158,7 @@ var ts;
26992
27158
  return finishNode(factory.createImportTypeAssertionContainer(clause, multiLine), pos);
26993
27159
  }
26994
27160
  function parseImportType() {
26995
- sourceFlags |= 1048576;
27161
+ sourceFlags |= 2097152;
26996
27162
  var pos = getNodePos();
26997
27163
  var isTypeOf = parseOptional(112);
26998
27164
  parseExpected(100);
@@ -27135,14 +27301,14 @@ var ts;
27135
27301
  switch (token()) {
27136
27302
  case 53:
27137
27303
  nextToken();
27138
- type = finishNode(factory.createJSDocNonNullableType(type), pos);
27304
+ type = finishNode(factory.createJSDocNonNullableType(type, true), pos);
27139
27305
  break;
27140
27306
  case 57:
27141
27307
  if (lookAhead(nextTokenIsStartOfType)) {
27142
27308
  return type;
27143
27309
  }
27144
27310
  nextToken();
27145
- type = finishNode(factory.createJSDocNullableType(type), pos);
27311
+ type = finishNode(factory.createJSDocNullableType(type, true), pos);
27146
27312
  break;
27147
27313
  case 22:
27148
27314
  parseExpected(22);
@@ -27167,9 +27333,20 @@ var ts;
27167
27333
  parseExpected(operator);
27168
27334
  return finishNode(factory.createTypeOperatorNode(operator, parseTypeOperatorOrHigher()), pos);
27169
27335
  }
27336
+ function tryParseConstraintOfInferType() {
27337
+ if (parseOptional(94)) {
27338
+ var constraint = disallowConditionalTypesAnd(parseType);
27339
+ if (inDisallowConditionalTypesContext() || token() !== 57) {
27340
+ return constraint;
27341
+ }
27342
+ }
27343
+ }
27170
27344
  function parseTypeParameterOfInferType() {
27171
27345
  var pos = getNodePos();
27172
- return finishNode(factory.createTypeParameterDeclaration(undefined, parseIdentifier(), undefined, undefined), pos);
27346
+ var name = parseIdentifier();
27347
+ var constraint = tryParse(tryParseConstraintOfInferType);
27348
+ var node = factory.createTypeParameterDeclaration(undefined, name, constraint);
27349
+ return finishNode(node, pos);
27173
27350
  }
27174
27351
  function parseInferType() {
27175
27352
  var pos = getNodePos();
@@ -27186,7 +27363,7 @@ var ts;
27186
27363
  case 137:
27187
27364
  return parseInferType();
27188
27365
  }
27189
- return parsePostfixTypeOrHigher();
27366
+ return allowConditionalTypesAnd(parsePostfixTypeOrHigher);
27190
27367
  }
27191
27368
  function parseFunctionOrConstructorTypeToError(isInUnionType) {
27192
27369
  if (isStartOfFunctionTypeOrConstructorType()) {
@@ -27302,20 +27479,20 @@ var ts;
27302
27479
  return finishNode(factory.createTypePredicateNode(assertsModifier, parameterName, type), pos);
27303
27480
  }
27304
27481
  function parseType() {
27305
- return doOutsideOfContext(40960, parseTypeWorker);
27306
- }
27307
- function parseTypeWorker(noConditionalTypes) {
27482
+ if (contextFlags & 40960) {
27483
+ return doOutsideOfContext(40960, parseType);
27484
+ }
27308
27485
  if (isStartOfFunctionTypeOrConstructorType()) {
27309
27486
  return parseFunctionOrConstructorType();
27310
27487
  }
27311
27488
  var pos = getNodePos();
27312
27489
  var type = parseUnionTypeOrHigher();
27313
- if (!noConditionalTypes && !scanner.hasPrecedingLineBreak() && parseOptional(94)) {
27314
- var extendsType = parseTypeWorker(true);
27490
+ if (!inDisallowConditionalTypesContext() && !scanner.hasPrecedingLineBreak() && parseOptional(94)) {
27491
+ var extendsType = disallowConditionalTypesAnd(parseType);
27315
27492
  parseExpected(57);
27316
- var trueType = parseTypeWorker();
27493
+ var trueType = allowConditionalTypesAnd(parseType);
27317
27494
  parseExpected(58);
27318
- var falseType = parseTypeWorker();
27495
+ var falseType = allowConditionalTypesAnd(parseType);
27319
27496
  return finishNode(factory.createConditionalTypeNode(type, extendsType, trueType, falseType), pos);
27320
27497
  }
27321
27498
  return type;
@@ -27834,14 +28011,14 @@ var ts;
27834
28011
  var expression;
27835
28012
  if (token() === 100) {
27836
28013
  if (lookAhead(nextTokenIsOpenParenOrLessThan)) {
27837
- sourceFlags |= 1048576;
28014
+ sourceFlags |= 2097152;
27838
28015
  expression = parseTokenNode();
27839
28016
  }
27840
28017
  else if (lookAhead(nextTokenIsDot)) {
27841
28018
  nextToken();
27842
28019
  nextToken();
27843
28020
  expression = finishNode(factory.createMetaProperty(100, parseIdentifierName()), pos);
27844
- sourceFlags |= 2097152;
28021
+ sourceFlags |= 4194304;
27845
28022
  }
27846
28023
  else {
27847
28024
  expression = parseMemberExpressionOrHigher();
@@ -27985,7 +28162,7 @@ var ts;
27985
28162
  return finishNode(factory.createJsxOpeningFragment(), pos);
27986
28163
  }
27987
28164
  var tagName = parseJsxElementName();
27988
- var typeArguments = (contextFlags & 131072) === 0 ? tryParseTypeArguments() : undefined;
28165
+ var typeArguments = (contextFlags & 262144) === 0 ? tryParseTypeArguments() : undefined;
27989
28166
  var attributes = parseJsxAttributes();
27990
28167
  var node;
27991
28168
  if (token() === 31) {
@@ -28243,7 +28420,7 @@ var ts;
28243
28420
  return result;
28244
28421
  }
28245
28422
  function parseTypeArgumentsInExpression() {
28246
- if ((contextFlags & 131072) !== 0) {
28423
+ if ((contextFlags & 262144) !== 0) {
28247
28424
  return undefined;
28248
28425
  }
28249
28426
  if (reScanLessThanToken() !== 29) {
@@ -28261,29 +28438,9 @@ var ts;
28261
28438
  case 20:
28262
28439
  case 14:
28263
28440
  case 15:
28264
- case 27:
28265
- case 24:
28266
- case 28:
28267
- case 21:
28268
- case 23:
28269
- case 58:
28270
- case 26:
28271
- case 57:
28272
- case 34:
28273
- case 36:
28274
- case 35:
28275
- case 37:
28276
- case 55:
28277
- case 56:
28278
- case 60:
28279
- case 52:
28280
- case 50:
28281
- case 51:
28282
- case 19:
28283
- case 1:
28284
28441
  return true;
28285
28442
  }
28286
- return false;
28443
+ return !isStartOfExpression();
28287
28444
  }
28288
28445
  function parsePrimaryExpression() {
28289
28446
  switch (token()) {
@@ -28602,7 +28759,7 @@ var ts;
28602
28759
  var openParenParsed = parseExpected(20);
28603
28760
  var expression = allowInAnd(parseExpression);
28604
28761
  parseExpectedMatchingBrackets(20, 21, openParenParsed, openParenPosition);
28605
- var statement = doInsideOfContext(16777216, parseStatement);
28762
+ var statement = doInsideOfContext(33554432, parseStatement);
28606
28763
  return withJSDoc(finishNode(factory.createWithStatement(expression, statement), pos), hasJSDoc);
28607
28764
  }
28608
28765
  function parseCaseClause() {
@@ -28924,16 +29081,16 @@ var ts;
28924
29081
  if (isAmbient) {
28925
29082
  for (var _i = 0, _a = modifiers; _i < _a.length; _i++) {
28926
29083
  var m = _a[_i];
28927
- m.flags |= 8388608;
29084
+ m.flags |= 16777216;
28928
29085
  }
28929
- return doInsideOfContext(8388608, function () { return parseDeclarationWorker(pos, hasJSDoc, decorators, modifiers); });
29086
+ return doInsideOfContext(16777216, function () { return parseDeclarationWorker(pos, hasJSDoc, decorators, modifiers); });
28930
29087
  }
28931
29088
  else {
28932
29089
  return parseDeclarationWorker(pos, hasJSDoc, decorators, modifiers);
28933
29090
  }
28934
29091
  }
28935
29092
  function tryReuseAmbientDeclaration() {
28936
- return doInsideOfContext(8388608, function () {
29093
+ return doInsideOfContext(16777216, function () {
28937
29094
  var node = currentNode(parsingContext);
28938
29095
  if (node) {
28939
29096
  return consumeNode(node);
@@ -29349,9 +29506,9 @@ var ts;
29349
29506
  if (isAmbient) {
29350
29507
  for (var _i = 0, _a = modifiers; _i < _a.length; _i++) {
29351
29508
  var m = _a[_i];
29352
- m.flags |= 8388608;
29509
+ m.flags |= 16777216;
29353
29510
  }
29354
- return doInsideOfContext(8388608, function () { return parsePropertyOrMethodDeclaration(pos, hasJSDoc, decorators, modifiers); });
29511
+ return doInsideOfContext(16777216, function () { return parsePropertyOrMethodDeclaration(pos, hasJSDoc, decorators, modifiers); });
29355
29512
  }
29356
29513
  else {
29357
29514
  return parsePropertyOrMethodDeclaration(pos, hasJSDoc, decorators, modifiers);
@@ -29809,7 +29966,7 @@ var ts;
29809
29966
  function parseJSDocTypeExpression(mayOmitBraces) {
29810
29967
  var pos = getNodePos();
29811
29968
  var hasBrace = (mayOmitBraces ? parseOptional : parseExpected)(18);
29812
- var type = doInsideOfContext(4194304, parseJSDocType);
29969
+ var type = doInsideOfContext(8388608, parseJSDocType);
29813
29970
  if (!mayOmitBraces || hasBrace) {
29814
29971
  parseExpectedJSDoc(19);
29815
29972
  }
@@ -29838,7 +29995,7 @@ var ts;
29838
29995
  JSDocParser.parseJSDocNameReference = parseJSDocNameReference;
29839
29996
  function parseIsolatedJSDocComment(content, start, length) {
29840
29997
  initializeState("", content, 99, undefined, 1);
29841
- var jsDoc = doInsideOfContext(4194304, function () { return parseJSDocCommentWorker(start, length); });
29998
+ var jsDoc = doInsideOfContext(8388608, function () { return parseJSDocCommentWorker(start, length); });
29842
29999
  var sourceFile = { languageVariant: 0, text: content };
29843
30000
  var diagnostics = ts.attachFileToDiagnostics(parseDiagnostics, sourceFile);
29844
30001
  clearState();
@@ -29849,9 +30006,9 @@ var ts;
29849
30006
  var saveToken = currentToken;
29850
30007
  var saveParseDiagnosticsLength = parseDiagnostics.length;
29851
30008
  var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode;
29852
- var comment = doInsideOfContext(4194304, function () { return parseJSDocCommentWorker(start, length); });
30009
+ var comment = doInsideOfContext(8388608, function () { return parseJSDocCommentWorker(start, length); });
29853
30010
  ts.setParent(comment, parent);
29854
- if (contextFlags & 131072) {
30011
+ if (contextFlags & 262144) {
29855
30012
  if (!jsDocDiagnostics) {
29856
30013
  jsDocDiagnostics = [];
29857
30014
  }
@@ -30620,7 +30777,7 @@ var ts;
30620
30777
  if (isBracketed) {
30621
30778
  skipWhitespace();
30622
30779
  parseExpected(63);
30623
- defaultType = doInsideOfContext(4194304, parseJSDocType);
30780
+ defaultType = doInsideOfContext(8388608, parseJSDocType);
30624
30781
  parseExpected(23);
30625
30782
  }
30626
30783
  if (ts.nodeIsMissing(name)) {
@@ -31009,7 +31166,7 @@ var ts;
31009
31166
  IncrementalParser.createSyntaxCursor = createSyntaxCursor;
31010
31167
  })(IncrementalParser || (IncrementalParser = {}));
31011
31168
  function isDeclarationFileName(fileName) {
31012
- return ts.fileExtensionIsOneOf(fileName, [".d.ts", ".d.mts", ".d.cts"]);
31169
+ return ts.fileExtensionIsOneOf(fileName, ts.supportedDeclarationExtensions);
31013
31170
  }
31014
31171
  ts.isDeclarationFileName = isDeclarationFileName;
31015
31172
  function parseResolutionMode(mode, pos, end, reportDiagnostic) {
@@ -34193,6 +34350,7 @@ var ts;
34193
34350
  Extensions[Extensions["Json"] = 2] = "Json";
34194
34351
  Extensions[Extensions["TSConfig"] = 3] = "TSConfig";
34195
34352
  Extensions[Extensions["DtsOnly"] = 4] = "DtsOnly";
34353
+ Extensions[Extensions["TsOnly"] = 5] = "TsOnly";
34196
34354
  })(Extensions || (Extensions = {}));
34197
34355
  function resolvedTypeScriptOnly(resolved) {
34198
34356
  if (!resolved) {
@@ -34989,13 +35147,31 @@ var ts;
34989
35147
  return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, initialDir, { moduleResolution: ts.ModuleResolutionKind.NodeJs, allowJs: true }, host, undefined, jsOnlyExtensions, undefined);
34990
35148
  }
34991
35149
  function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, lookupConfig) {
34992
- return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, ts.getDirectoryPath(containingFile), compilerOptions, host, cache, lookupConfig ? tsconfigExtensions : (compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions), redirectedReference);
35150
+ var extensions;
35151
+ if (lookupConfig) {
35152
+ extensions = tsconfigExtensions;
35153
+ }
35154
+ else if (compilerOptions.noDtsResolution) {
35155
+ extensions = [Extensions.TsOnly];
35156
+ if (compilerOptions.allowJs)
35157
+ extensions.push(Extensions.JavaScript);
35158
+ if (compilerOptions.resolveJsonModule)
35159
+ extensions.push(Extensions.Json);
35160
+ }
35161
+ else {
35162
+ extensions = compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions;
35163
+ }
35164
+ return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, ts.getDirectoryPath(containingFile), compilerOptions, host, cache, extensions, redirectedReference);
34993
35165
  }
34994
35166
  ts.nodeModuleNameResolver = nodeModuleNameResolver;
34995
35167
  function nodeModuleNameResolverWorker(features, moduleName, containingDirectory, compilerOptions, host, cache, extensions, redirectedReference) {
34996
35168
  var _a, _b;
34997
35169
  var traceEnabled = isTraceEnabled(compilerOptions, host);
34998
35170
  var failedLookupLocations = [];
35171
+ var conditions = features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"];
35172
+ if (compilerOptions.noDtsResolution) {
35173
+ conditions.pop();
35174
+ }
34999
35175
  var state = {
35000
35176
  compilerOptions: compilerOptions,
35001
35177
  host: host,
@@ -35003,7 +35179,7 @@ var ts;
35003
35179
  failedLookupLocations: failedLookupLocations,
35004
35180
  packageJsonInfoCache: cache,
35005
35181
  features: features,
35006
- conditions: features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"]
35182
+ conditions: conditions,
35007
35183
  };
35008
35184
  var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); });
35009
35185
  return createResolvedModuleWithFailedLookupLocations((_a = result === null || result === void 0 ? void 0 : result.value) === null || _a === void 0 ? void 0 : _a.resolved, (_b = result === null || result === void 0 ? void 0 : result.value) === null || _b === void 0 ? void 0 : _b.isExternalLibraryImport, failedLookupLocations, state.resultFromCache);
@@ -35148,9 +35324,9 @@ var ts;
35148
35324
  }
35149
35325
  }
35150
35326
  function loadJSOrExactTSFileName(extensions, candidate, onlyRecordFailures, state) {
35151
- if ((extensions === Extensions.TypeScript || extensions === Extensions.DtsOnly) && ts.fileExtensionIsOneOf(candidate, [".d.ts", ".d.cts", ".d.mts"])) {
35327
+ if ((extensions === Extensions.TypeScript || extensions === Extensions.DtsOnly) && ts.isDeclarationFileName(candidate)) {
35152
35328
  var result = tryFile(candidate, onlyRecordFailures, state);
35153
- return result !== undefined ? { path: candidate, ext: ts.forEach([".d.ts", ".d.cts", ".d.mts"], function (e) { return ts.fileExtensionIs(candidate, e) ? e : undefined; }) } : undefined;
35329
+ return result !== undefined ? { path: candidate, ext: ts.forEach(ts.supportedDeclarationExtensions, function (e) { return ts.fileExtensionIs(candidate, e) ? e : undefined; }) } : undefined;
35154
35330
  }
35155
35331
  return loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state);
35156
35332
  }
@@ -35178,20 +35354,22 @@ var ts;
35178
35354
  default: return tryExtension(".d.ts");
35179
35355
  }
35180
35356
  case Extensions.TypeScript:
35357
+ case Extensions.TsOnly:
35358
+ var useDts = extensions === Extensions.TypeScript;
35181
35359
  switch (originalExtension) {
35182
35360
  case ".mjs":
35183
35361
  case ".mts":
35184
35362
  case ".d.mts":
35185
- return tryExtension(".mts") || tryExtension(".d.mts");
35363
+ return tryExtension(".mts") || (useDts ? tryExtension(".d.mts") : undefined);
35186
35364
  case ".cjs":
35187
35365
  case ".cts":
35188
35366
  case ".d.cts":
35189
- return tryExtension(".cts") || tryExtension(".d.cts");
35367
+ return tryExtension(".cts") || (useDts ? tryExtension(".d.cts") : undefined);
35190
35368
  case ".json":
35191
35369
  candidate += ".json";
35192
- return tryExtension(".d.ts");
35370
+ return useDts ? tryExtension(".d.ts") : undefined;
35193
35371
  default:
35194
- return tryExtension(".ts") || tryExtension(".tsx") || tryExtension(".d.ts");
35372
+ return tryExtension(".ts") || tryExtension(".tsx") || (useDts ? tryExtension(".d.ts") : undefined);
35195
35373
  }
35196
35374
  case Extensions.JavaScript:
35197
35375
  switch (originalExtension) {
@@ -35405,6 +35583,7 @@ var ts;
35405
35583
  switch (extensions) {
35406
35584
  case Extensions.JavaScript:
35407
35585
  case Extensions.Json:
35586
+ case Extensions.TsOnly:
35408
35587
  packageFile = readPackageJsonMainField(jsonContent, candidate, state);
35409
35588
  break;
35410
35589
  case Extensions.TypeScript:
@@ -35467,14 +35646,16 @@ var ts;
35467
35646
  function extensionIsOk(extensions, extension) {
35468
35647
  switch (extensions) {
35469
35648
  case Extensions.JavaScript:
35470
- return extension === ".js" || extension === ".jsx";
35649
+ return extension === ".js" || extension === ".jsx" || extension === ".mjs" || extension === ".cjs";
35471
35650
  case Extensions.TSConfig:
35472
35651
  case Extensions.Json:
35473
35652
  return extension === ".json";
35474
35653
  case Extensions.TypeScript:
35475
- return extension === ".ts" || extension === ".tsx" || extension === ".d.ts";
35654
+ return extension === ".ts" || extension === ".tsx" || extension === ".mts" || extension === ".cts" || extension === ".d.ts" || extension === ".d.mts" || extension === ".d.cts";
35655
+ case Extensions.TsOnly:
35656
+ return extension === ".ts" || extension === ".tsx" || extension === ".mts" || extension === ".cts";
35476
35657
  case Extensions.DtsOnly:
35477
- return extension === ".d.ts";
35658
+ return extension === ".d.ts" || extension === ".d.mts" || extension === ".d.cts";
35478
35659
  }
35479
35660
  }
35480
35661
  function parsePackageName(moduleName) {
@@ -37367,6 +37548,7 @@ var ts;
37367
37548
  case 261:
37368
37549
  case 259:
37369
37550
  case 195:
37551
+ case 176:
37370
37552
  return 1 | 32;
37371
37553
  case 305:
37372
37554
  return 1 | 4 | 32;
@@ -37384,7 +37566,6 @@ var ts;
37384
37566
  case 317:
37385
37567
  case 179:
37386
37568
  case 175:
37387
- case 176:
37388
37569
  case 180:
37389
37570
  case 170:
37390
37571
  return 1 | 4 | 32 | 8;
@@ -37467,7 +37648,7 @@ var ts;
37467
37648
  return !!body && body.statements.some(function (s) { return ts.isExportDeclaration(s) || ts.isExportAssignment(s); });
37468
37649
  }
37469
37650
  function setExportContextFlag(node) {
37470
- if (node.flags & 8388608 && !hasExportDeclarations(node)) {
37651
+ if (node.flags & 16777216 && !hasExportDeclarations(node)) {
37471
37652
  node.flags |= 64;
37472
37653
  }
37473
37654
  else {
@@ -37642,8 +37823,8 @@ var ts;
37642
37823
  }
37643
37824
  function checkContextualIdentifier(node) {
37644
37825
  if (!file.parseDiagnostics.length &&
37826
+ !(node.flags & 16777216) &&
37645
37827
  !(node.flags & 8388608) &&
37646
- !(node.flags & 4194304) &&
37647
37828
  !ts.isIdentifierName(node)) {
37648
37829
  if (inStrictMode &&
37649
37830
  node.originalKeywordKind >= 117 &&
@@ -38518,7 +38699,7 @@ var ts;
38518
38699
  if (node.kind === 340 && container.kind !== 323) {
38519
38700
  return;
38520
38701
  }
38521
- if (inStrictMode && !(node.flags & 8388608)) {
38702
+ if (inStrictMode && !(node.flags & 16777216)) {
38522
38703
  checkStrictModeEvalOrArguments(node, node.name);
38523
38704
  }
38524
38705
  if (ts.isBindingPattern(node.name)) {
@@ -38533,7 +38714,7 @@ var ts;
38533
38714
  }
38534
38715
  }
38535
38716
  function bindFunctionDeclaration(node) {
38536
- if (!file.isDeclarationFile && !(node.flags & 8388608)) {
38717
+ if (!file.isDeclarationFile && !(node.flags & 16777216)) {
38537
38718
  if (ts.isAsyncFunction(node)) {
38538
38719
  emitFlags |= 2048;
38539
38720
  }
@@ -38548,7 +38729,7 @@ var ts;
38548
38729
  }
38549
38730
  }
38550
38731
  function bindFunctionExpression(node) {
38551
- if (!file.isDeclarationFile && !(node.flags & 8388608)) {
38732
+ if (!file.isDeclarationFile && !(node.flags & 16777216)) {
38552
38733
  if (ts.isAsyncFunction(node)) {
38553
38734
  emitFlags |= 2048;
38554
38735
  }
@@ -38561,7 +38742,7 @@ var ts;
38561
38742
  return bindAnonymousDeclaration(node, 16, bindingName);
38562
38743
  }
38563
38744
  function bindPropertyOrMethodOrAccessor(node, symbolFlags, symbolExcludes) {
38564
- if (!file.isDeclarationFile && !(node.flags & 8388608) && ts.isAsyncFunction(node)) {
38745
+ if (!file.isDeclarationFile && !(node.flags & 16777216) && ts.isAsyncFunction(node)) {
38565
38746
  emitFlags |= 2048;
38566
38747
  }
38567
38748
  if (currentFlow && ts.isObjectLiteralOrClassExpressionMethodOrAccessor(node)) {
@@ -38620,7 +38801,7 @@ var ts;
38620
38801
  currentFlow = reportedUnreachableFlow;
38621
38802
  if (!options.allowUnreachableCode) {
38622
38803
  var isError_1 = ts.unreachableCodeIsError(options) &&
38623
- !(node.flags & 8388608) &&
38804
+ !(node.flags & 16777216) &&
38624
38805
  (!ts.isVariableStatement(node) ||
38625
38806
  !!(ts.getCombinedNodeFlags(node.declarationList) & 3) ||
38626
38807
  node.declarationList.declarations.some(function (d) { return !!d.initializer; }));
@@ -39268,7 +39449,7 @@ var ts;
39268
39449
  ts.Debug.assert(!!(getNodeLinks(file).flags & 1));
39269
39450
  diagnostics = ts.addRange(diagnostics, suggestionDiagnostics.getDiagnostics(file.fileName));
39270
39451
  checkUnusedIdentifiers(getPotentiallyUnusedIdentifiers(file), function (containingNode, kind, diag) {
39271
- if (!ts.containsParseError(containingNode) && !unusedIsError(kind, !!(containingNode.flags & 8388608))) {
39452
+ if (!ts.containsParseError(containingNode) && !unusedIsError(kind, !!(containingNode.flags & 16777216))) {
39272
39453
  (diagnostics || (diagnostics = [])).push(__assign(__assign({}, diag), { category: ts.DiagnosticCategory.Suggestion }));
39273
39454
  }
39274
39455
  });
@@ -39699,7 +39880,7 @@ var ts;
39699
39880
  return diagnostic;
39700
39881
  }
39701
39882
  function isDeprecatedSymbol(symbol) {
39702
- return !!(getDeclarationNodeFlagsFromSymbol(symbol) & 134217728);
39883
+ return !!(getDeclarationNodeFlagsFromSymbol(symbol) & 268435456);
39703
39884
  }
39704
39885
  function addDeprecatedSuggestion(location, declarations, deprecatedEntity) {
39705
39886
  var diagnostic = ts.createDiagnosticForNode(location, ts.Diagnostics._0_is_deprecated, deprecatedEntity);
@@ -39910,7 +40091,7 @@ var ts;
39910
40091
  mergeSymbolTable(globals, moduleAugmentation.symbol.exports);
39911
40092
  }
39912
40093
  else {
39913
- var moduleNotFoundError = !(moduleName.parent.parent.flags & 8388608)
40094
+ var moduleNotFoundError = !(moduleName.parent.parent.flags & 16777216)
39914
40095
  ? ts.Diagnostics.Invalid_module_name_in_augmentation_module_0_cannot_be_found
39915
40096
  : undefined;
39916
40097
  var mainModule_1 = resolveExternalModuleNameWorker(moduleName, moduleName, moduleNotFoundError, true);
@@ -40006,7 +40187,7 @@ var ts;
40006
40187
  if ((moduleKind && (declarationFile.externalModuleIndicator || useFile.externalModuleIndicator)) ||
40007
40188
  (!ts.outFile(compilerOptions)) ||
40008
40189
  isInTypeQuery(usage) ||
40009
- declaration.flags & 8388608) {
40190
+ declaration.flags & 16777216) {
40010
40191
  return true;
40011
40192
  }
40012
40193
  if (isUsedInFunctionOrInstanceProperty(usage, declaration)) {
@@ -40046,7 +40227,7 @@ var ts;
40046
40227
  if (usage.kind === 271 && usage.isExportEquals) {
40047
40228
  return true;
40048
40229
  }
40049
- if (!!(usage.flags & 4194304) || isInTypeQuery(usage) || usageInTypeDeclaration()) {
40230
+ if (!!(usage.flags & 8388608) || isInTypeQuery(usage) || usageInTypeDeclaration()) {
40050
40231
  return true;
40051
40232
  }
40052
40233
  if (isUsedInFunctionOrInstanceProperty(usage, declaration)) {
@@ -40269,7 +40450,7 @@ var ts;
40269
40450
  isInExternalModule = true;
40270
40451
  case 261:
40271
40452
  var moduleExports = ((_a = getSymbolOfNode(location)) === null || _a === void 0 ? void 0 : _a.exports) || emptySymbols;
40272
- if (location.kind === 305 || (ts.isModuleDeclaration(location) && location.flags & 8388608 && !ts.isGlobalScopeAugmentation(location))) {
40453
+ if (location.kind === 305 || (ts.isModuleDeclaration(location) && location.flags & 16777216 && !ts.isGlobalScopeAugmentation(location))) {
40273
40454
  if (result = moduleExports.get("default")) {
40274
40455
  var localSymbol = ts.getLocalSymbolForExportDefault(result);
40275
40456
  if (localSymbol && (result.flags & meaning) && localSymbol.escapedName === name) {
@@ -40511,7 +40692,7 @@ var ts;
40511
40692
  checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation);
40512
40693
  }
40513
40694
  }
40514
- if (result && isInExternalModule && (meaning & 111551) === 111551 && !(originalLocation.flags & 4194304)) {
40695
+ if (result && isInExternalModule && (meaning & 111551) === 111551 && !(originalLocation.flags & 8388608)) {
40515
40696
  var merged = getMergedSymbol(result);
40516
40697
  if (ts.length(merged.declarations) && ts.every(merged.declarations, function (d) { return ts.isNamespaceExportDeclaration(d) || ts.isSourceFile(d) && !!d.symbol.globalExports; })) {
40517
40698
  errorOrSuggestion(!compilerOptions.allowUmdGlobalAccess, errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, ts.unescapeLeadingUnderscores(name));
@@ -40751,7 +40932,7 @@ var ts;
40751
40932
  var declaration = (_a = result.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 260); });
40752
40933
  if (declaration === undefined)
40753
40934
  return ts.Debug.fail("checkResolvedBlockScopedVariable could not find block-scoped declaration");
40754
- if (!(declaration.flags & 8388608) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) {
40935
+ if (!(declaration.flags & 16777216) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) {
40755
40936
  var diagnosticMessage = void 0;
40756
40937
  var declarationName = ts.declarationNameToString(ts.getNameOfDeclaration(declaration));
40757
40938
  if (result.flags & 2) {
@@ -41205,27 +41386,27 @@ var ts;
41205
41386
  function resolveAlias(symbol) {
41206
41387
  ts.Debug.assert((symbol.flags & 2097152) !== 0, "Should only get Alias here.");
41207
41388
  var links = getSymbolLinks(symbol);
41208
- if (!links.target) {
41209
- links.target = resolvingSymbol;
41389
+ if (!links.aliasTarget) {
41390
+ links.aliasTarget = resolvingSymbol;
41210
41391
  var node = getDeclarationOfAliasSymbol(symbol);
41211
41392
  if (!node)
41212
41393
  return ts.Debug.fail();
41213
41394
  var target = getTargetOfAliasDeclaration(node);
41214
- if (links.target === resolvingSymbol) {
41215
- links.target = target || unknownSymbol;
41395
+ if (links.aliasTarget === resolvingSymbol) {
41396
+ links.aliasTarget = target || unknownSymbol;
41216
41397
  }
41217
41398
  else {
41218
41399
  error(node, ts.Diagnostics.Circular_definition_of_import_alias_0, symbolToString(symbol));
41219
41400
  }
41220
41401
  }
41221
- else if (links.target === resolvingSymbol) {
41222
- links.target = unknownSymbol;
41402
+ else if (links.aliasTarget === resolvingSymbol) {
41403
+ links.aliasTarget = unknownSymbol;
41223
41404
  }
41224
- return links.target;
41405
+ return links.aliasTarget;
41225
41406
  }
41226
41407
  function tryResolveAlias(symbol) {
41227
41408
  var links = getSymbolLinks(symbol);
41228
- if (links.target !== resolvingSymbol) {
41409
+ if (links.aliasTarget !== resolvingSymbol) {
41229
41410
  return resolveAlias(symbol);
41230
41411
  }
41231
41412
  return undefined;
@@ -41416,7 +41597,7 @@ var ts;
41416
41597
  }
41417
41598
  }
41418
41599
  function getAssignmentDeclarationLocation(node) {
41419
- var typeAlias = ts.findAncestor(node, function (node) { return !(ts.isJSDocNode(node) || node.flags & 4194304) ? "quit" : ts.isJSDocTypeAlias(node); });
41600
+ var typeAlias = ts.findAncestor(node, function (node) { return !(ts.isJSDocNode(node) || node.flags & 8388608) ? "quit" : ts.isJSDocTypeAlias(node); });
41420
41601
  if (typeAlias) {
41421
41602
  return;
41422
41603
  }
@@ -42731,7 +42912,16 @@ var ts;
42731
42912
  if (type.flags & 262144 || objectFlags & 3) {
42732
42913
  if (type.flags & 262144 && ts.contains(context.inferTypeParameters, type)) {
42733
42914
  context.approximateLength += (ts.symbolName(type.symbol).length + 6);
42734
- return ts.factory.createInferTypeNode(typeParameterToDeclarationWithConstraint(type, context, undefined));
42915
+ var constraintNode = void 0;
42916
+ var constraint = getConstraintOfTypeParameter(type);
42917
+ if (constraint) {
42918
+ var inferredConstraint = getInferredTypeParameterConstraint(type, true);
42919
+ if (!(inferredConstraint && isTypeIdenticalTo(constraint, inferredConstraint))) {
42920
+ context.approximateLength += 9;
42921
+ constraintNode = constraint && typeToTypeNodeHelper(constraint, context);
42922
+ }
42923
+ }
42924
+ return ts.factory.createInferTypeNode(typeParameterToDeclarationWithConstraint(type, context, constraintNode));
42735
42925
  }
42736
42926
  if (context.flags & 4 &&
42737
42927
  type.flags & 262144 &&
@@ -42803,13 +42993,27 @@ var ts;
42803
42993
  return ts.Debug.fail("Should be unreachable.");
42804
42994
  function conditionalTypeToTypeNode(type) {
42805
42995
  var checkTypeNode = typeToTypeNodeHelper(type.checkType, context);
42996
+ context.approximateLength += 15;
42997
+ if (context.flags & 4 && type.root.isDistributive && !(type.checkType.flags & 262144)) {
42998
+ var newParam = createTypeParameter(createSymbol(262144, "T"));
42999
+ var name = typeParameterToName(newParam, context);
43000
+ var newTypeVariable = ts.factory.createTypeReferenceNode(name);
43001
+ context.approximateLength += 37;
43002
+ var newMapper = prependTypeMapping(type.root.checkType, newParam, type.combinedMapper || type.mapper);
43003
+ var saveInferTypeParameters_1 = context.inferTypeParameters;
43004
+ context.inferTypeParameters = type.root.inferTypeParameters;
43005
+ var extendsTypeNode_1 = typeToTypeNodeHelper(instantiateType(type.root.extendsType, newMapper), context);
43006
+ context.inferTypeParameters = saveInferTypeParameters_1;
43007
+ var trueTypeNode_1 = typeToTypeNodeOrCircularityElision(instantiateType(getTypeFromTypeNode(type.root.node.trueType), newMapper));
43008
+ var falseTypeNode_1 = typeToTypeNodeOrCircularityElision(instantiateType(getTypeFromTypeNode(type.root.node.falseType), newMapper));
43009
+ return ts.factory.createConditionalTypeNode(checkTypeNode, ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(undefined, ts.factory.cloneNode(newTypeVariable.typeName))), ts.factory.createConditionalTypeNode(ts.factory.createTypeReferenceNode(ts.factory.cloneNode(name)), typeToTypeNodeHelper(type.checkType, context), ts.factory.createConditionalTypeNode(newTypeVariable, extendsTypeNode_1, trueTypeNode_1, falseTypeNode_1), ts.factory.createKeywordTypeNode(143)), ts.factory.createKeywordTypeNode(143));
43010
+ }
42806
43011
  var saveInferTypeParameters = context.inferTypeParameters;
42807
43012
  context.inferTypeParameters = type.root.inferTypeParameters;
42808
43013
  var extendsTypeNode = typeToTypeNodeHelper(type.extendsType, context);
42809
43014
  context.inferTypeParameters = saveInferTypeParameters;
42810
43015
  var trueTypeNode = typeToTypeNodeOrCircularityElision(getTrueTypeFromConditionalType(type));
42811
43016
  var falseTypeNode = typeToTypeNodeOrCircularityElision(getFalseTypeFromConditionalType(type));
42812
- context.approximateLength += 15;
42813
43017
  return ts.factory.createConditionalTypeNode(checkTypeNode, extendsTypeNode, trueTypeNode, falseTypeNode);
42814
43018
  }
42815
43019
  function typeToTypeNodeOrCircularityElision(type) {
@@ -43453,9 +43657,6 @@ var ts;
43453
43657
  if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) {
43454
43658
  parameterType = getOptionalType(parameterType);
43455
43659
  }
43456
- if ((context.flags & 1073741824) && parameterDeclaration && !ts.isJSDocParameterTag(parameterDeclaration) && isOptionalUninitializedParameter(parameterDeclaration)) {
43457
- parameterType = getTypeWithFacts(parameterType, 524288);
43458
- }
43459
43660
  var parameterTypeNode = serializeTypeForDeclaration(context, parameterType, parameterSymbol, context.enclosingDeclaration, privateSymbolVisitor, bundledImports);
43460
43661
  var modifiers = !(context.flags & 8192) && preserveModifierFlags && parameterDeclaration && parameterDeclaration.modifiers ? parameterDeclaration.modifiers.map(ts.factory.cloneNode) : undefined;
43461
43662
  var isRest = parameterDeclaration && ts.isRestParameter(parameterDeclaration) || ts.getCheckFlags(parameterSymbol) & 32768;
@@ -43962,7 +44163,7 @@ var ts;
43962
44163
  var declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, enclosingDeclaration);
43963
44164
  if (declWithExistingAnnotation && !ts.isFunctionLikeDeclaration(declWithExistingAnnotation) && !ts.isGetAccessorDeclaration(declWithExistingAnnotation)) {
43964
44165
  var existing = ts.getEffectiveTypeAnnotationNode(declWithExistingAnnotation);
43965
- if (getTypeFromTypeNode(existing) === type && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
44166
+ if (typeNodeIsEquivalentToType(existing, declWithExistingAnnotation, type) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
43966
44167
  var result_6 = serializeExistingTypeNode(context, existing, includePrivateSymbol, bundled);
43967
44168
  if (result_6) {
43968
44169
  return result_6;
@@ -43979,6 +44180,16 @@ var ts;
43979
44180
  context.flags = oldFlags;
43980
44181
  return result;
43981
44182
  }
44183
+ function typeNodeIsEquivalentToType(typeNode, annotatedDeclaration, type) {
44184
+ var typeFromTypeNode = getTypeFromTypeNode(typeNode);
44185
+ if (typeFromTypeNode === type) {
44186
+ return true;
44187
+ }
44188
+ if (ts.isParameter(annotatedDeclaration) && annotatedDeclaration.questionToken) {
44189
+ return getTypeWithFacts(type, 524288) === typeFromTypeNode;
44190
+ }
44191
+ return false;
44192
+ }
43982
44193
  function serializeReturnTypeForSignature(context, type, signature, includePrivateSymbol, bundled) {
43983
44194
  if (!isErrorType(type) && context.enclosingDeclaration) {
43984
44195
  var annotation = signature.declaration && ts.getEffectiveReturnTypeNode(signature.declaration);
@@ -44462,7 +44673,7 @@ var ts;
44462
44673
  newModifierFlags |= 1;
44463
44674
  }
44464
44675
  if (addingDeclare && !(newModifierFlags & 1) &&
44465
- (!enclosingDeclaration_1 || !(enclosingDeclaration_1.flags & 8388608)) &&
44676
+ (!enclosingDeclaration_1 || !(enclosingDeclaration_1.flags & 16777216)) &&
44466
44677
  (ts.isEnumDeclaration(node) || ts.isVariableStatement(node) || ts.isFunctionDeclaration(node) || ts.isClassDeclaration(node) || ts.isModuleDeclaration(node))) {
44467
44678
  newModifierFlags |= 2;
44468
44679
  }
@@ -45228,7 +45439,7 @@ var ts;
45228
45439
  }
45229
45440
  var parent = getDeclarationContainer(node);
45230
45441
  if (!(ts.getCombinedModifierFlags(node) & 1) &&
45231
- !(node.kind !== 265 && parent.kind !== 305 && parent.flags & 8388608)) {
45442
+ !(node.kind !== 265 && parent.kind !== 305 && parent.flags & 16777216)) {
45232
45443
  return isGlobalSourceFile(parent);
45233
45444
  }
45234
45445
  return isDeclarationVisible(parent);
@@ -45517,7 +45728,7 @@ var ts;
45517
45728
  return parentType;
45518
45729
  }
45519
45730
  var pattern = declaration.parent;
45520
- if (strictNullChecks && declaration.flags & 8388608 && ts.isParameterDeclaration(declaration)) {
45731
+ if (strictNullChecks && declaration.flags & 16777216 && ts.isParameterDeclaration(declaration)) {
45521
45732
  parentType = getNonNullableType(parentType);
45522
45733
  }
45523
45734
  else if (strictNullChecks && pattern.parent.initializer && !(getTypeFacts(getTypeOfInitializer(pattern.parent.initializer)) & 65536)) {
@@ -45615,7 +45826,7 @@ var ts;
45615
45826
  }
45616
45827
  if ((noImplicitAny || ts.isInJSFile(declaration)) &&
45617
45828
  ts.isVariableDeclaration(declaration) && !ts.isBindingPattern(declaration.name) &&
45618
- !(ts.getCombinedModifierFlags(declaration) & 1) && !(declaration.flags & 8388608)) {
45829
+ !(ts.getCombinedModifierFlags(declaration) & 1) && !(declaration.flags & 16777216)) {
45619
45830
  if (!(ts.getCombinedNodeFlags(declaration) & 2) && (!declaration.initializer || isNullOrUndefined(declaration.initializer))) {
45620
45831
  return autoType;
45621
45832
  }
@@ -45832,7 +46043,7 @@ var ts;
45832
46043
  }
45833
46044
  }
45834
46045
  var sourceTypes = ts.some(constructorTypes, function (t) { return !!(t.flags & ~98304); }) ? constructorTypes : types;
45835
- type = getUnionType(sourceTypes, 2);
46046
+ type = getUnionType(sourceTypes);
45836
46047
  }
45837
46048
  }
45838
46049
  var widened = getWidenedType(addOptionality(type, false, definedInMethod && !definedInConstructor));
@@ -46904,7 +47115,7 @@ var ts;
46904
47115
  function isLiteralEnumMember(member) {
46905
47116
  var expr = member.initializer;
46906
47117
  if (!expr) {
46907
- return !(member.flags & 8388608);
47118
+ return !(member.flags & 16777216);
46908
47119
  }
46909
47120
  switch (expr.kind) {
46910
47121
  case 10:
@@ -48218,8 +48429,9 @@ var ts;
48218
48429
  return circularConstraintType;
48219
48430
  }
48220
48431
  var result = void 0;
48221
- if (stack.length < 10 || stack.length < 50 && !isDeeplyNestedType(t, stack, stack.length)) {
48222
- stack.push(t);
48432
+ var identity_1 = getRecursionIdentity(t);
48433
+ if (stack.length < 10 || stack.length < 50 && !ts.contains(stack, identity_1)) {
48434
+ stack.push(identity_1);
48223
48435
  result = computeBaseConstraint(getSimplifiedType(t, false));
48224
48436
  stack.pop();
48225
48437
  }
@@ -49187,7 +49399,7 @@ var ts;
49187
49399
  function getConstraintDeclaration(type) {
49188
49400
  return ts.mapDefined(ts.filter(type.symbol && type.symbol.declarations, ts.isTypeParameterDeclaration), ts.getEffectiveConstraintOfTypeParameter)[0];
49189
49401
  }
49190
- function getInferredTypeParameterConstraint(typeParameter) {
49402
+ function getInferredTypeParameterConstraint(typeParameter, omitTypeReferences) {
49191
49403
  var _a;
49192
49404
  var inferences;
49193
49405
  if ((_a = typeParameter.symbol) === null || _a === void 0 ? void 0 : _a.declarations) {
@@ -49195,7 +49407,7 @@ var ts;
49195
49407
  var declaration = _b[_i];
49196
49408
  if (declaration.parent.kind === 190) {
49197
49409
  var _c = ts.walkUpParenthesizedTypesAndGetParentAndChild(declaration.parent.parent), _d = _c[0], childTypeParameter = _d === void 0 ? declaration.parent : _d, grandParent = _c[1];
49198
- if (grandParent.kind === 178) {
49410
+ if (grandParent.kind === 178 && !omitTypeReferences) {
49199
49411
  var typeReference = grandParent;
49200
49412
  var typeParameters = getTypeParametersForTypeReference(typeReference);
49201
49413
  if (typeParameters) {
@@ -49565,7 +49777,7 @@ var ts;
49565
49777
  return constraints ? getSubstitutionType(type, getIntersectionType(ts.append(constraints, type))) : type;
49566
49778
  }
49567
49779
  function isJSDocTypeReference(node) {
49568
- return !!(node.flags & 4194304) && (node.kind === 178 || node.kind === 200);
49780
+ return !!(node.flags & 8388608) && (node.kind === 178 || node.kind === 200);
49569
49781
  }
49570
49782
  function checkNoTypeArguments(node, symbol) {
49571
49783
  if (node.typeArguments) {
@@ -50959,7 +51171,7 @@ var ts;
50959
51171
  if (ts.isCallLikeExpression(parent)) {
50960
51172
  return ts.isCallOrNewExpression(parent) && ts.isIdentifier(node) && hasMatchingArgument(parent, node);
50961
51173
  }
50962
- return ts.every(symbol.declarations, function (d) { return !ts.isFunctionLike(d) || !!(ts.getCombinedNodeFlags(d) & 134217728); });
51174
+ return ts.every(symbol.declarations, function (d) { return !ts.isFunctionLike(d) || !!(ts.getCombinedNodeFlags(d) & 268435456); });
50963
51175
  }
50964
51176
  return true;
50965
51177
  }
@@ -51548,7 +51760,7 @@ var ts;
51548
51760
  links.resolvedSymbol = unknownSymbol;
51549
51761
  return links.resolvedType = errorType;
51550
51762
  }
51551
- var targetMeaning = node.isTypeOf ? 111551 : node.flags & 4194304 ? 111551 | 788968 : 788968;
51763
+ var targetMeaning = node.isTypeOf ? 111551 : node.flags & 8388608 ? 111551 | 788968 : 788968;
51552
51764
  var innerModuleSymbol = resolveExternalModuleName(node, node.argument.literal);
51553
51765
  if (!innerModuleSymbol) {
51554
51766
  links.resolvedSymbol = unknownSymbol;
@@ -51865,7 +52077,7 @@ var ts;
51865
52077
  if (parent && ts.isObjectLiteralExpression(parent) && ts.isBinaryExpression(parent.parent) && ts.getAssignmentDeclarationKind(parent.parent) === 6) {
51866
52078
  return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent.parent.left).parent).thisType;
51867
52079
  }
51868
- var host = node.flags & 4194304 ? ts.getHostSignatureFromJSDoc(node) : undefined;
52080
+ var host = node.flags & 8388608 ? ts.getHostSignatureFromJSDoc(node) : undefined;
51869
52081
  if (host && ts.isFunctionExpression(host) && ts.isBinaryExpression(host.parent) && ts.getAssignmentDeclarationKind(host.parent) === 3) {
51870
52082
  return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(host.parent.left).parent).thisType;
51871
52083
  }
@@ -51938,7 +52150,7 @@ var ts;
51938
52150
  case 143:
51939
52151
  return neverType;
51940
52152
  case 148:
51941
- return node.flags & 131072 && !noImplicitAny ? anyType : nonPrimitiveType;
52153
+ return node.flags & 262144 && !noImplicitAny ? anyType : nonPrimitiveType;
51942
52154
  case 138:
51943
52155
  return intrinsicMarkerType;
51944
52156
  case 192:
@@ -55396,12 +55608,12 @@ var ts;
55396
55608
  function isDeeplyNestedType(type, stack, depth, maxDepth) {
55397
55609
  if (maxDepth === void 0) { maxDepth = 3; }
55398
55610
  if (depth >= maxDepth) {
55399
- var identity_1 = getRecursionIdentity(type);
55611
+ var identity_2 = getRecursionIdentity(type);
55400
55612
  var count = 0;
55401
55613
  var lastTypeId = 0;
55402
55614
  for (var i = 0; i < depth; i++) {
55403
55615
  var t = stack[i];
55404
- if (getRecursionIdentity(t) === identity_1) {
55616
+ if (getRecursionIdentity(t) === identity_2) {
55405
55617
  if (t.id >= lastTypeId) {
55406
55618
  count++;
55407
55619
  if (count >= maxDepth) {
@@ -56162,6 +56374,7 @@ var ts;
56162
56374
  var inference = inferences[i];
56163
56375
  if (t === inference.typeParameter) {
56164
56376
  if (fix && !inference.isFixed) {
56377
+ inferFromIntraExpressionSites(context);
56165
56378
  clearCachedInferences(inferences);
56166
56379
  inference.isFixed = true;
56167
56380
  }
@@ -56178,6 +56391,24 @@ var ts;
56178
56391
  }
56179
56392
  }
56180
56393
  }
56394
+ function addIntraExpressionInferenceSite(context, node, type) {
56395
+ var _a;
56396
+ ((_a = context.intraExpressionInferenceSites) !== null && _a !== void 0 ? _a : (context.intraExpressionInferenceSites = [])).push({ node: node, type: type });
56397
+ }
56398
+ function inferFromIntraExpressionSites(context) {
56399
+ if (context.intraExpressionInferenceSites) {
56400
+ for (var _i = 0, _a = context.intraExpressionInferenceSites; _i < _a.length; _i++) {
56401
+ var _b = _a[_i], node = _b.node, type = _b.type;
56402
+ var contextualType = node.kind === 169 ?
56403
+ getContextualTypeForObjectLiteralMethod(node, 2) :
56404
+ getContextualType(node, 2);
56405
+ if (contextualType) {
56406
+ inferTypes(context.inferences, type, contextualType);
56407
+ }
56408
+ }
56409
+ context.intraExpressionInferenceSites = undefined;
56410
+ }
56411
+ }
56181
56412
  function createInferenceInfo(typeParameter) {
56182
56413
  return {
56183
56414
  typeParameter: typeParameter,
@@ -57928,7 +58159,7 @@ var ts;
57928
58159
  }
57929
58160
  }
57930
58161
  function getTypeOfDottedName(node, diagnostic) {
57931
- if (!(node.flags & 16777216)) {
58162
+ if (!(node.flags & 33554432)) {
57932
58163
  switch (node.kind) {
57933
58164
  case 79:
57934
58165
  var symbol = getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(node));
@@ -59133,6 +59364,7 @@ var ts;
59133
59364
  function isConstraintPosition(type, node) {
59134
59365
  var parent = node.parent;
59135
59366
  return parent.kind === 206 ||
59367
+ parent.kind === 161 ||
59136
59368
  parent.kind === 208 && parent.expression === node ||
59137
59369
  parent.kind === 207 && parent.expression === node &&
59138
59370
  !(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent.argumentExpression)));
@@ -59344,7 +59576,7 @@ var ts;
59344
59576
  isInTypeQuery(node) || node.parent.kind === 275) ||
59345
59577
  node.parent.kind === 230 ||
59346
59578
  declaration.kind === 254 && declaration.exclamationToken ||
59347
- declaration.flags & 8388608;
59579
+ declaration.flags & 16777216;
59348
59580
  var initialType = assumeInitialized ? (isParameter ? removeOptionalityFromDeclaredType(type, declaration) : type) :
59349
59581
  type === autoType || type === autoArrayType ? undefinedType :
59350
59582
  getOptionalType(type);
@@ -60179,7 +60411,7 @@ var ts;
60179
60411
  }
60180
60412
  function getContextualTypeForObjectLiteralMethod(node, contextFlags) {
60181
60413
  ts.Debug.assert(ts.isObjectLiteralMethod(node));
60182
- if (node.flags & 16777216) {
60414
+ if (node.flags & 33554432) {
60183
60415
  return undefined;
60184
60416
  }
60185
60417
  return getContextualTypeForObjectLiteralElement(node, contextFlags);
@@ -60317,7 +60549,7 @@ var ts;
60317
60549
  return type;
60318
60550
  }
60319
60551
  function getContextualType(node, contextFlags) {
60320
- if (node.flags & 16777216) {
60552
+ if (node.flags & 33554432) {
60321
60553
  return undefined;
60322
60554
  }
60323
60555
  if (node.contextualType) {
@@ -60688,6 +60920,11 @@ var ts;
60688
60920
  var type = checkExpressionForMutableLocation(e, checkMode, elementContextualType, forceTuple);
60689
60921
  elementTypes.push(addOptionality(type, true, hasOmittedExpression));
60690
60922
  elementFlags.push(hasOmittedExpression ? 2 : 1);
60923
+ if (contextualType && someType(contextualType, isTupleLikeType) && checkMode && checkMode & 2 && !(checkMode & 4) && isContextSensitive(e)) {
60924
+ var inferenceContext = getInferenceContext(node);
60925
+ ts.Debug.assert(inferenceContext);
60926
+ addIntraExpressionInferenceSite(inferenceContext, e, type);
60927
+ }
60691
60928
  }
60692
60929
  }
60693
60930
  if (inDestructuringPattern) {
@@ -60869,6 +61106,13 @@ var ts;
60869
61106
  prop.target = member;
60870
61107
  member = prop;
60871
61108
  allPropertiesTable === null || allPropertiesTable === void 0 ? void 0 : allPropertiesTable.set(prop.escapedName, prop);
61109
+ if (contextualType && checkMode && checkMode & 2 && !(checkMode & 4) &&
61110
+ (memberDecl.kind === 296 || memberDecl.kind === 169) && isContextSensitive(memberDecl)) {
61111
+ var inferenceContext = getInferenceContext(node);
61112
+ ts.Debug.assert(inferenceContext);
61113
+ var inferenceNode = memberDecl.kind === 296 ? memberDecl.initializer : memberDecl;
61114
+ addIntraExpressionInferenceSite(inferenceContext, inferenceNode, type);
61115
+ }
60872
61116
  }
60873
61117
  else if (memberDecl.kind === 298) {
60874
61118
  if (languageVersion < 2) {
@@ -61786,7 +62030,7 @@ var ts;
61786
62030
  if (compilerOptions.noPropertyAccessFromIndexSignature && ts.isPropertyAccessExpression(node)) {
61787
62031
  error(right, ts.Diagnostics.Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0, ts.unescapeLeadingUnderscores(right.escapedText));
61788
62032
  }
61789
- if (indexInfo.declaration && ts.getCombinedNodeFlags(indexInfo.declaration) & 134217728) {
62033
+ if (indexInfo.declaration && ts.getCombinedNodeFlags(indexInfo.declaration) & 268435456) {
61790
62034
  addDeprecatedSuggestion(right, [indexInfo.declaration], right.escapedText);
61791
62035
  }
61792
62036
  }
@@ -61840,7 +62084,7 @@ var ts;
61840
62084
  if (declaration && isPropertyWithoutInitializer(declaration)) {
61841
62085
  if (!ts.isStatic(declaration)) {
61842
62086
  var flowContainer = getControlFlowContainer(node);
61843
- if (flowContainer.kind === 171 && flowContainer.parent === declaration.parent && !(declaration.flags & 8388608)) {
62087
+ if (flowContainer.kind === 171 && flowContainer.parent === declaration.parent && !(declaration.flags & 16777216)) {
61844
62088
  assumeUninitialized = true;
61845
62089
  }
61846
62090
  }
@@ -61876,7 +62120,7 @@ var ts;
61876
62120
  }
61877
62121
  else if (valueDeclaration.kind === 257 &&
61878
62122
  node.parent.kind !== 178 &&
61879
- !(valueDeclaration.flags & 8388608) &&
62123
+ !(valueDeclaration.flags & 16777216) &&
61880
62124
  !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) {
61881
62125
  diagnosticMessage = error(right, ts.Diagnostics.Class_0_used_before_its_declaration, declarationName);
61882
62126
  }
@@ -62441,19 +62685,21 @@ var ts;
62441
62685
  if (node.kind !== 165) {
62442
62686
  var contextualType = getContextualType(node, ts.every(signature.typeParameters, function (p) { return !!getDefaultFromTypeParameter(p); }) ? 8 : 0);
62443
62687
  if (contextualType) {
62444
- var outerContext = getInferenceContext(node);
62445
- var outerMapper = getMapperFromContext(cloneInferenceContext(outerContext, 1));
62446
- var instantiatedType = instantiateType(contextualType, outerMapper);
62447
- var contextualSignature = getSingleCallSignature(instantiatedType);
62448
- var inferenceSourceType = contextualSignature && contextualSignature.typeParameters ?
62449
- getOrCreateTypeFromSignature(getSignatureInstantiationWithoutFillingInTypeArguments(contextualSignature, contextualSignature.typeParameters)) :
62450
- instantiatedType;
62451
62688
  var inferenceTargetType = getReturnTypeOfSignature(signature);
62452
- inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, 128);
62453
- var returnContext = createInferenceContext(signature.typeParameters, signature, context.flags);
62454
- var returnSourceType = instantiateType(contextualType, outerContext && outerContext.returnMapper);
62455
- inferTypes(returnContext.inferences, returnSourceType, inferenceTargetType);
62456
- context.returnMapper = ts.some(returnContext.inferences, hasInferenceCandidates) ? getMapperFromContext(cloneInferredPartOfContext(returnContext)) : undefined;
62689
+ if (couldContainTypeVariables(inferenceTargetType)) {
62690
+ var outerContext = getInferenceContext(node);
62691
+ var outerMapper = getMapperFromContext(cloneInferenceContext(outerContext, 1));
62692
+ var instantiatedType = instantiateType(contextualType, outerMapper);
62693
+ var contextualSignature = getSingleCallSignature(instantiatedType);
62694
+ var inferenceSourceType = contextualSignature && contextualSignature.typeParameters ?
62695
+ getOrCreateTypeFromSignature(getSignatureInstantiationWithoutFillingInTypeArguments(contextualSignature, contextualSignature.typeParameters)) :
62696
+ instantiatedType;
62697
+ inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, 128);
62698
+ var returnContext = createInferenceContext(signature.typeParameters, signature, context.flags);
62699
+ var returnSourceType = instantiateType(contextualType, outerContext && outerContext.returnMapper);
62700
+ inferTypes(returnContext.inferences, returnSourceType, inferenceTargetType);
62701
+ context.returnMapper = ts.some(returnContext.inferences, hasInferenceCandidates) ? getMapperFromContext(cloneInferredPartOfContext(returnContext)) : undefined;
62702
+ }
62457
62703
  }
62458
62704
  }
62459
62705
  var restType = getNonArrayRestType(signature);
@@ -62465,7 +62711,7 @@ var ts;
62465
62711
  }
62466
62712
  }
62467
62713
  var thisType = getThisTypeOfSignature(signature);
62468
- if (thisType) {
62714
+ if (thisType && couldContainTypeVariables(thisType)) {
62469
62715
  var thisArgumentNode = getThisArgumentOfCall(node);
62470
62716
  inferTypes(context.inferences, getThisArgumentType(thisArgumentNode), thisType);
62471
62717
  }
@@ -62473,11 +62719,13 @@ var ts;
62473
62719
  var arg = args[i];
62474
62720
  if (arg.kind !== 227 && !(checkMode & 32 && hasSkipDirectInferenceFlag(arg))) {
62475
62721
  var paramType = getTypeAtPosition(signature, i);
62476
- var argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
62477
- inferTypes(context.inferences, argType, paramType);
62722
+ if (couldContainTypeVariables(paramType)) {
62723
+ var argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
62724
+ inferTypes(context.inferences, argType, paramType);
62725
+ }
62478
62726
  }
62479
62727
  }
62480
- if (restType) {
62728
+ if (restType && couldContainTypeVariables(restType)) {
62481
62729
  var spreadType = getSpreadArgumentType(args, argCount, args.length, restType, context, checkMode);
62482
62730
  inferTypes(context.inferences, spreadType, restType);
62483
62731
  }
@@ -63813,7 +64061,7 @@ var ts;
63813
64061
  return returnType;
63814
64062
  }
63815
64063
  function checkDeprecatedSignature(signature, node) {
63816
- if (signature.declaration && signature.declaration.flags & 134217728) {
64064
+ if (signature.declaration && signature.declaration.flags & 268435456) {
63817
64065
  var suggestionNode = getDeprecatedSuggestionNode(node);
63818
64066
  var name = ts.tryGetPropertyAccessOrIdentifierToString(ts.getInvokedExpression(node));
63819
64067
  addDeprecatedSuggestionWithSignature(suggestionNode, signature.declaration, name, signatureToString(signature));
@@ -63893,7 +64141,7 @@ var ts;
63893
64141
  var newSymbol = createSymbol(2097152, "default");
63894
64142
  newSymbol.parent = originalSymbol;
63895
64143
  newSymbol.nameType = getStringLiteralType("default");
63896
- newSymbol.target = resolveSymbol(symbol);
64144
+ newSymbol.aliasTarget = resolveSymbol(symbol);
63897
64145
  memberTable.set("default", newSymbol);
63898
64146
  return createAnonymousType(anonymousSymbol, memberTable, ts.emptyArray, ts.emptyArray, ts.emptyArray);
63899
64147
  }
@@ -63950,7 +64198,7 @@ var ts;
63950
64198
  : 0;
63951
64199
  if (targetDeclarationKind !== 0) {
63952
64200
  var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind);
63953
- return !!decl && !!(decl.flags & 8388608);
64201
+ return !!decl && !!(decl.flags & 16777216);
63954
64202
  }
63955
64203
  return false;
63956
64204
  }
@@ -64145,7 +64393,7 @@ var ts;
64145
64393
  error(node, ts.Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node12_or_nodenext);
64146
64394
  }
64147
64395
  var file = ts.getSourceFileOfNode(node);
64148
- ts.Debug.assert(!!(file.flags & 2097152), "Containing file is missing import meta node flag.");
64396
+ ts.Debug.assert(!!(file.flags & 4194304), "Containing file is missing import meta node flag.");
64149
64397
  return node.name.escapedText === "meta" ? getGlobalImportMetaType() : errorType;
64150
64398
  }
64151
64399
  function getTypeOfParameter(symbol) {
@@ -65943,6 +66191,9 @@ var ts;
65943
66191
  context.contextualType = contextualType;
65944
66192
  context.inferenceContext = inferenceContext;
65945
66193
  var type = checkExpression(node, checkMode | 1 | (inferenceContext ? 2 : 0));
66194
+ if (inferenceContext && inferenceContext.intraExpressionInferenceSites) {
66195
+ inferenceContext.intraExpressionInferenceSites = undefined;
66196
+ }
65946
66197
  var result = maybeTypeOfKind(type, 2944) && isLiteralOfContextualType(type, instantiateContextualType(contextualType, node)) ?
65947
66198
  getRegularTypeOfLiteralType(type) : type;
65948
66199
  return result;
@@ -66190,7 +66441,7 @@ var ts;
66190
66441
  if (quickType) {
66191
66442
  return quickType;
66192
66443
  }
66193
- if (node.flags & 67108864 && flowTypeCache) {
66444
+ if (node.flags & 134217728 && flowTypeCache) {
66194
66445
  var cachedType = flowTypeCache[getNodeId(node)];
66195
66446
  if (cachedType) {
66196
66447
  return cachedType;
@@ -66201,7 +66452,7 @@ var ts;
66201
66452
  if (flowInvocationCount !== startInvocationCount) {
66202
66453
  var cache = flowTypeCache || (flowTypeCache = []);
66203
66454
  cache[getNodeId(node)] = type;
66204
- ts.setNodeFlags(node, node.flags | 67108864);
66455
+ ts.setNodeFlags(node, node.flags | 134217728);
66205
66456
  }
66206
66457
  return type;
66207
66458
  }
@@ -66271,7 +66522,7 @@ var ts;
66271
66522
  if (compilerOptions.isolatedModules) {
66272
66523
  ts.Debug.assert(!!(type.symbol.flags & 128));
66273
66524
  var constEnumDeclaration = type.symbol.valueDeclaration;
66274
- if (constEnumDeclaration.flags & 8388608) {
66525
+ if (constEnumDeclaration.flags & 16777216) {
66275
66526
  error(node, ts.Diagnostics.Cannot_access_ambient_const_enums_when_the_isolatedModules_flag_is_provided);
66276
66527
  }
66277
66528
  }
@@ -66414,19 +66665,28 @@ var ts;
66414
66665
  if (constraintType && defaultType) {
66415
66666
  checkTypeAssignableTo(defaultType, getTypeWithThisArgument(instantiateType(constraintType, makeUnaryTypeMapper(typeParameter, defaultType)), defaultType), node.default, ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1);
66416
66667
  }
66417
- if (node.parent.kind === 258 || node.parent.kind === 257 || node.parent.kind === 259) {
66668
+ checkNodeDeferred(node);
66669
+ addLazyDiagnostic(function () { return checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0); });
66670
+ }
66671
+ function checkTypeParameterDeferred(node) {
66672
+ if (ts.isInterfaceDeclaration(node.parent) || ts.isClassLike(node.parent) || ts.isTypeAliasDeclaration(node.parent)) {
66673
+ var typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfNode(node));
66418
66674
  var modifiers = getVarianceModifiers(typeParameter);
66419
- if (modifiers === 32768 || modifiers === 65536) {
66675
+ if (modifiers) {
66420
66676
  var symbol = getSymbolOfNode(node.parent);
66421
- var source = createMarkerType(symbol, typeParameter, modifiers === 65536 ? markerSubType : markerSuperType);
66422
- var target = createMarkerType(symbol, typeParameter, modifiers === 65536 ? markerSuperType : markerSubType);
66423
- var saveVarianceTypeParameter = typeParameter;
66424
- varianceTypeParameter = typeParameter;
66425
- checkTypeAssignableTo(source, target, node, ts.Diagnostics.Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation);
66426
- varianceTypeParameter = saveVarianceTypeParameter;
66677
+ if (ts.isTypeAliasDeclaration(node.parent) && !(ts.getObjectFlags(getDeclaredTypeOfSymbol(symbol)) & (16 | 32))) {
66678
+ error(node, ts.Diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types);
66679
+ }
66680
+ else if (modifiers === 32768 || modifiers === 65536) {
66681
+ var source = createMarkerType(symbol, typeParameter, modifiers === 65536 ? markerSubType : markerSuperType);
66682
+ var target = createMarkerType(symbol, typeParameter, modifiers === 65536 ? markerSuperType : markerSubType);
66683
+ var saveVarianceTypeParameter = typeParameter;
66684
+ varianceTypeParameter = typeParameter;
66685
+ checkTypeAssignableTo(source, target, node, ts.Diagnostics.Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation);
66686
+ varianceTypeParameter = saveVarianceTypeParameter;
66687
+ }
66427
66688
  }
66428
66689
  }
66429
- addLazyDiagnostic(function () { return checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0); });
66430
66690
  }
66431
66691
  function checkParameter(node) {
66432
66692
  checkGrammarDecoratorsAndModifiers(node);
@@ -66853,7 +67113,7 @@ var ts;
66853
67113
  superCallStatement = statement;
66854
67114
  break;
66855
67115
  }
66856
- if (!ts.isPrologueDirective(statement) && nodeImmediatelyReferencesSuperOrThis(statement)) {
67116
+ if (nodeImmediatelyReferencesSuperOrThis(statement)) {
66857
67117
  break;
66858
67118
  }
66859
67119
  }
@@ -66892,7 +67152,7 @@ var ts;
66892
67152
  checkDecorators(node);
66893
67153
  checkSignatureDeclaration(node);
66894
67154
  if (node.kind === 172) {
66895
- if (!(node.flags & 8388608) && ts.nodeIsPresent(node.body) && (node.flags & 256)) {
67155
+ if (!(node.flags & 16777216) && ts.nodeIsPresent(node.body) && (node.flags & 256)) {
66896
67156
  if (!(node.flags & 512)) {
66897
67157
  error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value);
66898
67158
  }
@@ -66982,7 +67242,7 @@ var ts;
66982
67242
  }
66983
67243
  var symbol = getNodeLinks(node).resolvedSymbol;
66984
67244
  if (symbol) {
66985
- if (ts.some(symbol.declarations, function (d) { return isTypeDeclaration(d) && !!(d.flags & 134217728); })) {
67245
+ if (ts.some(symbol.declarations, function (d) { return isTypeDeclaration(d) && !!(d.flags & 268435456); })) {
66986
67246
  addDeprecatedSuggestion(getDeprecatedSuggestionNode(node), symbol.declarations, symbol.escapedName);
66987
67247
  }
66988
67248
  if (type.flags & 32 && symbol.flags & 8) {
@@ -67139,6 +67399,22 @@ var ts;
67139
67399
  grammarErrorOnNode(node, ts.Diagnostics.infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type);
67140
67400
  }
67141
67401
  checkSourceElement(node.typeParameter);
67402
+ var symbol = getSymbolOfNode(node.typeParameter);
67403
+ if (symbol.declarations && symbol.declarations.length > 1) {
67404
+ var links = getSymbolLinks(symbol);
67405
+ if (!links.typeParametersChecked) {
67406
+ links.typeParametersChecked = true;
67407
+ var typeParameter = getDeclaredTypeOfTypeParameter(symbol);
67408
+ var declarations = ts.getDeclarationsOfKind(symbol, 163);
67409
+ if (!areTypeParametersIdentical(declarations, [typeParameter], function (decl) { return [decl]; })) {
67410
+ var name = symbolToString(symbol);
67411
+ for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) {
67412
+ var declaration = declarations_4[_i];
67413
+ error(declaration.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_constraints, name);
67414
+ }
67415
+ }
67416
+ }
67417
+ }
67142
67418
  registerForUnusedIdentifiersCheck(node);
67143
67419
  }
67144
67420
  function checkTemplateLiteralType(node) {
@@ -67176,14 +67452,14 @@ var ts;
67176
67452
  getTypeFromTypeNode(node);
67177
67453
  }
67178
67454
  function isPrivateWithinAmbient(node) {
67179
- return (ts.hasEffectiveModifier(node, 8) || ts.isPrivateIdentifierClassElementDeclaration(node)) && !!(node.flags & 8388608);
67455
+ return (ts.hasEffectiveModifier(node, 8) || ts.isPrivateIdentifierClassElementDeclaration(node)) && !!(node.flags & 16777216);
67180
67456
  }
67181
67457
  function getEffectiveDeclarationFlags(n, flagsToCheck) {
67182
67458
  var flags = ts.getCombinedModifierFlags(n);
67183
67459
  if (n.parent.kind !== 258 &&
67184
67460
  n.parent.kind !== 257 &&
67185
67461
  n.parent.kind !== 226 &&
67186
- n.flags & 8388608) {
67462
+ n.flags & 16777216) {
67187
67463
  if (!(flags & 2) && !(ts.isModuleBlock(n.parent) && ts.isModuleDeclaration(n.parent.parent) && ts.isGlobalScopeAugmentation(n.parent.parent))) {
67188
67464
  flags |= 1;
67189
67465
  }
@@ -67295,10 +67571,10 @@ var ts;
67295
67571
  var hasNonAmbientClass = false;
67296
67572
  var functionDeclarations = [];
67297
67573
  if (declarations) {
67298
- for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) {
67299
- var current = declarations_4[_i];
67574
+ for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) {
67575
+ var current = declarations_5[_i];
67300
67576
  var node = current;
67301
- var inAmbientContext = node.flags & 8388608;
67577
+ var inAmbientContext = node.flags & 16777216;
67302
67578
  var inAmbientContextOrInterface = node.parent && (node.parent.kind === 258 || node.parent.kind === 182) || inAmbientContext;
67303
67579
  if (inAmbientContextOrInterface) {
67304
67580
  previousDeclaration = undefined;
@@ -67932,7 +68208,7 @@ var ts;
67932
68208
  if (hasBindableName(node)) {
67933
68209
  var symbol = getSymbolOfNode(node);
67934
68210
  var localSymbol = node.localSymbol || symbol;
67935
- var firstDeclaration = (_a = localSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (declaration) { return declaration.kind === node.kind && !(declaration.flags & 131072); });
68211
+ var firstDeclaration = (_a = localSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (declaration) { return declaration.kind === node.kind && !(declaration.flags & 262144); });
67936
68212
  if (node === firstDeclaration) {
67937
68213
  checkFunctionOrConstructorSymbol(localSymbol);
67938
68214
  }
@@ -68042,7 +68318,7 @@ var ts;
68042
68318
  var symbol = getSymbolOfNode(member);
68043
68319
  if (!symbol.isReferenced
68044
68320
  && (ts.hasEffectiveModifier(member, 8) || ts.isNamedDeclaration(member) && ts.isPrivateIdentifier(member.name))
68045
- && !(member.flags & 8388608)) {
68321
+ && !(member.flags & 16777216)) {
68046
68322
  addDiagnostic(member, 0, ts.createDiagnosticForNode(member.name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, symbolToString(symbol)));
68047
68323
  }
68048
68324
  break;
@@ -68217,8 +68493,8 @@ var ts;
68217
68493
  : ts.createDiagnosticForNode(declarationList.parent.kind === 237 ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused));
68218
68494
  }
68219
68495
  else {
68220
- for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) {
68221
- var decl = declarations_5[_i];
68496
+ for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) {
68497
+ var decl = declarations_6[_i];
68222
68498
  addDiagnostic(decl, 0, ts.createDiagnosticForNode(decl, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(decl.name)));
68223
68499
  }
68224
68500
  }
@@ -68258,7 +68534,7 @@ var ts;
68258
68534
  }
68259
68535
  }
68260
68536
  function checkCollisionWithArgumentsInGeneratedCode(node) {
68261
- if (languageVersion >= 2 || !ts.hasRestParameter(node) || node.flags & 8388608 || ts.nodeIsMissing(node.body)) {
68537
+ if (languageVersion >= 2 || !ts.hasRestParameter(node) || node.flags & 16777216 || ts.nodeIsMissing(node.body)) {
68262
68538
  return;
68263
68539
  }
68264
68540
  ts.forEach(node.parameters, function (p) {
@@ -68280,7 +68556,7 @@ var ts;
68280
68556
  node.kind === 296) {
68281
68557
  return false;
68282
68558
  }
68283
- if (node.flags & 8388608) {
68559
+ if (node.flags & 16777216) {
68284
68560
  return false;
68285
68561
  }
68286
68562
  if (ts.isImportClause(node) || ts.isImportEqualsDeclaration(node) || ts.isImportSpecifier(node)) {
@@ -68406,7 +68682,7 @@ var ts;
68406
68682
  recordPotentialCollisionWithReflectInGeneratedCode(node, name);
68407
68683
  if (ts.isClassLike(node)) {
68408
68684
  checkTypeNameIsReserved(name, ts.Diagnostics.Class_name_cannot_be_0);
68409
- if (!(node.flags & 8388608)) {
68685
+ if (!(node.flags & 16777216)) {
68410
68686
  checkClassNameCollisionWithObject(name);
68411
68687
  }
68412
68688
  }
@@ -69667,21 +69943,21 @@ var ts;
69667
69943
  return;
69668
69944
  }
69669
69945
  var type = getDeclaredTypeOfSymbol(symbol);
69670
- if (!areTypeParametersIdentical(declarations, type.localTypeParameters)) {
69946
+ if (!areTypeParametersIdentical(declarations, type.localTypeParameters, ts.getEffectiveTypeParameterDeclarations)) {
69671
69947
  var name = symbolToString(symbol);
69672
- for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) {
69673
- var declaration = declarations_6[_i];
69948
+ for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) {
69949
+ var declaration = declarations_7[_i];
69674
69950
  error(declaration.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, name);
69675
69951
  }
69676
69952
  }
69677
69953
  }
69678
69954
  }
69679
- function areTypeParametersIdentical(declarations, targetParameters) {
69955
+ function areTypeParametersIdentical(declarations, targetParameters, getTypeParameterDeclarations) {
69680
69956
  var maxTypeArgumentCount = ts.length(targetParameters);
69681
69957
  var minTypeArgumentCount = getMinTypeArgumentCount(targetParameters);
69682
- for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) {
69683
- var declaration = declarations_7[_i];
69684
- var sourceParameters = ts.getEffectiveTypeParameterDeclarations(declaration);
69958
+ for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) {
69959
+ var declaration = declarations_8[_i];
69960
+ var sourceParameters = getTypeParameterDeclarations(declaration);
69685
69961
  var numTypeParameters = sourceParameters.length;
69686
69962
  if (numTypeParameters < minTypeArgumentCount || numTypeParameters > maxTypeArgumentCount) {
69687
69963
  return false;
@@ -69740,7 +70016,7 @@ var ts;
69740
70016
  checkTypeParameterListsIdentical(symbol);
69741
70017
  checkFunctionOrConstructorSymbol(symbol);
69742
70018
  checkClassForDuplicateDeclarations(node);
69743
- var nodeInAmbientContext = !!(node.flags & 8388608);
70019
+ var nodeInAmbientContext = !!(node.flags & 16777216);
69744
70020
  if (!nodeInAmbientContext) {
69745
70021
  checkClassForStaticPropertyNameConflicts(node);
69746
70022
  }
@@ -69872,7 +70148,7 @@ var ts;
69872
70148
  }
69873
70149
  function checkMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, memberHasOverrideModifier, memberHasAbstractModifier, memberIsStatic, memberIsParameterProperty, memberName, errorNode) {
69874
70150
  var isJs = ts.isInJSFile(node);
69875
- var nodeInAmbientContext = !!(node.flags & 8388608);
70151
+ var nodeInAmbientContext = !!(node.flags & 16777216);
69876
70152
  if (baseWithThis && (memberHasOverrideModifier || compilerOptions.noImplicitOverride)) {
69877
70153
  var memberEscapedName = ts.escapeLeadingUnderscores(memberName);
69878
70154
  var thisType = memberIsStatic ? staticType : typeWithThis;
@@ -70059,7 +70335,7 @@ var ts;
70059
70335
  && !(derived.flags & 33554432)
70060
70336
  && !(baseDeclarationFlags & 128)
70061
70337
  && !(derivedDeclarationFlags & 128)
70062
- && !((_b = derived.declarations) === null || _b === void 0 ? void 0 : _b.some(function (d) { return !!(d.flags & 8388608); }))) {
70338
+ && !((_b = derived.declarations) === null || _b === void 0 ? void 0 : _b.some(function (d) { return !!(d.flags & 16777216); }))) {
70063
70339
  var constructor = findConstructorDeclaration(ts.getClassLikeDeclarationOfSymbol(type.symbol));
70064
70340
  var propName = uninitialized.name;
70065
70341
  if (uninitialized.exclamationToken
@@ -70149,7 +70425,7 @@ var ts;
70149
70425
  return ok;
70150
70426
  }
70151
70427
  function checkPropertyInitialization(node) {
70152
- if (!strictNullChecks || !strictPropertyInitialization || node.flags & 8388608) {
70428
+ if (!strictNullChecks || !strictPropertyInitialization || node.flags & 16777216) {
70153
70429
  return;
70154
70430
  }
70155
70431
  var constructor = findConstructorDeclaration(node);
@@ -70279,7 +70555,7 @@ var ts;
70279
70555
  if (member.initializer) {
70280
70556
  return computeConstantValue(member);
70281
70557
  }
70282
- if (member.parent.flags & 8388608 && !ts.isEnumConst(member.parent) && getEnumKind(getSymbolOfNode(member.parent)) === 0) {
70558
+ if (member.parent.flags & 16777216 && !ts.isEnumConst(member.parent) && getEnumKind(getSymbolOfNode(member.parent)) === 0) {
70283
70559
  return undefined;
70284
70560
  }
70285
70561
  if (autoValue !== undefined) {
@@ -70307,7 +70583,7 @@ var ts;
70307
70583
  else if (isConstEnum) {
70308
70584
  error(initializer, ts.Diagnostics.const_enum_member_initializers_can_only_contain_literal_values_and_other_computed_enum_values);
70309
70585
  }
70310
- else if (member.parent.flags & 8388608) {
70586
+ else if (member.parent.flags & 16777216) {
70311
70587
  error(initializer, ts.Diagnostics.In_ambient_enum_declarations_member_initializer_must_be_constant_expression);
70312
70588
  }
70313
70589
  else {
@@ -70465,11 +70741,11 @@ var ts;
70465
70741
  function getFirstNonAmbientClassOrFunctionDeclaration(symbol) {
70466
70742
  var declarations = symbol.declarations;
70467
70743
  if (declarations) {
70468
- for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) {
70469
- var declaration = declarations_8[_i];
70744
+ for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) {
70745
+ var declaration = declarations_9[_i];
70470
70746
  if ((declaration.kind === 257 ||
70471
70747
  (declaration.kind === 256 && ts.nodeIsPresent(declaration.body))) &&
70472
- !(declaration.flags & 8388608)) {
70748
+ !(declaration.flags & 16777216)) {
70473
70749
  return declaration;
70474
70750
  }
70475
70751
  }
@@ -70499,7 +70775,7 @@ var ts;
70499
70775
  addLazyDiagnostic(checkModuleDeclarationDiagnostics);
70500
70776
  function checkModuleDeclarationDiagnostics() {
70501
70777
  var isGlobalAugmentation = ts.isGlobalScopeAugmentation(node);
70502
- var inAmbientContext = node.flags & 8388608;
70778
+ var inAmbientContext = node.flags & 16777216;
70503
70779
  if (isGlobalAugmentation && !inAmbientContext) {
70504
70780
  error(node.name, ts.Diagnostics.Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context);
70505
70781
  }
@@ -70685,7 +70961,7 @@ var ts;
70685
70961
  }
70686
70962
  if (compilerOptions.isolatedModules
70687
70963
  && !ts.isTypeOnlyImportOrExportDeclaration(node)
70688
- && !(node.flags & 8388608)) {
70964
+ && !(node.flags & 16777216)) {
70689
70965
  var typeOnlyAlias = getTypeOnlyAliasDeclaration(symbol);
70690
70966
  var isType = !(target.flags & 111551);
70691
70967
  if (isType || typeOnlyAlias) {
@@ -70728,7 +71004,7 @@ var ts;
70728
71004
  }
70729
71005
  }
70730
71006
  function isDeprecatedAliasedSymbol(symbol) {
70731
- return !!symbol.declarations && ts.every(symbol.declarations, function (d) { return !!(ts.getCombinedNodeFlags(d) & 134217728); });
71007
+ return !!symbol.declarations && ts.every(symbol.declarations, function (d) { return !!(ts.getCombinedNodeFlags(d) & 268435456); });
70732
71008
  }
70733
71009
  function checkDeprecatedAliasedSymbol(symbol, location) {
70734
71010
  if (!(symbol.flags & 2097152))
@@ -70853,7 +71129,7 @@ var ts;
70853
71129
  }
70854
71130
  }
70855
71131
  else {
70856
- if (moduleKind >= ts.ModuleKind.ES2015 && ts.getSourceFileOfNode(node).impliedNodeFormat === undefined && !node.isTypeOnly && !(node.flags & 8388608)) {
71132
+ if (moduleKind >= ts.ModuleKind.ES2015 && ts.getSourceFileOfNode(node).impliedNodeFormat === undefined && !node.isTypeOnly && !(node.flags & 16777216)) {
70857
71133
  grammarErrorOnNode(node, ts.Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead);
70858
71134
  }
70859
71135
  }
@@ -70875,7 +71151,7 @@ var ts;
70875
71151
  ts.forEach(node.exportClause.elements, checkExportSpecifier);
70876
71152
  var inAmbientExternalModule = node.parent.kind === 262 && ts.isAmbientModule(node.parent.parent);
70877
71153
  var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 262 &&
70878
- !node.moduleSpecifier && node.flags & 8388608;
71154
+ !node.moduleSpecifier && node.flags & 16777216;
70879
71155
  if (node.parent.kind !== 305 && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) {
70880
71156
  error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace);
70881
71157
  }
@@ -71028,10 +71304,10 @@ var ts;
71028
71304
  checkExpressionCached(node.expression);
71029
71305
  }
71030
71306
  checkExternalModuleExports(container);
71031
- if ((node.flags & 8388608) && !ts.isEntityNameExpression(node.expression)) {
71307
+ if ((node.flags & 16777216) && !ts.isEntityNameExpression(node.expression)) {
71032
71308
  grammarErrorOnNode(node.expression, ts.Diagnostics.The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context);
71033
71309
  }
71034
- if (node.isExportEquals && !(node.flags & 8388608)) {
71310
+ if (node.isExportEquals && !(node.flags & 16777216)) {
71035
71311
  if (moduleKind >= ts.ModuleKind.ES2015 && ts.getSourceFileOfNode(node).impliedNodeFormat !== ts.ModuleKind.CommonJS) {
71036
71312
  grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead);
71037
71313
  }
@@ -71375,6 +71651,9 @@ var ts;
71375
71651
  case 226:
71376
71652
  checkClassExpressionDeferred(node);
71377
71653
  break;
71654
+ case 163:
71655
+ checkTypeParameterDeferred(node);
71656
+ break;
71378
71657
  case 279:
71379
71658
  checkJsxSelfClosingElementDeferred(node);
71380
71659
  break;
@@ -71429,7 +71708,7 @@ var ts;
71429
71708
  addLazyDiagnostic(function () {
71430
71709
  if (!node.isDeclarationFile && (compilerOptions.noUnusedLocals || compilerOptions.noUnusedParameters)) {
71431
71710
  checkUnusedIdentifiers(getPotentiallyUnusedIdentifiers(node), function (containingNode, kind, diag) {
71432
- if (!ts.containsParseError(containingNode) && unusedIsError(kind, !!(containingNode.flags & 8388608))) {
71711
+ if (!ts.containsParseError(containingNode) && unusedIsError(kind, !!(containingNode.flags & 16777216))) {
71433
71712
  diagnostics.add(diag);
71434
71713
  }
71435
71714
  });
@@ -71510,7 +71789,7 @@ var ts;
71510
71789
  return diagnostics.getGlobalDiagnostics();
71511
71790
  }
71512
71791
  function getSymbolsInScope(location, meaning) {
71513
- if (location.flags & 16777216) {
71792
+ if (location.flags & 33554432) {
71514
71793
  return [];
71515
71794
  }
71516
71795
  var symbols = ts.createSymbolTable();
@@ -71823,7 +72102,7 @@ var ts;
71823
72102
  }
71824
72103
  var parent = node.parent;
71825
72104
  var grandParent = parent.parent;
71826
- if (node.flags & 16777216) {
72105
+ if (node.flags & 33554432) {
71827
72106
  return undefined;
71828
72107
  }
71829
72108
  if (isDeclarationNameOrImportPropertyName(node)) {
@@ -71953,7 +72232,7 @@ var ts;
71953
72232
  if (ts.isSourceFile(node) && !ts.isExternalModule(node)) {
71954
72233
  return errorType;
71955
72234
  }
71956
- if (node.flags & 16777216) {
72235
+ if (node.flags & 33554432) {
71957
72236
  return errorType;
71958
72237
  }
71959
72238
  var classDecl = ts.tryGetClassImplementingOrExtendingExpressionWithTypeArguments(node);
@@ -72085,11 +72364,11 @@ var ts;
72085
72364
  var _a = symbol, leftSpread = _a.leftSpread, rightSpread = _a.rightSpread, syntheticOrigin = _a.syntheticOrigin;
72086
72365
  return leftSpread ? [leftSpread, rightSpread]
72087
72366
  : syntheticOrigin ? [syntheticOrigin]
72088
- : ts.singleElementArray(tryGetAliasTarget(symbol));
72367
+ : ts.singleElementArray(tryGetTarget(symbol));
72089
72368
  }
72090
72369
  return undefined;
72091
72370
  }
72092
- function tryGetAliasTarget(symbol) {
72371
+ function tryGetTarget(symbol) {
72093
72372
  var target;
72094
72373
  var next = symbol;
72095
72374
  while (next = getSymbolLinks(next).target) {
@@ -72274,7 +72553,7 @@ var ts;
72274
72553
  if (links === null || links === void 0 ? void 0 : links.referenced) {
72275
72554
  return true;
72276
72555
  }
72277
- var target = getSymbolLinks(symbol).target;
72556
+ var target = getSymbolLinks(symbol).aliasTarget;
72278
72557
  if (target && ts.getEffectiveModifierFlags(node) & 1 &&
72279
72558
  target.flags & 111551 &&
72280
72559
  (ts.shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target))) {
@@ -72310,11 +72589,6 @@ var ts;
72310
72589
  !parameter.initializer &&
72311
72590
  ts.hasSyntacticModifier(parameter, 16476);
72312
72591
  }
72313
- function isOptionalUninitializedParameter(parameter) {
72314
- return !!strictNullChecks &&
72315
- isOptionalParameter(parameter) &&
72316
- !parameter.initializer;
72317
- }
72318
72592
  function isExpandoFunctionDeclaration(node) {
72319
72593
  var declaration = ts.getParseTreeNode(node, ts.isFunctionDeclaration);
72320
72594
  if (!declaration) {
@@ -72867,7 +73141,7 @@ var ts;
72867
73141
  function checkExternalEmitHelpers(location, helpers) {
72868
73142
  if ((requestedExternalEmitHelpers & helpers) !== helpers && compilerOptions.importHelpers) {
72869
73143
  var sourceFile = ts.getSourceFileOfNode(location);
72870
- if (ts.isEffectiveExternalModule(sourceFile, compilerOptions) && !(location.flags & 8388608)) {
73144
+ if (ts.isEffectiveExternalModule(sourceFile, compilerOptions) && !(location.flags & 16777216)) {
72871
73145
  var helpersModule = resolveHelpersModule(sourceFile, location);
72872
73146
  if (helpersModule !== unknownSymbol) {
72873
73147
  var uncheckedHelpers = helpers & ~requestedExternalEmitHelpers;
@@ -73117,7 +73391,7 @@ var ts;
73117
73391
  else if (node.kind === 164) {
73118
73392
  return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare");
73119
73393
  }
73120
- else if ((node.parent.flags & 8388608) && node.parent.kind === 262) {
73394
+ else if ((node.parent.flags & 16777216) && node.parent.kind === 262) {
73121
73395
  return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context);
73122
73396
  }
73123
73397
  else if (ts.isPrivateIdentifierClassElementDeclaration(node)) {
@@ -73163,7 +73437,7 @@ var ts;
73163
73437
  if (flags & 256) {
73164
73438
  return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async");
73165
73439
  }
73166
- else if (flags & 2 || node.parent.flags & 8388608) {
73440
+ else if (flags & 2 || node.parent.flags & 16777216) {
73167
73441
  return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async");
73168
73442
  }
73169
73443
  else if (node.kind === 164) {
@@ -73179,8 +73453,7 @@ var ts;
73179
73453
  case 144:
73180
73454
  var inOutFlag = modifier.kind === 101 ? 32768 : 65536;
73181
73455
  var inOutText = modifier.kind === 101 ? "in" : "out";
73182
- if (node.kind !== 163 || (node.parent.kind !== 258 &&
73183
- node.parent.kind !== 257 && node.parent.kind !== 259)) {
73456
+ if (node.kind !== 163 || !(ts.isInterfaceDeclaration(node.parent) || ts.isClassLike(node.parent) || ts.isTypeAliasDeclaration(node.parent))) {
73184
73457
  return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias, inOutText);
73185
73458
  }
73186
73459
  if (flags & inOutFlag) {
@@ -73305,7 +73578,7 @@ var ts;
73305
73578
  if (i !== (parameterCount - 1)) {
73306
73579
  return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list);
73307
73580
  }
73308
- if (!(parameter.flags & 8388608)) {
73581
+ if (!(parameter.flags & 16777216)) {
73309
73582
  checkGrammarForDisallowedTrailingComma(parameters, ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma);
73310
73583
  }
73311
73584
  if (parameter.questionToken) {
@@ -73511,7 +73784,7 @@ var ts;
73511
73784
  ts.Debug.assert(node.kind === 256 ||
73512
73785
  node.kind === 213 ||
73513
73786
  node.kind === 169);
73514
- if (node.flags & 8388608) {
73787
+ if (node.flags & 16777216) {
73515
73788
  return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context);
73516
73789
  }
73517
73790
  if (!node.body) {
@@ -73726,7 +73999,7 @@ var ts;
73726
73999
  return false;
73727
74000
  }
73728
74001
  function checkGrammarAccessor(accessor) {
73729
- if (!(accessor.flags & 8388608) && (accessor.parent.kind !== 182) && (accessor.parent.kind !== 258)) {
74002
+ if (!(accessor.flags & 16777216) && (accessor.parent.kind !== 182) && (accessor.parent.kind !== 258)) {
73730
74003
  if (languageVersion < 1) {
73731
74004
  return grammarErrorOnNode(accessor.name, ts.Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher);
73732
74005
  }
@@ -73856,7 +74129,7 @@ var ts;
73856
74129
  if (languageVersion < 2 && ts.isPrivateIdentifier(node.name)) {
73857
74130
  return grammarErrorOnNode(node.name, ts.Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher);
73858
74131
  }
73859
- if (node.flags & 8388608) {
74132
+ if (node.flags & 16777216) {
73860
74133
  return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_ambient_context_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type);
73861
74134
  }
73862
74135
  else if (node.kind === 169 && !node.body) {
@@ -73967,7 +74240,7 @@ var ts;
73967
74240
  }
73968
74241
  function checkGrammarVariableDeclaration(node) {
73969
74242
  if (node.parent.parent.kind !== 243 && node.parent.parent.kind !== 244) {
73970
- if (node.flags & 8388608) {
74243
+ if (node.flags & 16777216) {
73971
74244
  checkAmbientInitializer(node);
73972
74245
  }
73973
74246
  else if (!node.initializer) {
@@ -73979,7 +74252,7 @@ var ts;
73979
74252
  }
73980
74253
  }
73981
74254
  }
73982
- if (node.exclamationToken && (node.parent.parent.kind !== 237 || !node.type || node.initializer || node.flags & 8388608)) {
74255
+ if (node.exclamationToken && (node.parent.parent.kind !== 237 || !node.type || node.initializer || node.flags & 16777216)) {
73983
74256
  var message = node.initializer
73984
74257
  ? ts.Diagnostics.Declarations_with_initializers_cannot_also_have_definite_assignment_assertions
73985
74258
  : !node.type
@@ -73988,7 +74261,7 @@ var ts;
73988
74261
  return grammarErrorOnNode(node.exclamationToken, message);
73989
74262
  }
73990
74263
  if ((moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS) && moduleKind !== ts.ModuleKind.System &&
73991
- !(node.parent.parent.flags & 8388608) && ts.hasSyntacticModifier(node.parent.parent, 1)) {
74264
+ !(node.parent.parent.flags & 16777216) && ts.hasSyntacticModifier(node.parent.parent, 1)) {
73992
74265
  checkESModuleMarker(node.name);
73993
74266
  }
73994
74267
  var checkLetConstNames = (ts.isLet(node) || ts.isVarConst(node));
@@ -74159,11 +74432,11 @@ var ts;
74159
74432
  return grammarErrorOnNode(node.initializer, ts.Diagnostics.A_type_literal_property_cannot_have_an_initializer);
74160
74433
  }
74161
74434
  }
74162
- if (node.flags & 8388608) {
74435
+ if (node.flags & 16777216) {
74163
74436
  checkAmbientInitializer(node);
74164
74437
  }
74165
74438
  if (ts.isPropertyDeclaration(node) && node.exclamationToken && (!ts.isClassLike(node.parent) || !node.type || node.initializer ||
74166
- node.flags & 8388608 || ts.isStatic(node) || ts.hasAbstractModifier(node))) {
74439
+ node.flags & 16777216 || ts.isStatic(node) || ts.hasAbstractModifier(node))) {
74167
74440
  var message = node.initializer
74168
74441
  ? ts.Diagnostics.Declarations_with_initializers_cannot_also_have_definite_assignment_assertions
74169
74442
  : !node.type
@@ -74197,10 +74470,10 @@ var ts;
74197
74470
  return false;
74198
74471
  }
74199
74472
  function checkGrammarSourceFile(node) {
74200
- return !!(node.flags & 8388608) && checkGrammarTopLevelElementsForRequiredDeclareModifier(node);
74473
+ return !!(node.flags & 16777216) && checkGrammarTopLevelElementsForRequiredDeclareModifier(node);
74201
74474
  }
74202
74475
  function checkGrammarStatementInAmbientContext(node) {
74203
- if (node.flags & 8388608) {
74476
+ if (node.flags & 16777216) {
74204
74477
  var links = getNodeLinks(node);
74205
74478
  if (!links.hasReportedStatementInAmbientContext && (ts.isFunctionLike(node.parent) || ts.isAccessor(node.parent))) {
74206
74479
  return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts);
@@ -77352,7 +77625,7 @@ var ts;
77352
77625
  return !ts.nodeIsMissing(node.body);
77353
77626
  }
77354
77627
  function visitPropertyDeclaration(node) {
77355
- if (node.flags & 8388608 || ts.hasSyntacticModifier(node, 128)) {
77628
+ if (node.flags & 16777216 || ts.hasSyntacticModifier(node, 128)) {
77356
77629
  return undefined;
77357
77630
  }
77358
77631
  var updated = factory.updatePropertyDeclaration(node, undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), visitPropertyNameOfClassElement(node), undefined, undefined, ts.visitNode(node.initializer, visitor));
@@ -77376,19 +77649,19 @@ var ts;
77376
77649
  }
77377
77650
  var statements = [];
77378
77651
  resumeLexicalEnvironment();
77379
- var indexAfterLastPrologueStatement = factory.copyPrologue(body.statements, statements, false, visitor);
77380
- var superStatementIndex = ts.findSuperStatementIndex(body.statements, indexAfterLastPrologueStatement);
77652
+ var prologueStatementCount = factory.copyPrologue(body.statements, statements, false, visitor);
77653
+ var superStatementIndex = ts.findSuperStatementIndex(body.statements, prologueStatementCount);
77381
77654
  if (superStatementIndex >= 0) {
77382
- ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, indexAfterLastPrologueStatement, superStatementIndex + 1 - indexAfterLastPrologueStatement));
77655
+ ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, prologueStatementCount, superStatementIndex + 1 - prologueStatementCount));
77383
77656
  }
77384
77657
  var parameterPropertyAssignments = ts.mapDefined(parametersWithPropertyAssignments, transformParameterWithPropertyAssignment);
77385
77658
  if (superStatementIndex >= 0) {
77386
77659
  ts.addRange(statements, parameterPropertyAssignments);
77387
77660
  }
77388
77661
  else {
77389
- statements = ts.addRange(parameterPropertyAssignments, statements);
77662
+ statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, prologueStatementCount), true), parameterPropertyAssignments, true), statements.slice(prologueStatementCount), true);
77390
77663
  }
77391
- ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, superStatementIndex + 1));
77664
+ ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, superStatementIndex + 1 + prologueStatementCount));
77392
77665
  statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment());
77393
77666
  var block = factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), body.statements), true);
77394
77667
  ts.setTextRange(block, body);
@@ -82591,8 +82864,8 @@ var ts;
82591
82864
  }
82592
82865
  function getRangeUnion(declarations) {
82593
82866
  var pos = -1, end = -1;
82594
- for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) {
82595
- var node = declarations_9[_i];
82867
+ for (var _i = 0, declarations_10 = declarations; _i < declarations_10.length; _i++) {
82868
+ var node = declarations_10[_i];
82596
82869
  pos = pos === -1 ? node.pos : node.pos === -1 ? pos : Math.min(pos, node.pos);
82597
82870
  end = Math.max(end, node.end);
82598
82871
  }
@@ -88674,6 +88947,10 @@ var ts;
88674
88947
  return factory.updateModifiers(statement, modifiers);
88675
88948
  }
88676
88949
  function transformTopLevelDeclaration(input) {
88950
+ if (lateMarkedStatements) {
88951
+ while (ts.orderedRemoveItem(lateMarkedStatements, input))
88952
+ ;
88953
+ }
88677
88954
  if (shouldStripInternal(input))
88678
88955
  return;
88679
88956
  switch (input.kind) {
@@ -88767,7 +89044,7 @@ var ts;
88767
89044
  needsScopeFixMarker = false;
88768
89045
  var statements = ts.visitNodes(inner.statements, visitDeclarationStatements);
88769
89046
  var lateStatements = transformAndReplaceLatePaintedStatements(statements);
88770
- if (input.flags & 8388608) {
89047
+ if (input.flags & 16777216) {
88771
89048
  needsScopeFixMarker = false;
88772
89049
  }
88773
89050
  if (!ts.isGlobalScopeAugmentation(input) && !hasScopeMarker(lateStatements) && !resultHasScopeMarker) {
@@ -89640,7 +89917,7 @@ var ts;
89640
89917
  addOutput(buildInfoPath);
89641
89918
  }
89642
89919
  function getOwnOutputFileNames(configFile, inputFileName, ignoreCase, addOutput, getCommonSourceDirectory) {
89643
- if (ts.fileExtensionIs(inputFileName, ".d.ts"))
89920
+ if (ts.isDeclarationFileName(inputFileName))
89644
89921
  return;
89645
89922
  var js = getOutputJSFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory);
89646
89923
  addOutput(js);
@@ -89678,7 +89955,7 @@ var ts;
89678
89955
  ts.getCommonSourceDirectory = getCommonSourceDirectory;
89679
89956
  function getCommonSourceDirectoryOfConfig(_a, ignoreCase) {
89680
89957
  var options = _a.options, fileNames = _a.fileNames;
89681
- return getCommonSourceDirectory(options, function () { return ts.filter(fileNames, function (file) { return !(options.noEmitForJsFiles && ts.fileExtensionIsOneOf(file, ts.supportedJSExtensionsFlat)) && !ts.fileExtensionIs(file, ".d.ts"); }); }, ts.getDirectoryPath(ts.normalizeSlashes(ts.Debug.checkDefined(options.configFilePath))), ts.createGetCanonicalFileName(!ignoreCase));
89958
+ return getCommonSourceDirectory(options, function () { return ts.filter(fileNames, function (file) { return !(options.noEmitForJsFiles && ts.fileExtensionIsOneOf(file, ts.supportedJSExtensionsFlat)) && !ts.isDeclarationFileName(file); }); }, ts.getDirectoryPath(ts.normalizeSlashes(ts.Debug.checkDefined(options.configFilePath))), ts.createGetCanonicalFileName(!ignoreCase));
89682
89959
  }
89683
89960
  ts.getCommonSourceDirectoryOfConfig = getCommonSourceDirectoryOfConfig;
89684
89961
  function getAllProjectOutputs(configFile, ignoreCase) {
@@ -89718,7 +89995,7 @@ var ts;
89718
89995
  var getCommonSourceDirectory = ts.memoize(function () { return getCommonSourceDirectoryOfConfig(configFile, ignoreCase); });
89719
89996
  for (var _a = 0, _b = configFile.fileNames; _a < _b.length; _a++) {
89720
89997
  var inputFileName = _b[_a];
89721
- if (ts.fileExtensionIs(inputFileName, ".d.ts"))
89998
+ if (ts.isDeclarationFileName(inputFileName))
89722
89999
  continue;
89723
90000
  var jsFilePath = getOutputJSFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory);
89724
90001
  if (jsFilePath)
@@ -90207,6 +90484,9 @@ var ts;
90207
90484
  var currentParenthesizerRule;
90208
90485
  var _c = ts.performance.createTimerIf(extendedDiagnostics, "commentTime", "beforeComment", "afterComment"), enterComment = _c.enter, exitComment = _c.exit;
90209
90486
  var parenthesizer = ts.factory.parenthesizer;
90487
+ var typeArgumentParenthesizerRuleSelector = {
90488
+ select: function (index) { return index === 0 ? parenthesizer.parenthesizeLeadingTypeArgument : undefined; }
90489
+ };
90210
90490
  var emitBinaryExpression = createEmitBinaryExpression();
90211
90491
  reset();
90212
90492
  return {
@@ -91330,7 +91610,7 @@ var ts;
91330
91610
  writePunctuation("}");
91331
91611
  }
91332
91612
  function emitArrayType(node) {
91333
- emit(node.elementType, parenthesizer.parenthesizeElementTypeOfArrayType);
91613
+ emit(node.elementType, parenthesizer.parenthesizeNonArrayTypeOfPostfixType);
91334
91614
  writePunctuation("[");
91335
91615
  writePunctuation("]");
91336
91616
  }
@@ -91341,7 +91621,7 @@ var ts;
91341
91621
  function emitTupleType(node) {
91342
91622
  emitTokenWithComment(22, node.pos, writePunctuation, node);
91343
91623
  var flags = ts.getEmitFlags(node) & 1 ? 528 : 657;
91344
- emitList(node, node.elements, flags | 524288);
91624
+ emitList(node, node.elements, flags | 524288, parenthesizer.parenthesizeElementTypeOfTupleType);
91345
91625
  emitTokenWithComment(23, node.elements.end, writePunctuation, node);
91346
91626
  }
91347
91627
  function emitNamedTupleMember(node) {
@@ -91353,21 +91633,21 @@ var ts;
91353
91633
  emit(node.type);
91354
91634
  }
91355
91635
  function emitOptionalType(node) {
91356
- emit(node.type, parenthesizer.parenthesizeElementTypeOfArrayType);
91636
+ emit(node.type, parenthesizer.parenthesizeTypeOfOptionalType);
91357
91637
  writePunctuation("?");
91358
91638
  }
91359
91639
  function emitUnionType(node) {
91360
- emitList(node, node.types, 516, parenthesizer.parenthesizeMemberOfElementType);
91640
+ emitList(node, node.types, 516, parenthesizer.parenthesizeConstituentTypeOfUnionType);
91361
91641
  }
91362
91642
  function emitIntersectionType(node) {
91363
- emitList(node, node.types, 520, parenthesizer.parenthesizeMemberOfElementType);
91643
+ emitList(node, node.types, 520, parenthesizer.parenthesizeConstituentTypeOfIntersectionType);
91364
91644
  }
91365
91645
  function emitConditionalType(node) {
91366
- emit(node.checkType, parenthesizer.parenthesizeMemberOfConditionalType);
91646
+ emit(node.checkType, parenthesizer.parenthesizeCheckTypeOfConditionalType);
91367
91647
  writeSpace();
91368
91648
  writeKeyword("extends");
91369
91649
  writeSpace();
91370
- emit(node.extendsType, parenthesizer.parenthesizeMemberOfConditionalType);
91650
+ emit(node.extendsType, parenthesizer.parenthesizeExtendsTypeOfConditionalType);
91371
91651
  writeSpace();
91372
91652
  writePunctuation("?");
91373
91653
  writeSpace();
@@ -91393,10 +91673,13 @@ var ts;
91393
91673
  function emitTypeOperator(node) {
91394
91674
  writeTokenText(node.operator, writeKeyword);
91395
91675
  writeSpace();
91396
- emit(node.type, parenthesizer.parenthesizeMemberOfElementType);
91676
+ var parenthesizerRule = node.operator === 145 ?
91677
+ parenthesizer.parenthesizeOperandOfReadonlyTypeOperator :
91678
+ parenthesizer.parenthesizeOperandOfTypeOperator;
91679
+ emit(node.type, parenthesizerRule);
91397
91680
  }
91398
91681
  function emitIndexedAccessType(node) {
91399
- emit(node.objectType, parenthesizer.parenthesizeMemberOfElementType);
91682
+ emit(node.objectType, parenthesizer.parenthesizeNonArrayTypeOfPostfixType);
91400
91683
  writePunctuation("[");
91401
91684
  emit(node.indexType);
91402
91685
  writePunctuation("]");
@@ -93037,7 +93320,7 @@ var ts;
93037
93320
  emitList(parentNode, decorators, 2146305);
93038
93321
  }
93039
93322
  function emitTypeArguments(parentNode, typeArguments) {
93040
- emitList(parentNode, typeArguments, 53776, parenthesizer.parenthesizeMemberOfElementType);
93323
+ emitList(parentNode, typeArguments, 53776, typeArgumentParenthesizerRuleSelector);
93041
93324
  }
93042
93325
  function emitTypeParameters(parentNode, typeParameters) {
93043
93326
  if (ts.isFunctionLike(parentNode) && parentNode.typeArguments) {
@@ -93153,6 +93436,7 @@ var ts;
93153
93436
  if (format & 128) {
93154
93437
  increaseIndent();
93155
93438
  }
93439
+ var emitListItem = getEmitListItem(emit, parenthesizerRule);
93156
93440
  var previousSibling = void 0;
93157
93441
  var previousSourceFileTextKind = void 0;
93158
93442
  var shouldDecreaseIndentAfterEmit = false;
@@ -93190,12 +93474,7 @@ var ts;
93190
93474
  shouldEmitInterveningComments = mayEmitInterveningComments;
93191
93475
  }
93192
93476
  nextListElementPos = child.pos;
93193
- if (emit.length === 1) {
93194
- emit(child);
93195
- }
93196
- else {
93197
- emit(child, parenthesizerRule);
93198
- }
93477
+ emitListItem(child, emit, parenthesizerRule, i);
93199
93478
  if (shouldDecreaseIndentAfterEmit) {
93200
93479
  decreaseIndent();
93201
93480
  shouldDecreaseIndentAfterEmit = false;
@@ -94249,6 +94528,20 @@ var ts;
94249
94528
  function getClosingBracket(format) {
94250
94529
  return brackets[format & 15360][1];
94251
94530
  }
94531
+ function emitListItemNoParenthesizer(node, emit, _parenthesizerRule, _index) {
94532
+ emit(node);
94533
+ }
94534
+ function emitListItemWithParenthesizerRuleSelector(node, emit, parenthesizerRuleSelector, index) {
94535
+ emit(node, parenthesizerRuleSelector.select(index));
94536
+ }
94537
+ function emitListItemWithParenthesizerRule(node, emit, parenthesizerRule, _index) {
94538
+ emit(node, parenthesizerRule);
94539
+ }
94540
+ function getEmitListItem(emit, parenthesizerRule) {
94541
+ return emit.length === 1 ? emitListItemNoParenthesizer :
94542
+ typeof parenthesizerRule === "object" ? emitListItemWithParenthesizerRuleSelector :
94543
+ emitListItemWithParenthesizerRule;
94544
+ }
94252
94545
  })(ts || (ts = {}));
94253
94546
  var ts;
94254
94547
  (function (ts) {
@@ -94557,7 +94850,7 @@ var ts;
94557
94850
  return false;
94558
94851
  if (ts.outFile(options) || options.outDir)
94559
94852
  return false;
94560
- if (ts.fileExtensionIs(fileOrDirectoryPath, ".d.ts")) {
94853
+ if (ts.isDeclarationFileName(fileOrDirectoryPath)) {
94561
94854
  if (options.declarationDir)
94562
94855
  return false;
94563
94856
  }
@@ -95615,7 +95908,7 @@ var ts;
95615
95908
  var getCommonSourceDirectory_2 = ts.memoize(function () { return ts.getCommonSourceDirectoryOfConfig(parsedRef.commandLine, !host.useCaseSensitiveFileNames()); });
95616
95909
  for (var _b = 0, _c = parsedRef.commandLine.fileNames; _b < _c.length; _b++) {
95617
95910
  var fileName = _c[_b];
95618
- if (!ts.fileExtensionIs(fileName, ".d.ts") && !ts.fileExtensionIs(fileName, ".json")) {
95911
+ if (!ts.isDeclarationFileName(fileName) && !ts.fileExtensionIs(fileName, ".json")) {
95619
95912
  processProjectReferenceFile(ts.getOutputDeclarationFileName(fileName, parsedRef.commandLine, !host.useCaseSensitiveFileNames(), getCommonSourceDirectory_2), { kind: ts.FileIncludeKind.OutputFromProjectReference, index: index });
95620
95913
  }
95621
95914
  }
@@ -95791,7 +96084,7 @@ var ts;
95791
96084
  }
95792
96085
  function getRedirectReferenceForResolution(file) {
95793
96086
  var redirect = getResolvedProjectReferenceToRedirect(file.originalFileName);
95794
- if (redirect || !ts.fileExtensionIsOneOf(file.originalFileName, [".d.ts", ".d.cts", ".d.mts"]))
96087
+ if (redirect || !ts.isDeclarationFileName(file.originalFileName))
95795
96088
  return redirect;
95796
96089
  var resultFromDts = getRedirectReferenceForResolutionFromSourceOfProject(file.path);
95797
96090
  if (resultFromDts)
@@ -96045,7 +96338,7 @@ var ts;
96045
96338
  if (!ts.arrayIsEqualTo(oldSourceFile.moduleAugmentations, newSourceFile.moduleAugmentations, moduleNameIsEqualTo)) {
96046
96339
  structureIsReused = 1;
96047
96340
  }
96048
- if ((oldSourceFile.flags & 3145728) !== (newSourceFile.flags & 3145728)) {
96341
+ if ((oldSourceFile.flags & 6291456) !== (newSourceFile.flags & 6291456)) {
96049
96342
  structureIsReused = 1;
96050
96343
  }
96051
96344
  if (!ts.arrayIsEqualTo(oldSourceFile.typeReferenceDirectives, newSourceFile.typeReferenceDirectives, fileReferenceIsEqualTo)) {
@@ -96192,6 +96485,9 @@ var ts;
96192
96485
  return !!sourceFilesFoundSearchingNodeModules.get(file.path);
96193
96486
  }
96194
96487
  function isSourceFileDefaultLibrary(file) {
96488
+ if (!file.isDeclarationFile) {
96489
+ return false;
96490
+ }
96195
96491
  if (file.hasNoDefaultLib) {
96196
96492
  return true;
96197
96493
  }
@@ -96647,7 +96943,7 @@ var ts;
96647
96943
  var node = _a[_i];
96648
96944
  collectModuleReferences(node, false);
96649
96945
  }
96650
- if ((file.flags & 1048576) || isJavaScriptFile) {
96946
+ if ((file.flags & 2097152) || isJavaScriptFile) {
96651
96947
  collectDynamicImportOrRequireCalls(file);
96652
96948
  }
96653
96949
  file.imports = imports || ts.emptyArray;
@@ -96977,7 +97273,7 @@ var ts;
96977
97273
  return referencedProject && getProjectReferenceOutputName(referencedProject, fileName);
96978
97274
  }
96979
97275
  function getProjectReferenceRedirectProject(fileName) {
96980
- if (!resolvedProjectReferences || !resolvedProjectReferences.length || ts.fileExtensionIs(fileName, ".d.ts") || ts.fileExtensionIs(fileName, ".json")) {
97276
+ if (!resolvedProjectReferences || !resolvedProjectReferences.length || ts.isDeclarationFileName(fileName) || ts.fileExtensionIs(fileName, ".json")) {
96981
97277
  return undefined;
96982
97278
  }
96983
97279
  return getResolvedProjectReferenceToRedirect(fileName);
@@ -97019,7 +97315,7 @@ var ts;
97019
97315
  else {
97020
97316
  var getCommonSourceDirectory_3 = ts.memoize(function () { return ts.getCommonSourceDirectoryOfConfig(resolvedRef.commandLine, !host.useCaseSensitiveFileNames()); });
97021
97317
  ts.forEach(resolvedRef.commandLine.fileNames, function (fileName) {
97022
- if (!ts.fileExtensionIs(fileName, ".d.ts") && !ts.fileExtensionIs(fileName, ".json")) {
97318
+ if (!ts.isDeclarationFileName(fileName) && !ts.fileExtensionIs(fileName, ".json")) {
97023
97319
  var outputDts = ts.getOutputDeclarationFileName(fileName, resolvedRef.commandLine, !host.useCaseSensitiveFileNames(), getCommonSourceDirectory_3);
97024
97320
  mapFromToProjectReferenceRedirectSource.set(toPath(outputDts), fileName);
97025
97321
  }
@@ -97169,7 +97465,7 @@ var ts;
97169
97465
  && index < file.imports.length
97170
97466
  && !elideImport
97171
97467
  && !(isJsFile && !ts.getAllowJSCompilerOption(optionsForFile))
97172
- && (ts.isInJSFile(file.imports[index]) || !(file.imports[index].flags & 4194304));
97468
+ && (ts.isInJSFile(file.imports[index]) || !(file.imports[index].flags & 8388608));
97173
97469
  if (elideImport) {
97174
97470
  modulesWithElidedImports.set(file.path, true);
97175
97471
  }
@@ -97768,7 +98064,7 @@ var ts;
97768
98064
  if (options.outDir) {
97769
98065
  return ts.containsPath(options.outDir, filePath, currentDirectory, !host.useCaseSensitiveFileNames());
97770
98066
  }
97771
- if (ts.fileExtensionIsOneOf(filePath, ts.supportedJSExtensionsFlat) || ts.fileExtensionIs(filePath, ".d.ts")) {
98067
+ if (ts.fileExtensionIsOneOf(filePath, ts.supportedJSExtensionsFlat) || ts.isDeclarationFileName(filePath)) {
97772
98068
  var filePathWithoutExtension = ts.removeFileExtension(filePath);
97773
98069
  return !!getSourceFileByPath((filePathWithoutExtension + ".ts")) ||
97774
98070
  !!getSourceFileByPath((filePathWithoutExtension + ".tsx"));
@@ -98300,7 +98596,7 @@ var ts;
98300
98596
  var emitOutput_1 = getFileEmitOutput(programOfThisState, sourceFile, true, cancellationToken, undefined, true);
98301
98597
  var firstDts_1 = ts.firstOrUndefined(emitOutput_1.outputFiles);
98302
98598
  if (firstDts_1) {
98303
- ts.Debug.assert(ts.fileExtensionIsOneOf(firstDts_1.name, [".d.ts", ".d.mts", ".d.cts"]), "File extension for signature expected to be dts", function () { return "Found: " + ts.getAnyExtensionFromPath(firstDts_1.name) + " for " + firstDts_1.name + ":: All output files: " + JSON.stringify(emitOutput_1.outputFiles.map(function (f) { return f.name; })); });
98599
+ ts.Debug.assert(ts.isDeclarationFileName(firstDts_1.name), "File extension for signature expected to be dts", function () { return "Found: " + ts.getAnyExtensionFromPath(firstDts_1.name) + " for " + firstDts_1.name + ":: All output files: " + JSON.stringify(emitOutput_1.outputFiles.map(function (f) { return f.name; })); });
98304
98600
  latestSignature = (computeHash || ts.generateDjb2Hash)(firstDts_1.text);
98305
98601
  if (exportedModulesMapCache && latestSignature !== prevSignature) {
98306
98602
  updateExportedModules(sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
@@ -98613,7 +98909,7 @@ var ts;
98613
98909
  function assertSourceFileOkWithoutNextAffectedCall(state, sourceFile) {
98614
98910
  ts.Debug.assert(!sourceFile || !state.affectedFiles || state.affectedFiles[state.affectedFilesIndex - 1] !== sourceFile || !state.semanticDiagnosticsPerFile.has(sourceFile.resolvedPath));
98615
98911
  }
98616
- function getNextAffectedFile(state, cancellationToken, computeHash) {
98912
+ function getNextAffectedFile(state, cancellationToken, computeHash, host) {
98617
98913
  while (true) {
98618
98914
  var affectedFiles = state.affectedFiles;
98619
98915
  if (affectedFiles) {
@@ -98623,7 +98919,7 @@ var ts;
98623
98919
  var affectedFile = affectedFiles[affectedFilesIndex];
98624
98920
  if (!seenAffectedFiles.has(affectedFile.resolvedPath)) {
98625
98921
  state.affectedFilesIndex = affectedFilesIndex;
98626
- handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash);
98922
+ handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
98627
98923
  return affectedFile;
98628
98924
  }
98629
98925
  affectedFilesIndex++;
@@ -98657,6 +98953,11 @@ var ts;
98657
98953
  state.seenAffectedFiles = new ts.Set();
98658
98954
  }
98659
98955
  }
98956
+ function clearAffectedFilesPendingEmit(state) {
98957
+ state.affectedFilesPendingEmit = undefined;
98958
+ state.affectedFilesPendingEmitKind = undefined;
98959
+ state.affectedFilesPendingEmitIndex = undefined;
98960
+ }
98660
98961
  function getNextAffectedFilePendingEmit(state) {
98661
98962
  var affectedFilesPendingEmit = state.affectedFilesPendingEmit;
98662
98963
  if (affectedFilesPendingEmit) {
@@ -98672,13 +98973,11 @@ var ts;
98672
98973
  }
98673
98974
  }
98674
98975
  }
98675
- state.affectedFilesPendingEmit = undefined;
98676
- state.affectedFilesPendingEmitKind = undefined;
98677
- state.affectedFilesPendingEmitIndex = undefined;
98976
+ clearAffectedFilesPendingEmit(state);
98678
98977
  }
98679
98978
  return undefined;
98680
98979
  }
98681
- function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash) {
98980
+ function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
98682
98981
  var _a;
98683
98982
  removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
98684
98983
  if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
@@ -98699,16 +98998,16 @@ var ts;
98699
98998
  ts.Debug.assert(state.hasCalledUpdateShapeSignature.has(affectedFile.resolvedPath) || ((_a = state.currentAffectedFilesSignatures) === null || _a === void 0 ? void 0 : _a.has(affectedFile.resolvedPath)), "Signature not updated for affected file: " + affectedFile.fileName);
98700
98999
  }
98701
99000
  if (!state.compilerOptions.assumeChangesOnlyAffectDirectDependencies) {
98702
- forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, function (state, path) { return handleDtsMayChangeOf(state, path, cancellationToken, computeHash); });
99001
+ forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, function (state, path) { return handleDtsMayChangeOf(state, path, cancellationToken, computeHash, host); });
98703
99002
  }
98704
99003
  }
98705
- function handleDtsMayChangeOf(state, path, cancellationToken, computeHash) {
99004
+ function handleDtsMayChangeOf(state, path, cancellationToken, computeHash, host) {
98706
99005
  removeSemanticDiagnosticsOf(state, path);
98707
99006
  if (!state.changedFilesSet.has(path)) {
98708
99007
  var program = ts.Debug.checkDefined(state.program);
98709
99008
  var sourceFile = program.getSourceFileByPath(path);
98710
99009
  if (sourceFile) {
98711
- ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap, true);
99010
+ ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap, !host.disableUseFileVersionAsSignature);
98712
99011
  if (ts.getEmitDeclarations(state.compilerOptions)) {
98713
99012
  addToAffectedFilesPendingEmit(state, path, 0);
98714
99013
  }
@@ -98853,8 +99152,8 @@ var ts;
98853
99152
  var signature = state.currentAffectedFilesSignatures && state.currentAffectedFilesSignatures.get(key);
98854
99153
  var actualSignature = signature !== null && signature !== void 0 ? signature : value.signature;
98855
99154
  return value.version === actualSignature ?
98856
- value.affectsGlobalScope ?
98857
- { version: value.version, signature: undefined, affectsGlobalScope: true, impliedFormat: value.impliedFormat } :
99155
+ value.affectsGlobalScope || value.impliedFormat ?
99156
+ { version: value.version, signature: undefined, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
98858
99157
  value.version :
98859
99158
  actualSignature !== undefined ?
98860
99159
  signature === undefined ?
@@ -99087,7 +99386,7 @@ var ts;
99087
99386
  return ts.emitSkippedWithNoDiagnostics;
99088
99387
  }
99089
99388
  function emitNextAffectedFile(writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
99090
- var affected = getNextAffectedFile(state, cancellationToken, computeHash);
99389
+ var affected = getNextAffectedFile(state, cancellationToken, computeHash, host);
99091
99390
  var emitKind = 1;
99092
99391
  var isPendingEmitFile = false;
99093
99392
  if (!affected) {
@@ -99113,55 +99412,49 @@ var ts;
99113
99412
  return toAffectedFileEmitResult(state, ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles || emitKind === 0, customTransformers), affected, emitKind, isPendingEmitFile);
99114
99413
  }
99115
99414
  function emit(targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
99116
- var restorePendingEmitOnHandlingNoEmitSuccess = false;
99117
- var savedAffectedFilesPendingEmit;
99118
- var savedAffectedFilesPendingEmitKind;
99119
- var savedAffectedFilesPendingEmitIndex;
99120
- if (kind !== BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram &&
99121
- !targetSourceFile &&
99122
- !ts.outFile(state.compilerOptions) &&
99123
- !state.compilerOptions.noEmit &&
99124
- state.compilerOptions.noEmitOnError) {
99125
- restorePendingEmitOnHandlingNoEmitSuccess = true;
99126
- savedAffectedFilesPendingEmit = state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice();
99127
- savedAffectedFilesPendingEmitKind = state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind);
99128
- savedAffectedFilesPendingEmitIndex = state.affectedFilesPendingEmitIndex;
99129
- }
99415
+ var _a;
99130
99416
  if (kind === BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram) {
99131
99417
  assertSourceFileOkWithoutNextAffectedCall(state, targetSourceFile);
99132
99418
  }
99133
99419
  var result = ts.handleNoEmitOptions(builderProgram, targetSourceFile, writeFile, cancellationToken);
99134
99420
  if (result)
99135
99421
  return result;
99136
- if (restorePendingEmitOnHandlingNoEmitSuccess) {
99137
- state.affectedFilesPendingEmit = savedAffectedFilesPendingEmit;
99138
- state.affectedFilesPendingEmitKind = savedAffectedFilesPendingEmitKind;
99139
- state.affectedFilesPendingEmitIndex = savedAffectedFilesPendingEmitIndex;
99140
- }
99141
- if (!targetSourceFile && kind === BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram) {
99142
- var sourceMaps = [];
99143
- var emitSkipped = false;
99144
- var diagnostics = void 0;
99145
- var emittedFiles = [];
99146
- var affectedEmitResult = void 0;
99147
- while (affectedEmitResult = emitNextAffectedFile(writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers)) {
99148
- emitSkipped = emitSkipped || affectedEmitResult.result.emitSkipped;
99149
- diagnostics = ts.addRange(diagnostics, affectedEmitResult.result.diagnostics);
99150
- emittedFiles = ts.addRange(emittedFiles, affectedEmitResult.result.emittedFiles);
99151
- sourceMaps = ts.addRange(sourceMaps, affectedEmitResult.result.sourceMaps);
99422
+ if (!targetSourceFile) {
99423
+ if (kind === BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram) {
99424
+ var sourceMaps = [];
99425
+ var emitSkipped = false;
99426
+ var diagnostics = void 0;
99427
+ var emittedFiles = [];
99428
+ var affectedEmitResult = void 0;
99429
+ while (affectedEmitResult = emitNextAffectedFile(writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers)) {
99430
+ emitSkipped = emitSkipped || affectedEmitResult.result.emitSkipped;
99431
+ diagnostics = ts.addRange(diagnostics, affectedEmitResult.result.diagnostics);
99432
+ emittedFiles = ts.addRange(emittedFiles, affectedEmitResult.result.emittedFiles);
99433
+ sourceMaps = ts.addRange(sourceMaps, affectedEmitResult.result.sourceMaps);
99434
+ }
99435
+ return {
99436
+ emitSkipped: emitSkipped,
99437
+ diagnostics: diagnostics || ts.emptyArray,
99438
+ emittedFiles: emittedFiles,
99439
+ sourceMaps: sourceMaps
99440
+ };
99441
+ }
99442
+ else if ((_a = state.affectedFilesPendingEmitKind) === null || _a === void 0 ? void 0 : _a.size) {
99443
+ ts.Debug.assert(kind === BuilderProgramKind.SemanticDiagnosticsBuilderProgram);
99444
+ if (!emitOnlyDtsFiles
99445
+ || ts.every(state.affectedFilesPendingEmit, function (path, index) {
99446
+ return index < state.affectedFilesPendingEmitIndex ||
99447
+ state.affectedFilesPendingEmitKind.get(path) === 0;
99448
+ })) {
99449
+ clearAffectedFilesPendingEmit(state);
99450
+ }
99152
99451
  }
99153
- return {
99154
- emitSkipped: emitSkipped,
99155
- diagnostics: diagnostics || ts.emptyArray,
99156
- emittedFiles: emittedFiles,
99157
- sourceMaps: sourceMaps
99158
- };
99159
99452
  }
99160
99453
  return ts.Debug.checkDefined(state.program).emit(targetSourceFile, writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
99161
99454
  }
99162
99455
  function getSemanticDiagnosticsOfNextAffectedFile(cancellationToken, ignoreSourceFile) {
99163
99456
  while (true) {
99164
- var affected = getNextAffectedFile(state, cancellationToken, computeHash);
99457
+ var affected = getNextAffectedFile(state, cancellationToken, computeHash, host);
99165
99458
  if (!affected) {
99166
99459
  return undefined;
99167
99460
  }
@@ -101916,9 +102209,6 @@ var ts;
101916
102209
  function newer(date1, date2) {
101917
102210
  return date2 > date1 ? date2 : date1;
101918
102211
  }
101919
- function isDeclarationFile(fileName) {
101920
- return ts.fileExtensionIs(fileName, ".d.ts");
101921
- }
101922
102212
  function isCircularBuildOrder(buildOrder) {
101923
102213
  return !!buildOrder && !!buildOrder.buildOrder;
101924
102214
  }
@@ -102456,7 +102746,7 @@ var ts;
102456
102746
  outputFiles.forEach(function (_a) {
102457
102747
  var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
102458
102748
  var priorChangeTime;
102459
- if (!anyDtsChanged && isDeclarationFile(name)) {
102749
+ if (!anyDtsChanged && ts.isDeclarationFileName(name)) {
102460
102750
  if (host.fileExists(name) && state.readFileWithCache(name) === text) {
102461
102751
  priorChangeTime = host.getModifiedTime(name);
102462
102752
  }
@@ -102772,7 +103062,7 @@ var ts;
102772
103062
  newestOutputFileTime = outputTime;
102773
103063
  newestOutputFileName = output;
102774
103064
  }
102775
- if (isDeclarationFile(output)) {
103065
+ if (ts.isDeclarationFileName(output)) {
102776
103066
  var outputModifiedTime = ts.getModifiedTime(host, output);
102777
103067
  newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, outputModifiedTime);
102778
103068
  }
@@ -102912,7 +103202,7 @@ var ts;
102912
103202
  reportVerbose = false;
102913
103203
  reportStatus(state, verboseMessage, proj.options.configFilePath);
102914
103204
  }
102915
- if (isDeclarationFile(file)) {
103205
+ if (ts.isDeclarationFileName(file)) {
102916
103206
  priorNewestUpdateTime = newer(priorNewestUpdateTime, ts.getModifiedTime(host, file));
102917
103207
  }
102918
103208
  host.setModifiedTime(file, now);