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/lib.es2022.array.d.ts +123 -0
- package/lib/lib.es2022.d.ts +25 -0
- package/lib/lib.es2022.error.d.ts +28 -0
- package/lib/lib.es2022.full.d.ts +25 -0
- package/lib/lib.es2022.object.d.ts +28 -0
- package/lib/lib.es2022.string.d.ts +27 -0
- package/lib/lib.es5.d.ts +1 -1
- package/lib/lib.esnext.d.ts +1 -1
- package/lib/protocol.d.ts +1 -0
- package/lib/tsc.js +258 -172
- package/lib/tsserver.js +368 -229
- package/lib/tsserverlibrary.d.ts +2 -0
- package/lib/tsserverlibrary.js +368 -229
- package/lib/typescript.d.ts +1 -0
- package/lib/typescript.js +367 -229
- package/lib/typescriptServices.d.ts +1 -0
- package/lib/typescriptServices.js +367 -229
- package/lib/typingsInstaller.js +331 -211
- package/package.json +1 -1
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20211106";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -4994,6 +4994,7 @@ var ts;
|
|
|
4994
4994
|
NodeCheckFlags[NodeCheckFlags["ConstructorReferenceInClass"] = 33554432] = "ConstructorReferenceInClass";
|
|
4995
4995
|
NodeCheckFlags[NodeCheckFlags["ContainsClassWithPrivateIdentifiers"] = 67108864] = "ContainsClassWithPrivateIdentifiers";
|
|
4996
4996
|
NodeCheckFlags[NodeCheckFlags["ContainsSuperPropertyInStaticInitializer"] = 134217728] = "ContainsSuperPropertyInStaticInitializer";
|
|
4997
|
+
NodeCheckFlags[NodeCheckFlags["InCheckIdentifier"] = 268435456] = "InCheckIdentifier";
|
|
4997
4998
|
})(NodeCheckFlags = ts.NodeCheckFlags || (ts.NodeCheckFlags = {}));
|
|
4998
4999
|
var TypeFlags;
|
|
4999
5000
|
(function (TypeFlags) {
|
|
@@ -5067,8 +5068,6 @@ var ts;
|
|
|
5067
5068
|
// 'Narrowable' types are types where narrowing actually narrows.
|
|
5068
5069
|
// This *should* be every type other than null, undefined, void, and never
|
|
5069
5070
|
TypeFlags[TypeFlags["Narrowable"] = 536624127] = "Narrowable";
|
|
5070
|
-
/* @internal */
|
|
5071
|
-
TypeFlags[TypeFlags["NotPrimitiveUnion"] = 468598819] = "NotPrimitiveUnion";
|
|
5072
5071
|
// The following flags are aggregated during union and intersection type construction
|
|
5073
5072
|
/* @internal */
|
|
5074
5073
|
TypeFlags[TypeFlags["IncludesMask"] = 205258751] = "IncludesMask";
|
|
@@ -5081,6 +5080,10 @@ var ts;
|
|
|
5081
5080
|
TypeFlags[TypeFlags["IncludesWildcard"] = 8388608] = "IncludesWildcard";
|
|
5082
5081
|
/* @internal */
|
|
5083
5082
|
TypeFlags[TypeFlags["IncludesEmptyObject"] = 16777216] = "IncludesEmptyObject";
|
|
5083
|
+
/* @internal */
|
|
5084
|
+
TypeFlags[TypeFlags["IncludesInstantiable"] = 33554432] = "IncludesInstantiable";
|
|
5085
|
+
/* @internal */
|
|
5086
|
+
TypeFlags[TypeFlags["NotPrimitiveUnion"] = 36323363] = "NotPrimitiveUnion";
|
|
5084
5087
|
})(TypeFlags = ts.TypeFlags || (ts.TypeFlags = {}));
|
|
5085
5088
|
// Types included in TypeFlags.ObjectFlagsType have an objectFlags property. Some ObjectFlags
|
|
5086
5089
|
// are specific to certain types and reuse the same bit position. Those ObjectFlags require a check
|
|
@@ -5414,6 +5417,7 @@ var ts;
|
|
|
5414
5417
|
ScriptTarget[ScriptTarget["ES2019"] = 6] = "ES2019";
|
|
5415
5418
|
ScriptTarget[ScriptTarget["ES2020"] = 7] = "ES2020";
|
|
5416
5419
|
ScriptTarget[ScriptTarget["ES2021"] = 8] = "ES2021";
|
|
5420
|
+
ScriptTarget[ScriptTarget["ES2022"] = 9] = "ES2022";
|
|
5417
5421
|
ScriptTarget[ScriptTarget["ESNext"] = 99] = "ESNext";
|
|
5418
5422
|
ScriptTarget[ScriptTarget["JSON"] = 100] = "JSON";
|
|
5419
5423
|
ScriptTarget[ScriptTarget["Latest"] = 99] = "Latest";
|
|
@@ -5582,15 +5586,16 @@ var ts;
|
|
|
5582
5586
|
TransformFlags[TransformFlags["ContainsTypeScript"] = 1] = "ContainsTypeScript";
|
|
5583
5587
|
TransformFlags[TransformFlags["ContainsJsx"] = 2] = "ContainsJsx";
|
|
5584
5588
|
TransformFlags[TransformFlags["ContainsESNext"] = 4] = "ContainsESNext";
|
|
5585
|
-
TransformFlags[TransformFlags["
|
|
5586
|
-
TransformFlags[TransformFlags["
|
|
5587
|
-
TransformFlags[TransformFlags["
|
|
5588
|
-
TransformFlags[TransformFlags["
|
|
5589
|
-
TransformFlags[TransformFlags["
|
|
5590
|
-
TransformFlags[TransformFlags["
|
|
5591
|
-
TransformFlags[TransformFlags["
|
|
5592
|
-
TransformFlags[TransformFlags["
|
|
5593
|
-
TransformFlags[TransformFlags["
|
|
5589
|
+
TransformFlags[TransformFlags["ContainsES2022"] = 8] = "ContainsES2022";
|
|
5590
|
+
TransformFlags[TransformFlags["ContainsES2021"] = 16] = "ContainsES2021";
|
|
5591
|
+
TransformFlags[TransformFlags["ContainsES2020"] = 32] = "ContainsES2020";
|
|
5592
|
+
TransformFlags[TransformFlags["ContainsES2019"] = 64] = "ContainsES2019";
|
|
5593
|
+
TransformFlags[TransformFlags["ContainsES2018"] = 128] = "ContainsES2018";
|
|
5594
|
+
TransformFlags[TransformFlags["ContainsES2017"] = 256] = "ContainsES2017";
|
|
5595
|
+
TransformFlags[TransformFlags["ContainsES2016"] = 512] = "ContainsES2016";
|
|
5596
|
+
TransformFlags[TransformFlags["ContainsES2015"] = 1024] = "ContainsES2015";
|
|
5597
|
+
TransformFlags[TransformFlags["ContainsGenerator"] = 2048] = "ContainsGenerator";
|
|
5598
|
+
TransformFlags[TransformFlags["ContainsDestructuringAssignment"] = 4096] = "ContainsDestructuringAssignment";
|
|
5594
5599
|
// Markers
|
|
5595
5600
|
// - Flags used to indicate that a subtree contains a specific transformation.
|
|
5596
5601
|
TransformFlags[TransformFlags["ContainsTypeScriptClassSyntax"] = 4096] = "ContainsTypeScriptClassSyntax";
|
|
@@ -5617,15 +5622,16 @@ var ts;
|
|
|
5617
5622
|
TransformFlags[TransformFlags["AssertTypeScript"] = 1] = "AssertTypeScript";
|
|
5618
5623
|
TransformFlags[TransformFlags["AssertJsx"] = 2] = "AssertJsx";
|
|
5619
5624
|
TransformFlags[TransformFlags["AssertESNext"] = 4] = "AssertESNext";
|
|
5620
|
-
TransformFlags[TransformFlags["
|
|
5621
|
-
TransformFlags[TransformFlags["
|
|
5622
|
-
TransformFlags[TransformFlags["
|
|
5623
|
-
TransformFlags[TransformFlags["
|
|
5624
|
-
TransformFlags[TransformFlags["
|
|
5625
|
-
TransformFlags[TransformFlags["
|
|
5626
|
-
TransformFlags[TransformFlags["
|
|
5627
|
-
TransformFlags[TransformFlags["
|
|
5628
|
-
TransformFlags[TransformFlags["
|
|
5625
|
+
TransformFlags[TransformFlags["AssertES2022"] = 8] = "AssertES2022";
|
|
5626
|
+
TransformFlags[TransformFlags["AssertES2021"] = 16] = "AssertES2021";
|
|
5627
|
+
TransformFlags[TransformFlags["AssertES2020"] = 32] = "AssertES2020";
|
|
5628
|
+
TransformFlags[TransformFlags["AssertES2019"] = 64] = "AssertES2019";
|
|
5629
|
+
TransformFlags[TransformFlags["AssertES2018"] = 128] = "AssertES2018";
|
|
5630
|
+
TransformFlags[TransformFlags["AssertES2017"] = 256] = "AssertES2017";
|
|
5631
|
+
TransformFlags[TransformFlags["AssertES2016"] = 512] = "AssertES2016";
|
|
5632
|
+
TransformFlags[TransformFlags["AssertES2015"] = 1024] = "AssertES2015";
|
|
5633
|
+
TransformFlags[TransformFlags["AssertGenerator"] = 2048] = "AssertGenerator";
|
|
5634
|
+
TransformFlags[TransformFlags["AssertDestructuringAssignment"] = 4096] = "AssertDestructuringAssignment";
|
|
5629
5635
|
// Scope Exclusions
|
|
5630
5636
|
// - Bitmasks that exclude flags from propagating out of a specific context
|
|
5631
5637
|
// into the subtree flags of their container.
|
|
@@ -8295,7 +8301,7 @@ var ts;
|
|
|
8295
8301
|
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."),
|
|
8296
8302
|
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."),
|
|
8297
8303
|
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'."),
|
|
8298
|
-
|
|
8304
|
+
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'."),
|
|
8299
8305
|
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."),
|
|
8300
8306
|
Dynamic_import_cannot_have_type_arguments: diag(1326, ts.DiagnosticCategory.Error, "Dynamic_import_cannot_have_type_arguments_1326", "Dynamic import cannot have type arguments."),
|
|
8301
8307
|
String_literal_with_double_quotes_expected: diag(1327, ts.DiagnosticCategory.Error, "String_literal_with_double_quotes_expected_1327", "String literal with double quotes expected."),
|
|
@@ -8895,11 +8901,12 @@ var ts;
|
|
|
8895
8901
|
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."),
|
|
8896
8902
|
Namespace_name_cannot_be_0: diag(2819, ts.DiagnosticCategory.Error, "Namespace_name_cannot_be_0_2819", "Namespace name cannot be '{0}'."),
|
|
8897
8903
|
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}'?"),
|
|
8898
|
-
|
|
8904
|
+
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'."),
|
|
8899
8905
|
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."),
|
|
8900
8906
|
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}'?"),
|
|
8901
8907
|
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."),
|
|
8902
8908
|
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}'?"),
|
|
8909
|
+
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."),
|
|
8903
8910
|
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}'."),
|
|
8904
8911
|
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}'."),
|
|
8905
8912
|
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}'."),
|
|
@@ -11926,6 +11933,7 @@ var ts;
|
|
|
11926
11933
|
tokenValue = tokenValue.slice(0, -1);
|
|
11927
11934
|
pos--;
|
|
11928
11935
|
}
|
|
11936
|
+
return getIdentifierToken();
|
|
11929
11937
|
}
|
|
11930
11938
|
return token;
|
|
11931
11939
|
}
|
|
@@ -12171,6 +12179,8 @@ var ts;
|
|
|
12171
12179
|
switch (ts.getEmitScriptTarget(options)) {
|
|
12172
12180
|
case 99 /* ESNext */:
|
|
12173
12181
|
return "lib.esnext.full.d.ts";
|
|
12182
|
+
case 9 /* ES2022 */:
|
|
12183
|
+
return "lib.es2022.full.d.ts";
|
|
12174
12184
|
case 8 /* ES2021 */:
|
|
12175
12185
|
return "lib.es2021.full.d.ts";
|
|
12176
12186
|
case 7 /* ES2020 */:
|
|
@@ -14637,6 +14647,7 @@ var ts;
|
|
|
14637
14647
|
AsyncIterableIterator: ts.emptyArray,
|
|
14638
14648
|
AsyncGenerator: ts.emptyArray,
|
|
14639
14649
|
AsyncGeneratorFunction: ts.emptyArray,
|
|
14650
|
+
NumberFormat: ["formatToParts"]
|
|
14640
14651
|
},
|
|
14641
14652
|
es2019: {
|
|
14642
14653
|
Array: ["flat", "flatMap"],
|
|
@@ -14658,8 +14669,21 @@ var ts;
|
|
|
14658
14669
|
PromiseConstructor: ["any"],
|
|
14659
14670
|
String: ["replaceAll"]
|
|
14660
14671
|
},
|
|
14661
|
-
|
|
14662
|
-
|
|
14672
|
+
es2022: {
|
|
14673
|
+
Array: ["at"],
|
|
14674
|
+
String: ["at"],
|
|
14675
|
+
Int8Array: ["at"],
|
|
14676
|
+
Uint8Array: ["at"],
|
|
14677
|
+
Uint8ClampedArray: ["at"],
|
|
14678
|
+
Int16Array: ["at"],
|
|
14679
|
+
Uint16Array: ["at"],
|
|
14680
|
+
Int32Array: ["at"],
|
|
14681
|
+
Uint32Array: ["at"],
|
|
14682
|
+
Float32Array: ["at"],
|
|
14683
|
+
Float64Array: ["at"],
|
|
14684
|
+
BigInt64Array: ["at"],
|
|
14685
|
+
BigUint64Array: ["at"],
|
|
14686
|
+
ObjectConstructor: ["hasOwn"]
|
|
14663
14687
|
}
|
|
14664
14688
|
};
|
|
14665
14689
|
}
|
|
@@ -22199,7 +22223,7 @@ var ts;
|
|
|
22199
22223
|
var node = createBaseLiteral(8 /* NumericLiteral */, typeof value === "number" ? value + "" : value);
|
|
22200
22224
|
node.numericLiteralFlags = numericLiteralFlags;
|
|
22201
22225
|
if (numericLiteralFlags & 384 /* BinaryOrOctalSpecifier */)
|
|
22202
|
-
node.transformFlags |=
|
|
22226
|
+
node.transformFlags |= 1024 /* ContainsES2015 */;
|
|
22203
22227
|
return node;
|
|
22204
22228
|
}
|
|
22205
22229
|
// @api
|
|
@@ -22218,7 +22242,7 @@ var ts;
|
|
|
22218
22242
|
var node = createBaseStringLiteral(text, isSingleQuote);
|
|
22219
22243
|
node.hasExtendedUnicodeEscape = hasExtendedUnicodeEscape;
|
|
22220
22244
|
if (hasExtendedUnicodeEscape)
|
|
22221
|
-
node.transformFlags |=
|
|
22245
|
+
node.transformFlags |= 1024 /* ContainsES2015 */;
|
|
22222
22246
|
return node;
|
|
22223
22247
|
}
|
|
22224
22248
|
// @api
|
|
@@ -22346,8 +22370,8 @@ var ts;
|
|
|
22346
22370
|
case 131 /* AsyncKeyword */:
|
|
22347
22371
|
// 'async' modifier is ES2017 (async functions) or ES2018 (async generators)
|
|
22348
22372
|
transformFlags =
|
|
22349
|
-
|
|
22350
|
-
|
|
22373
|
+
256 /* ContainsES2017 */ |
|
|
22374
|
+
128 /* ContainsES2018 */;
|
|
22351
22375
|
break;
|
|
22352
22376
|
case 123 /* PublicKeyword */:
|
|
22353
22377
|
case 121 /* PrivateKeyword */:
|
|
@@ -22371,10 +22395,10 @@ var ts;
|
|
|
22371
22395
|
transformFlags = 1 /* ContainsTypeScript */;
|
|
22372
22396
|
break;
|
|
22373
22397
|
case 106 /* SuperKeyword */:
|
|
22374
|
-
transformFlags =
|
|
22398
|
+
transformFlags = 1024 /* ContainsES2015 */ | 33554432 /* ContainsLexicalSuper */;
|
|
22375
22399
|
break;
|
|
22376
22400
|
case 124 /* StaticKeyword */:
|
|
22377
|
-
transformFlags =
|
|
22401
|
+
transformFlags = 1024 /* ContainsES2015 */;
|
|
22378
22402
|
break;
|
|
22379
22403
|
case 108 /* ThisKeyword */:
|
|
22380
22404
|
// 'this' indicates a lexical 'this'
|
|
@@ -22471,7 +22495,7 @@ var ts;
|
|
|
22471
22495
|
node.expression = parenthesizerRules().parenthesizeExpressionOfComputedPropertyName(expression);
|
|
22472
22496
|
node.transformFlags |=
|
|
22473
22497
|
propagateChildFlags(node.expression) |
|
|
22474
|
-
|
|
22498
|
+
1024 /* ContainsES2015 */ |
|
|
22475
22499
|
65536 /* ContainsComputedPropertyName */;
|
|
22476
22500
|
return node;
|
|
22477
22501
|
}
|
|
@@ -22519,7 +22543,7 @@ var ts;
|
|
|
22519
22543
|
if (ts.modifiersToFlags(node.modifiers) & 16476 /* ParameterPropertyModifier */)
|
|
22520
22544
|
node.transformFlags |= 4096 /* ContainsTypeScriptClassSyntax */;
|
|
22521
22545
|
if (initializer || dotDotDotToken)
|
|
22522
|
-
node.transformFlags |=
|
|
22546
|
+
node.transformFlags |= 1024 /* ContainsES2015 */;
|
|
22523
22547
|
}
|
|
22524
22548
|
return node;
|
|
22525
22549
|
}
|
|
@@ -22628,20 +22652,20 @@ var ts;
|
|
|
22628
22652
|
node.transformFlags |=
|
|
22629
22653
|
propagateChildFlags(node.asteriskToken) |
|
|
22630
22654
|
propagateChildFlags(node.questionToken) |
|
|
22631
|
-
|
|
22655
|
+
1024 /* ContainsES2015 */;
|
|
22632
22656
|
if (questionToken) {
|
|
22633
22657
|
node.transformFlags |= 1 /* ContainsTypeScript */;
|
|
22634
22658
|
}
|
|
22635
22659
|
if (ts.modifiersToFlags(node.modifiers) & 256 /* Async */) {
|
|
22636
22660
|
if (asteriskToken) {
|
|
22637
|
-
node.transformFlags |=
|
|
22661
|
+
node.transformFlags |= 128 /* ContainsES2018 */;
|
|
22638
22662
|
}
|
|
22639
22663
|
else {
|
|
22640
|
-
node.transformFlags |=
|
|
22664
|
+
node.transformFlags |= 256 /* ContainsES2017 */;
|
|
22641
22665
|
}
|
|
22642
22666
|
}
|
|
22643
22667
|
else if (asteriskToken) {
|
|
22644
|
-
node.transformFlags |=
|
|
22668
|
+
node.transformFlags |= 2048 /* ContainsGenerator */;
|
|
22645
22669
|
}
|
|
22646
22670
|
return node;
|
|
22647
22671
|
}
|
|
@@ -22682,7 +22706,7 @@ var ts;
|
|
|
22682
22706
|
/*name*/ undefined,
|
|
22683
22707
|
/*typeParameters*/ undefined, parameters,
|
|
22684
22708
|
/*type*/ undefined, body);
|
|
22685
|
-
node.transformFlags |=
|
|
22709
|
+
node.transformFlags |= 1024 /* ContainsES2015 */;
|
|
22686
22710
|
return node;
|
|
22687
22711
|
}
|
|
22688
22712
|
// @api
|
|
@@ -23176,11 +23200,11 @@ var ts;
|
|
|
23176
23200
|
node.elements = createNodeArray(elements);
|
|
23177
23201
|
node.transformFlags |=
|
|
23178
23202
|
propagateChildrenFlags(node.elements) |
|
|
23179
|
-
|
|
23203
|
+
1024 /* ContainsES2015 */ |
|
|
23180
23204
|
262144 /* ContainsBindingPattern */;
|
|
23181
23205
|
if (node.transformFlags & 16384 /* ContainsRestOrSpread */) {
|
|
23182
23206
|
node.transformFlags |=
|
|
23183
|
-
|
|
23207
|
+
128 /* ContainsES2018 */ |
|
|
23184
23208
|
32768 /* ContainsObjectRestOrSpread */;
|
|
23185
23209
|
}
|
|
23186
23210
|
return node;
|
|
@@ -23197,7 +23221,7 @@ var ts;
|
|
|
23197
23221
|
node.elements = createNodeArray(elements);
|
|
23198
23222
|
node.transformFlags |=
|
|
23199
23223
|
propagateChildrenFlags(node.elements) |
|
|
23200
|
-
|
|
23224
|
+
1024 /* ContainsES2015 */ |
|
|
23201
23225
|
262144 /* ContainsBindingPattern */;
|
|
23202
23226
|
return node;
|
|
23203
23227
|
}
|
|
@@ -23216,7 +23240,7 @@ var ts;
|
|
|
23216
23240
|
node.dotDotDotToken = dotDotDotToken;
|
|
23217
23241
|
node.transformFlags |=
|
|
23218
23242
|
propagateChildFlags(node.dotDotDotToken) |
|
|
23219
|
-
|
|
23243
|
+
1024 /* ContainsES2015 */;
|
|
23220
23244
|
if (node.propertyName) {
|
|
23221
23245
|
node.transformFlags |= ts.isIdentifier(node.propertyName) ?
|
|
23222
23246
|
propagateIdentifierNameFlags(node.propertyName) :
|
|
@@ -23290,8 +23314,8 @@ var ts;
|
|
|
23290
23314
|
// super method calls require a lexical 'this'
|
|
23291
23315
|
// super method calls require 'super' hoisting in ES2017 and ES2018 async functions and async generators
|
|
23292
23316
|
node.transformFlags |=
|
|
23293
|
-
|
|
23294
|
-
|
|
23317
|
+
256 /* ContainsES2017 */ |
|
|
23318
|
+
128 /* ContainsES2018 */;
|
|
23295
23319
|
}
|
|
23296
23320
|
return node;
|
|
23297
23321
|
}
|
|
@@ -23313,7 +23337,7 @@ var ts;
|
|
|
23313
23337
|
node.questionDotToken = questionDotToken;
|
|
23314
23338
|
node.name = asName(name);
|
|
23315
23339
|
node.transformFlags |=
|
|
23316
|
-
|
|
23340
|
+
32 /* ContainsES2020 */ |
|
|
23317
23341
|
propagateChildFlags(node.expression) |
|
|
23318
23342
|
propagateChildFlags(node.questionDotToken) |
|
|
23319
23343
|
(ts.isIdentifier(node.name) ?
|
|
@@ -23344,8 +23368,8 @@ var ts;
|
|
|
23344
23368
|
// super method calls require a lexical 'this'
|
|
23345
23369
|
// super method calls require 'super' hoisting in ES2017 and ES2018 async functions and async generators
|
|
23346
23370
|
node.transformFlags |=
|
|
23347
|
-
|
|
23348
|
-
|
|
23371
|
+
256 /* ContainsES2017 */ |
|
|
23372
|
+
128 /* ContainsES2018 */;
|
|
23349
23373
|
}
|
|
23350
23374
|
return node;
|
|
23351
23375
|
}
|
|
@@ -23370,7 +23394,7 @@ var ts;
|
|
|
23370
23394
|
propagateChildFlags(node.expression) |
|
|
23371
23395
|
propagateChildFlags(node.questionDotToken) |
|
|
23372
23396
|
propagateChildFlags(node.argumentExpression) |
|
|
23373
|
-
|
|
23397
|
+
32 /* ContainsES2020 */;
|
|
23374
23398
|
return node;
|
|
23375
23399
|
}
|
|
23376
23400
|
// @api
|
|
@@ -23429,7 +23453,7 @@ var ts;
|
|
|
23429
23453
|
propagateChildFlags(node.questionDotToken) |
|
|
23430
23454
|
propagateChildrenFlags(node.typeArguments) |
|
|
23431
23455
|
propagateChildrenFlags(node.arguments) |
|
|
23432
|
-
|
|
23456
|
+
32 /* ContainsES2020 */;
|
|
23433
23457
|
if (node.typeArguments) {
|
|
23434
23458
|
node.transformFlags |= 1 /* ContainsTypeScript */;
|
|
23435
23459
|
}
|
|
@@ -23458,7 +23482,7 @@ var ts;
|
|
|
23458
23482
|
propagateChildFlags(node.expression) |
|
|
23459
23483
|
propagateChildrenFlags(node.typeArguments) |
|
|
23460
23484
|
propagateChildrenFlags(node.arguments) |
|
|
23461
|
-
|
|
23485
|
+
32 /* ContainsES2020 */;
|
|
23462
23486
|
if (node.typeArguments) {
|
|
23463
23487
|
node.transformFlags |= 1 /* ContainsTypeScript */;
|
|
23464
23488
|
}
|
|
@@ -23482,12 +23506,12 @@ var ts;
|
|
|
23482
23506
|
propagateChildFlags(node.tag) |
|
|
23483
23507
|
propagateChildrenFlags(node.typeArguments) |
|
|
23484
23508
|
propagateChildFlags(node.template) |
|
|
23485
|
-
|
|
23509
|
+
1024 /* ContainsES2015 */;
|
|
23486
23510
|
if (node.typeArguments) {
|
|
23487
23511
|
node.transformFlags |= 1 /* ContainsTypeScript */;
|
|
23488
23512
|
}
|
|
23489
23513
|
if (ts.hasInvalidEscape(node.template)) {
|
|
23490
|
-
node.transformFlags |=
|
|
23514
|
+
node.transformFlags |= 128 /* ContainsES2018 */;
|
|
23491
23515
|
}
|
|
23492
23516
|
return node;
|
|
23493
23517
|
}
|
|
@@ -23541,14 +23565,14 @@ var ts;
|
|
|
23541
23565
|
}
|
|
23542
23566
|
if (ts.modifiersToFlags(node.modifiers) & 256 /* Async */) {
|
|
23543
23567
|
if (node.asteriskToken) {
|
|
23544
|
-
node.transformFlags |=
|
|
23568
|
+
node.transformFlags |= 128 /* ContainsES2018 */;
|
|
23545
23569
|
}
|
|
23546
23570
|
else {
|
|
23547
|
-
node.transformFlags |=
|
|
23571
|
+
node.transformFlags |= 256 /* ContainsES2017 */;
|
|
23548
23572
|
}
|
|
23549
23573
|
}
|
|
23550
23574
|
else if (node.asteriskToken) {
|
|
23551
|
-
node.transformFlags |=
|
|
23575
|
+
node.transformFlags |= 2048 /* ContainsGenerator */;
|
|
23552
23576
|
}
|
|
23553
23577
|
return node;
|
|
23554
23578
|
}
|
|
@@ -23572,9 +23596,9 @@ var ts;
|
|
|
23572
23596
|
node.equalsGreaterThanToken = equalsGreaterThanToken !== null && equalsGreaterThanToken !== void 0 ? equalsGreaterThanToken : createToken(38 /* EqualsGreaterThanToken */);
|
|
23573
23597
|
node.transformFlags |=
|
|
23574
23598
|
propagateChildFlags(node.equalsGreaterThanToken) |
|
|
23575
|
-
|
|
23599
|
+
1024 /* ContainsES2015 */;
|
|
23576
23600
|
if (ts.modifiersToFlags(node.modifiers) & 256 /* Async */) {
|
|
23577
|
-
node.transformFlags |=
|
|
23601
|
+
node.transformFlags |= 256 /* ContainsES2017 */ | 8192 /* ContainsLexicalThis */;
|
|
23578
23602
|
}
|
|
23579
23603
|
return node;
|
|
23580
23604
|
}
|
|
@@ -23634,8 +23658,8 @@ var ts;
|
|
|
23634
23658
|
node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression);
|
|
23635
23659
|
node.transformFlags |=
|
|
23636
23660
|
propagateChildFlags(node.expression) |
|
|
23637
|
-
|
|
23638
|
-
|
|
23661
|
+
256 /* ContainsES2017 */ |
|
|
23662
|
+
128 /* ContainsES2018 */ |
|
|
23639
23663
|
1048576 /* ContainsAwait */;
|
|
23640
23664
|
return node;
|
|
23641
23665
|
}
|
|
@@ -23701,35 +23725,35 @@ var ts;
|
|
|
23701
23725
|
propagateChildFlags(node.operatorToken) |
|
|
23702
23726
|
propagateChildFlags(node.right);
|
|
23703
23727
|
if (operatorKind === 60 /* QuestionQuestionToken */) {
|
|
23704
|
-
node.transformFlags |=
|
|
23728
|
+
node.transformFlags |= 32 /* ContainsES2020 */;
|
|
23705
23729
|
}
|
|
23706
23730
|
else if (operatorKind === 63 /* EqualsToken */) {
|
|
23707
23731
|
if (ts.isObjectLiteralExpression(node.left)) {
|
|
23708
23732
|
node.transformFlags |=
|
|
23709
|
-
|
|
23710
|
-
|
|
23711
|
-
|
|
23733
|
+
1024 /* ContainsES2015 */ |
|
|
23734
|
+
128 /* ContainsES2018 */ |
|
|
23735
|
+
4096 /* ContainsDestructuringAssignment */ |
|
|
23712
23736
|
propagateAssignmentPatternFlags(node.left);
|
|
23713
23737
|
}
|
|
23714
23738
|
else if (ts.isArrayLiteralExpression(node.left)) {
|
|
23715
23739
|
node.transformFlags |=
|
|
23716
|
-
|
|
23717
|
-
|
|
23740
|
+
1024 /* ContainsES2015 */ |
|
|
23741
|
+
4096 /* ContainsDestructuringAssignment */ |
|
|
23718
23742
|
propagateAssignmentPatternFlags(node.left);
|
|
23719
23743
|
}
|
|
23720
23744
|
}
|
|
23721
23745
|
else if (operatorKind === 42 /* AsteriskAsteriskToken */ || operatorKind === 67 /* AsteriskAsteriskEqualsToken */) {
|
|
23722
|
-
node.transformFlags |=
|
|
23746
|
+
node.transformFlags |= 512 /* ContainsES2016 */;
|
|
23723
23747
|
}
|
|
23724
23748
|
else if (ts.isLogicalOrCoalescingAssignmentOperator(operatorKind)) {
|
|
23725
|
-
node.transformFlags |=
|
|
23749
|
+
node.transformFlags |= 16 /* ContainsES2021 */;
|
|
23726
23750
|
}
|
|
23727
23751
|
return node;
|
|
23728
23752
|
}
|
|
23729
23753
|
function propagateAssignmentPatternFlags(node) {
|
|
23730
23754
|
if (node.transformFlags & 32768 /* ContainsObjectRestOrSpread */)
|
|
23731
23755
|
return 32768 /* ContainsObjectRestOrSpread */;
|
|
23732
|
-
if (node.transformFlags &
|
|
23756
|
+
if (node.transformFlags & 128 /* ContainsES2018 */) {
|
|
23733
23757
|
// check for nested spread assignments, otherwise '{ x: { a, ...b } = foo } = c'
|
|
23734
23758
|
// will not be correctly interpreted by the ES2018 transformer
|
|
23735
23759
|
for (var _i = 0, _a = ts.getElementsOfBindingOrAssignmentPattern(node); _i < _a.length; _i++) {
|
|
@@ -23739,7 +23763,7 @@ var ts;
|
|
|
23739
23763
|
if (target.transformFlags & 32768 /* ContainsObjectRestOrSpread */) {
|
|
23740
23764
|
return 32768 /* ContainsObjectRestOrSpread */;
|
|
23741
23765
|
}
|
|
23742
|
-
if (target.transformFlags &
|
|
23766
|
+
if (target.transformFlags & 128 /* ContainsES2018 */) {
|
|
23743
23767
|
var flags_1 = propagateAssignmentPatternFlags(target);
|
|
23744
23768
|
if (flags_1)
|
|
23745
23769
|
return flags_1;
|
|
@@ -23791,7 +23815,7 @@ var ts;
|
|
|
23791
23815
|
node.transformFlags |=
|
|
23792
23816
|
propagateChildFlags(node.head) |
|
|
23793
23817
|
propagateChildrenFlags(node.templateSpans) |
|
|
23794
|
-
|
|
23818
|
+
1024 /* ContainsES2015 */;
|
|
23795
23819
|
return node;
|
|
23796
23820
|
}
|
|
23797
23821
|
// @api
|
|
@@ -23830,9 +23854,9 @@ var ts;
|
|
|
23830
23854
|
node.text = text;
|
|
23831
23855
|
node.rawText = rawText;
|
|
23832
23856
|
node.templateFlags = templateFlags & 2048 /* TemplateLiteralLikeFlags */;
|
|
23833
|
-
node.transformFlags |=
|
|
23857
|
+
node.transformFlags |= 1024 /* ContainsES2015 */;
|
|
23834
23858
|
if (node.templateFlags) {
|
|
23835
|
-
node.transformFlags |=
|
|
23859
|
+
node.transformFlags |= 128 /* ContainsES2018 */;
|
|
23836
23860
|
}
|
|
23837
23861
|
return node;
|
|
23838
23862
|
}
|
|
@@ -23861,8 +23885,8 @@ var ts;
|
|
|
23861
23885
|
node.transformFlags |=
|
|
23862
23886
|
propagateChildFlags(node.expression) |
|
|
23863
23887
|
propagateChildFlags(node.asteriskToken) |
|
|
23864
|
-
|
|
23865
|
-
|
|
23888
|
+
1024 /* ContainsES2015 */ |
|
|
23889
|
+
128 /* ContainsES2018 */ |
|
|
23866
23890
|
524288 /* ContainsYield */;
|
|
23867
23891
|
return node;
|
|
23868
23892
|
}
|
|
@@ -23879,7 +23903,7 @@ var ts;
|
|
|
23879
23903
|
node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression);
|
|
23880
23904
|
node.transformFlags |=
|
|
23881
23905
|
propagateChildFlags(node.expression) |
|
|
23882
|
-
|
|
23906
|
+
1024 /* ContainsES2015 */ |
|
|
23883
23907
|
16384 /* ContainsRestOrSpread */;
|
|
23884
23908
|
return node;
|
|
23885
23909
|
}
|
|
@@ -23892,7 +23916,7 @@ var ts;
|
|
|
23892
23916
|
// @api
|
|
23893
23917
|
function createClassExpression(decorators, modifiers, name, typeParameters, heritageClauses, members) {
|
|
23894
23918
|
var node = createBaseClassLikeDeclaration(225 /* ClassExpression */, decorators, modifiers, name, typeParameters, heritageClauses, members);
|
|
23895
|
-
node.transformFlags |=
|
|
23919
|
+
node.transformFlags |= 1024 /* ContainsES2015 */;
|
|
23896
23920
|
return node;
|
|
23897
23921
|
}
|
|
23898
23922
|
// @api
|
|
@@ -23918,7 +23942,7 @@ var ts;
|
|
|
23918
23942
|
node.transformFlags |=
|
|
23919
23943
|
propagateChildFlags(node.expression) |
|
|
23920
23944
|
propagateChildrenFlags(node.typeArguments) |
|
|
23921
|
-
|
|
23945
|
+
1024 /* ContainsES2015 */;
|
|
23922
23946
|
return node;
|
|
23923
23947
|
}
|
|
23924
23948
|
// @api
|
|
@@ -23989,7 +24013,7 @@ var ts;
|
|
|
23989
24013
|
node.transformFlags |= propagateChildFlags(node.name);
|
|
23990
24014
|
switch (keywordToken) {
|
|
23991
24015
|
case 103 /* NewKeyword */:
|
|
23992
|
-
node.transformFlags |=
|
|
24016
|
+
node.transformFlags |= 1024 /* ContainsES2015 */;
|
|
23993
24017
|
break;
|
|
23994
24018
|
case 100 /* ImportKeyword */:
|
|
23995
24019
|
node.transformFlags |= 4 /* ContainsESNext */;
|
|
@@ -24016,7 +24040,7 @@ var ts;
|
|
|
24016
24040
|
node.transformFlags |=
|
|
24017
24041
|
propagateChildFlags(node.expression) |
|
|
24018
24042
|
propagateChildFlags(node.literal) |
|
|
24019
|
-
|
|
24043
|
+
1024 /* ContainsES2015 */;
|
|
24020
24044
|
return node;
|
|
24021
24045
|
}
|
|
24022
24046
|
// @api
|
|
@@ -24029,7 +24053,7 @@ var ts;
|
|
|
24029
24053
|
// @api
|
|
24030
24054
|
function createSemicolonClassElement() {
|
|
24031
24055
|
var node = createBaseNode(233 /* SemicolonClassElement */);
|
|
24032
|
-
node.transformFlags |=
|
|
24056
|
+
node.transformFlags |= 1024 /* ContainsES2015 */;
|
|
24033
24057
|
return node;
|
|
24034
24058
|
}
|
|
24035
24059
|
//
|
|
@@ -24193,9 +24217,9 @@ var ts;
|
|
|
24193
24217
|
propagateChildFlags(node.initializer) |
|
|
24194
24218
|
propagateChildFlags(node.expression) |
|
|
24195
24219
|
propagateChildFlags(node.statement) |
|
|
24196
|
-
|
|
24220
|
+
1024 /* ContainsES2015 */;
|
|
24197
24221
|
if (awaitModifier)
|
|
24198
|
-
node.transformFlags |=
|
|
24222
|
+
node.transformFlags |= 128 /* ContainsES2018 */;
|
|
24199
24223
|
return node;
|
|
24200
24224
|
}
|
|
24201
24225
|
// @api
|
|
@@ -24244,7 +24268,7 @@ var ts;
|
|
|
24244
24268
|
// return in an ES2018 async generator must be awaited
|
|
24245
24269
|
node.transformFlags |=
|
|
24246
24270
|
propagateChildFlags(node.expression) |
|
|
24247
|
-
|
|
24271
|
+
128 /* ContainsES2018 */ |
|
|
24248
24272
|
2097152 /* ContainsHoistedDeclarationOrCompletion */;
|
|
24249
24273
|
return node;
|
|
24250
24274
|
}
|
|
@@ -24374,7 +24398,7 @@ var ts;
|
|
|
24374
24398
|
2097152 /* ContainsHoistedDeclarationOrCompletion */;
|
|
24375
24399
|
if (flags & 3 /* BlockScoped */) {
|
|
24376
24400
|
node.transformFlags |=
|
|
24377
|
-
|
|
24401
|
+
1024 /* ContainsES2015 */ |
|
|
24378
24402
|
131072 /* ContainsBlockScopedBinding */;
|
|
24379
24403
|
}
|
|
24380
24404
|
return node;
|
|
@@ -24398,14 +24422,14 @@ var ts;
|
|
|
24398
24422
|
2097152 /* ContainsHoistedDeclarationOrCompletion */;
|
|
24399
24423
|
if (ts.modifiersToFlags(node.modifiers) & 256 /* Async */) {
|
|
24400
24424
|
if (node.asteriskToken) {
|
|
24401
|
-
node.transformFlags |=
|
|
24425
|
+
node.transformFlags |= 128 /* ContainsES2018 */;
|
|
24402
24426
|
}
|
|
24403
24427
|
else {
|
|
24404
|
-
node.transformFlags |=
|
|
24428
|
+
node.transformFlags |= 256 /* ContainsES2017 */;
|
|
24405
24429
|
}
|
|
24406
24430
|
}
|
|
24407
24431
|
else if (node.asteriskToken) {
|
|
24408
|
-
node.transformFlags |=
|
|
24432
|
+
node.transformFlags |= 2048 /* ContainsGenerator */;
|
|
24409
24433
|
}
|
|
24410
24434
|
}
|
|
24411
24435
|
return node;
|
|
@@ -24430,7 +24454,7 @@ var ts;
|
|
|
24430
24454
|
node.transformFlags = 1 /* ContainsTypeScript */;
|
|
24431
24455
|
}
|
|
24432
24456
|
else {
|
|
24433
|
-
node.transformFlags |=
|
|
24457
|
+
node.transformFlags |= 1024 /* ContainsES2015 */;
|
|
24434
24458
|
if (node.transformFlags & 4096 /* ContainsTypeScriptClassSyntax */) {
|
|
24435
24459
|
node.transformFlags |= 1 /* ContainsTypeScript */;
|
|
24436
24460
|
}
|
|
@@ -25470,7 +25494,7 @@ var ts;
|
|
|
25470
25494
|
node.transformFlags |= propagateChildrenFlags(node.types);
|
|
25471
25495
|
switch (token) {
|
|
25472
25496
|
case 94 /* ExtendsKeyword */:
|
|
25473
|
-
node.transformFlags |=
|
|
25497
|
+
node.transformFlags |= 1024 /* ContainsES2015 */;
|
|
25474
25498
|
break;
|
|
25475
25499
|
case 117 /* ImplementsKeyword */:
|
|
25476
25500
|
node.transformFlags |= 1 /* ContainsTypeScript */;
|
|
@@ -25501,7 +25525,7 @@ var ts;
|
|
|
25501
25525
|
propagateChildFlags(node.variableDeclaration) |
|
|
25502
25526
|
propagateChildFlags(node.block);
|
|
25503
25527
|
if (!variableDeclaration)
|
|
25504
|
-
node.transformFlags |=
|
|
25528
|
+
node.transformFlags |= 64 /* ContainsES2019 */;
|
|
25505
25529
|
return node;
|
|
25506
25530
|
}
|
|
25507
25531
|
// @api
|
|
@@ -25552,7 +25576,7 @@ var ts;
|
|
|
25552
25576
|
node.objectAssignmentInitializer = objectAssignmentInitializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(objectAssignmentInitializer);
|
|
25553
25577
|
node.transformFlags |=
|
|
25554
25578
|
propagateChildFlags(node.objectAssignmentInitializer) |
|
|
25555
|
-
|
|
25579
|
+
1024 /* ContainsES2015 */;
|
|
25556
25580
|
return node;
|
|
25557
25581
|
}
|
|
25558
25582
|
function finishUpdateShorthandPropertyAssignment(updated, original) {
|
|
@@ -25582,7 +25606,7 @@ var ts;
|
|
|
25582
25606
|
node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression);
|
|
25583
25607
|
node.transformFlags |=
|
|
25584
25608
|
propagateChildFlags(node.expression) |
|
|
25585
|
-
|
|
25609
|
+
128 /* ContainsES2018 */ |
|
|
25586
25610
|
32768 /* ContainsObjectRestOrSpread */;
|
|
25587
25611
|
return node;
|
|
25588
25612
|
}
|
|
@@ -38255,6 +38279,7 @@ var ts;
|
|
|
38255
38279
|
["es2019", "lib.es2019.d.ts"],
|
|
38256
38280
|
["es2020", "lib.es2020.d.ts"],
|
|
38257
38281
|
["es2021", "lib.es2021.d.ts"],
|
|
38282
|
+
["es2022", "lib.es2022.d.ts"],
|
|
38258
38283
|
["esnext", "lib.esnext.d.ts"],
|
|
38259
38284
|
// Host only
|
|
38260
38285
|
["dom", "lib.dom.d.ts"],
|
|
@@ -38298,12 +38323,16 @@ var ts;
|
|
|
38298
38323
|
["es2021.string", "lib.es2021.string.d.ts"],
|
|
38299
38324
|
["es2021.weakref", "lib.es2021.weakref.d.ts"],
|
|
38300
38325
|
["es2021.intl", "lib.es2021.intl.d.ts"],
|
|
38301
|
-
["
|
|
38326
|
+
["es2022.array", "lib.es2022.array.d.ts"],
|
|
38327
|
+
["es2022.error", "lib.es2022.error.d.ts"],
|
|
38328
|
+
["es2022.object", "lib.es2022.object.d.ts"],
|
|
38329
|
+
["es2022.string", "lib.es2022.string.d.ts"],
|
|
38330
|
+
["esnext.array", "lib.es2022.array.d.ts"],
|
|
38302
38331
|
["esnext.symbol", "lib.es2019.symbol.d.ts"],
|
|
38303
38332
|
["esnext.asynciterable", "lib.es2018.asynciterable.d.ts"],
|
|
38304
38333
|
["esnext.intl", "lib.esnext.intl.d.ts"],
|
|
38305
38334
|
["esnext.bigint", "lib.es2020.bigint.d.ts"],
|
|
38306
|
-
["esnext.string", "lib.
|
|
38335
|
+
["esnext.string", "lib.es2022.string.d.ts"],
|
|
38307
38336
|
["esnext.promise", "lib.es2021.promise.d.ts"],
|
|
38308
38337
|
["esnext.weakref", "lib.es2021.weakref.d.ts"]
|
|
38309
38338
|
];
|
|
@@ -38535,6 +38564,7 @@ var ts;
|
|
|
38535
38564
|
es2019: 6 /* ES2019 */,
|
|
38536
38565
|
es2020: 7 /* ES2020 */,
|
|
38537
38566
|
es2021: 8 /* ES2021 */,
|
|
38567
|
+
es2022: 9 /* ES2022 */,
|
|
38538
38568
|
esnext: 99 /* ESNext */,
|
|
38539
38569
|
})),
|
|
38540
38570
|
affectsSourceFile: true,
|
|
@@ -54312,12 +54342,15 @@ var ts;
|
|
|
54312
54342
|
}
|
|
54313
54343
|
/** Return the inferred type for a binding element */
|
|
54314
54344
|
function getTypeForBindingElement(declaration) {
|
|
54315
|
-
var
|
|
54316
|
-
|
|
54317
|
-
|
|
54318
|
-
|
|
54345
|
+
var parentType = getTypeForBindingElementParent(declaration.parent.parent);
|
|
54346
|
+
return parentType && getBindingElementTypeFromParentType(declaration, parentType);
|
|
54347
|
+
}
|
|
54348
|
+
function getBindingElementTypeFromParentType(declaration, parentType) {
|
|
54349
|
+
// If an any type was inferred for parent, infer that for the binding element
|
|
54350
|
+
if (isTypeAny(parentType)) {
|
|
54319
54351
|
return parentType;
|
|
54320
54352
|
}
|
|
54353
|
+
var pattern = declaration.parent;
|
|
54321
54354
|
// Relax null check on ambient destructuring parameters, since the parameters have no implementation and are just documentation
|
|
54322
54355
|
if (strictNullChecks && declaration.flags & 8388608 /* Ambient */ && ts.isParameterDeclaration(declaration)) {
|
|
54323
54356
|
parentType = getNonNullableType(parentType);
|
|
@@ -59529,6 +59562,8 @@ var ts;
|
|
|
59529
59562
|
// We ignore 'never' types in unions
|
|
59530
59563
|
if (!(flags & 131072 /* Never */)) {
|
|
59531
59564
|
includes |= flags & 205258751 /* IncludesMask */;
|
|
59565
|
+
if (flags & 465829888 /* Instantiable */)
|
|
59566
|
+
includes |= 33554432 /* IncludesInstantiable */;
|
|
59532
59567
|
if (type === wildcardType)
|
|
59533
59568
|
includes |= 8388608 /* IncludesWildcard */;
|
|
59534
59569
|
if (!strictNullChecks && flags & 98304 /* Nullable */) {
|
|
@@ -59742,7 +59777,7 @@ var ts;
|
|
|
59742
59777
|
origin = createOriginUnionOrIntersectionType(1048576 /* Union */, reducedTypes);
|
|
59743
59778
|
}
|
|
59744
59779
|
}
|
|
59745
|
-
var objectFlags = (includes &
|
|
59780
|
+
var objectFlags = (includes & 36323363 /* NotPrimitiveUnion */ ? 0 : 65536 /* PrimitiveUnion */) |
|
|
59746
59781
|
(includes & 2097152 /* Intersection */ ? 33554432 /* ContainsIntersections */ : 0);
|
|
59747
59782
|
return getUnionTypeFromSortedList(typeSet, objectFlags, aliasSymbol, aliasTypeArguments, origin);
|
|
59748
59783
|
}
|
|
@@ -61292,7 +61327,7 @@ var ts;
|
|
|
61292
61327
|
var declarations = ts.concatenate(leftProp.declarations, rightProp.declarations);
|
|
61293
61328
|
var flags = 4 /* Property */ | (leftProp.flags & 16777216 /* Optional */);
|
|
61294
61329
|
var result = createSymbol(flags, leftProp.escapedName);
|
|
61295
|
-
result.type = getUnionType([getTypeOfSymbol(leftProp), removeMissingOrUndefinedType(rightType)]);
|
|
61330
|
+
result.type = getUnionType([getTypeOfSymbol(leftProp), removeMissingOrUndefinedType(rightType)], 2 /* Subtype */);
|
|
61296
61331
|
result.leftSpread = leftProp;
|
|
61297
61332
|
result.rightSpread = rightProp;
|
|
61298
61333
|
result.declarations = declarations;
|
|
@@ -62937,7 +62972,7 @@ var ts;
|
|
|
62937
62972
|
return true;
|
|
62938
62973
|
}
|
|
62939
62974
|
if (source.flags & 524288 /* Object */ && target.flags & 524288 /* Object */) {
|
|
62940
|
-
var related = relation.get(getRelationKey(source, target, 0 /* None */, relation));
|
|
62975
|
+
var related = relation.get(getRelationKey(source, target, 0 /* None */, relation, /*ignoreConstraints*/ false));
|
|
62941
62976
|
if (related !== undefined) {
|
|
62942
62977
|
return !!(related & 1 /* Succeeded */);
|
|
62943
62978
|
}
|
|
@@ -63786,7 +63821,8 @@ var ts;
|
|
|
63786
63821
|
if (overflow) {
|
|
63787
63822
|
return 0 /* False */;
|
|
63788
63823
|
}
|
|
63789
|
-
var
|
|
63824
|
+
var keyIntersectionState = intersectionState | (inPropertyCheck ? 16 /* InPropertyCheck */ : 0);
|
|
63825
|
+
var id = getRelationKey(source, target, keyIntersectionState, relation, /*ingnoreConstraints*/ false);
|
|
63790
63826
|
var entry = relation.get(id);
|
|
63791
63827
|
if (entry !== undefined) {
|
|
63792
63828
|
if (reportErrors && entry & 2 /* Failed */ && !(entry & 4 /* Reported */)) {
|
|
@@ -63813,16 +63849,13 @@ var ts;
|
|
|
63813
63849
|
targetStack = [];
|
|
63814
63850
|
}
|
|
63815
63851
|
else {
|
|
63816
|
-
//
|
|
63817
|
-
//
|
|
63818
|
-
//
|
|
63819
|
-
var broadestEquivalentId = id.
|
|
63820
|
-
var index = ts.length(id.slice(0, offset).match(/[-=]/g) || undefined);
|
|
63821
|
-
return "=" + index;
|
|
63822
|
-
}); }).join(",");
|
|
63852
|
+
// A key that starts with "*" is an indication that we have type references that reference constrained
|
|
63853
|
+
// type parameters. For such keys we also check against the key we would have gotten if all type parameters
|
|
63854
|
+
// were unconstrained.
|
|
63855
|
+
var broadestEquivalentId = id.startsWith("*") ? getRelationKey(source, target, keyIntersectionState, relation, /*ignoreConstraints*/ true) : undefined;
|
|
63823
63856
|
for (var i = 0; i < maybeCount; i++) {
|
|
63824
63857
|
// If source and target are already being compared, consider them related with assumptions
|
|
63825
|
-
if (id === maybeKeys[i] || broadestEquivalentId === maybeKeys[i]) {
|
|
63858
|
+
if (id === maybeKeys[i] || broadestEquivalentId && broadestEquivalentId === maybeKeys[i]) {
|
|
63826
63859
|
return 3 /* Maybe */;
|
|
63827
63860
|
}
|
|
63828
63861
|
}
|
|
@@ -64117,7 +64150,7 @@ var ts;
|
|
|
64117
64150
|
originalErrorInfo = undefined;
|
|
64118
64151
|
}
|
|
64119
64152
|
}
|
|
64120
|
-
else if (isGenericMappedType(target)) {
|
|
64153
|
+
else if (isGenericMappedType(target) && relation !== identityRelation) {
|
|
64121
64154
|
// Check if source type `S` is related to target type `{ [P in Q]: T }` or `{ [P in Q as R]: T}`.
|
|
64122
64155
|
var keysRemapped = !!target.declaration.nameType;
|
|
64123
64156
|
var templateType = getTemplateTypeFromMappedType(target);
|
|
@@ -65329,48 +65362,56 @@ var ts;
|
|
|
65329
65362
|
function isTypeReferenceWithGenericArguments(type) {
|
|
65330
65363
|
return isNonDeferredTypeReference(type) && ts.some(getTypeArguments(type), function (t) { return !!(t.flags & 262144 /* TypeParameter */) || isTypeReferenceWithGenericArguments(t); });
|
|
65331
65364
|
}
|
|
65332
|
-
|
|
65333
|
-
|
|
65334
|
-
|
|
65335
|
-
|
|
65336
|
-
|
|
65337
|
-
|
|
65338
|
-
|
|
65339
|
-
|
|
65340
|
-
|
|
65341
|
-
if (
|
|
65342
|
-
|
|
65343
|
-
|
|
65344
|
-
|
|
65345
|
-
|
|
65365
|
+
function getGenericTypeReferenceRelationKey(source, target, postFix, ignoreConstraints) {
|
|
65366
|
+
var typeParameters = [];
|
|
65367
|
+
var constraintMarker = "";
|
|
65368
|
+
var sourceId = getTypeReferenceId(source, 0);
|
|
65369
|
+
var targetId = getTypeReferenceId(target, 0);
|
|
65370
|
+
return "" + constraintMarker + sourceId + "," + targetId + postFix;
|
|
65371
|
+
// getTypeReferenceId(A<T, number, U>) returns "111=0-12=1"
|
|
65372
|
+
// where A.id=111 and number.id=12
|
|
65373
|
+
function getTypeReferenceId(type, depth) {
|
|
65374
|
+
if (depth === void 0) { depth = 0; }
|
|
65375
|
+
var result = "" + type.target.id;
|
|
65376
|
+
for (var _i = 0, _a = getTypeArguments(type); _i < _a.length; _i++) {
|
|
65377
|
+
var t = _a[_i];
|
|
65378
|
+
if (t.flags & 262144 /* TypeParameter */) {
|
|
65379
|
+
if (ignoreConstraints || isUnconstrainedTypeParameter(t)) {
|
|
65380
|
+
var index = typeParameters.indexOf(t);
|
|
65381
|
+
if (index < 0) {
|
|
65382
|
+
index = typeParameters.length;
|
|
65383
|
+
typeParameters.push(t);
|
|
65384
|
+
}
|
|
65385
|
+
result += "=" + index;
|
|
65386
|
+
continue;
|
|
65387
|
+
}
|
|
65388
|
+
// We mark type references that reference constrained type parameters such that we know to obtain
|
|
65389
|
+
// and look for a "broadest equivalent key" in the cache.
|
|
65390
|
+
constraintMarker = "*";
|
|
65391
|
+
}
|
|
65392
|
+
else if (depth < 4 && isTypeReferenceWithGenericArguments(t)) {
|
|
65393
|
+
result += "<" + getTypeReferenceId(t, depth + 1) + ">";
|
|
65394
|
+
continue;
|
|
65346
65395
|
}
|
|
65347
|
-
result += "=" + index;
|
|
65348
|
-
}
|
|
65349
|
-
else if (depth < 4 && isTypeReferenceWithGenericArguments(t)) {
|
|
65350
|
-
result += "<" + getTypeReferenceId(t, typeParameters, depth + 1) + ">";
|
|
65351
|
-
}
|
|
65352
|
-
else {
|
|
65353
65396
|
result += "-" + t.id;
|
|
65354
65397
|
}
|
|
65398
|
+
return result;
|
|
65355
65399
|
}
|
|
65356
|
-
return result;
|
|
65357
65400
|
}
|
|
65358
65401
|
/**
|
|
65359
65402
|
* To improve caching, the relation key for two generic types uses the target's id plus ids of the type parameters.
|
|
65360
65403
|
* For other cases, the types ids are used.
|
|
65361
65404
|
*/
|
|
65362
|
-
function getRelationKey(source, target, intersectionState, relation) {
|
|
65405
|
+
function getRelationKey(source, target, intersectionState, relation, ignoreConstraints) {
|
|
65363
65406
|
if (relation === identityRelation && source.id > target.id) {
|
|
65364
65407
|
var temp = source;
|
|
65365
65408
|
source = target;
|
|
65366
65409
|
target = temp;
|
|
65367
65410
|
}
|
|
65368
65411
|
var postFix = intersectionState ? ":" + intersectionState : "";
|
|
65369
|
-
|
|
65370
|
-
|
|
65371
|
-
|
|
65372
|
-
}
|
|
65373
|
-
return source.id + "," + target.id + postFix;
|
|
65412
|
+
return isTypeReferenceWithGenericArguments(source) && isTypeReferenceWithGenericArguments(target) ?
|
|
65413
|
+
getGenericTypeReferenceRelationKey(source, target, postFix, ignoreConstraints) :
|
|
65414
|
+
source.id + "," + target.id + postFix;
|
|
65374
65415
|
}
|
|
65375
65416
|
// Invoke the callback for each underlying property symbol of the given symbol and return the first
|
|
65376
65417
|
// value that isn't undefined.
|
|
@@ -65418,28 +65459,35 @@ var ts;
|
|
|
65418
65459
|
!hasBaseType(checkClass, getDeclaringClass(p)) : false; }) ? undefined : checkClass;
|
|
65419
65460
|
}
|
|
65420
65461
|
// Return true if the given type is deeply nested. We consider this to be the case when structural type comparisons
|
|
65421
|
-
// for
|
|
65462
|
+
// for maxDepth or more occurrences or instantiations of the type have been recorded on the given stack. It is possible,
|
|
65422
65463
|
// though highly unlikely, for this test to be true in a situation where a chain of instantiations is not infinitely
|
|
65423
|
-
// expanding. Effectively, we will generate a false positive when two types are structurally equal to at least
|
|
65464
|
+
// expanding. Effectively, we will generate a false positive when two types are structurally equal to at least maxDepth
|
|
65424
65465
|
// levels, but unequal at some level beyond that.
|
|
65425
|
-
// In addition, this will also detect when an indexed access has been chained off of
|
|
65426
|
-
// the dual of the structural comparison), and likewise mark the type as deeply nested, potentially adding
|
|
65427
|
-
// for finite but deeply expanding indexed accesses (eg, for `Q[P1][P2][P3][P4][P5]`).
|
|
65428
|
-
// It also detects when a recursive type reference has expanded
|
|
65466
|
+
// In addition, this will also detect when an indexed access has been chained off of maxDepth more times (which is
|
|
65467
|
+
// essentially the dual of the structural comparison), and likewise mark the type as deeply nested, potentially adding
|
|
65468
|
+
// false positives for finite but deeply expanding indexed accesses (eg, for `Q[P1][P2][P3][P4][P5]`).
|
|
65469
|
+
// It also detects when a recursive type reference has expanded maxDepth or more times, e.g. if the true branch of
|
|
65429
65470
|
// `type A<T> = null extends T ? [A<NonNullable<T>>] : [T]`
|
|
65430
|
-
// has expanded into `[A<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>>>>>>]
|
|
65431
|
-
//
|
|
65471
|
+
// has expanded into `[A<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>>>>>>]`. In such cases we need
|
|
65472
|
+
// to terminate the expansion, and we do so here.
|
|
65432
65473
|
function isDeeplyNestedType(type, stack, depth, maxDepth) {
|
|
65433
|
-
if (maxDepth === void 0) { maxDepth =
|
|
65474
|
+
if (maxDepth === void 0) { maxDepth = 3; }
|
|
65434
65475
|
if (depth >= maxDepth) {
|
|
65435
65476
|
var identity_1 = getRecursionIdentity(type);
|
|
65436
65477
|
var count = 0;
|
|
65478
|
+
var lastTypeId = 0;
|
|
65437
65479
|
for (var i = 0; i < depth; i++) {
|
|
65438
|
-
|
|
65439
|
-
|
|
65440
|
-
|
|
65441
|
-
|
|
65480
|
+
var t = stack[i];
|
|
65481
|
+
if (getRecursionIdentity(t) === identity_1) {
|
|
65482
|
+
// We only count occurrences with a higher type id than the previous occurrence, since higher
|
|
65483
|
+
// type ids are an indicator of newer instantiations caused by recursion.
|
|
65484
|
+
if (t.id >= lastTypeId) {
|
|
65485
|
+
count++;
|
|
65486
|
+
if (count >= maxDepth) {
|
|
65487
|
+
return true;
|
|
65488
|
+
}
|
|
65442
65489
|
}
|
|
65490
|
+
lastTypeId = t.id;
|
|
65443
65491
|
}
|
|
65444
65492
|
}
|
|
65445
65493
|
}
|
|
@@ -66178,7 +66226,8 @@ var ts;
|
|
|
66178
66226
|
(resolveName(param, param.name.escapedText, 788968 /* Type */, undefined, param.name.escapedText, /*isUse*/ true) ||
|
|
66179
66227
|
param.name.originalKeywordKind && ts.isTypeNodeKind(param.name.originalKeywordKind))) {
|
|
66180
66228
|
var newName = "arg" + param.parent.parameters.indexOf(param);
|
|
66181
|
-
|
|
66229
|
+
var typeName = ts.declarationNameToString(param.name) + (param.dotDotDotToken ? "[]" : "");
|
|
66230
|
+
errorOrSuggestion(noImplicitAny, declaration, ts.Diagnostics.Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1, newName, typeName);
|
|
66182
66231
|
return;
|
|
66183
66232
|
}
|
|
66184
66233
|
diagnostic = declaration.dotDotDotToken ?
|
|
@@ -67544,29 +67593,6 @@ var ts;
|
|
|
67544
67593
|
}
|
|
67545
67594
|
return false;
|
|
67546
67595
|
}
|
|
67547
|
-
function getPropertyAccess(expr) {
|
|
67548
|
-
if (ts.isAccessExpression(expr)) {
|
|
67549
|
-
return expr;
|
|
67550
|
-
}
|
|
67551
|
-
if (ts.isIdentifier(expr)) {
|
|
67552
|
-
var symbol = getResolvedSymbol(expr);
|
|
67553
|
-
if (isConstVariable(symbol)) {
|
|
67554
|
-
var declaration = symbol.valueDeclaration;
|
|
67555
|
-
// Given 'const x = obj.kind', allow 'x' as an alias for 'obj.kind'
|
|
67556
|
-
if (ts.isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && ts.isAccessExpression(declaration.initializer)) {
|
|
67557
|
-
return declaration.initializer;
|
|
67558
|
-
}
|
|
67559
|
-
// Given 'const { kind: x } = obj', allow 'x' as an alias for 'obj.kind'
|
|
67560
|
-
if (ts.isBindingElement(declaration) && !declaration.initializer) {
|
|
67561
|
-
var parent = declaration.parent.parent;
|
|
67562
|
-
if (ts.isVariableDeclaration(parent) && !parent.type && parent.initializer && (ts.isIdentifier(parent.initializer) || ts.isAccessExpression(parent.initializer))) {
|
|
67563
|
-
return declaration;
|
|
67564
|
-
}
|
|
67565
|
-
}
|
|
67566
|
-
}
|
|
67567
|
-
}
|
|
67568
|
-
return undefined;
|
|
67569
|
-
}
|
|
67570
67596
|
function getAccessedPropertyName(access) {
|
|
67571
67597
|
var propertyName;
|
|
67572
67598
|
return access.kind === 205 /* PropertyAccessExpression */ ? access.name.escapedText :
|
|
@@ -68465,20 +68491,21 @@ var ts;
|
|
|
68465
68491
|
}
|
|
68466
68492
|
return false;
|
|
68467
68493
|
}
|
|
68468
|
-
function getFlowTypeOfReference(reference, declaredType, initialType, flowContainer) {
|
|
68494
|
+
function getFlowTypeOfReference(reference, declaredType, initialType, flowContainer, flowNode) {
|
|
68469
68495
|
if (initialType === void 0) { initialType = declaredType; }
|
|
68496
|
+
if (flowNode === void 0) { flowNode = reference.flowNode; }
|
|
68470
68497
|
var key;
|
|
68471
68498
|
var isKeySet = false;
|
|
68472
68499
|
var flowDepth = 0;
|
|
68473
68500
|
if (flowAnalysisDisabled) {
|
|
68474
68501
|
return errorType;
|
|
68475
68502
|
}
|
|
68476
|
-
if (!
|
|
68503
|
+
if (!flowNode) {
|
|
68477
68504
|
return declaredType;
|
|
68478
68505
|
}
|
|
68479
68506
|
flowInvocationCount++;
|
|
68480
68507
|
var sharedFlowStart = sharedFlowCount;
|
|
68481
|
-
var evolvedType = getTypeFromFlowType(getTypeAtFlowNode(
|
|
68508
|
+
var evolvedType = getTypeFromFlowType(getTypeAtFlowNode(flowNode));
|
|
68482
68509
|
sharedFlowCount = sharedFlowStart;
|
|
68483
68510
|
// When the reference is 'x' in an 'x.length', 'x.push(value)', 'x.unshift(value)' or x[n] = value' operation,
|
|
68484
68511
|
// we give type 'any[]' to 'x' instead of using the type determined by control flow analysis such that operations
|
|
@@ -68910,13 +68937,57 @@ var ts;
|
|
|
68910
68937
|
}
|
|
68911
68938
|
return result;
|
|
68912
68939
|
}
|
|
68940
|
+
function getCandidateDiscriminantPropertyAccess(expr) {
|
|
68941
|
+
if (ts.isBindingPattern(reference)) {
|
|
68942
|
+
// When the reference is a binding pattern, we are narrowing a pesudo-reference in getNarrowedTypeOfSymbol.
|
|
68943
|
+
// An identifier for a destructuring variable declared in the same binding pattern is a candidate.
|
|
68944
|
+
if (ts.isIdentifier(expr)) {
|
|
68945
|
+
var symbol = getResolvedSymbol(expr);
|
|
68946
|
+
var declaration = symbol.valueDeclaration;
|
|
68947
|
+
if (declaration && ts.isBindingElement(declaration) && !declaration.initializer && !declaration.dotDotDotToken && reference === declaration.parent) {
|
|
68948
|
+
return declaration;
|
|
68949
|
+
}
|
|
68950
|
+
}
|
|
68951
|
+
}
|
|
68952
|
+
else if (ts.isAccessExpression(expr)) {
|
|
68953
|
+
// An access expression is a candidate if the reference matches the left hand expression.
|
|
68954
|
+
if (isMatchingReference(reference, expr.expression)) {
|
|
68955
|
+
return expr;
|
|
68956
|
+
}
|
|
68957
|
+
}
|
|
68958
|
+
else if (ts.isIdentifier(expr)) {
|
|
68959
|
+
var symbol = getResolvedSymbol(expr);
|
|
68960
|
+
if (isConstVariable(symbol)) {
|
|
68961
|
+
var declaration = symbol.valueDeclaration;
|
|
68962
|
+
// Given 'const x = obj.kind', allow 'x' as an alias for 'obj.kind'
|
|
68963
|
+
if (ts.isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && ts.isAccessExpression(declaration.initializer) &&
|
|
68964
|
+
isMatchingReference(reference, declaration.initializer.expression)) {
|
|
68965
|
+
return declaration.initializer;
|
|
68966
|
+
}
|
|
68967
|
+
// Given 'const { kind: x } = obj', allow 'x' as an alias for 'obj.kind'
|
|
68968
|
+
if (ts.isBindingElement(declaration) && !declaration.initializer) {
|
|
68969
|
+
var parent = declaration.parent.parent;
|
|
68970
|
+
if (ts.isVariableDeclaration(parent) && !parent.type && parent.initializer && (ts.isIdentifier(parent.initializer) || ts.isAccessExpression(parent.initializer)) &&
|
|
68971
|
+
isMatchingReference(reference, parent.initializer)) {
|
|
68972
|
+
return declaration;
|
|
68973
|
+
}
|
|
68974
|
+
}
|
|
68975
|
+
}
|
|
68976
|
+
}
|
|
68977
|
+
return undefined;
|
|
68978
|
+
}
|
|
68913
68979
|
function getDiscriminantPropertyAccess(expr, computedType) {
|
|
68914
|
-
var access, name;
|
|
68915
68980
|
var type = declaredType.flags & 1048576 /* Union */ ? declaredType : computedType;
|
|
68916
|
-
|
|
68917
|
-
|
|
68918
|
-
|
|
68919
|
-
|
|
68981
|
+
if (type.flags & 1048576 /* Union */) {
|
|
68982
|
+
var access = getCandidateDiscriminantPropertyAccess(expr);
|
|
68983
|
+
if (access) {
|
|
68984
|
+
var name = getAccessedPropertyName(access);
|
|
68985
|
+
if (name && isDiscriminantProperty(type, name)) {
|
|
68986
|
+
return access;
|
|
68987
|
+
}
|
|
68988
|
+
}
|
|
68989
|
+
}
|
|
68990
|
+
return undefined;
|
|
68920
68991
|
}
|
|
68921
68992
|
function narrowTypeByDiscriminant(type, access, narrowType) {
|
|
68922
68993
|
var propName = getAccessedPropertyName(access);
|
|
@@ -69674,6 +69745,49 @@ var ts;
|
|
|
69674
69745
|
}
|
|
69675
69746
|
}
|
|
69676
69747
|
}
|
|
69748
|
+
function getNarrowedTypeOfSymbol(symbol, location) {
|
|
69749
|
+
// If we have a non-rest binding element with no initializer declared as a const variable or a const-like
|
|
69750
|
+
// parameter (a parameter for which there are no assignments in the function body), and if the parent type
|
|
69751
|
+
// for the destructuring is a union type, one or more of the binding elements may represent discriminant
|
|
69752
|
+
// properties, and we want the effects of conditional checks on such discriminants to affect the types of
|
|
69753
|
+
// other binding elements from the same destructuring. Consider:
|
|
69754
|
+
//
|
|
69755
|
+
// type Action =
|
|
69756
|
+
// | { kind: 'A', payload: number }
|
|
69757
|
+
// | { kind: 'B', payload: string };
|
|
69758
|
+
//
|
|
69759
|
+
// function f1({ kind, payload }: Action) {
|
|
69760
|
+
// if (kind === 'A') {
|
|
69761
|
+
// payload.toFixed();
|
|
69762
|
+
// }
|
|
69763
|
+
// if (kind === 'B') {
|
|
69764
|
+
// payload.toUpperCase();
|
|
69765
|
+
// }
|
|
69766
|
+
// }
|
|
69767
|
+
//
|
|
69768
|
+
// Above, we want the conditional checks on 'kind' to affect the type of 'payload'. To facilitate this, we use
|
|
69769
|
+
// the binding pattern AST instance for '{ kind, payload }' as a pseudo-reference and narrow this reference
|
|
69770
|
+
// as if it occurred in the specified location. We then recompute the narrowed binding element type by
|
|
69771
|
+
// destructuring from the narrowed parent type.
|
|
69772
|
+
var declaration = symbol.valueDeclaration;
|
|
69773
|
+
if (declaration && ts.isBindingElement(declaration) && !declaration.initializer && !declaration.dotDotDotToken && declaration.parent.elements.length >= 2) {
|
|
69774
|
+
var parent = declaration.parent.parent;
|
|
69775
|
+
if (parent.kind === 253 /* VariableDeclaration */ && ts.getCombinedNodeFlags(declaration) & 2 /* Const */ || parent.kind === 163 /* Parameter */) {
|
|
69776
|
+
var links = getNodeLinks(location);
|
|
69777
|
+
if (!(links.flags & 268435456 /* InCheckIdentifier */)) {
|
|
69778
|
+
links.flags |= 268435456 /* InCheckIdentifier */;
|
|
69779
|
+
var parentType = getTypeForBindingElementParent(parent);
|
|
69780
|
+
links.flags &= ~268435456 /* InCheckIdentifier */;
|
|
69781
|
+
if (parentType && parentType.flags & 1048576 /* Union */ && !(parent.kind === 163 /* Parameter */ && isSymbolAssigned(symbol))) {
|
|
69782
|
+
var pattern = declaration.parent;
|
|
69783
|
+
var narrowedType = getFlowTypeOfReference(pattern, parentType, parentType, /*flowContainer*/ undefined, location.flowNode);
|
|
69784
|
+
return getBindingElementTypeFromParentType(declaration, narrowedType);
|
|
69785
|
+
}
|
|
69786
|
+
}
|
|
69787
|
+
}
|
|
69788
|
+
}
|
|
69789
|
+
return getTypeOfSymbol(symbol);
|
|
69790
|
+
}
|
|
69677
69791
|
function checkIdentifier(node, checkMode) {
|
|
69678
69792
|
var symbol = getResolvedSymbol(node);
|
|
69679
69793
|
if (symbol === unknownSymbol) {
|
|
@@ -69747,7 +69861,7 @@ var ts;
|
|
|
69747
69861
|
}
|
|
69748
69862
|
}
|
|
69749
69863
|
checkNestedBlockScopedBinding(node, symbol);
|
|
69750
|
-
var type =
|
|
69864
|
+
var type = getNarrowedTypeOfSymbol(localOrExportSymbol, node);
|
|
69751
69865
|
var assignmentKind = ts.getAssignmentTargetKind(node);
|
|
69752
69866
|
if (assignmentKind) {
|
|
69753
69867
|
if (!(localOrExportSymbol.flags & 3 /* Variable */) &&
|
|
@@ -70790,13 +70904,13 @@ var ts;
|
|
|
70790
70904
|
function isCircularMappedProperty(symbol) {
|
|
70791
70905
|
return !!(ts.getCheckFlags(symbol) & 262144 /* Mapped */ && !symbol.type && findResolutionCycleStartIndex(symbol, 0 /* Type */) >= 0);
|
|
70792
70906
|
}
|
|
70793
|
-
function getTypeOfPropertyOfContextualType(type, name) {
|
|
70907
|
+
function getTypeOfPropertyOfContextualType(type, name, nameType) {
|
|
70794
70908
|
return mapType(type, function (t) {
|
|
70795
70909
|
var _a;
|
|
70796
70910
|
if (isGenericMappedType(t)) {
|
|
70797
70911
|
var constraint = getConstraintTypeFromMappedType(t);
|
|
70798
70912
|
var constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
|
|
70799
|
-
var propertyNameType = getStringLiteralType(ts.unescapeLeadingUnderscores(name));
|
|
70913
|
+
var propertyNameType = nameType || getStringLiteralType(ts.unescapeLeadingUnderscores(name));
|
|
70800
70914
|
if (isTypeAssignableTo(propertyNameType, constraintOfConstraint)) {
|
|
70801
70915
|
return substituteIndexedMappedType(t, propertyNameType);
|
|
70802
70916
|
}
|
|
@@ -70812,7 +70926,7 @@ var ts;
|
|
|
70812
70926
|
return restType;
|
|
70813
70927
|
}
|
|
70814
70928
|
}
|
|
70815
|
-
return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), getStringLiteralType(ts.unescapeLeadingUnderscores(name)))) === null || _a === void 0 ? void 0 : _a.type;
|
|
70929
|
+
return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(ts.unescapeLeadingUnderscores(name)))) === null || _a === void 0 ? void 0 : _a.type;
|
|
70816
70930
|
}
|
|
70817
70931
|
return undefined;
|
|
70818
70932
|
}, /*noReductions*/ true);
|
|
@@ -70840,7 +70954,8 @@ var ts;
|
|
|
70840
70954
|
// For a (non-symbol) computed property, there is no reason to look up the name
|
|
70841
70955
|
// in the type. It will just be "__computed", which does not appear in any
|
|
70842
70956
|
// SymbolTable.
|
|
70843
|
-
|
|
70957
|
+
var symbol = getSymbolOfNode(element);
|
|
70958
|
+
return getTypeOfPropertyOfContextualType(type, symbol.escapedName, getSymbolLinks(symbol).nameType);
|
|
70844
70959
|
}
|
|
70845
70960
|
if (element.name) {
|
|
70846
70961
|
var nameType_2 = getLiteralTypeFromPropertyName(element.name);
|
|
@@ -82963,8 +83078,11 @@ var ts;
|
|
|
82963
83078
|
function checkAssertClause(declaration) {
|
|
82964
83079
|
var _a;
|
|
82965
83080
|
if (declaration.assertClause) {
|
|
82966
|
-
|
|
82967
|
-
|
|
83081
|
+
var mode = (moduleKind === ts.ModuleKind.NodeNext) && declaration.moduleSpecifier && getUsageModeForExpression(declaration.moduleSpecifier);
|
|
83082
|
+
if (mode !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.ESNext) {
|
|
83083
|
+
return grammarErrorOnNode(declaration.assertClause, moduleKind === ts.ModuleKind.NodeNext
|
|
83084
|
+
? ts.Diagnostics.Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls
|
|
83085
|
+
: ts.Diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext);
|
|
82968
83086
|
}
|
|
82969
83087
|
if (ts.isImportDeclaration(declaration) ? (_a = declaration.importClause) === null || _a === void 0 ? void 0 : _a.isTypeOnly : declaration.isTypeOnly) {
|
|
82970
83088
|
return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.Import_assertions_cannot_be_used_with_type_only_imports_or_exports);
|
|
@@ -86811,12 +86929,12 @@ var ts;
|
|
|
86811
86929
|
return grammarErrorOnNode(node, ts.Diagnostics.Dynamic_import_cannot_have_type_arguments);
|
|
86812
86930
|
}
|
|
86813
86931
|
var nodeArguments = node.arguments;
|
|
86814
|
-
if (moduleKind !== ts.ModuleKind.ESNext) {
|
|
86932
|
+
if (moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.NodeNext) {
|
|
86815
86933
|
// We are allowed trailing comma after proposal-import-assertions.
|
|
86816
86934
|
checkGrammarForDisallowedTrailingComma(nodeArguments);
|
|
86817
86935
|
if (nodeArguments.length > 1) {
|
|
86818
86936
|
var assertionArgument = nodeArguments[1];
|
|
86819
|
-
return grammarErrorOnNode(assertionArgument, ts.Diagnostics.
|
|
86937
|
+
return grammarErrorOnNode(assertionArgument, ts.Diagnostics.Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_or_nodenext);
|
|
86820
86938
|
}
|
|
86821
86939
|
}
|
|
86822
86940
|
if (nodeArguments.length === 0 || nodeArguments.length > 2) {
|
|
@@ -93516,7 +93634,7 @@ var ts;
|
|
|
93516
93634
|
return ts.visitEachChild(node, visitor, context);
|
|
93517
93635
|
}
|
|
93518
93636
|
function visitor(node) {
|
|
93519
|
-
if ((node.transformFlags &
|
|
93637
|
+
if ((node.transformFlags & 256 /* ContainsES2017 */) === 0) {
|
|
93520
93638
|
return node;
|
|
93521
93639
|
}
|
|
93522
93640
|
switch (node.kind) {
|
|
@@ -94149,7 +94267,7 @@ var ts;
|
|
|
94149
94267
|
* expression of an `ExpressionStatement`).
|
|
94150
94268
|
*/
|
|
94151
94269
|
function visitorWorker(node, expressionResultIsUnused) {
|
|
94152
|
-
if ((node.transformFlags &
|
|
94270
|
+
if ((node.transformFlags & 128 /* ContainsES2018 */) === 0) {
|
|
94153
94271
|
return node;
|
|
94154
94272
|
}
|
|
94155
94273
|
switch (node.kind) {
|
|
@@ -94846,7 +94964,7 @@ var ts;
|
|
|
94846
94964
|
return ts.visitEachChild(node, visitor, context);
|
|
94847
94965
|
}
|
|
94848
94966
|
function visitor(node) {
|
|
94849
|
-
if ((node.transformFlags &
|
|
94967
|
+
if ((node.transformFlags & 64 /* ContainsES2019 */) === 0) {
|
|
94850
94968
|
return node;
|
|
94851
94969
|
}
|
|
94852
94970
|
switch (node.kind) {
|
|
@@ -94878,7 +94996,7 @@ var ts;
|
|
|
94878
94996
|
return ts.visitEachChild(node, visitor, context);
|
|
94879
94997
|
}
|
|
94880
94998
|
function visitor(node) {
|
|
94881
|
-
if ((node.transformFlags &
|
|
94999
|
+
if ((node.transformFlags & 32 /* ContainsES2020 */) === 0) {
|
|
94882
95000
|
return node;
|
|
94883
95001
|
}
|
|
94884
95002
|
switch (node.kind) {
|
|
@@ -95055,7 +95173,7 @@ var ts;
|
|
|
95055
95173
|
return ts.visitEachChild(node, visitor, context);
|
|
95056
95174
|
}
|
|
95057
95175
|
function visitor(node) {
|
|
95058
|
-
if ((node.transformFlags &
|
|
95176
|
+
if ((node.transformFlags & 16 /* ContainsES2021 */) === 0) {
|
|
95059
95177
|
return node;
|
|
95060
95178
|
}
|
|
95061
95179
|
switch (node.kind) {
|
|
@@ -95819,7 +95937,7 @@ var ts;
|
|
|
95819
95937
|
return ts.visitEachChild(node, visitor, context);
|
|
95820
95938
|
}
|
|
95821
95939
|
function visitor(node) {
|
|
95822
|
-
if ((node.transformFlags &
|
|
95940
|
+
if ((node.transformFlags & 512 /* ContainsES2016 */) === 0) {
|
|
95823
95941
|
return node;
|
|
95824
95942
|
}
|
|
95825
95943
|
switch (node.kind) {
|
|
@@ -96067,7 +96185,7 @@ var ts;
|
|
|
96067
96185
|
|| ts.isBlock(node));
|
|
96068
96186
|
}
|
|
96069
96187
|
function shouldVisitNode(node) {
|
|
96070
|
-
return (node.transformFlags &
|
|
96188
|
+
return (node.transformFlags & 1024 /* ContainsES2015 */) !== 0
|
|
96071
96189
|
|| convertedLoopState !== undefined
|
|
96072
96190
|
|| (hierarchyFacts & 8192 /* ConstructorWithCapturedSuper */ && isOrMayContainReturnCompletion(node))
|
|
96073
96191
|
|| (ts.isIterationStatement(node, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatement(node))
|
|
@@ -99380,7 +99498,7 @@ var ts;
|
|
|
99380
99498
|
var withBlockStack; // A stack containing `with` blocks.
|
|
99381
99499
|
return ts.chainBundle(context, transformSourceFile);
|
|
99382
99500
|
function transformSourceFile(node) {
|
|
99383
|
-
if (node.isDeclarationFile || (node.transformFlags &
|
|
99501
|
+
if (node.isDeclarationFile || (node.transformFlags & 2048 /* ContainsGenerator */) === 0) {
|
|
99384
99502
|
return node;
|
|
99385
99503
|
}
|
|
99386
99504
|
var visited = ts.visitEachChild(node, visitor, context);
|
|
@@ -99403,7 +99521,7 @@ var ts;
|
|
|
99403
99521
|
else if (ts.isFunctionLikeDeclaration(node) && node.asteriskToken) {
|
|
99404
99522
|
return visitGenerator(node);
|
|
99405
99523
|
}
|
|
99406
|
-
else if (transformFlags &
|
|
99524
|
+
else if (transformFlags & 2048 /* ContainsGenerator */) {
|
|
99407
99525
|
return ts.visitEachChild(node, visitor, context);
|
|
99408
99526
|
}
|
|
99409
99527
|
else {
|
|
@@ -99459,7 +99577,7 @@ var ts;
|
|
|
99459
99577
|
if (node.transformFlags & 524288 /* ContainsYield */) {
|
|
99460
99578
|
return visitJavaScriptContainingYield(node);
|
|
99461
99579
|
}
|
|
99462
|
-
else if (node.transformFlags & (
|
|
99580
|
+
else if (node.transformFlags & (2048 /* ContainsGenerator */ | 2097152 /* ContainsHoistedDeclarationOrCompletion */)) {
|
|
99463
99581
|
return ts.visitEachChild(node, visitor, context);
|
|
99464
99582
|
}
|
|
99465
99583
|
else {
|
|
@@ -102108,7 +102226,7 @@ var ts;
|
|
|
102108
102226
|
function visitorWorker(node, valueIsDiscarded) {
|
|
102109
102227
|
// This visitor does not need to descend into the tree if there is no dynamic import, destructuring assignment, or update expression
|
|
102110
102228
|
// as export/import statements are only transformed at the top level of a file.
|
|
102111
|
-
if (!(node.transformFlags & (4194304 /* ContainsDynamicImport */ |
|
|
102229
|
+
if (!(node.transformFlags & (4194304 /* ContainsDynamicImport */ | 4096 /* ContainsDestructuringAssignment */ | 67108864 /* ContainsUpdateExpressionForIdentifier */))) {
|
|
102112
102230
|
return node;
|
|
102113
102231
|
}
|
|
102114
102232
|
switch (node.kind) {
|
|
@@ -104324,7 +104442,7 @@ var ts;
|
|
|
104324
104442
|
* @param node The node to visit.
|
|
104325
104443
|
*/
|
|
104326
104444
|
function visitorWorker(node, valueIsDiscarded) {
|
|
104327
|
-
if (!(node.transformFlags & (
|
|
104445
|
+
if (!(node.transformFlags & (4096 /* ContainsDestructuringAssignment */ | 4194304 /* ContainsDynamicImport */ | 67108864 /* ContainsUpdateExpressionForIdentifier */))) {
|
|
104328
104446
|
return node;
|
|
104329
104447
|
}
|
|
104330
104448
|
switch (node.kind) {
|
|
@@ -119549,13 +119667,15 @@ var ts;
|
|
|
119549
119667
|
if (host.fileExists(packageJsonPath)) {
|
|
119550
119668
|
var packageJsonContent = JSON.parse(host.readFile(packageJsonPath));
|
|
119551
119669
|
// TODO: Inject `require` or `import` condition based on the intended import mode
|
|
119552
|
-
|
|
119553
|
-
|
|
119554
|
-
|
|
119555
|
-
|
|
119556
|
-
|
|
119557
|
-
|
|
119558
|
-
|
|
119670
|
+
if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node12 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) {
|
|
119671
|
+
var fromExports = packageJsonContent.exports && typeof packageJsonContent.name === "string" ? tryGetModuleNameFromExports(options, path, packageRootPath, packageJsonContent.name, packageJsonContent.exports, ["node", "types"]) : undefined;
|
|
119672
|
+
if (fromExports) {
|
|
119673
|
+
var withJsExtension = !ts.hasTSFileExtension(fromExports.moduleFileToTry) ? fromExports : { moduleFileToTry: ts.removeFileExtension(fromExports.moduleFileToTry) + tryGetJSExtensionForFile(fromExports.moduleFileToTry, options) };
|
|
119674
|
+
return __assign(__assign({}, withJsExtension), { verbatimFromExports: true });
|
|
119675
|
+
}
|
|
119676
|
+
if (packageJsonContent.exports) {
|
|
119677
|
+
return { moduleFileToTry: path, blockedByExports: true };
|
|
119678
|
+
}
|
|
119559
119679
|
}
|
|
119560
119680
|
var versionPaths = packageJsonContent.typesVersions
|
|
119561
119681
|
? ts.getPackageJsonTypesVersionsPaths(packageJsonContent.typesVersions)
|
|
@@ -129331,7 +129451,7 @@ var ts;
|
|
|
129331
129451
|
}
|
|
129332
129452
|
node = ts.factory.updateModifiers(node, modifiers & (~presentModifiers));
|
|
129333
129453
|
completionNodes.push(node);
|
|
129334
|
-
}, body, isAbstract);
|
|
129454
|
+
}, body, 2 /* Property */, isAbstract);
|
|
129335
129455
|
if (completionNodes.length) {
|
|
129336
129456
|
insertText = printer.printSnippetList(1 /* MultiLine */, ts.factory.createNodeArray(completionNodes), sourceFile);
|
|
129337
129457
|
}
|
|
@@ -138172,7 +138292,7 @@ var ts;
|
|
|
138172
138292
|
if (depthRemaining === 0)
|
|
138173
138293
|
return;
|
|
138174
138294
|
cancellationToken.throwIfCancellationRequested();
|
|
138175
|
-
if (ts.isDeclaration(n) || ts.isVariableStatement(n) || ts.isReturnStatement(n) || n.kind === 1 /* EndOfFileToken */) {
|
|
138295
|
+
if (ts.isDeclaration(n) || ts.isVariableStatement(n) || ts.isReturnStatement(n) || ts.isCallOrNewExpression(n) || n.kind === 1 /* EndOfFileToken */) {
|
|
138176
138296
|
addOutliningForLeadingCommentsForNode(n, sourceFile, cancellationToken, out);
|
|
138177
138297
|
}
|
|
138178
138298
|
if (ts.isFunctionLike(n) && ts.isBinaryExpression(n.parent) && ts.isPropertyAccessExpression(n.parent.left)) {
|
|
@@ -146698,9 +146818,6 @@ var ts;
|
|
|
146698
146818
|
});
|
|
146699
146819
|
function makeChange(changeTracker, sourceFile, pos) {
|
|
146700
146820
|
var token = ts.getTokenAtPosition(sourceFile, pos);
|
|
146701
|
-
if (!ts.isIdentifier(token)) {
|
|
146702
|
-
return ts.Debug.fail("add-name-to-nameless-parameter operates on identifiers, but got a " + ts.Debug.formatSyntaxKind(token.kind));
|
|
146703
|
-
}
|
|
146704
146821
|
var param = token.parent;
|
|
146705
146822
|
if (!ts.isParameter(param)) {
|
|
146706
146823
|
return ts.Debug.fail("Tried to add a parameter name to a non-parameter: " + ts.Debug.formatSyntaxKind(token.kind));
|
|
@@ -146708,9 +146825,10 @@ var ts;
|
|
|
146708
146825
|
var i = param.parent.parameters.indexOf(param);
|
|
146709
146826
|
ts.Debug.assert(!param.type, "Tried to add a parameter name to a parameter that already had one.");
|
|
146710
146827
|
ts.Debug.assert(i > -1, "Parameter not found in parent parameter list.");
|
|
146828
|
+
var typeNode = ts.factory.createTypeReferenceNode(param.name, /*typeArguments*/ undefined);
|
|
146711
146829
|
var replacement = ts.factory.createParameterDeclaration(
|
|
146712
|
-
/*decorators*/ undefined, param.modifiers, param.dotDotDotToken, "arg" + i, param.questionToken, ts.factory.
|
|
146713
|
-
changeTracker.replaceNode(sourceFile,
|
|
146830
|
+
/*decorators*/ undefined, param.modifiers, param.dotDotDotToken, "arg" + i, param.questionToken, param.dotDotDotToken ? ts.factory.createArrayTypeNode(typeNode) : typeNode, param.initializer);
|
|
146831
|
+
changeTracker.replaceNode(sourceFile, param, replacement);
|
|
146714
146832
|
}
|
|
146715
146833
|
})(codefix = ts.codefix || (ts.codefix = {}));
|
|
146716
146834
|
})(ts || (ts = {}));
|
|
@@ -152879,10 +152997,22 @@ var ts;
|
|
|
152879
152997
|
if (usage.numberIndex) {
|
|
152880
152998
|
types.push(checker.createArrayType(combineFromUsage(usage.numberIndex)));
|
|
152881
152999
|
}
|
|
152882
|
-
if (((_a = usage.properties) === null || _a === void 0 ? void 0 : _a.size) || ((_b = usage.
|
|
153000
|
+
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) {
|
|
152883
153001
|
types.push(inferStructuralType(usage));
|
|
152884
153002
|
}
|
|
152885
|
-
|
|
153003
|
+
var candidateTypes = (usage.candidateTypes || []).map(function (t) { return checker.getBaseTypeOfLiteralType(t); });
|
|
153004
|
+
var callsType = ((_c = usage.calls) === null || _c === void 0 ? void 0 : _c.length) ? inferStructuralType(usage) : undefined;
|
|
153005
|
+
if (callsType && candidateTypes) {
|
|
153006
|
+
types.push(checker.getUnionType(__spreadArray([callsType], candidateTypes, true), 2 /* Subtype */));
|
|
153007
|
+
}
|
|
153008
|
+
else {
|
|
153009
|
+
if (callsType) {
|
|
153010
|
+
types.push(callsType);
|
|
153011
|
+
}
|
|
153012
|
+
if (ts.length(candidateTypes)) {
|
|
153013
|
+
types.push.apply(types, candidateTypes);
|
|
153014
|
+
}
|
|
153015
|
+
}
|
|
152886
153016
|
types.push.apply(types, inferNamedTypesFromProperties(usage));
|
|
152887
153017
|
return types;
|
|
152888
153018
|
}
|
|
@@ -153164,11 +153294,18 @@ var ts;
|
|
|
153164
153294
|
};
|
|
153165
153295
|
}
|
|
153166
153296
|
codefix.getNoopSymbolTrackerWithResolver = getNoopSymbolTrackerWithResolver;
|
|
153297
|
+
var PreserveOptionalFlags;
|
|
153298
|
+
(function (PreserveOptionalFlags) {
|
|
153299
|
+
PreserveOptionalFlags[PreserveOptionalFlags["Method"] = 1] = "Method";
|
|
153300
|
+
PreserveOptionalFlags[PreserveOptionalFlags["Property"] = 2] = "Property";
|
|
153301
|
+
PreserveOptionalFlags[PreserveOptionalFlags["All"] = 3] = "All";
|
|
153302
|
+
})(PreserveOptionalFlags = codefix.PreserveOptionalFlags || (codefix.PreserveOptionalFlags = {}));
|
|
153167
153303
|
/**
|
|
153168
153304
|
* `addClassElement` will not be called if we can't figure out a representation for `symbol` in `enclosingDeclaration`.
|
|
153169
153305
|
* @param body If defined, this will be the body of the member node passed to `addClassElement`. Otherwise, the body will default to a stub.
|
|
153170
153306
|
*/
|
|
153171
|
-
function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, context, preferences, importAdder, addClassElement, body, isAmbient) {
|
|
153307
|
+
function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, context, preferences, importAdder, addClassElement, body, preserveOptional, isAmbient) {
|
|
153308
|
+
if (preserveOptional === void 0) { preserveOptional = 3 /* All */; }
|
|
153172
153309
|
if (isAmbient === void 0) { isAmbient = false; }
|
|
153173
153310
|
var declarations = symbol.getDeclarations();
|
|
153174
153311
|
if (!(declarations && declarations.length)) {
|
|
@@ -153197,7 +153334,7 @@ var ts;
|
|
|
153197
153334
|
}
|
|
153198
153335
|
}
|
|
153199
153336
|
addClassElement(ts.factory.createPropertyDeclaration(
|
|
153200
|
-
/*decorators*/ undefined, modifiers, name, optional ? ts.factory.createToken(57 /* QuestionToken */) : undefined, typeNode,
|
|
153337
|
+
/*decorators*/ undefined, modifiers, name, optional && (preserveOptional & 2 /* Property */) ? ts.factory.createToken(57 /* QuestionToken */) : undefined, typeNode,
|
|
153201
153338
|
/*initializer*/ undefined));
|
|
153202
153339
|
break;
|
|
153203
153340
|
case 171 /* GetAccessor */:
|
|
@@ -153261,13 +153398,13 @@ var ts;
|
|
|
153261
153398
|
}
|
|
153262
153399
|
else {
|
|
153263
153400
|
ts.Debug.assert(declarations.length === signatures.length, "Declarations and signatures should match count");
|
|
153264
|
-
addClassElement(createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, name, optional, modifiers, quotePreference, body));
|
|
153401
|
+
addClassElement(createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, name, optional && !!(preserveOptional & 1 /* Method */), modifiers, quotePreference, body));
|
|
153265
153402
|
}
|
|
153266
153403
|
}
|
|
153267
153404
|
break;
|
|
153268
153405
|
}
|
|
153269
153406
|
function outputMethod(quotePreference, signature, modifiers, name, body) {
|
|
153270
|
-
var method = createSignatureDeclarationFromSignature(168 /* MethodDeclaration */, context, quotePreference, signature, body, name, modifiers, optional, enclosingDeclaration, importAdder);
|
|
153407
|
+
var method = createSignatureDeclarationFromSignature(168 /* MethodDeclaration */, context, quotePreference, signature, body, name, modifiers, optional && !!(preserveOptional & 1 /* Method */), enclosingDeclaration, importAdder);
|
|
153271
153408
|
if (method)
|
|
153272
153409
|
addClassElement(method);
|
|
153273
153410
|
}
|
|
@@ -155706,11 +155843,12 @@ var ts;
|
|
|
155706
155843
|
return node.expression;
|
|
155707
155844
|
}
|
|
155708
155845
|
}
|
|
155709
|
-
else if (ts.isVariableStatement(node)) {
|
|
155846
|
+
else if (ts.isVariableStatement(node) || ts.isVariableDeclarationList(node)) {
|
|
155847
|
+
var declarations_5 = ts.isVariableStatement(node) ? node.declarationList.declarations : node.declarations;
|
|
155710
155848
|
var numInitializers = 0;
|
|
155711
155849
|
var lastInitializer = void 0;
|
|
155712
|
-
for (var _i = 0,
|
|
155713
|
-
var declaration =
|
|
155850
|
+
for (var _i = 0, declarations_4 = declarations_5; _i < declarations_4.length; _i++) {
|
|
155851
|
+
var declaration = declarations_4[_i];
|
|
155714
155852
|
if (declaration.initializer) {
|
|
155715
155853
|
numInitializers++;
|
|
155716
155854
|
lastInitializer = declaration.initializer;
|
|
@@ -159780,8 +159918,8 @@ var ts;
|
|
|
159780
159918
|
var doc = ts.JsDoc.getJsDocCommentsFromDeclarations(declarations, checker);
|
|
159781
159919
|
if (checker && (doc.length === 0 || declarations.some(hasJSDocInheritDocTag))) {
|
|
159782
159920
|
var seenSymbols_1 = new ts.Set();
|
|
159783
|
-
for (var _i = 0,
|
|
159784
|
-
var declaration =
|
|
159921
|
+
for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) {
|
|
159922
|
+
var declaration = declarations_6[_i];
|
|
159785
159923
|
var inheritedDocs = findBaseOfDeclaration(checker, declaration, function (symbol) {
|
|
159786
159924
|
if (!seenSymbols_1.has(symbol)) {
|
|
159787
159925
|
seenSymbols_1.add(symbol);
|