typescript 4.6.0-dev.20211102 → 4.6.0-dev.20211106

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/tsserver.js CHANGED
@@ -100,7 +100,7 @@ var ts;
100
100
  // The following is baselined as a literal template type without intervention
101
101
  /** The version of the TypeScript compiler release */
102
102
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
103
- ts.version = ts.versionMajorMinor + ".0-dev.20211102";
103
+ ts.version = ts.versionMajorMinor + ".0-dev.20211106";
104
104
  /* @internal */
105
105
  var Comparison;
106
106
  (function (Comparison) {
@@ -4800,6 +4800,7 @@ var ts;
4800
4800
  NodeCheckFlags[NodeCheckFlags["ConstructorReferenceInClass"] = 33554432] = "ConstructorReferenceInClass";
4801
4801
  NodeCheckFlags[NodeCheckFlags["ContainsClassWithPrivateIdentifiers"] = 67108864] = "ContainsClassWithPrivateIdentifiers";
4802
4802
  NodeCheckFlags[NodeCheckFlags["ContainsSuperPropertyInStaticInitializer"] = 134217728] = "ContainsSuperPropertyInStaticInitializer";
4803
+ NodeCheckFlags[NodeCheckFlags["InCheckIdentifier"] = 268435456] = "InCheckIdentifier";
4803
4804
  })(NodeCheckFlags = ts.NodeCheckFlags || (ts.NodeCheckFlags = {}));
4804
4805
  var TypeFlags;
4805
4806
  (function (TypeFlags) {
@@ -4873,8 +4874,6 @@ var ts;
4873
4874
  // 'Narrowable' types are types where narrowing actually narrows.
4874
4875
  // This *should* be every type other than null, undefined, void, and never
4875
4876
  TypeFlags[TypeFlags["Narrowable"] = 536624127] = "Narrowable";
4876
- /* @internal */
4877
- TypeFlags[TypeFlags["NotPrimitiveUnion"] = 468598819] = "NotPrimitiveUnion";
4878
4877
  // The following flags are aggregated during union and intersection type construction
4879
4878
  /* @internal */
4880
4879
  TypeFlags[TypeFlags["IncludesMask"] = 205258751] = "IncludesMask";
@@ -4887,6 +4886,10 @@ var ts;
4887
4886
  TypeFlags[TypeFlags["IncludesWildcard"] = 8388608] = "IncludesWildcard";
4888
4887
  /* @internal */
4889
4888
  TypeFlags[TypeFlags["IncludesEmptyObject"] = 16777216] = "IncludesEmptyObject";
4889
+ /* @internal */
4890
+ TypeFlags[TypeFlags["IncludesInstantiable"] = 33554432] = "IncludesInstantiable";
4891
+ /* @internal */
4892
+ TypeFlags[TypeFlags["NotPrimitiveUnion"] = 36323363] = "NotPrimitiveUnion";
4890
4893
  })(TypeFlags = ts.TypeFlags || (ts.TypeFlags = {}));
4891
4894
  // Types included in TypeFlags.ObjectFlagsType have an objectFlags property. Some ObjectFlags
4892
4895
  // are specific to certain types and reuse the same bit position. Those ObjectFlags require a check
@@ -5220,6 +5223,7 @@ var ts;
5220
5223
  ScriptTarget[ScriptTarget["ES2019"] = 6] = "ES2019";
5221
5224
  ScriptTarget[ScriptTarget["ES2020"] = 7] = "ES2020";
5222
5225
  ScriptTarget[ScriptTarget["ES2021"] = 8] = "ES2021";
5226
+ ScriptTarget[ScriptTarget["ES2022"] = 9] = "ES2022";
5223
5227
  ScriptTarget[ScriptTarget["ESNext"] = 99] = "ESNext";
5224
5228
  ScriptTarget[ScriptTarget["JSON"] = 100] = "JSON";
5225
5229
  ScriptTarget[ScriptTarget["Latest"] = 99] = "Latest";
@@ -5388,15 +5392,16 @@ var ts;
5388
5392
  TransformFlags[TransformFlags["ContainsTypeScript"] = 1] = "ContainsTypeScript";
5389
5393
  TransformFlags[TransformFlags["ContainsJsx"] = 2] = "ContainsJsx";
5390
5394
  TransformFlags[TransformFlags["ContainsESNext"] = 4] = "ContainsESNext";
5391
- TransformFlags[TransformFlags["ContainsES2021"] = 8] = "ContainsES2021";
5392
- TransformFlags[TransformFlags["ContainsES2020"] = 16] = "ContainsES2020";
5393
- TransformFlags[TransformFlags["ContainsES2019"] = 32] = "ContainsES2019";
5394
- TransformFlags[TransformFlags["ContainsES2018"] = 64] = "ContainsES2018";
5395
- TransformFlags[TransformFlags["ContainsES2017"] = 128] = "ContainsES2017";
5396
- TransformFlags[TransformFlags["ContainsES2016"] = 256] = "ContainsES2016";
5397
- TransformFlags[TransformFlags["ContainsES2015"] = 512] = "ContainsES2015";
5398
- TransformFlags[TransformFlags["ContainsGenerator"] = 1024] = "ContainsGenerator";
5399
- TransformFlags[TransformFlags["ContainsDestructuringAssignment"] = 2048] = "ContainsDestructuringAssignment";
5395
+ TransformFlags[TransformFlags["ContainsES2022"] = 8] = "ContainsES2022";
5396
+ TransformFlags[TransformFlags["ContainsES2021"] = 16] = "ContainsES2021";
5397
+ TransformFlags[TransformFlags["ContainsES2020"] = 32] = "ContainsES2020";
5398
+ TransformFlags[TransformFlags["ContainsES2019"] = 64] = "ContainsES2019";
5399
+ TransformFlags[TransformFlags["ContainsES2018"] = 128] = "ContainsES2018";
5400
+ TransformFlags[TransformFlags["ContainsES2017"] = 256] = "ContainsES2017";
5401
+ TransformFlags[TransformFlags["ContainsES2016"] = 512] = "ContainsES2016";
5402
+ TransformFlags[TransformFlags["ContainsES2015"] = 1024] = "ContainsES2015";
5403
+ TransformFlags[TransformFlags["ContainsGenerator"] = 2048] = "ContainsGenerator";
5404
+ TransformFlags[TransformFlags["ContainsDestructuringAssignment"] = 4096] = "ContainsDestructuringAssignment";
5400
5405
  // Markers
5401
5406
  // - Flags used to indicate that a subtree contains a specific transformation.
5402
5407
  TransformFlags[TransformFlags["ContainsTypeScriptClassSyntax"] = 4096] = "ContainsTypeScriptClassSyntax";
@@ -5423,15 +5428,16 @@ var ts;
5423
5428
  TransformFlags[TransformFlags["AssertTypeScript"] = 1] = "AssertTypeScript";
5424
5429
  TransformFlags[TransformFlags["AssertJsx"] = 2] = "AssertJsx";
5425
5430
  TransformFlags[TransformFlags["AssertESNext"] = 4] = "AssertESNext";
5426
- TransformFlags[TransformFlags["AssertES2021"] = 8] = "AssertES2021";
5427
- TransformFlags[TransformFlags["AssertES2020"] = 16] = "AssertES2020";
5428
- TransformFlags[TransformFlags["AssertES2019"] = 32] = "AssertES2019";
5429
- TransformFlags[TransformFlags["AssertES2018"] = 64] = "AssertES2018";
5430
- TransformFlags[TransformFlags["AssertES2017"] = 128] = "AssertES2017";
5431
- TransformFlags[TransformFlags["AssertES2016"] = 256] = "AssertES2016";
5432
- TransformFlags[TransformFlags["AssertES2015"] = 512] = "AssertES2015";
5433
- TransformFlags[TransformFlags["AssertGenerator"] = 1024] = "AssertGenerator";
5434
- TransformFlags[TransformFlags["AssertDestructuringAssignment"] = 2048] = "AssertDestructuringAssignment";
5431
+ TransformFlags[TransformFlags["AssertES2022"] = 8] = "AssertES2022";
5432
+ TransformFlags[TransformFlags["AssertES2021"] = 16] = "AssertES2021";
5433
+ TransformFlags[TransformFlags["AssertES2020"] = 32] = "AssertES2020";
5434
+ TransformFlags[TransformFlags["AssertES2019"] = 64] = "AssertES2019";
5435
+ TransformFlags[TransformFlags["AssertES2018"] = 128] = "AssertES2018";
5436
+ TransformFlags[TransformFlags["AssertES2017"] = 256] = "AssertES2017";
5437
+ TransformFlags[TransformFlags["AssertES2016"] = 512] = "AssertES2016";
5438
+ TransformFlags[TransformFlags["AssertES2015"] = 1024] = "AssertES2015";
5439
+ TransformFlags[TransformFlags["AssertGenerator"] = 2048] = "AssertGenerator";
5440
+ TransformFlags[TransformFlags["AssertDestructuringAssignment"] = 4096] = "AssertDestructuringAssignment";
5435
5441
  // Scope Exclusions
5436
5442
  // - Bitmasks that exclude flags from propagating out of a specific context
5437
5443
  // into the subtree flags of their container.
@@ -8101,7 +8107,7 @@ var ts;
8101
8107
  Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1321, ts.DiagnosticCategory.Error, "Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_cal_1321", "Type of 'yield' operand in an async generator must either be a valid promise or must not contain a callable 'then' member."),
8102
8108
  Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1322, ts.DiagnosticCategory.Error, "Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_con_1322", "Type of iterated elements of a 'yield*' operand must either be a valid promise or must not contain a callable 'then' member."),
8103
8109
  Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd_system_umd_node12_or_nodenext: diag(1323, ts.DiagnosticCategory.Error, "Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd__1323", "Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'."),
8104
- Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext: diag(1324, ts.DiagnosticCategory.Error, "Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_1324", "Dynamic imports only support a second argument when the '--module' option is set to 'esnext'."),
8110
+ Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_or_nodenext: diag(1324, ts.DiagnosticCategory.Error, "Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_or_nodenext_1324", "Dynamic imports only support a second argument when the '--module' option is set to 'esnext' or 'nodenext'."),
8105
8111
  Argument_of_dynamic_import_cannot_be_spread_element: diag(1325, ts.DiagnosticCategory.Error, "Argument_of_dynamic_import_cannot_be_spread_element_1325", "Argument of dynamic import cannot be spread element."),
8106
8112
  Dynamic_import_cannot_have_type_arguments: diag(1326, ts.DiagnosticCategory.Error, "Dynamic_import_cannot_have_type_arguments_1326", "Dynamic import cannot have type arguments."),
8107
8113
  String_literal_with_double_quotes_expected: diag(1327, ts.DiagnosticCategory.Error, "String_literal_with_double_quotes_expected_1327", "String literal with double quotes expected."),
@@ -8701,11 +8707,12 @@ var ts;
8701
8707
  Duplicate_identifier_0_Compiler_reserves_name_1_when_emitting_super_references_in_static_initializers: diag(2818, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_Compiler_reserves_name_1_when_emitting_super_references_in_static_initializer_2818", "Duplicate identifier '{0}'. Compiler reserves name '{1}' when emitting 'super' references in static initializers."),
8702
8708
  Namespace_name_cannot_be_0: diag(2819, ts.DiagnosticCategory.Error, "Namespace_name_cannot_be_0_2819", "Namespace name cannot be '{0}'."),
8703
8709
  Type_0_is_not_assignable_to_type_1_Did_you_mean_2: diag(2820, ts.DiagnosticCategory.Error, "Type_0_is_not_assignable_to_type_1_Did_you_mean_2_2820", "Type '{0}' is not assignable to type '{1}'. Did you mean '{2}'?"),
8704
- Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext: diag(2821, ts.DiagnosticCategory.Error, "Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_2821", "Import assertions are only supported when the '--module' option is set to 'esnext'."),
8710
+ Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext: diag(2821, ts.DiagnosticCategory.Error, "Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext_2821", "Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'."),
8705
8711
  Import_assertions_cannot_be_used_with_type_only_imports_or_exports: diag(2822, ts.DiagnosticCategory.Error, "Import_assertions_cannot_be_used_with_type_only_imports_or_exports_2822", "Import assertions cannot be used with type-only imports or exports."),
8706
8712
  Cannot_find_namespace_0_Did_you_mean_1: diag(2833, ts.DiagnosticCategory.Error, "Cannot_find_namespace_0_Did_you_mean_1_2833", "Cannot find namespace '{0}'. Did you mean '{1}'?"),
8707
8713
  Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node12_or_nodenext_Consider_adding_an_extension_to_the_import_path: diag(2834, ts.DiagnosticCategory.Error, "Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2834", "Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Consider adding an extension to the import path."),
8708
8714
  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}'?"),
8715
+ 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."),
8709
8716
  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}'."),
8710
8717
  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}'."),
8711
8718
  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}'."),
@@ -11732,6 +11739,7 @@ var ts;
11732
11739
  tokenValue = tokenValue.slice(0, -1);
11733
11740
  pos--;
11734
11741
  }
11742
+ return getIdentifierToken();
11735
11743
  }
11736
11744
  return token;
11737
11745
  }
@@ -11977,6 +11985,8 @@ var ts;
11977
11985
  switch (ts.getEmitScriptTarget(options)) {
11978
11986
  case 99 /* ESNext */:
11979
11987
  return "lib.esnext.full.d.ts";
11988
+ case 9 /* ES2022 */:
11989
+ return "lib.es2022.full.d.ts";
11980
11990
  case 8 /* ES2021 */:
11981
11991
  return "lib.es2021.full.d.ts";
11982
11992
  case 7 /* ES2020 */:
@@ -14443,6 +14453,7 @@ var ts;
14443
14453
  AsyncIterableIterator: ts.emptyArray,
14444
14454
  AsyncGenerator: ts.emptyArray,
14445
14455
  AsyncGeneratorFunction: ts.emptyArray,
14456
+ NumberFormat: ["formatToParts"]
14446
14457
  },
14447
14458
  es2019: {
14448
14459
  Array: ["flat", "flatMap"],
@@ -14464,8 +14475,21 @@ var ts;
14464
14475
  PromiseConstructor: ["any"],
14465
14476
  String: ["replaceAll"]
14466
14477
  },
14467
- esnext: {
14468
- NumberFormat: ["formatToParts"]
14478
+ es2022: {
14479
+ Array: ["at"],
14480
+ String: ["at"],
14481
+ Int8Array: ["at"],
14482
+ Uint8Array: ["at"],
14483
+ Uint8ClampedArray: ["at"],
14484
+ Int16Array: ["at"],
14485
+ Uint16Array: ["at"],
14486
+ Int32Array: ["at"],
14487
+ Uint32Array: ["at"],
14488
+ Float32Array: ["at"],
14489
+ Float64Array: ["at"],
14490
+ BigInt64Array: ["at"],
14491
+ BigUint64Array: ["at"],
14492
+ ObjectConstructor: ["hasOwn"]
14469
14493
  }
14470
14494
  };
14471
14495
  }
@@ -22005,7 +22029,7 @@ var ts;
22005
22029
  var node = createBaseLiteral(8 /* NumericLiteral */, typeof value === "number" ? value + "" : value);
22006
22030
  node.numericLiteralFlags = numericLiteralFlags;
22007
22031
  if (numericLiteralFlags & 384 /* BinaryOrOctalSpecifier */)
22008
- node.transformFlags |= 512 /* ContainsES2015 */;
22032
+ node.transformFlags |= 1024 /* ContainsES2015 */;
22009
22033
  return node;
22010
22034
  }
22011
22035
  // @api
@@ -22024,7 +22048,7 @@ var ts;
22024
22048
  var node = createBaseStringLiteral(text, isSingleQuote);
22025
22049
  node.hasExtendedUnicodeEscape = hasExtendedUnicodeEscape;
22026
22050
  if (hasExtendedUnicodeEscape)
22027
- node.transformFlags |= 512 /* ContainsES2015 */;
22051
+ node.transformFlags |= 1024 /* ContainsES2015 */;
22028
22052
  return node;
22029
22053
  }
22030
22054
  // @api
@@ -22152,8 +22176,8 @@ var ts;
22152
22176
  case 131 /* AsyncKeyword */:
22153
22177
  // 'async' modifier is ES2017 (async functions) or ES2018 (async generators)
22154
22178
  transformFlags =
22155
- 128 /* ContainsES2017 */ |
22156
- 64 /* ContainsES2018 */;
22179
+ 256 /* ContainsES2017 */ |
22180
+ 128 /* ContainsES2018 */;
22157
22181
  break;
22158
22182
  case 123 /* PublicKeyword */:
22159
22183
  case 121 /* PrivateKeyword */:
@@ -22177,10 +22201,10 @@ var ts;
22177
22201
  transformFlags = 1 /* ContainsTypeScript */;
22178
22202
  break;
22179
22203
  case 106 /* SuperKeyword */:
22180
- transformFlags = 512 /* ContainsES2015 */ | 33554432 /* ContainsLexicalSuper */;
22204
+ transformFlags = 1024 /* ContainsES2015 */ | 33554432 /* ContainsLexicalSuper */;
22181
22205
  break;
22182
22206
  case 124 /* StaticKeyword */:
22183
- transformFlags = 512 /* ContainsES2015 */;
22207
+ transformFlags = 1024 /* ContainsES2015 */;
22184
22208
  break;
22185
22209
  case 108 /* ThisKeyword */:
22186
22210
  // 'this' indicates a lexical 'this'
@@ -22277,7 +22301,7 @@ var ts;
22277
22301
  node.expression = parenthesizerRules().parenthesizeExpressionOfComputedPropertyName(expression);
22278
22302
  node.transformFlags |=
22279
22303
  propagateChildFlags(node.expression) |
22280
- 512 /* ContainsES2015 */ |
22304
+ 1024 /* ContainsES2015 */ |
22281
22305
  65536 /* ContainsComputedPropertyName */;
22282
22306
  return node;
22283
22307
  }
@@ -22325,7 +22349,7 @@ var ts;
22325
22349
  if (ts.modifiersToFlags(node.modifiers) & 16476 /* ParameterPropertyModifier */)
22326
22350
  node.transformFlags |= 4096 /* ContainsTypeScriptClassSyntax */;
22327
22351
  if (initializer || dotDotDotToken)
22328
- node.transformFlags |= 512 /* ContainsES2015 */;
22352
+ node.transformFlags |= 1024 /* ContainsES2015 */;
22329
22353
  }
22330
22354
  return node;
22331
22355
  }
@@ -22434,20 +22458,20 @@ var ts;
22434
22458
  node.transformFlags |=
22435
22459
  propagateChildFlags(node.asteriskToken) |
22436
22460
  propagateChildFlags(node.questionToken) |
22437
- 512 /* ContainsES2015 */;
22461
+ 1024 /* ContainsES2015 */;
22438
22462
  if (questionToken) {
22439
22463
  node.transformFlags |= 1 /* ContainsTypeScript */;
22440
22464
  }
22441
22465
  if (ts.modifiersToFlags(node.modifiers) & 256 /* Async */) {
22442
22466
  if (asteriskToken) {
22443
- node.transformFlags |= 64 /* ContainsES2018 */;
22467
+ node.transformFlags |= 128 /* ContainsES2018 */;
22444
22468
  }
22445
22469
  else {
22446
- node.transformFlags |= 128 /* ContainsES2017 */;
22470
+ node.transformFlags |= 256 /* ContainsES2017 */;
22447
22471
  }
22448
22472
  }
22449
22473
  else if (asteriskToken) {
22450
- node.transformFlags |= 1024 /* ContainsGenerator */;
22474
+ node.transformFlags |= 2048 /* ContainsGenerator */;
22451
22475
  }
22452
22476
  return node;
22453
22477
  }
@@ -22488,7 +22512,7 @@ var ts;
22488
22512
  /*name*/ undefined,
22489
22513
  /*typeParameters*/ undefined, parameters,
22490
22514
  /*type*/ undefined, body);
22491
- node.transformFlags |= 512 /* ContainsES2015 */;
22515
+ node.transformFlags |= 1024 /* ContainsES2015 */;
22492
22516
  return node;
22493
22517
  }
22494
22518
  // @api
@@ -22982,11 +23006,11 @@ var ts;
22982
23006
  node.elements = createNodeArray(elements);
22983
23007
  node.transformFlags |=
22984
23008
  propagateChildrenFlags(node.elements) |
22985
- 512 /* ContainsES2015 */ |
23009
+ 1024 /* ContainsES2015 */ |
22986
23010
  262144 /* ContainsBindingPattern */;
22987
23011
  if (node.transformFlags & 16384 /* ContainsRestOrSpread */) {
22988
23012
  node.transformFlags |=
22989
- 64 /* ContainsES2018 */ |
23013
+ 128 /* ContainsES2018 */ |
22990
23014
  32768 /* ContainsObjectRestOrSpread */;
22991
23015
  }
22992
23016
  return node;
@@ -23003,7 +23027,7 @@ var ts;
23003
23027
  node.elements = createNodeArray(elements);
23004
23028
  node.transformFlags |=
23005
23029
  propagateChildrenFlags(node.elements) |
23006
- 512 /* ContainsES2015 */ |
23030
+ 1024 /* ContainsES2015 */ |
23007
23031
  262144 /* ContainsBindingPattern */;
23008
23032
  return node;
23009
23033
  }
@@ -23022,7 +23046,7 @@ var ts;
23022
23046
  node.dotDotDotToken = dotDotDotToken;
23023
23047
  node.transformFlags |=
23024
23048
  propagateChildFlags(node.dotDotDotToken) |
23025
- 512 /* ContainsES2015 */;
23049
+ 1024 /* ContainsES2015 */;
23026
23050
  if (node.propertyName) {
23027
23051
  node.transformFlags |= ts.isIdentifier(node.propertyName) ?
23028
23052
  propagateIdentifierNameFlags(node.propertyName) :
@@ -23096,8 +23120,8 @@ var ts;
23096
23120
  // super method calls require a lexical 'this'
23097
23121
  // super method calls require 'super' hoisting in ES2017 and ES2018 async functions and async generators
23098
23122
  node.transformFlags |=
23099
- 128 /* ContainsES2017 */ |
23100
- 64 /* ContainsES2018 */;
23123
+ 256 /* ContainsES2017 */ |
23124
+ 128 /* ContainsES2018 */;
23101
23125
  }
23102
23126
  return node;
23103
23127
  }
@@ -23119,7 +23143,7 @@ var ts;
23119
23143
  node.questionDotToken = questionDotToken;
23120
23144
  node.name = asName(name);
23121
23145
  node.transformFlags |=
23122
- 16 /* ContainsES2020 */ |
23146
+ 32 /* ContainsES2020 */ |
23123
23147
  propagateChildFlags(node.expression) |
23124
23148
  propagateChildFlags(node.questionDotToken) |
23125
23149
  (ts.isIdentifier(node.name) ?
@@ -23150,8 +23174,8 @@ var ts;
23150
23174
  // super method calls require a lexical 'this'
23151
23175
  // super method calls require 'super' hoisting in ES2017 and ES2018 async functions and async generators
23152
23176
  node.transformFlags |=
23153
- 128 /* ContainsES2017 */ |
23154
- 64 /* ContainsES2018 */;
23177
+ 256 /* ContainsES2017 */ |
23178
+ 128 /* ContainsES2018 */;
23155
23179
  }
23156
23180
  return node;
23157
23181
  }
@@ -23176,7 +23200,7 @@ var ts;
23176
23200
  propagateChildFlags(node.expression) |
23177
23201
  propagateChildFlags(node.questionDotToken) |
23178
23202
  propagateChildFlags(node.argumentExpression) |
23179
- 16 /* ContainsES2020 */;
23203
+ 32 /* ContainsES2020 */;
23180
23204
  return node;
23181
23205
  }
23182
23206
  // @api
@@ -23235,7 +23259,7 @@ var ts;
23235
23259
  propagateChildFlags(node.questionDotToken) |
23236
23260
  propagateChildrenFlags(node.typeArguments) |
23237
23261
  propagateChildrenFlags(node.arguments) |
23238
- 16 /* ContainsES2020 */;
23262
+ 32 /* ContainsES2020 */;
23239
23263
  if (node.typeArguments) {
23240
23264
  node.transformFlags |= 1 /* ContainsTypeScript */;
23241
23265
  }
@@ -23264,7 +23288,7 @@ var ts;
23264
23288
  propagateChildFlags(node.expression) |
23265
23289
  propagateChildrenFlags(node.typeArguments) |
23266
23290
  propagateChildrenFlags(node.arguments) |
23267
- 16 /* ContainsES2020 */;
23291
+ 32 /* ContainsES2020 */;
23268
23292
  if (node.typeArguments) {
23269
23293
  node.transformFlags |= 1 /* ContainsTypeScript */;
23270
23294
  }
@@ -23288,12 +23312,12 @@ var ts;
23288
23312
  propagateChildFlags(node.tag) |
23289
23313
  propagateChildrenFlags(node.typeArguments) |
23290
23314
  propagateChildFlags(node.template) |
23291
- 512 /* ContainsES2015 */;
23315
+ 1024 /* ContainsES2015 */;
23292
23316
  if (node.typeArguments) {
23293
23317
  node.transformFlags |= 1 /* ContainsTypeScript */;
23294
23318
  }
23295
23319
  if (ts.hasInvalidEscape(node.template)) {
23296
- node.transformFlags |= 64 /* ContainsES2018 */;
23320
+ node.transformFlags |= 128 /* ContainsES2018 */;
23297
23321
  }
23298
23322
  return node;
23299
23323
  }
@@ -23347,14 +23371,14 @@ var ts;
23347
23371
  }
23348
23372
  if (ts.modifiersToFlags(node.modifiers) & 256 /* Async */) {
23349
23373
  if (node.asteriskToken) {
23350
- node.transformFlags |= 64 /* ContainsES2018 */;
23374
+ node.transformFlags |= 128 /* ContainsES2018 */;
23351
23375
  }
23352
23376
  else {
23353
- node.transformFlags |= 128 /* ContainsES2017 */;
23377
+ node.transformFlags |= 256 /* ContainsES2017 */;
23354
23378
  }
23355
23379
  }
23356
23380
  else if (node.asteriskToken) {
23357
- node.transformFlags |= 1024 /* ContainsGenerator */;
23381
+ node.transformFlags |= 2048 /* ContainsGenerator */;
23358
23382
  }
23359
23383
  return node;
23360
23384
  }
@@ -23378,9 +23402,9 @@ var ts;
23378
23402
  node.equalsGreaterThanToken = equalsGreaterThanToken !== null && equalsGreaterThanToken !== void 0 ? equalsGreaterThanToken : createToken(38 /* EqualsGreaterThanToken */);
23379
23403
  node.transformFlags |=
23380
23404
  propagateChildFlags(node.equalsGreaterThanToken) |
23381
- 512 /* ContainsES2015 */;
23405
+ 1024 /* ContainsES2015 */;
23382
23406
  if (ts.modifiersToFlags(node.modifiers) & 256 /* Async */) {
23383
- node.transformFlags |= 128 /* ContainsES2017 */ | 8192 /* ContainsLexicalThis */;
23407
+ node.transformFlags |= 256 /* ContainsES2017 */ | 8192 /* ContainsLexicalThis */;
23384
23408
  }
23385
23409
  return node;
23386
23410
  }
@@ -23440,8 +23464,8 @@ var ts;
23440
23464
  node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression);
23441
23465
  node.transformFlags |=
23442
23466
  propagateChildFlags(node.expression) |
23443
- 128 /* ContainsES2017 */ |
23444
- 64 /* ContainsES2018 */ |
23467
+ 256 /* ContainsES2017 */ |
23468
+ 128 /* ContainsES2018 */ |
23445
23469
  1048576 /* ContainsAwait */;
23446
23470
  return node;
23447
23471
  }
@@ -23507,35 +23531,35 @@ var ts;
23507
23531
  propagateChildFlags(node.operatorToken) |
23508
23532
  propagateChildFlags(node.right);
23509
23533
  if (operatorKind === 60 /* QuestionQuestionToken */) {
23510
- node.transformFlags |= 16 /* ContainsES2020 */;
23534
+ node.transformFlags |= 32 /* ContainsES2020 */;
23511
23535
  }
23512
23536
  else if (operatorKind === 63 /* EqualsToken */) {
23513
23537
  if (ts.isObjectLiteralExpression(node.left)) {
23514
23538
  node.transformFlags |=
23515
- 512 /* ContainsES2015 */ |
23516
- 64 /* ContainsES2018 */ |
23517
- 2048 /* ContainsDestructuringAssignment */ |
23539
+ 1024 /* ContainsES2015 */ |
23540
+ 128 /* ContainsES2018 */ |
23541
+ 4096 /* ContainsDestructuringAssignment */ |
23518
23542
  propagateAssignmentPatternFlags(node.left);
23519
23543
  }
23520
23544
  else if (ts.isArrayLiteralExpression(node.left)) {
23521
23545
  node.transformFlags |=
23522
- 512 /* ContainsES2015 */ |
23523
- 2048 /* ContainsDestructuringAssignment */ |
23546
+ 1024 /* ContainsES2015 */ |
23547
+ 4096 /* ContainsDestructuringAssignment */ |
23524
23548
  propagateAssignmentPatternFlags(node.left);
23525
23549
  }
23526
23550
  }
23527
23551
  else if (operatorKind === 42 /* AsteriskAsteriskToken */ || operatorKind === 67 /* AsteriskAsteriskEqualsToken */) {
23528
- node.transformFlags |= 256 /* ContainsES2016 */;
23552
+ node.transformFlags |= 512 /* ContainsES2016 */;
23529
23553
  }
23530
23554
  else if (ts.isLogicalOrCoalescingAssignmentOperator(operatorKind)) {
23531
- node.transformFlags |= 8 /* ContainsES2021 */;
23555
+ node.transformFlags |= 16 /* ContainsES2021 */;
23532
23556
  }
23533
23557
  return node;
23534
23558
  }
23535
23559
  function propagateAssignmentPatternFlags(node) {
23536
23560
  if (node.transformFlags & 32768 /* ContainsObjectRestOrSpread */)
23537
23561
  return 32768 /* ContainsObjectRestOrSpread */;
23538
- if (node.transformFlags & 64 /* ContainsES2018 */) {
23562
+ if (node.transformFlags & 128 /* ContainsES2018 */) {
23539
23563
  // check for nested spread assignments, otherwise '{ x: { a, ...b } = foo } = c'
23540
23564
  // will not be correctly interpreted by the ES2018 transformer
23541
23565
  for (var _i = 0, _a = ts.getElementsOfBindingOrAssignmentPattern(node); _i < _a.length; _i++) {
@@ -23545,7 +23569,7 @@ var ts;
23545
23569
  if (target.transformFlags & 32768 /* ContainsObjectRestOrSpread */) {
23546
23570
  return 32768 /* ContainsObjectRestOrSpread */;
23547
23571
  }
23548
- if (target.transformFlags & 64 /* ContainsES2018 */) {
23572
+ if (target.transformFlags & 128 /* ContainsES2018 */) {
23549
23573
  var flags_1 = propagateAssignmentPatternFlags(target);
23550
23574
  if (flags_1)
23551
23575
  return flags_1;
@@ -23597,7 +23621,7 @@ var ts;
23597
23621
  node.transformFlags |=
23598
23622
  propagateChildFlags(node.head) |
23599
23623
  propagateChildrenFlags(node.templateSpans) |
23600
- 512 /* ContainsES2015 */;
23624
+ 1024 /* ContainsES2015 */;
23601
23625
  return node;
23602
23626
  }
23603
23627
  // @api
@@ -23636,9 +23660,9 @@ var ts;
23636
23660
  node.text = text;
23637
23661
  node.rawText = rawText;
23638
23662
  node.templateFlags = templateFlags & 2048 /* TemplateLiteralLikeFlags */;
23639
- node.transformFlags |= 512 /* ContainsES2015 */;
23663
+ node.transformFlags |= 1024 /* ContainsES2015 */;
23640
23664
  if (node.templateFlags) {
23641
- node.transformFlags |= 64 /* ContainsES2018 */;
23665
+ node.transformFlags |= 128 /* ContainsES2018 */;
23642
23666
  }
23643
23667
  return node;
23644
23668
  }
@@ -23667,8 +23691,8 @@ var ts;
23667
23691
  node.transformFlags |=
23668
23692
  propagateChildFlags(node.expression) |
23669
23693
  propagateChildFlags(node.asteriskToken) |
23670
- 512 /* ContainsES2015 */ |
23671
- 64 /* ContainsES2018 */ |
23694
+ 1024 /* ContainsES2015 */ |
23695
+ 128 /* ContainsES2018 */ |
23672
23696
  524288 /* ContainsYield */;
23673
23697
  return node;
23674
23698
  }
@@ -23685,7 +23709,7 @@ var ts;
23685
23709
  node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression);
23686
23710
  node.transformFlags |=
23687
23711
  propagateChildFlags(node.expression) |
23688
- 512 /* ContainsES2015 */ |
23712
+ 1024 /* ContainsES2015 */ |
23689
23713
  16384 /* ContainsRestOrSpread */;
23690
23714
  return node;
23691
23715
  }
@@ -23698,7 +23722,7 @@ var ts;
23698
23722
  // @api
23699
23723
  function createClassExpression(decorators, modifiers, name, typeParameters, heritageClauses, members) {
23700
23724
  var node = createBaseClassLikeDeclaration(225 /* ClassExpression */, decorators, modifiers, name, typeParameters, heritageClauses, members);
23701
- node.transformFlags |= 512 /* ContainsES2015 */;
23725
+ node.transformFlags |= 1024 /* ContainsES2015 */;
23702
23726
  return node;
23703
23727
  }
23704
23728
  // @api
@@ -23724,7 +23748,7 @@ var ts;
23724
23748
  node.transformFlags |=
23725
23749
  propagateChildFlags(node.expression) |
23726
23750
  propagateChildrenFlags(node.typeArguments) |
23727
- 512 /* ContainsES2015 */;
23751
+ 1024 /* ContainsES2015 */;
23728
23752
  return node;
23729
23753
  }
23730
23754
  // @api
@@ -23795,7 +23819,7 @@ var ts;
23795
23819
  node.transformFlags |= propagateChildFlags(node.name);
23796
23820
  switch (keywordToken) {
23797
23821
  case 103 /* NewKeyword */:
23798
- node.transformFlags |= 512 /* ContainsES2015 */;
23822
+ node.transformFlags |= 1024 /* ContainsES2015 */;
23799
23823
  break;
23800
23824
  case 100 /* ImportKeyword */:
23801
23825
  node.transformFlags |= 4 /* ContainsESNext */;
@@ -23822,7 +23846,7 @@ var ts;
23822
23846
  node.transformFlags |=
23823
23847
  propagateChildFlags(node.expression) |
23824
23848
  propagateChildFlags(node.literal) |
23825
- 512 /* ContainsES2015 */;
23849
+ 1024 /* ContainsES2015 */;
23826
23850
  return node;
23827
23851
  }
23828
23852
  // @api
@@ -23835,7 +23859,7 @@ var ts;
23835
23859
  // @api
23836
23860
  function createSemicolonClassElement() {
23837
23861
  var node = createBaseNode(233 /* SemicolonClassElement */);
23838
- node.transformFlags |= 512 /* ContainsES2015 */;
23862
+ node.transformFlags |= 1024 /* ContainsES2015 */;
23839
23863
  return node;
23840
23864
  }
23841
23865
  //
@@ -23999,9 +24023,9 @@ var ts;
23999
24023
  propagateChildFlags(node.initializer) |
24000
24024
  propagateChildFlags(node.expression) |
24001
24025
  propagateChildFlags(node.statement) |
24002
- 512 /* ContainsES2015 */;
24026
+ 1024 /* ContainsES2015 */;
24003
24027
  if (awaitModifier)
24004
- node.transformFlags |= 64 /* ContainsES2018 */;
24028
+ node.transformFlags |= 128 /* ContainsES2018 */;
24005
24029
  return node;
24006
24030
  }
24007
24031
  // @api
@@ -24050,7 +24074,7 @@ var ts;
24050
24074
  // return in an ES2018 async generator must be awaited
24051
24075
  node.transformFlags |=
24052
24076
  propagateChildFlags(node.expression) |
24053
- 64 /* ContainsES2018 */ |
24077
+ 128 /* ContainsES2018 */ |
24054
24078
  2097152 /* ContainsHoistedDeclarationOrCompletion */;
24055
24079
  return node;
24056
24080
  }
@@ -24180,7 +24204,7 @@ var ts;
24180
24204
  2097152 /* ContainsHoistedDeclarationOrCompletion */;
24181
24205
  if (flags & 3 /* BlockScoped */) {
24182
24206
  node.transformFlags |=
24183
- 512 /* ContainsES2015 */ |
24207
+ 1024 /* ContainsES2015 */ |
24184
24208
  131072 /* ContainsBlockScopedBinding */;
24185
24209
  }
24186
24210
  return node;
@@ -24204,14 +24228,14 @@ var ts;
24204
24228
  2097152 /* ContainsHoistedDeclarationOrCompletion */;
24205
24229
  if (ts.modifiersToFlags(node.modifiers) & 256 /* Async */) {
24206
24230
  if (node.asteriskToken) {
24207
- node.transformFlags |= 64 /* ContainsES2018 */;
24231
+ node.transformFlags |= 128 /* ContainsES2018 */;
24208
24232
  }
24209
24233
  else {
24210
- node.transformFlags |= 128 /* ContainsES2017 */;
24234
+ node.transformFlags |= 256 /* ContainsES2017 */;
24211
24235
  }
24212
24236
  }
24213
24237
  else if (node.asteriskToken) {
24214
- node.transformFlags |= 1024 /* ContainsGenerator */;
24238
+ node.transformFlags |= 2048 /* ContainsGenerator */;
24215
24239
  }
24216
24240
  }
24217
24241
  return node;
@@ -24236,7 +24260,7 @@ var ts;
24236
24260
  node.transformFlags = 1 /* ContainsTypeScript */;
24237
24261
  }
24238
24262
  else {
24239
- node.transformFlags |= 512 /* ContainsES2015 */;
24263
+ node.transformFlags |= 1024 /* ContainsES2015 */;
24240
24264
  if (node.transformFlags & 4096 /* ContainsTypeScriptClassSyntax */) {
24241
24265
  node.transformFlags |= 1 /* ContainsTypeScript */;
24242
24266
  }
@@ -25276,7 +25300,7 @@ var ts;
25276
25300
  node.transformFlags |= propagateChildrenFlags(node.types);
25277
25301
  switch (token) {
25278
25302
  case 94 /* ExtendsKeyword */:
25279
- node.transformFlags |= 512 /* ContainsES2015 */;
25303
+ node.transformFlags |= 1024 /* ContainsES2015 */;
25280
25304
  break;
25281
25305
  case 117 /* ImplementsKeyword */:
25282
25306
  node.transformFlags |= 1 /* ContainsTypeScript */;
@@ -25307,7 +25331,7 @@ var ts;
25307
25331
  propagateChildFlags(node.variableDeclaration) |
25308
25332
  propagateChildFlags(node.block);
25309
25333
  if (!variableDeclaration)
25310
- node.transformFlags |= 32 /* ContainsES2019 */;
25334
+ node.transformFlags |= 64 /* ContainsES2019 */;
25311
25335
  return node;
25312
25336
  }
25313
25337
  // @api
@@ -25358,7 +25382,7 @@ var ts;
25358
25382
  node.objectAssignmentInitializer = objectAssignmentInitializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(objectAssignmentInitializer);
25359
25383
  node.transformFlags |=
25360
25384
  propagateChildFlags(node.objectAssignmentInitializer) |
25361
- 512 /* ContainsES2015 */;
25385
+ 1024 /* ContainsES2015 */;
25362
25386
  return node;
25363
25387
  }
25364
25388
  function finishUpdateShorthandPropertyAssignment(updated, original) {
@@ -25388,7 +25412,7 @@ var ts;
25388
25412
  node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression);
25389
25413
  node.transformFlags |=
25390
25414
  propagateChildFlags(node.expression) |
25391
- 64 /* ContainsES2018 */ |
25415
+ 128 /* ContainsES2018 */ |
25392
25416
  32768 /* ContainsObjectRestOrSpread */;
25393
25417
  return node;
25394
25418
  }
@@ -38061,6 +38085,7 @@ var ts;
38061
38085
  ["es2019", "lib.es2019.d.ts"],
38062
38086
  ["es2020", "lib.es2020.d.ts"],
38063
38087
  ["es2021", "lib.es2021.d.ts"],
38088
+ ["es2022", "lib.es2022.d.ts"],
38064
38089
  ["esnext", "lib.esnext.d.ts"],
38065
38090
  // Host only
38066
38091
  ["dom", "lib.dom.d.ts"],
@@ -38104,12 +38129,16 @@ var ts;
38104
38129
  ["es2021.string", "lib.es2021.string.d.ts"],
38105
38130
  ["es2021.weakref", "lib.es2021.weakref.d.ts"],
38106
38131
  ["es2021.intl", "lib.es2021.intl.d.ts"],
38107
- ["esnext.array", "lib.es2019.array.d.ts"],
38132
+ ["es2022.array", "lib.es2022.array.d.ts"],
38133
+ ["es2022.error", "lib.es2022.error.d.ts"],
38134
+ ["es2022.object", "lib.es2022.object.d.ts"],
38135
+ ["es2022.string", "lib.es2022.string.d.ts"],
38136
+ ["esnext.array", "lib.es2022.array.d.ts"],
38108
38137
  ["esnext.symbol", "lib.es2019.symbol.d.ts"],
38109
38138
  ["esnext.asynciterable", "lib.es2018.asynciterable.d.ts"],
38110
38139
  ["esnext.intl", "lib.esnext.intl.d.ts"],
38111
38140
  ["esnext.bigint", "lib.es2020.bigint.d.ts"],
38112
- ["esnext.string", "lib.es2021.string.d.ts"],
38141
+ ["esnext.string", "lib.es2022.string.d.ts"],
38113
38142
  ["esnext.promise", "lib.es2021.promise.d.ts"],
38114
38143
  ["esnext.weakref", "lib.es2021.weakref.d.ts"]
38115
38144
  ];
@@ -38341,6 +38370,7 @@ var ts;
38341
38370
  es2019: 6 /* ES2019 */,
38342
38371
  es2020: 7 /* ES2020 */,
38343
38372
  es2021: 8 /* ES2021 */,
38373
+ es2022: 9 /* ES2022 */,
38344
38374
  esnext: 99 /* ESNext */,
38345
38375
  })),
38346
38376
  affectsSourceFile: true,
@@ -54118,12 +54148,15 @@ var ts;
54118
54148
  }
54119
54149
  /** Return the inferred type for a binding element */
54120
54150
  function getTypeForBindingElement(declaration) {
54121
- var pattern = declaration.parent;
54122
- var parentType = getTypeForBindingElementParent(pattern.parent);
54123
- // If no type or an any type was inferred for parent, infer that for the binding element
54124
- if (!parentType || isTypeAny(parentType)) {
54151
+ var parentType = getTypeForBindingElementParent(declaration.parent.parent);
54152
+ return parentType && getBindingElementTypeFromParentType(declaration, parentType);
54153
+ }
54154
+ function getBindingElementTypeFromParentType(declaration, parentType) {
54155
+ // If an any type was inferred for parent, infer that for the binding element
54156
+ if (isTypeAny(parentType)) {
54125
54157
  return parentType;
54126
54158
  }
54159
+ var pattern = declaration.parent;
54127
54160
  // Relax null check on ambient destructuring parameters, since the parameters have no implementation and are just documentation
54128
54161
  if (strictNullChecks && declaration.flags & 8388608 /* Ambient */ && ts.isParameterDeclaration(declaration)) {
54129
54162
  parentType = getNonNullableType(parentType);
@@ -59335,6 +59368,8 @@ var ts;
59335
59368
  // We ignore 'never' types in unions
59336
59369
  if (!(flags & 131072 /* Never */)) {
59337
59370
  includes |= flags & 205258751 /* IncludesMask */;
59371
+ if (flags & 465829888 /* Instantiable */)
59372
+ includes |= 33554432 /* IncludesInstantiable */;
59338
59373
  if (type === wildcardType)
59339
59374
  includes |= 8388608 /* IncludesWildcard */;
59340
59375
  if (!strictNullChecks && flags & 98304 /* Nullable */) {
@@ -59548,7 +59583,7 @@ var ts;
59548
59583
  origin = createOriginUnionOrIntersectionType(1048576 /* Union */, reducedTypes);
59549
59584
  }
59550
59585
  }
59551
- var objectFlags = (includes & 468598819 /* NotPrimitiveUnion */ ? 0 : 65536 /* PrimitiveUnion */) |
59586
+ var objectFlags = (includes & 36323363 /* NotPrimitiveUnion */ ? 0 : 65536 /* PrimitiveUnion */) |
59552
59587
  (includes & 2097152 /* Intersection */ ? 33554432 /* ContainsIntersections */ : 0);
59553
59588
  return getUnionTypeFromSortedList(typeSet, objectFlags, aliasSymbol, aliasTypeArguments, origin);
59554
59589
  }
@@ -61098,7 +61133,7 @@ var ts;
61098
61133
  var declarations = ts.concatenate(leftProp.declarations, rightProp.declarations);
61099
61134
  var flags = 4 /* Property */ | (leftProp.flags & 16777216 /* Optional */);
61100
61135
  var result = createSymbol(flags, leftProp.escapedName);
61101
- result.type = getUnionType([getTypeOfSymbol(leftProp), removeMissingOrUndefinedType(rightType)]);
61136
+ result.type = getUnionType([getTypeOfSymbol(leftProp), removeMissingOrUndefinedType(rightType)], 2 /* Subtype */);
61102
61137
  result.leftSpread = leftProp;
61103
61138
  result.rightSpread = rightProp;
61104
61139
  result.declarations = declarations;
@@ -62743,7 +62778,7 @@ var ts;
62743
62778
  return true;
62744
62779
  }
62745
62780
  if (source.flags & 524288 /* Object */ && target.flags & 524288 /* Object */) {
62746
- var related = relation.get(getRelationKey(source, target, 0 /* None */, relation));
62781
+ var related = relation.get(getRelationKey(source, target, 0 /* None */, relation, /*ignoreConstraints*/ false));
62747
62782
  if (related !== undefined) {
62748
62783
  return !!(related & 1 /* Succeeded */);
62749
62784
  }
@@ -63592,7 +63627,8 @@ var ts;
63592
63627
  if (overflow) {
63593
63628
  return 0 /* False */;
63594
63629
  }
63595
- var id = getRelationKey(source, target, intersectionState | (inPropertyCheck ? 16 /* InPropertyCheck */ : 0), relation);
63630
+ var keyIntersectionState = intersectionState | (inPropertyCheck ? 16 /* InPropertyCheck */ : 0);
63631
+ var id = getRelationKey(source, target, keyIntersectionState, relation, /*ingnoreConstraints*/ false);
63596
63632
  var entry = relation.get(id);
63597
63633
  if (entry !== undefined) {
63598
63634
  if (reportErrors && entry & 2 /* Failed */ && !(entry & 4 /* Reported */)) {
@@ -63619,16 +63655,13 @@ var ts;
63619
63655
  targetStack = [];
63620
63656
  }
63621
63657
  else {
63622
- // generate a key where all type parameter id positions are replaced with unconstrained type parameter ids
63623
- // this isn't perfect - nested type references passed as type arguments will muck up the indexes and thus
63624
- // prevent finding matches- but it should hit up the common cases
63625
- var broadestEquivalentId = id.split(",").map(function (i) { return i.replace(/-\d+/g, function (_match, offset) {
63626
- var index = ts.length(id.slice(0, offset).match(/[-=]/g) || undefined);
63627
- return "=" + index;
63628
- }); }).join(",");
63658
+ // A key that starts with "*" is an indication that we have type references that reference constrained
63659
+ // type parameters. For such keys we also check against the key we would have gotten if all type parameters
63660
+ // were unconstrained.
63661
+ var broadestEquivalentId = id.startsWith("*") ? getRelationKey(source, target, keyIntersectionState, relation, /*ignoreConstraints*/ true) : undefined;
63629
63662
  for (var i = 0; i < maybeCount; i++) {
63630
63663
  // If source and target are already being compared, consider them related with assumptions
63631
- if (id === maybeKeys[i] || broadestEquivalentId === maybeKeys[i]) {
63664
+ if (id === maybeKeys[i] || broadestEquivalentId && broadestEquivalentId === maybeKeys[i]) {
63632
63665
  return 3 /* Maybe */;
63633
63666
  }
63634
63667
  }
@@ -63923,7 +63956,7 @@ var ts;
63923
63956
  originalErrorInfo = undefined;
63924
63957
  }
63925
63958
  }
63926
- else if (isGenericMappedType(target)) {
63959
+ else if (isGenericMappedType(target) && relation !== identityRelation) {
63927
63960
  // Check if source type `S` is related to target type `{ [P in Q]: T }` or `{ [P in Q as R]: T}`.
63928
63961
  var keysRemapped = !!target.declaration.nameType;
63929
63962
  var templateType = getTemplateTypeFromMappedType(target);
@@ -65135,48 +65168,56 @@ var ts;
65135
65168
  function isTypeReferenceWithGenericArguments(type) {
65136
65169
  return isNonDeferredTypeReference(type) && ts.some(getTypeArguments(type), function (t) { return !!(t.flags & 262144 /* TypeParameter */) || isTypeReferenceWithGenericArguments(t); });
65137
65170
  }
65138
- /**
65139
- * getTypeReferenceId(A<T, number, U>) returns "111=0-12=1"
65140
- * where A.id=111 and number.id=12
65141
- */
65142
- function getTypeReferenceId(type, typeParameters, depth) {
65143
- if (depth === void 0) { depth = 0; }
65144
- var result = "" + type.target.id;
65145
- for (var _i = 0, _a = getTypeArguments(type); _i < _a.length; _i++) {
65146
- var t = _a[_i];
65147
- if (isUnconstrainedTypeParameter(t)) {
65148
- var index = typeParameters.indexOf(t);
65149
- if (index < 0) {
65150
- index = typeParameters.length;
65151
- typeParameters.push(t);
65171
+ function getGenericTypeReferenceRelationKey(source, target, postFix, ignoreConstraints) {
65172
+ var typeParameters = [];
65173
+ var constraintMarker = "";
65174
+ var sourceId = getTypeReferenceId(source, 0);
65175
+ var targetId = getTypeReferenceId(target, 0);
65176
+ return "" + constraintMarker + sourceId + "," + targetId + postFix;
65177
+ // getTypeReferenceId(A<T, number, U>) returns "111=0-12=1"
65178
+ // where A.id=111 and number.id=12
65179
+ function getTypeReferenceId(type, depth) {
65180
+ if (depth === void 0) { depth = 0; }
65181
+ var result = "" + type.target.id;
65182
+ for (var _i = 0, _a = getTypeArguments(type); _i < _a.length; _i++) {
65183
+ var t = _a[_i];
65184
+ if (t.flags & 262144 /* TypeParameter */) {
65185
+ if (ignoreConstraints || isUnconstrainedTypeParameter(t)) {
65186
+ var index = typeParameters.indexOf(t);
65187
+ if (index < 0) {
65188
+ index = typeParameters.length;
65189
+ typeParameters.push(t);
65190
+ }
65191
+ result += "=" + index;
65192
+ continue;
65193
+ }
65194
+ // We mark type references that reference constrained type parameters such that we know to obtain
65195
+ // and look for a "broadest equivalent key" in the cache.
65196
+ constraintMarker = "*";
65197
+ }
65198
+ else if (depth < 4 && isTypeReferenceWithGenericArguments(t)) {
65199
+ result += "<" + getTypeReferenceId(t, depth + 1) + ">";
65200
+ continue;
65152
65201
  }
65153
- result += "=" + index;
65154
- }
65155
- else if (depth < 4 && isTypeReferenceWithGenericArguments(t)) {
65156
- result += "<" + getTypeReferenceId(t, typeParameters, depth + 1) + ">";
65157
- }
65158
- else {
65159
65202
  result += "-" + t.id;
65160
65203
  }
65204
+ return result;
65161
65205
  }
65162
- return result;
65163
65206
  }
65164
65207
  /**
65165
65208
  * To improve caching, the relation key for two generic types uses the target's id plus ids of the type parameters.
65166
65209
  * For other cases, the types ids are used.
65167
65210
  */
65168
- function getRelationKey(source, target, intersectionState, relation) {
65211
+ function getRelationKey(source, target, intersectionState, relation, ignoreConstraints) {
65169
65212
  if (relation === identityRelation && source.id > target.id) {
65170
65213
  var temp = source;
65171
65214
  source = target;
65172
65215
  target = temp;
65173
65216
  }
65174
65217
  var postFix = intersectionState ? ":" + intersectionState : "";
65175
- if (isTypeReferenceWithGenericArguments(source) && isTypeReferenceWithGenericArguments(target)) {
65176
- var typeParameters = [];
65177
- return getTypeReferenceId(source, typeParameters) + "," + getTypeReferenceId(target, typeParameters) + postFix;
65178
- }
65179
- return source.id + "," + target.id + postFix;
65218
+ return isTypeReferenceWithGenericArguments(source) && isTypeReferenceWithGenericArguments(target) ?
65219
+ getGenericTypeReferenceRelationKey(source, target, postFix, ignoreConstraints) :
65220
+ source.id + "," + target.id + postFix;
65180
65221
  }
65181
65222
  // Invoke the callback for each underlying property symbol of the given symbol and return the first
65182
65223
  // value that isn't undefined.
@@ -65224,28 +65265,35 @@ var ts;
65224
65265
  !hasBaseType(checkClass, getDeclaringClass(p)) : false; }) ? undefined : checkClass;
65225
65266
  }
65226
65267
  // Return true if the given type is deeply nested. We consider this to be the case when structural type comparisons
65227
- // for 5 or more occurrences or instantiations of the type have been recorded on the given stack. It is possible,
65268
+ // for maxDepth or more occurrences or instantiations of the type have been recorded on the given stack. It is possible,
65228
65269
  // though highly unlikely, for this test to be true in a situation where a chain of instantiations is not infinitely
65229
- // expanding. Effectively, we will generate a false positive when two types are structurally equal to at least 5
65270
+ // expanding. Effectively, we will generate a false positive when two types are structurally equal to at least maxDepth
65230
65271
  // levels, but unequal at some level beyond that.
65231
- // In addition, this will also detect when an indexed access has been chained off of 5 or more times (which is essentially
65232
- // the dual of the structural comparison), and likewise mark the type as deeply nested, potentially adding false positives
65233
- // for finite but deeply expanding indexed accesses (eg, for `Q[P1][P2][P3][P4][P5]`).
65234
- // It also detects when a recursive type reference has expanded 5 or more times, eg, if the true branch of
65272
+ // In addition, this will also detect when an indexed access has been chained off of maxDepth more times (which is
65273
+ // essentially the dual of the structural comparison), and likewise mark the type as deeply nested, potentially adding
65274
+ // false positives for finite but deeply expanding indexed accesses (eg, for `Q[P1][P2][P3][P4][P5]`).
65275
+ // It also detects when a recursive type reference has expanded maxDepth or more times, e.g. if the true branch of
65235
65276
  // `type A<T> = null extends T ? [A<NonNullable<T>>] : [T]`
65236
- // has expanded into `[A<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>>>>>>]`
65237
- // in such cases we need to terminate the expansion, and we do so here.
65277
+ // has expanded into `[A<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>>>>>>]`. In such cases we need
65278
+ // to terminate the expansion, and we do so here.
65238
65279
  function isDeeplyNestedType(type, stack, depth, maxDepth) {
65239
- if (maxDepth === void 0) { maxDepth = 5; }
65280
+ if (maxDepth === void 0) { maxDepth = 3; }
65240
65281
  if (depth >= maxDepth) {
65241
65282
  var identity_1 = getRecursionIdentity(type);
65242
65283
  var count = 0;
65284
+ var lastTypeId = 0;
65243
65285
  for (var i = 0; i < depth; i++) {
65244
- if (getRecursionIdentity(stack[i]) === identity_1) {
65245
- count++;
65246
- if (count >= maxDepth) {
65247
- return true;
65286
+ var t = stack[i];
65287
+ if (getRecursionIdentity(t) === identity_1) {
65288
+ // We only count occurrences with a higher type id than the previous occurrence, since higher
65289
+ // type ids are an indicator of newer instantiations caused by recursion.
65290
+ if (t.id >= lastTypeId) {
65291
+ count++;
65292
+ if (count >= maxDepth) {
65293
+ return true;
65294
+ }
65248
65295
  }
65296
+ lastTypeId = t.id;
65249
65297
  }
65250
65298
  }
65251
65299
  }
@@ -65984,7 +66032,8 @@ var ts;
65984
66032
  (resolveName(param, param.name.escapedText, 788968 /* Type */, undefined, param.name.escapedText, /*isUse*/ true) ||
65985
66033
  param.name.originalKeywordKind && ts.isTypeNodeKind(param.name.originalKeywordKind))) {
65986
66034
  var newName = "arg" + param.parent.parameters.indexOf(param);
65987
- errorOrSuggestion(noImplicitAny, declaration, ts.Diagnostics.Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1, newName, ts.declarationNameToString(param.name));
66035
+ var typeName = ts.declarationNameToString(param.name) + (param.dotDotDotToken ? "[]" : "");
66036
+ errorOrSuggestion(noImplicitAny, declaration, ts.Diagnostics.Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1, newName, typeName);
65988
66037
  return;
65989
66038
  }
65990
66039
  diagnostic = declaration.dotDotDotToken ?
@@ -67350,29 +67399,6 @@ var ts;
67350
67399
  }
67351
67400
  return false;
67352
67401
  }
67353
- function getPropertyAccess(expr) {
67354
- if (ts.isAccessExpression(expr)) {
67355
- return expr;
67356
- }
67357
- if (ts.isIdentifier(expr)) {
67358
- var symbol = getResolvedSymbol(expr);
67359
- if (isConstVariable(symbol)) {
67360
- var declaration = symbol.valueDeclaration;
67361
- // Given 'const x = obj.kind', allow 'x' as an alias for 'obj.kind'
67362
- if (ts.isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && ts.isAccessExpression(declaration.initializer)) {
67363
- return declaration.initializer;
67364
- }
67365
- // Given 'const { kind: x } = obj', allow 'x' as an alias for 'obj.kind'
67366
- if (ts.isBindingElement(declaration) && !declaration.initializer) {
67367
- var parent = declaration.parent.parent;
67368
- if (ts.isVariableDeclaration(parent) && !parent.type && parent.initializer && (ts.isIdentifier(parent.initializer) || ts.isAccessExpression(parent.initializer))) {
67369
- return declaration;
67370
- }
67371
- }
67372
- }
67373
- }
67374
- return undefined;
67375
- }
67376
67402
  function getAccessedPropertyName(access) {
67377
67403
  var propertyName;
67378
67404
  return access.kind === 205 /* PropertyAccessExpression */ ? access.name.escapedText :
@@ -68271,20 +68297,21 @@ var ts;
68271
68297
  }
68272
68298
  return false;
68273
68299
  }
68274
- function getFlowTypeOfReference(reference, declaredType, initialType, flowContainer) {
68300
+ function getFlowTypeOfReference(reference, declaredType, initialType, flowContainer, flowNode) {
68275
68301
  if (initialType === void 0) { initialType = declaredType; }
68302
+ if (flowNode === void 0) { flowNode = reference.flowNode; }
68276
68303
  var key;
68277
68304
  var isKeySet = false;
68278
68305
  var flowDepth = 0;
68279
68306
  if (flowAnalysisDisabled) {
68280
68307
  return errorType;
68281
68308
  }
68282
- if (!reference.flowNode) {
68309
+ if (!flowNode) {
68283
68310
  return declaredType;
68284
68311
  }
68285
68312
  flowInvocationCount++;
68286
68313
  var sharedFlowStart = sharedFlowCount;
68287
- var evolvedType = getTypeFromFlowType(getTypeAtFlowNode(reference.flowNode));
68314
+ var evolvedType = getTypeFromFlowType(getTypeAtFlowNode(flowNode));
68288
68315
  sharedFlowCount = sharedFlowStart;
68289
68316
  // When the reference is 'x' in an 'x.length', 'x.push(value)', 'x.unshift(value)' or x[n] = value' operation,
68290
68317
  // we give type 'any[]' to 'x' instead of using the type determined by control flow analysis such that operations
@@ -68716,13 +68743,57 @@ var ts;
68716
68743
  }
68717
68744
  return result;
68718
68745
  }
68746
+ function getCandidateDiscriminantPropertyAccess(expr) {
68747
+ if (ts.isBindingPattern(reference)) {
68748
+ // When the reference is a binding pattern, we are narrowing a pesudo-reference in getNarrowedTypeOfSymbol.
68749
+ // An identifier for a destructuring variable declared in the same binding pattern is a candidate.
68750
+ if (ts.isIdentifier(expr)) {
68751
+ var symbol = getResolvedSymbol(expr);
68752
+ var declaration = symbol.valueDeclaration;
68753
+ if (declaration && ts.isBindingElement(declaration) && !declaration.initializer && !declaration.dotDotDotToken && reference === declaration.parent) {
68754
+ return declaration;
68755
+ }
68756
+ }
68757
+ }
68758
+ else if (ts.isAccessExpression(expr)) {
68759
+ // An access expression is a candidate if the reference matches the left hand expression.
68760
+ if (isMatchingReference(reference, expr.expression)) {
68761
+ return expr;
68762
+ }
68763
+ }
68764
+ else if (ts.isIdentifier(expr)) {
68765
+ var symbol = getResolvedSymbol(expr);
68766
+ if (isConstVariable(symbol)) {
68767
+ var declaration = symbol.valueDeclaration;
68768
+ // Given 'const x = obj.kind', allow 'x' as an alias for 'obj.kind'
68769
+ if (ts.isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && ts.isAccessExpression(declaration.initializer) &&
68770
+ isMatchingReference(reference, declaration.initializer.expression)) {
68771
+ return declaration.initializer;
68772
+ }
68773
+ // Given 'const { kind: x } = obj', allow 'x' as an alias for 'obj.kind'
68774
+ if (ts.isBindingElement(declaration) && !declaration.initializer) {
68775
+ var parent = declaration.parent.parent;
68776
+ if (ts.isVariableDeclaration(parent) && !parent.type && parent.initializer && (ts.isIdentifier(parent.initializer) || ts.isAccessExpression(parent.initializer)) &&
68777
+ isMatchingReference(reference, parent.initializer)) {
68778
+ return declaration;
68779
+ }
68780
+ }
68781
+ }
68782
+ }
68783
+ return undefined;
68784
+ }
68719
68785
  function getDiscriminantPropertyAccess(expr, computedType) {
68720
- var access, name;
68721
68786
  var type = declaredType.flags & 1048576 /* Union */ ? declaredType : computedType;
68722
- return type.flags & 1048576 /* Union */ && (access = getPropertyAccess(expr)) && (name = getAccessedPropertyName(access)) &&
68723
- isMatchingReference(reference, ts.isAccessExpression(access) ? access.expression : access.parent.parent.initializer) &&
68724
- isDiscriminantProperty(type, name) ?
68725
- access : undefined;
68787
+ if (type.flags & 1048576 /* Union */) {
68788
+ var access = getCandidateDiscriminantPropertyAccess(expr);
68789
+ if (access) {
68790
+ var name = getAccessedPropertyName(access);
68791
+ if (name && isDiscriminantProperty(type, name)) {
68792
+ return access;
68793
+ }
68794
+ }
68795
+ }
68796
+ return undefined;
68726
68797
  }
68727
68798
  function narrowTypeByDiscriminant(type, access, narrowType) {
68728
68799
  var propName = getAccessedPropertyName(access);
@@ -69480,6 +69551,49 @@ var ts;
69480
69551
  }
69481
69552
  }
69482
69553
  }
69554
+ function getNarrowedTypeOfSymbol(symbol, location) {
69555
+ // If we have a non-rest binding element with no initializer declared as a const variable or a const-like
69556
+ // parameter (a parameter for which there are no assignments in the function body), and if the parent type
69557
+ // for the destructuring is a union type, one or more of the binding elements may represent discriminant
69558
+ // properties, and we want the effects of conditional checks on such discriminants to affect the types of
69559
+ // other binding elements from the same destructuring. Consider:
69560
+ //
69561
+ // type Action =
69562
+ // | { kind: 'A', payload: number }
69563
+ // | { kind: 'B', payload: string };
69564
+ //
69565
+ // function f1({ kind, payload }: Action) {
69566
+ // if (kind === 'A') {
69567
+ // payload.toFixed();
69568
+ // }
69569
+ // if (kind === 'B') {
69570
+ // payload.toUpperCase();
69571
+ // }
69572
+ // }
69573
+ //
69574
+ // Above, we want the conditional checks on 'kind' to affect the type of 'payload'. To facilitate this, we use
69575
+ // the binding pattern AST instance for '{ kind, payload }' as a pseudo-reference and narrow this reference
69576
+ // as if it occurred in the specified location. We then recompute the narrowed binding element type by
69577
+ // destructuring from the narrowed parent type.
69578
+ var declaration = symbol.valueDeclaration;
69579
+ if (declaration && ts.isBindingElement(declaration) && !declaration.initializer && !declaration.dotDotDotToken && declaration.parent.elements.length >= 2) {
69580
+ var parent = declaration.parent.parent;
69581
+ if (parent.kind === 253 /* VariableDeclaration */ && ts.getCombinedNodeFlags(declaration) & 2 /* Const */ || parent.kind === 163 /* Parameter */) {
69582
+ var links = getNodeLinks(location);
69583
+ if (!(links.flags & 268435456 /* InCheckIdentifier */)) {
69584
+ links.flags |= 268435456 /* InCheckIdentifier */;
69585
+ var parentType = getTypeForBindingElementParent(parent);
69586
+ links.flags &= ~268435456 /* InCheckIdentifier */;
69587
+ if (parentType && parentType.flags & 1048576 /* Union */ && !(parent.kind === 163 /* Parameter */ && isSymbolAssigned(symbol))) {
69588
+ var pattern = declaration.parent;
69589
+ var narrowedType = getFlowTypeOfReference(pattern, parentType, parentType, /*flowContainer*/ undefined, location.flowNode);
69590
+ return getBindingElementTypeFromParentType(declaration, narrowedType);
69591
+ }
69592
+ }
69593
+ }
69594
+ }
69595
+ return getTypeOfSymbol(symbol);
69596
+ }
69483
69597
  function checkIdentifier(node, checkMode) {
69484
69598
  var symbol = getResolvedSymbol(node);
69485
69599
  if (symbol === unknownSymbol) {
@@ -69553,7 +69667,7 @@ var ts;
69553
69667
  }
69554
69668
  }
69555
69669
  checkNestedBlockScopedBinding(node, symbol);
69556
- var type = getTypeOfSymbol(localOrExportSymbol);
69670
+ var type = getNarrowedTypeOfSymbol(localOrExportSymbol, node);
69557
69671
  var assignmentKind = ts.getAssignmentTargetKind(node);
69558
69672
  if (assignmentKind) {
69559
69673
  if (!(localOrExportSymbol.flags & 3 /* Variable */) &&
@@ -70596,13 +70710,13 @@ var ts;
70596
70710
  function isCircularMappedProperty(symbol) {
70597
70711
  return !!(ts.getCheckFlags(symbol) & 262144 /* Mapped */ && !symbol.type && findResolutionCycleStartIndex(symbol, 0 /* Type */) >= 0);
70598
70712
  }
70599
- function getTypeOfPropertyOfContextualType(type, name) {
70713
+ function getTypeOfPropertyOfContextualType(type, name, nameType) {
70600
70714
  return mapType(type, function (t) {
70601
70715
  var _a;
70602
70716
  if (isGenericMappedType(t)) {
70603
70717
  var constraint = getConstraintTypeFromMappedType(t);
70604
70718
  var constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
70605
- var propertyNameType = getStringLiteralType(ts.unescapeLeadingUnderscores(name));
70719
+ var propertyNameType = nameType || getStringLiteralType(ts.unescapeLeadingUnderscores(name));
70606
70720
  if (isTypeAssignableTo(propertyNameType, constraintOfConstraint)) {
70607
70721
  return substituteIndexedMappedType(t, propertyNameType);
70608
70722
  }
@@ -70618,7 +70732,7 @@ var ts;
70618
70732
  return restType;
70619
70733
  }
70620
70734
  }
70621
- return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), getStringLiteralType(ts.unescapeLeadingUnderscores(name)))) === null || _a === void 0 ? void 0 : _a.type;
70735
+ return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(ts.unescapeLeadingUnderscores(name)))) === null || _a === void 0 ? void 0 : _a.type;
70622
70736
  }
70623
70737
  return undefined;
70624
70738
  }, /*noReductions*/ true);
@@ -70646,7 +70760,8 @@ var ts;
70646
70760
  // For a (non-symbol) computed property, there is no reason to look up the name
70647
70761
  // in the type. It will just be "__computed", which does not appear in any
70648
70762
  // SymbolTable.
70649
- return getTypeOfPropertyOfContextualType(type, getSymbolOfNode(element).escapedName);
70763
+ var symbol = getSymbolOfNode(element);
70764
+ return getTypeOfPropertyOfContextualType(type, symbol.escapedName, getSymbolLinks(symbol).nameType);
70650
70765
  }
70651
70766
  if (element.name) {
70652
70767
  var nameType_2 = getLiteralTypeFromPropertyName(element.name);
@@ -82769,8 +82884,11 @@ var ts;
82769
82884
  function checkAssertClause(declaration) {
82770
82885
  var _a;
82771
82886
  if (declaration.assertClause) {
82772
- if (moduleKind !== ts.ModuleKind.ESNext) {
82773
- return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext);
82887
+ var mode = (moduleKind === ts.ModuleKind.NodeNext) && declaration.moduleSpecifier && getUsageModeForExpression(declaration.moduleSpecifier);
82888
+ if (mode !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.ESNext) {
82889
+ return grammarErrorOnNode(declaration.assertClause, moduleKind === ts.ModuleKind.NodeNext
82890
+ ? ts.Diagnostics.Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls
82891
+ : ts.Diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext);
82774
82892
  }
82775
82893
  if (ts.isImportDeclaration(declaration) ? (_a = declaration.importClause) === null || _a === void 0 ? void 0 : _a.isTypeOnly : declaration.isTypeOnly) {
82776
82894
  return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.Import_assertions_cannot_be_used_with_type_only_imports_or_exports);
@@ -86617,12 +86735,12 @@ var ts;
86617
86735
  return grammarErrorOnNode(node, ts.Diagnostics.Dynamic_import_cannot_have_type_arguments);
86618
86736
  }
86619
86737
  var nodeArguments = node.arguments;
86620
- if (moduleKind !== ts.ModuleKind.ESNext) {
86738
+ if (moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.NodeNext) {
86621
86739
  // We are allowed trailing comma after proposal-import-assertions.
86622
86740
  checkGrammarForDisallowedTrailingComma(nodeArguments);
86623
86741
  if (nodeArguments.length > 1) {
86624
86742
  var assertionArgument = nodeArguments[1];
86625
- return grammarErrorOnNode(assertionArgument, ts.Diagnostics.Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext);
86743
+ return grammarErrorOnNode(assertionArgument, ts.Diagnostics.Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_or_nodenext);
86626
86744
  }
86627
86745
  }
86628
86746
  if (nodeArguments.length === 0 || nodeArguments.length > 2) {
@@ -93322,7 +93440,7 @@ var ts;
93322
93440
  return ts.visitEachChild(node, visitor, context);
93323
93441
  }
93324
93442
  function visitor(node) {
93325
- if ((node.transformFlags & 128 /* ContainsES2017 */) === 0) {
93443
+ if ((node.transformFlags & 256 /* ContainsES2017 */) === 0) {
93326
93444
  return node;
93327
93445
  }
93328
93446
  switch (node.kind) {
@@ -93955,7 +94073,7 @@ var ts;
93955
94073
  * expression of an `ExpressionStatement`).
93956
94074
  */
93957
94075
  function visitorWorker(node, expressionResultIsUnused) {
93958
- if ((node.transformFlags & 64 /* ContainsES2018 */) === 0) {
94076
+ if ((node.transformFlags & 128 /* ContainsES2018 */) === 0) {
93959
94077
  return node;
93960
94078
  }
93961
94079
  switch (node.kind) {
@@ -94652,7 +94770,7 @@ var ts;
94652
94770
  return ts.visitEachChild(node, visitor, context);
94653
94771
  }
94654
94772
  function visitor(node) {
94655
- if ((node.transformFlags & 32 /* ContainsES2019 */) === 0) {
94773
+ if ((node.transformFlags & 64 /* ContainsES2019 */) === 0) {
94656
94774
  return node;
94657
94775
  }
94658
94776
  switch (node.kind) {
@@ -94684,7 +94802,7 @@ var ts;
94684
94802
  return ts.visitEachChild(node, visitor, context);
94685
94803
  }
94686
94804
  function visitor(node) {
94687
- if ((node.transformFlags & 16 /* ContainsES2020 */) === 0) {
94805
+ if ((node.transformFlags & 32 /* ContainsES2020 */) === 0) {
94688
94806
  return node;
94689
94807
  }
94690
94808
  switch (node.kind) {
@@ -94861,7 +94979,7 @@ var ts;
94861
94979
  return ts.visitEachChild(node, visitor, context);
94862
94980
  }
94863
94981
  function visitor(node) {
94864
- if ((node.transformFlags & 8 /* ContainsES2021 */) === 0) {
94982
+ if ((node.transformFlags & 16 /* ContainsES2021 */) === 0) {
94865
94983
  return node;
94866
94984
  }
94867
94985
  switch (node.kind) {
@@ -95625,7 +95743,7 @@ var ts;
95625
95743
  return ts.visitEachChild(node, visitor, context);
95626
95744
  }
95627
95745
  function visitor(node) {
95628
- if ((node.transformFlags & 256 /* ContainsES2016 */) === 0) {
95746
+ if ((node.transformFlags & 512 /* ContainsES2016 */) === 0) {
95629
95747
  return node;
95630
95748
  }
95631
95749
  switch (node.kind) {
@@ -95873,7 +95991,7 @@ var ts;
95873
95991
  || ts.isBlock(node));
95874
95992
  }
95875
95993
  function shouldVisitNode(node) {
95876
- return (node.transformFlags & 512 /* ContainsES2015 */) !== 0
95994
+ return (node.transformFlags & 1024 /* ContainsES2015 */) !== 0
95877
95995
  || convertedLoopState !== undefined
95878
95996
  || (hierarchyFacts & 8192 /* ConstructorWithCapturedSuper */ && isOrMayContainReturnCompletion(node))
95879
95997
  || (ts.isIterationStatement(node, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatement(node))
@@ -99186,7 +99304,7 @@ var ts;
99186
99304
  var withBlockStack; // A stack containing `with` blocks.
99187
99305
  return ts.chainBundle(context, transformSourceFile);
99188
99306
  function transformSourceFile(node) {
99189
- if (node.isDeclarationFile || (node.transformFlags & 1024 /* ContainsGenerator */) === 0) {
99307
+ if (node.isDeclarationFile || (node.transformFlags & 2048 /* ContainsGenerator */) === 0) {
99190
99308
  return node;
99191
99309
  }
99192
99310
  var visited = ts.visitEachChild(node, visitor, context);
@@ -99209,7 +99327,7 @@ var ts;
99209
99327
  else if (ts.isFunctionLikeDeclaration(node) && node.asteriskToken) {
99210
99328
  return visitGenerator(node);
99211
99329
  }
99212
- else if (transformFlags & 1024 /* ContainsGenerator */) {
99330
+ else if (transformFlags & 2048 /* ContainsGenerator */) {
99213
99331
  return ts.visitEachChild(node, visitor, context);
99214
99332
  }
99215
99333
  else {
@@ -99265,7 +99383,7 @@ var ts;
99265
99383
  if (node.transformFlags & 524288 /* ContainsYield */) {
99266
99384
  return visitJavaScriptContainingYield(node);
99267
99385
  }
99268
- else if (node.transformFlags & (1024 /* ContainsGenerator */ | 2097152 /* ContainsHoistedDeclarationOrCompletion */)) {
99386
+ else if (node.transformFlags & (2048 /* ContainsGenerator */ | 2097152 /* ContainsHoistedDeclarationOrCompletion */)) {
99269
99387
  return ts.visitEachChild(node, visitor, context);
99270
99388
  }
99271
99389
  else {
@@ -101914,7 +102032,7 @@ var ts;
101914
102032
  function visitorWorker(node, valueIsDiscarded) {
101915
102033
  // This visitor does not need to descend into the tree if there is no dynamic import, destructuring assignment, or update expression
101916
102034
  // as export/import statements are only transformed at the top level of a file.
101917
- if (!(node.transformFlags & (4194304 /* ContainsDynamicImport */ | 2048 /* ContainsDestructuringAssignment */ | 67108864 /* ContainsUpdateExpressionForIdentifier */))) {
102035
+ if (!(node.transformFlags & (4194304 /* ContainsDynamicImport */ | 4096 /* ContainsDestructuringAssignment */ | 67108864 /* ContainsUpdateExpressionForIdentifier */))) {
101918
102036
  return node;
101919
102037
  }
101920
102038
  switch (node.kind) {
@@ -104130,7 +104248,7 @@ var ts;
104130
104248
  * @param node The node to visit.
104131
104249
  */
104132
104250
  function visitorWorker(node, valueIsDiscarded) {
104133
- if (!(node.transformFlags & (2048 /* ContainsDestructuringAssignment */ | 4194304 /* ContainsDynamicImport */ | 67108864 /* ContainsUpdateExpressionForIdentifier */))) {
104251
+ if (!(node.transformFlags & (4096 /* ContainsDestructuringAssignment */ | 4194304 /* ContainsDynamicImport */ | 67108864 /* ContainsUpdateExpressionForIdentifier */))) {
104134
104252
  return node;
104135
104253
  }
104136
104254
  switch (node.kind) {
@@ -119355,13 +119473,15 @@ var ts;
119355
119473
  if (host.fileExists(packageJsonPath)) {
119356
119474
  var packageJsonContent = JSON.parse(host.readFile(packageJsonPath));
119357
119475
  // TODO: Inject `require` or `import` condition based on the intended import mode
119358
- var fromExports = packageJsonContent.exports && typeof packageJsonContent.name === "string" ? tryGetModuleNameFromExports(options, path, packageRootPath, packageJsonContent.name, packageJsonContent.exports, ["node", "types"]) : undefined;
119359
- if (fromExports) {
119360
- var withJsExtension = !ts.hasTSFileExtension(fromExports.moduleFileToTry) ? fromExports : { moduleFileToTry: ts.removeFileExtension(fromExports.moduleFileToTry) + tryGetJSExtensionForFile(fromExports.moduleFileToTry, options) };
119361
- return __assign(__assign({}, withJsExtension), { verbatimFromExports: true });
119362
- }
119363
- if (packageJsonContent.exports) {
119364
- return { moduleFileToTry: path, blockedByExports: true };
119476
+ if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node12 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) {
119477
+ var fromExports = packageJsonContent.exports && typeof packageJsonContent.name === "string" ? tryGetModuleNameFromExports(options, path, packageRootPath, packageJsonContent.name, packageJsonContent.exports, ["node", "types"]) : undefined;
119478
+ if (fromExports) {
119479
+ var withJsExtension = !ts.hasTSFileExtension(fromExports.moduleFileToTry) ? fromExports : { moduleFileToTry: ts.removeFileExtension(fromExports.moduleFileToTry) + tryGetJSExtensionForFile(fromExports.moduleFileToTry, options) };
119480
+ return __assign(__assign({}, withJsExtension), { verbatimFromExports: true });
119481
+ }
119482
+ if (packageJsonContent.exports) {
119483
+ return { moduleFileToTry: path, blockedByExports: true };
119484
+ }
119365
119485
  }
119366
119486
  var versionPaths = packageJsonContent.typesVersions
119367
119487
  ? ts.getPackageJsonTypesVersionsPaths(packageJsonContent.typesVersions)
@@ -128749,7 +128869,7 @@ var ts;
128749
128869
  }
128750
128870
  node = ts.factory.updateModifiers(node, modifiers & (~presentModifiers));
128751
128871
  completionNodes.push(node);
128752
- }, body, isAbstract);
128872
+ }, body, 2 /* Property */, isAbstract);
128753
128873
  if (completionNodes.length) {
128754
128874
  insertText = printer.printSnippetList(1 /* MultiLine */, ts.factory.createNodeArray(completionNodes), sourceFile);
128755
128875
  }
@@ -137590,7 +137710,7 @@ var ts;
137590
137710
  if (depthRemaining === 0)
137591
137711
  return;
137592
137712
  cancellationToken.throwIfCancellationRequested();
137593
- if (ts.isDeclaration(n) || ts.isVariableStatement(n) || ts.isReturnStatement(n) || n.kind === 1 /* EndOfFileToken */) {
137713
+ if (ts.isDeclaration(n) || ts.isVariableStatement(n) || ts.isReturnStatement(n) || ts.isCallOrNewExpression(n) || n.kind === 1 /* EndOfFileToken */) {
137594
137714
  addOutliningForLeadingCommentsForNode(n, sourceFile, cancellationToken, out);
137595
137715
  }
137596
137716
  if (ts.isFunctionLike(n) && ts.isBinaryExpression(n.parent) && ts.isPropertyAccessExpression(n.parent.left)) {
@@ -146116,9 +146236,6 @@ var ts;
146116
146236
  });
146117
146237
  function makeChange(changeTracker, sourceFile, pos) {
146118
146238
  var token = ts.getTokenAtPosition(sourceFile, pos);
146119
- if (!ts.isIdentifier(token)) {
146120
- return ts.Debug.fail("add-name-to-nameless-parameter operates on identifiers, but got a " + ts.Debug.formatSyntaxKind(token.kind));
146121
- }
146122
146239
  var param = token.parent;
146123
146240
  if (!ts.isParameter(param)) {
146124
146241
  return ts.Debug.fail("Tried to add a parameter name to a non-parameter: " + ts.Debug.formatSyntaxKind(token.kind));
@@ -146126,9 +146243,10 @@ var ts;
146126
146243
  var i = param.parent.parameters.indexOf(param);
146127
146244
  ts.Debug.assert(!param.type, "Tried to add a parameter name to a parameter that already had one.");
146128
146245
  ts.Debug.assert(i > -1, "Parameter not found in parent parameter list.");
146246
+ var typeNode = ts.factory.createTypeReferenceNode(param.name, /*typeArguments*/ undefined);
146129
146247
  var replacement = ts.factory.createParameterDeclaration(
146130
- /*decorators*/ undefined, param.modifiers, param.dotDotDotToken, "arg" + i, param.questionToken, ts.factory.createTypeReferenceNode(token, /*typeArguments*/ undefined), param.initializer);
146131
- changeTracker.replaceNode(sourceFile, token, replacement);
146248
+ /*decorators*/ undefined, param.modifiers, param.dotDotDotToken, "arg" + i, param.questionToken, param.dotDotDotToken ? ts.factory.createArrayTypeNode(typeNode) : typeNode, param.initializer);
146249
+ changeTracker.replaceNode(sourceFile, param, replacement);
146132
146250
  }
146133
146251
  })(codefix = ts.codefix || (ts.codefix = {}));
146134
146252
  })(ts || (ts = {}));
@@ -152297,10 +152415,22 @@ var ts;
152297
152415
  if (usage.numberIndex) {
152298
152416
  types.push(checker.createArrayType(combineFromUsage(usage.numberIndex)));
152299
152417
  }
152300
- if (((_a = usage.properties) === null || _a === void 0 ? void 0 : _a.size) || ((_b = usage.calls) === null || _b === void 0 ? void 0 : _b.length) || ((_c = usage.constructs) === null || _c === void 0 ? void 0 : _c.length) || usage.stringIndex) {
152418
+ if (((_a = usage.properties) === null || _a === void 0 ? void 0 : _a.size) || ((_b = usage.constructs) === null || _b === void 0 ? void 0 : _b.length) || usage.stringIndex) {
152301
152419
  types.push(inferStructuralType(usage));
152302
152420
  }
152303
- types.push.apply(types, (usage.candidateTypes || []).map(function (t) { return checker.getBaseTypeOfLiteralType(t); }));
152421
+ var candidateTypes = (usage.candidateTypes || []).map(function (t) { return checker.getBaseTypeOfLiteralType(t); });
152422
+ var callsType = ((_c = usage.calls) === null || _c === void 0 ? void 0 : _c.length) ? inferStructuralType(usage) : undefined;
152423
+ if (callsType && candidateTypes) {
152424
+ types.push(checker.getUnionType(__spreadArray([callsType], candidateTypes, true), 2 /* Subtype */));
152425
+ }
152426
+ else {
152427
+ if (callsType) {
152428
+ types.push(callsType);
152429
+ }
152430
+ if (ts.length(candidateTypes)) {
152431
+ types.push.apply(types, candidateTypes);
152432
+ }
152433
+ }
152304
152434
  types.push.apply(types, inferNamedTypesFromProperties(usage));
152305
152435
  return types;
152306
152436
  }
@@ -152582,11 +152712,18 @@ var ts;
152582
152712
  };
152583
152713
  }
152584
152714
  codefix.getNoopSymbolTrackerWithResolver = getNoopSymbolTrackerWithResolver;
152715
+ var PreserveOptionalFlags;
152716
+ (function (PreserveOptionalFlags) {
152717
+ PreserveOptionalFlags[PreserveOptionalFlags["Method"] = 1] = "Method";
152718
+ PreserveOptionalFlags[PreserveOptionalFlags["Property"] = 2] = "Property";
152719
+ PreserveOptionalFlags[PreserveOptionalFlags["All"] = 3] = "All";
152720
+ })(PreserveOptionalFlags = codefix.PreserveOptionalFlags || (codefix.PreserveOptionalFlags = {}));
152585
152721
  /**
152586
152722
  * `addClassElement` will not be called if we can't figure out a representation for `symbol` in `enclosingDeclaration`.
152587
152723
  * @param body If defined, this will be the body of the member node passed to `addClassElement`. Otherwise, the body will default to a stub.
152588
152724
  */
152589
- function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, context, preferences, importAdder, addClassElement, body, isAmbient) {
152725
+ function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, context, preferences, importAdder, addClassElement, body, preserveOptional, isAmbient) {
152726
+ if (preserveOptional === void 0) { preserveOptional = 3 /* All */; }
152590
152727
  if (isAmbient === void 0) { isAmbient = false; }
152591
152728
  var declarations = symbol.getDeclarations();
152592
152729
  if (!(declarations && declarations.length)) {
@@ -152615,7 +152752,7 @@ var ts;
152615
152752
  }
152616
152753
  }
152617
152754
  addClassElement(ts.factory.createPropertyDeclaration(
152618
- /*decorators*/ undefined, modifiers, name, optional ? ts.factory.createToken(57 /* QuestionToken */) : undefined, typeNode,
152755
+ /*decorators*/ undefined, modifiers, name, optional && (preserveOptional & 2 /* Property */) ? ts.factory.createToken(57 /* QuestionToken */) : undefined, typeNode,
152619
152756
  /*initializer*/ undefined));
152620
152757
  break;
152621
152758
  case 171 /* GetAccessor */:
@@ -152679,13 +152816,13 @@ var ts;
152679
152816
  }
152680
152817
  else {
152681
152818
  ts.Debug.assert(declarations.length === signatures.length, "Declarations and signatures should match count");
152682
- addClassElement(createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, name, optional, modifiers, quotePreference, body));
152819
+ addClassElement(createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, name, optional && !!(preserveOptional & 1 /* Method */), modifiers, quotePreference, body));
152683
152820
  }
152684
152821
  }
152685
152822
  break;
152686
152823
  }
152687
152824
  function outputMethod(quotePreference, signature, modifiers, name, body) {
152688
- var method = createSignatureDeclarationFromSignature(168 /* MethodDeclaration */, context, quotePreference, signature, body, name, modifiers, optional, enclosingDeclaration, importAdder);
152825
+ var method = createSignatureDeclarationFromSignature(168 /* MethodDeclaration */, context, quotePreference, signature, body, name, modifiers, optional && !!(preserveOptional & 1 /* Method */), enclosingDeclaration, importAdder);
152689
152826
  if (method)
152690
152827
  addClassElement(method);
152691
152828
  }
@@ -155124,11 +155261,12 @@ var ts;
155124
155261
  return node.expression;
155125
155262
  }
155126
155263
  }
155127
- else if (ts.isVariableStatement(node)) {
155264
+ else if (ts.isVariableStatement(node) || ts.isVariableDeclarationList(node)) {
155265
+ var declarations_5 = ts.isVariableStatement(node) ? node.declarationList.declarations : node.declarations;
155128
155266
  var numInitializers = 0;
155129
155267
  var lastInitializer = void 0;
155130
- for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {
155131
- var declaration = _a[_i];
155268
+ for (var _i = 0, declarations_4 = declarations_5; _i < declarations_4.length; _i++) {
155269
+ var declaration = declarations_4[_i];
155132
155270
  if (declaration.initializer) {
155133
155271
  numInitializers++;
155134
155272
  lastInitializer = declaration.initializer;
@@ -159198,8 +159336,8 @@ var ts;
159198
159336
  var doc = ts.JsDoc.getJsDocCommentsFromDeclarations(declarations, checker);
159199
159337
  if (checker && (doc.length === 0 || declarations.some(hasJSDocInheritDocTag))) {
159200
159338
  var seenSymbols_1 = new ts.Set();
159201
- for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) {
159202
- var declaration = declarations_4[_i];
159339
+ for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) {
159340
+ var declaration = declarations_6[_i];
159203
159341
  var inheritedDocs = findBaseOfDeclaration(checker, declaration, function (symbol) {
159204
159342
  if (!seenSymbols_1.has(symbol)) {
159205
159343
  seenSymbols_1.add(symbol);
@@ -163407,6 +163545,7 @@ var ts;
163407
163545
  ScriptTarget["ES2019"] = "ES2019";
163408
163546
  ScriptTarget["ES2020"] = "ES2020";
163409
163547
  ScriptTarget["ES2021"] = "ES2021";
163548
+ ScriptTarget["ES2022"] = "ES2022";
163410
163549
  ScriptTarget["ESNext"] = "ESNext";
163411
163550
  })(ScriptTarget = protocol.ScriptTarget || (protocol.ScriptTarget = {}));
163412
163551
  var ClassificationType;