typescript 5.0.0-dev.20221215 → 5.0.0-dev.20221217
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tsc.js +365 -288
- package/lib/tsserver.js +437 -320
- package/lib/tsserverlibrary.d.ts +2 -3
- package/lib/tsserverlibrary.js +438 -322
- package/lib/typescript.d.ts +2 -3
- package/lib/typescript.js +436 -321
- package/lib/typingsInstaller.js +68 -47
- package/package.json +1 -1
package/lib/tsserver.js
CHANGED
|
@@ -62,6 +62,7 @@ __export(server_exports, {
|
|
|
62
62
|
ContextFlags: () => ContextFlags,
|
|
63
63
|
CoreServicesShimHostAdapter: () => CoreServicesShimHostAdapter,
|
|
64
64
|
Debug: () => Debug,
|
|
65
|
+
DeprecationVersion: () => DeprecationVersion,
|
|
65
66
|
DiagnosticCategory: () => DiagnosticCategory,
|
|
66
67
|
Diagnostics: () => Diagnostics,
|
|
67
68
|
DocumentHighlights: () => DocumentHighlights,
|
|
@@ -2668,7 +2669,7 @@ __export(ts_server_exports3, {
|
|
|
2668
2669
|
|
|
2669
2670
|
// src/compiler/corePublic.ts
|
|
2670
2671
|
var versionMajorMinor = "5.0";
|
|
2671
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2672
|
+
var version = `${versionMajorMinor}.0-dev.20221217`;
|
|
2672
2673
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2673
2674
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2674
2675
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -6628,18 +6629,18 @@ var RelationComparisonResult = /* @__PURE__ */ ((RelationComparisonResult3) => {
|
|
|
6628
6629
|
RelationComparisonResult3[RelationComparisonResult3["ReportsMask"] = 24] = "ReportsMask";
|
|
6629
6630
|
return RelationComparisonResult3;
|
|
6630
6631
|
})(RelationComparisonResult || {});
|
|
6631
|
-
var GeneratedIdentifierFlags = /* @__PURE__ */ ((
|
|
6632
|
-
|
|
6633
|
-
|
|
6634
|
-
|
|
6635
|
-
|
|
6636
|
-
|
|
6637
|
-
|
|
6638
|
-
|
|
6639
|
-
|
|
6640
|
-
|
|
6641
|
-
|
|
6642
|
-
return
|
|
6632
|
+
var GeneratedIdentifierFlags = /* @__PURE__ */ ((GeneratedIdentifierFlags2) => {
|
|
6633
|
+
GeneratedIdentifierFlags2[GeneratedIdentifierFlags2["None"] = 0] = "None";
|
|
6634
|
+
GeneratedIdentifierFlags2[GeneratedIdentifierFlags2["Auto"] = 1] = "Auto";
|
|
6635
|
+
GeneratedIdentifierFlags2[GeneratedIdentifierFlags2["Loop"] = 2] = "Loop";
|
|
6636
|
+
GeneratedIdentifierFlags2[GeneratedIdentifierFlags2["Unique"] = 3] = "Unique";
|
|
6637
|
+
GeneratedIdentifierFlags2[GeneratedIdentifierFlags2["Node"] = 4] = "Node";
|
|
6638
|
+
GeneratedIdentifierFlags2[GeneratedIdentifierFlags2["KindMask"] = 7] = "KindMask";
|
|
6639
|
+
GeneratedIdentifierFlags2[GeneratedIdentifierFlags2["ReservedInNestedScopes"] = 8] = "ReservedInNestedScopes";
|
|
6640
|
+
GeneratedIdentifierFlags2[GeneratedIdentifierFlags2["Optimistic"] = 16] = "Optimistic";
|
|
6641
|
+
GeneratedIdentifierFlags2[GeneratedIdentifierFlags2["FileLevel"] = 32] = "FileLevel";
|
|
6642
|
+
GeneratedIdentifierFlags2[GeneratedIdentifierFlags2["AllowNameSubstitution"] = 64] = "AllowNameSubstitution";
|
|
6643
|
+
return GeneratedIdentifierFlags2;
|
|
6643
6644
|
})(GeneratedIdentifierFlags || {});
|
|
6644
6645
|
var TokenFlags = /* @__PURE__ */ ((TokenFlags2) => {
|
|
6645
6646
|
TokenFlags2[TokenFlags2["None"] = 0] = "None";
|
|
@@ -7245,7 +7246,7 @@ function diagnosticCategoryName(d, lowerCase = true) {
|
|
|
7245
7246
|
}
|
|
7246
7247
|
var ModuleResolutionKind = /* @__PURE__ */ ((ModuleResolutionKind3) => {
|
|
7247
7248
|
ModuleResolutionKind3[ModuleResolutionKind3["Classic"] = 1] = "Classic";
|
|
7248
|
-
ModuleResolutionKind3[ModuleResolutionKind3["
|
|
7249
|
+
ModuleResolutionKind3[ModuleResolutionKind3["Node10"] = 2] = "Node10";
|
|
7249
7250
|
ModuleResolutionKind3[ModuleResolutionKind3["Node16"] = 3] = "Node16";
|
|
7250
7251
|
ModuleResolutionKind3[ModuleResolutionKind3["NodeNext"] = 99] = "NodeNext";
|
|
7251
7252
|
ModuleResolutionKind3[ModuleResolutionKind3["Bundler"] = 100] = "Bundler";
|
|
@@ -7801,6 +7802,12 @@ var commentPragmas = {
|
|
|
7801
7802
|
kind: 4 /* MultiLine */
|
|
7802
7803
|
}
|
|
7803
7804
|
};
|
|
7805
|
+
var DeprecationVersion = /* @__PURE__ */ ((DeprecationVersion2) => {
|
|
7806
|
+
DeprecationVersion2["v5_0"] = "5.0";
|
|
7807
|
+
DeprecationVersion2["v5_5"] = "5.5";
|
|
7808
|
+
DeprecationVersion2["v6_0"] = "6.0";
|
|
7809
|
+
return DeprecationVersion2;
|
|
7810
|
+
})(DeprecationVersion || {});
|
|
7804
7811
|
|
|
7805
7812
|
// src/compiler/sys.ts
|
|
7806
7813
|
function generateDjb2Hash(data) {
|
|
@@ -9747,6 +9754,7 @@ var Diagnostics = {
|
|
|
9747
9754
|
_0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias: diag(1274, 1 /* Error */, "_0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias_1274", "'{0}' modifier can only appear on a type parameter of a class, interface or type alias"),
|
|
9748
9755
|
accessor_modifier_can_only_appear_on_a_property_declaration: diag(1275, 1 /* Error */, "accessor_modifier_can_only_appear_on_a_property_declaration_1275", "'accessor' modifier can only appear on a property declaration."),
|
|
9749
9756
|
An_accessor_property_cannot_be_declared_optional: diag(1276, 1 /* Error */, "An_accessor_property_cannot_be_declared_optional_1276", "An 'accessor' property cannot be declared optional."),
|
|
9757
|
+
_0_modifier_can_only_appear_on_a_type_parameter_of_a_function_method_or_class: diag(1277, 1 /* Error */, "_0_modifier_can_only_appear_on_a_type_parameter_of_a_function_method_or_class_1277", "'{0}' modifier can only appear on a type parameter of a function, method or class"),
|
|
9750
9758
|
with_statements_are_not_allowed_in_an_async_function_block: diag(1300, 1 /* Error */, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."),
|
|
9751
9759
|
await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1308, 1 /* Error */, "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308", "'await' expressions are only allowed within async functions and at the top levels of modules."),
|
|
9752
9760
|
The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level: diag(1309, 1 /* Error */, "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309", "The current file is a CommonJS module and cannot use 'await' at the top level."),
|
|
@@ -10365,7 +10373,7 @@ var Diagnostics = {
|
|
|
10365
10373
|
Its_element_type_0_is_not_a_valid_JSX_element: diag(2789, 1 /* Error */, "Its_element_type_0_is_not_a_valid_JSX_element_2789", "Its element type '{0}' is not a valid JSX element."),
|
|
10366
10374
|
The_operand_of_a_delete_operator_must_be_optional: diag(2790, 1 /* Error */, "The_operand_of_a_delete_operator_must_be_optional_2790", "The operand of a 'delete' operator must be optional."),
|
|
10367
10375
|
Exponentiation_cannot_be_performed_on_bigint_values_unless_the_target_option_is_set_to_es2016_or_later: diag(2791, 1 /* Error */, "Exponentiation_cannot_be_performed_on_bigint_values_unless_the_target_option_is_set_to_es2016_or_lat_2791", "Exponentiation cannot be performed on 'bigint' values unless the 'target' option is set to 'es2016' or later."),
|
|
10368
|
-
|
|
10376
|
+
Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_nodenext_or_to_add_aliases_to_the_paths_option: diag(2792, 1 /* Error */, "Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_nodenext_or_to_add_aliases_t_2792", "Cannot find module '{0}'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option?"),
|
|
10369
10377
|
The_call_would_have_succeeded_against_this_implementation_but_implementation_signatures_of_overloads_are_not_externally_visible: diag(2793, 1 /* Error */, "The_call_would_have_succeeded_against_this_implementation_but_implementation_signatures_of_overloads_2793", "The call would have succeeded against this implementation, but implementation signatures of overloads are not externally visible."),
|
|
10370
10378
|
Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise: diag(2794, 1 /* Error */, "Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise_2794", "Expected {0} arguments, but got {1}. Did you forget to include 'void' in your type argument to 'Promise'?"),
|
|
10371
10379
|
The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types: diag(2795, 1 /* Error */, "The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types_2795", "The 'intrinsic' keyword can only be used to declare compiler provided intrinsic types."),
|
|
@@ -10547,7 +10555,7 @@ var Diagnostics = {
|
|
|
10547
10555
|
Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name: diag(5067, 1 /* Error */, "Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name_5067", "Invalid value for 'jsxFactory'. '{0}' is not a valid identifier or qualified-name."),
|
|
10548
10556
|
Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: diag(5068, 1 /* Error */, "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__5068", "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig."),
|
|
10549
10557
|
Option_0_cannot_be_specified_without_specifying_option_1_or_option_2: diag(5069, 1 /* Error */, "Option_0_cannot_be_specified_without_specifying_option_1_or_option_2_5069", "Option '{0}' cannot be specified without specifying option '{1}' or option '{2}'."),
|
|
10550
|
-
|
|
10558
|
+
Option_resolveJsonModule_cannot_be_specified_when_moduleResolution_is_set_to_classic: diag(5070, 1 /* Error */, "Option_resolveJsonModule_cannot_be_specified_when_moduleResolution_is_set_to_classic_5070", "Option '--resolveJsonModule' cannot be specified when 'moduleResolution' is set to 'classic'."),
|
|
10551
10559
|
Option_resolveJsonModule_can_only_be_specified_when_module_code_generation_is_commonjs_amd_es2015_or_esNext: diag(5071, 1 /* Error */, "Option_resolveJsonModule_can_only_be_specified_when_module_code_generation_is_commonjs_amd_es2015_or_5071", "Option '--resolveJsonModule' can only be specified when module code generation is 'commonjs', 'amd', 'es2015' or 'esNext'."),
|
|
10552
10560
|
Unknown_build_option_0: diag(5072, 1 /* Error */, "Unknown_build_option_0_5072", "Unknown build option '{0}'."),
|
|
10553
10561
|
Build_option_0_requires_a_value_of_type_1: diag(5073, 1 /* Error */, "Build_option_0_requires_a_value_of_type_1_5073", "Build option '{0}' requires a value of type {1}."),
|
|
@@ -10578,6 +10586,9 @@ var Diagnostics = {
|
|
|
10578
10586
|
Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler: diag(5098, 1 /* Error */, "Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler_5098", "Option '{0}' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'bundler'."),
|
|
10579
10587
|
Import_assignment_is_not_allowed_when_moduleResolution_is_set_to_bundler_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead: diag(5099, 1 /* Error */, "Import_assignment_is_not_allowed_when_moduleResolution_is_set_to_bundler_Consider_using_import_Aster_5099", `Import assignment is not allowed when 'moduleResolution' is set to 'bundler'. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead.`),
|
|
10580
10588
|
Export_assignment_cannot_be_used_when_moduleResolution_is_set_to_bundler_Consider_using_export_default_or_another_module_format_instead: diag(5100, 1 /* Error */, "Export_assignment_cannot_be_used_when_moduleResolution_is_set_to_bundler_Consider_using_export_defau_5100", "Export assignment cannot be used when 'moduleResolution' is set to 'bundler'. Consider using 'export default' or another module format instead."),
|
|
10589
|
+
Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_ignoreDeprecations_Colon_2_to_silence_this_error: diag(5101, 1 /* Error */, "Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_ignoreDeprecations_Colon_2_to_5101", `Flag '{0}' is deprecated and will stop functioning in TypeScript {1}. Specify 'ignoreDeprecations: "{2}"' to silence this error.`),
|
|
10590
|
+
Flag_0_is_deprecated_Please_remove_it_from_your_configuration: diag(5102, 1 /* Error */, "Flag_0_is_deprecated_Please_remove_it_from_your_configuration_5102", "Flag '{0}' is deprecated. Please remove it from your configuration."),
|
|
10591
|
+
Invalid_value_for_ignoreDeprecations: diag(5103, 1 /* Error */, "Invalid_value_for_ignoreDeprecations_5103", "Invalid value for '--ignoreDeprecations'."),
|
|
10581
10592
|
Generates_a_sourcemap_for_each_corresponding_d_ts_file: diag(6e3, 3 /* Message */, "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000", "Generates a sourcemap for each corresponding '.d.ts' file."),
|
|
10582
10593
|
Concatenate_and_emit_output_to_single_file: diag(6001, 3 /* Message */, "Concatenate_and_emit_output_to_single_file_6001", "Concatenate and emit output to single file."),
|
|
10583
10594
|
Generates_corresponding_d_ts_file: diag(6002, 3 /* Message */, "Generates_corresponding_d_ts_file_6002", "Generates corresponding '.d.ts' file."),
|
|
@@ -14013,12 +14024,10 @@ function formatJSDocLink(link) {
|
|
|
14013
14024
|
}
|
|
14014
14025
|
function getEffectiveTypeParameterDeclarations(node) {
|
|
14015
14026
|
if (isJSDocSignature(node)) {
|
|
14016
|
-
if (
|
|
14017
|
-
const
|
|
14018
|
-
|
|
14019
|
-
|
|
14020
|
-
if (overloadTag) {
|
|
14021
|
-
return flatMap(node.parent.tags, (tag) => isJSDocTemplateTag(tag) ? tag.typeParameters : void 0);
|
|
14027
|
+
if (isJSDocOverloadTag(node.parent)) {
|
|
14028
|
+
const jsDoc = getJSDocRoot(node.parent);
|
|
14029
|
+
if (jsDoc && length(jsDoc.tags)) {
|
|
14030
|
+
return flatMap(jsDoc.tags, (tag) => isJSDocTemplateTag(tag) ? tag.typeParameters : void 0);
|
|
14022
14031
|
}
|
|
14023
14032
|
}
|
|
14024
14033
|
return emptyArray;
|
|
@@ -14175,10 +14184,10 @@ function isStringTextContainingNode(node) {
|
|
|
14175
14184
|
return node.kind === 10 /* StringLiteral */ || isTemplateLiteralKind(node.kind);
|
|
14176
14185
|
}
|
|
14177
14186
|
function isGeneratedIdentifier(node) {
|
|
14178
|
-
return isIdentifier(node) &&
|
|
14187
|
+
return isIdentifier(node) && node.autoGenerate !== void 0;
|
|
14179
14188
|
}
|
|
14180
14189
|
function isGeneratedPrivateIdentifier(node) {
|
|
14181
|
-
return isPrivateIdentifier(node) &&
|
|
14190
|
+
return isPrivateIdentifier(node) && node.autoGenerate !== void 0;
|
|
14182
14191
|
}
|
|
14183
14192
|
function isPrivateIdentifierClassElementDeclaration(node) {
|
|
14184
14193
|
return (isPropertyDeclaration(node) || isMethodOrAccessor(node)) && isPrivateIdentifier(node.name);
|
|
@@ -15553,7 +15562,7 @@ function tryGetTextOfPropertyName(name) {
|
|
|
15553
15562
|
switch (name.kind) {
|
|
15554
15563
|
case 79 /* Identifier */:
|
|
15555
15564
|
case 80 /* PrivateIdentifier */:
|
|
15556
|
-
return name.
|
|
15565
|
+
return name.autoGenerate ? void 0 : name.escapedText;
|
|
15557
15566
|
case 10 /* StringLiteral */:
|
|
15558
15567
|
case 8 /* NumericLiteral */:
|
|
15559
15568
|
case 14 /* NoSubstitutionTemplateLiteral */:
|
|
@@ -18834,7 +18843,7 @@ function closeFileWatcher(watcher) {
|
|
|
18834
18843
|
watcher.close();
|
|
18835
18844
|
}
|
|
18836
18845
|
function getCheckFlags(symbol) {
|
|
18837
|
-
return symbol.flags & 33554432 /* Transient */ ? symbol.checkFlags : 0;
|
|
18846
|
+
return symbol.flags & 33554432 /* Transient */ ? symbol.links.checkFlags : 0;
|
|
18838
18847
|
}
|
|
18839
18848
|
function getDeclarationModifierFlagsFromSymbol(s, isWrite = false) {
|
|
18840
18849
|
if (s.valueDeclaration) {
|
|
@@ -18843,7 +18852,7 @@ function getDeclarationModifierFlagsFromSymbol(s, isWrite = false) {
|
|
|
18843
18852
|
return s.parent && s.parent.flags & 32 /* Class */ ? flags : flags & ~28 /* AccessibilityModifier */;
|
|
18844
18853
|
}
|
|
18845
18854
|
if (getCheckFlags(s) & 6 /* Synthetic */) {
|
|
18846
|
-
const checkFlags = s.checkFlags;
|
|
18855
|
+
const checkFlags = s.links.checkFlags;
|
|
18847
18856
|
const accessModifier = checkFlags & 1024 /* ContainsPrivate */ ? 8 /* Private */ : checkFlags & 256 /* ContainsPublic */ ? 4 /* Public */ : 16 /* Protected */;
|
|
18848
18857
|
const staticModifier = checkFlags & 2048 /* ContainsStatic */ ? 32 /* Static */ : 0;
|
|
18849
18858
|
return accessModifier | staticModifier;
|
|
@@ -19107,9 +19116,16 @@ function Symbol4(flags, name) {
|
|
|
19107
19116
|
this.escapedName = name;
|
|
19108
19117
|
this.declarations = void 0;
|
|
19109
19118
|
this.valueDeclaration = void 0;
|
|
19110
|
-
this.id =
|
|
19111
|
-
this.mergeId =
|
|
19119
|
+
this.id = 0;
|
|
19120
|
+
this.mergeId = 0;
|
|
19112
19121
|
this.parent = void 0;
|
|
19122
|
+
this.members = void 0;
|
|
19123
|
+
this.exports = void 0;
|
|
19124
|
+
this.exportSymbol = void 0;
|
|
19125
|
+
this.constEnumOnlyModule = void 0;
|
|
19126
|
+
this.isReferenced = void 0;
|
|
19127
|
+
this.isAssigned = void 0;
|
|
19128
|
+
this.links = void 0;
|
|
19113
19129
|
}
|
|
19114
19130
|
function Type3(checker, flags) {
|
|
19115
19131
|
this.flags = flags;
|
|
@@ -19423,7 +19439,7 @@ function getEmitModuleResolutionKind(compilerOptions) {
|
|
|
19423
19439
|
if (moduleResolution === void 0) {
|
|
19424
19440
|
switch (getEmitModuleKind(compilerOptions)) {
|
|
19425
19441
|
case 1 /* CommonJS */:
|
|
19426
|
-
moduleResolution = 2 /*
|
|
19442
|
+
moduleResolution = 2 /* Node10 */;
|
|
19427
19443
|
break;
|
|
19428
19444
|
case 100 /* Node16 */:
|
|
19429
19445
|
moduleResolution = 3 /* Node16 */;
|
|
@@ -21803,15 +21819,23 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
21803
21819
|
const node = baseFactory2.createBaseIdentifierNode(79 /* Identifier */);
|
|
21804
21820
|
node.originalKeywordKind = originalKeywordKind;
|
|
21805
21821
|
node.escapedText = escapedText;
|
|
21806
|
-
node.
|
|
21822
|
+
node.autoGenerate = void 0;
|
|
21823
|
+
node.typeArguments = void 0;
|
|
21824
|
+
node.hasExtendedUnicodeEscape = void 0;
|
|
21825
|
+
node.jsDoc = void 0;
|
|
21826
|
+
node.jsDocCache = void 0;
|
|
21827
|
+
node.flowNode = void 0;
|
|
21828
|
+
node.symbol = void 0;
|
|
21807
21829
|
return node;
|
|
21808
21830
|
}
|
|
21809
21831
|
function createBaseGeneratedIdentifier(text, autoGenerateFlags, prefix, suffix) {
|
|
21810
21832
|
const node = createBaseIdentifier(escapeLeadingUnderscores(text), void 0);
|
|
21811
|
-
node.
|
|
21812
|
-
|
|
21813
|
-
|
|
21814
|
-
|
|
21833
|
+
node.autoGenerate = {
|
|
21834
|
+
flags: autoGenerateFlags,
|
|
21835
|
+
id: nextAutoGenerateId,
|
|
21836
|
+
prefix,
|
|
21837
|
+
suffix
|
|
21838
|
+
};
|
|
21815
21839
|
nextAutoGenerateId++;
|
|
21816
21840
|
return node;
|
|
21817
21841
|
}
|
|
@@ -21825,10 +21849,6 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
21825
21849
|
const node = createBaseIdentifier(escapeLeadingUnderscores(text), originalKeywordKind);
|
|
21826
21850
|
node.typeArguments = asNodeArray(typeArguments);
|
|
21827
21851
|
node.hasExtendedUnicodeEscape = hasExtendedUnicodeEscape;
|
|
21828
|
-
node.jsDoc = void 0;
|
|
21829
|
-
node.jsDocCache = void 0;
|
|
21830
|
-
node.flowNode = void 0;
|
|
21831
|
-
node.symbol = void 0;
|
|
21832
21852
|
if (node.originalKeywordKind === 133 /* AwaitKeyword */) {
|
|
21833
21853
|
node.transformFlags |= 67108864 /* ContainsPossibleTopLevelAwait */;
|
|
21834
21854
|
}
|
|
@@ -21873,7 +21893,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
21873
21893
|
function createBasePrivateIdentifier(escapedText) {
|
|
21874
21894
|
const node = baseFactory2.createBasePrivateIdentifierNode(80 /* PrivateIdentifier */);
|
|
21875
21895
|
node.escapedText = escapedText;
|
|
21876
|
-
node.
|
|
21896
|
+
node.autoGenerate = void 0;
|
|
21877
21897
|
node.transformFlags |= 16777216 /* ContainsClassFields */;
|
|
21878
21898
|
return node;
|
|
21879
21899
|
}
|
|
@@ -21884,10 +21904,12 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
21884
21904
|
}
|
|
21885
21905
|
function createBaseGeneratedPrivateIdentifier(text, autoGenerateFlags, prefix, suffix) {
|
|
21886
21906
|
const node = createBasePrivateIdentifier(escapeLeadingUnderscores(text));
|
|
21887
|
-
node.
|
|
21888
|
-
|
|
21889
|
-
|
|
21890
|
-
|
|
21907
|
+
node.autoGenerate = {
|
|
21908
|
+
flags: autoGenerateFlags,
|
|
21909
|
+
id: nextAutoGenerateId,
|
|
21910
|
+
prefix,
|
|
21911
|
+
suffix
|
|
21912
|
+
};
|
|
21891
21913
|
nextAutoGenerateId++;
|
|
21892
21914
|
return node;
|
|
21893
21915
|
}
|
|
@@ -24680,10 +24702,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
24680
24702
|
function cloneGeneratedIdentifier(node) {
|
|
24681
24703
|
const clone2 = createBaseIdentifier(node.escapedText, void 0);
|
|
24682
24704
|
clone2.flags |= node.flags & ~8 /* Synthesized */;
|
|
24683
|
-
clone2.
|
|
24684
|
-
clone2.autoGenerateId = node.autoGenerateId;
|
|
24685
|
-
clone2.autoGeneratePrefix = node.autoGeneratePrefix;
|
|
24686
|
-
clone2.autoGenerateSuffix = node.autoGenerateSuffix;
|
|
24705
|
+
clone2.autoGenerate = { ...node.autoGenerate };
|
|
24687
24706
|
clone2.transformFlags = node.transformFlags;
|
|
24688
24707
|
setOriginalNode(clone2, node);
|
|
24689
24708
|
return clone2;
|
|
@@ -24704,10 +24723,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
24704
24723
|
function cloneGeneratedPrivateIdentifier(node) {
|
|
24705
24724
|
const clone2 = createBasePrivateIdentifier(node.escapedText);
|
|
24706
24725
|
clone2.flags |= node.flags & ~8 /* Synthesized */;
|
|
24707
|
-
clone2.
|
|
24708
|
-
clone2.autoGenerateId = node.autoGenerateId;
|
|
24709
|
-
clone2.autoGeneratePrefix = node.autoGeneratePrefix;
|
|
24710
|
-
clone2.autoGenerateSuffix = node.autoGenerateSuffix;
|
|
24726
|
+
clone2.autoGenerate = { ...node.autoGenerate };
|
|
24711
24727
|
clone2.transformFlags = node.transformFlags;
|
|
24712
24728
|
setOriginalNode(clone2, node);
|
|
24713
24729
|
return clone2;
|
|
@@ -28070,13 +28086,13 @@ function elideNodes(factory2, nodes) {
|
|
|
28070
28086
|
return setTextRange(factory2.createNodeArray([], nodes.hasTrailingComma), nodes);
|
|
28071
28087
|
}
|
|
28072
28088
|
function getNodeForGeneratedName(name) {
|
|
28073
|
-
if (name.
|
|
28074
|
-
const autoGenerateId = name.
|
|
28089
|
+
if (name.autoGenerate.flags & 4 /* Node */) {
|
|
28090
|
+
const autoGenerateId = name.autoGenerate.id;
|
|
28075
28091
|
let node = name;
|
|
28076
28092
|
let original = node.original;
|
|
28077
28093
|
while (original) {
|
|
28078
28094
|
node = original;
|
|
28079
|
-
if (isMemberName(node) && !!(node.
|
|
28095
|
+
if (isMemberName(node) && (node.autoGenerate === void 0 || !!(node.autoGenerate.flags & 4 /* Node */) && node.autoGenerate.id !== autoGenerateId)) {
|
|
28080
28096
|
break;
|
|
28081
28097
|
}
|
|
28082
28098
|
original = node.original;
|
|
@@ -28613,6 +28629,7 @@ var forEachChildTable = {
|
|
|
28613
28629
|
[346 /* JSDocThisTag */]: forEachChildInJSDocTypeLikeTag,
|
|
28614
28630
|
[343 /* JSDocEnumTag */]: forEachChildInJSDocTypeLikeTag,
|
|
28615
28631
|
[352 /* JSDocThrowsTag */]: forEachChildInJSDocTypeLikeTag,
|
|
28632
|
+
[342 /* JSDocOverloadTag */]: forEachChildInJSDocTypeLikeTag,
|
|
28616
28633
|
[326 /* JSDocSignature */]: function forEachChildInJSDocSignature(node, cbNode, _cbNodes) {
|
|
28617
28634
|
return forEach(node.typeParameters, cbNode) || forEach(node.parameters, cbNode) || visitNode2(cbNode, node.type);
|
|
28618
28635
|
},
|
|
@@ -29727,7 +29744,7 @@ var Parser;
|
|
|
29727
29744
|
case ParsingContext.ArrayBindingElements:
|
|
29728
29745
|
return token() === 27 /* CommaToken */ || token() === 25 /* DotDotDotToken */ || isBindingIdentifierOrPrivateIdentifierOrPattern();
|
|
29729
29746
|
case ParsingContext.TypeParameters:
|
|
29730
|
-
return token() === 101 /* InKeyword */ || isIdentifier2();
|
|
29747
|
+
return token() === 101 /* InKeyword */ || token() === 85 /* ConstKeyword */ || isIdentifier2();
|
|
29731
29748
|
case ParsingContext.ArrayLiteralMembers:
|
|
29732
29749
|
switch (token()) {
|
|
29733
29750
|
case 27 /* CommaToken */:
|
|
@@ -30432,7 +30449,7 @@ var Parser;
|
|
|
30432
30449
|
}
|
|
30433
30450
|
function parseTypeParameter() {
|
|
30434
30451
|
const pos = getNodePos();
|
|
30435
|
-
const modifiers = parseModifiers();
|
|
30452
|
+
const modifiers = parseModifiers(true);
|
|
30436
30453
|
const name = parseIdentifier();
|
|
30437
30454
|
let constraint;
|
|
30438
30455
|
let expression;
|
|
@@ -31395,11 +31412,12 @@ var Parser;
|
|
|
31395
31412
|
return Tristate.False;
|
|
31396
31413
|
} else {
|
|
31397
31414
|
Debug.assert(first2 === 29 /* LessThanToken */);
|
|
31398
|
-
if (!isIdentifier2()) {
|
|
31415
|
+
if (!isIdentifier2() && token() !== 85 /* ConstKeyword */) {
|
|
31399
31416
|
return Tristate.False;
|
|
31400
31417
|
}
|
|
31401
31418
|
if (languageVariant === 1 /* JSX */) {
|
|
31402
31419
|
const isArrowFunctionInJsx = lookAhead(() => {
|
|
31420
|
+
parseOptional(85 /* ConstKeyword */);
|
|
31403
31421
|
const third = nextToken();
|
|
31404
31422
|
if (third === 94 /* ExtendsKeyword */) {
|
|
31405
31423
|
const fourth = nextToken();
|
|
@@ -33122,10 +33140,10 @@ var Parser;
|
|
|
33122
33140
|
}
|
|
33123
33141
|
return list && createNodeArray2(list, pos);
|
|
33124
33142
|
}
|
|
33125
|
-
function tryParseModifier(
|
|
33143
|
+
function tryParseModifier(permitConstAsModifier, stopOnStartOfClassStaticBlock, hasSeenStaticModifier) {
|
|
33126
33144
|
const pos = getNodePos();
|
|
33127
33145
|
const kind = token();
|
|
33128
|
-
if (token() === 85 /* ConstKeyword */ &&
|
|
33146
|
+
if (token() === 85 /* ConstKeyword */ && permitConstAsModifier) {
|
|
33129
33147
|
if (!tryParse(nextTokenIsOnSameLineAndCanFollowModifier)) {
|
|
33130
33148
|
return void 0;
|
|
33131
33149
|
}
|
|
@@ -33149,10 +33167,10 @@ var Parser;
|
|
|
33149
33167
|
setTextRangePosEnd(decoratorsAndModifiers, decorators.pos, modifiers.end);
|
|
33150
33168
|
return decoratorsAndModifiers;
|
|
33151
33169
|
}
|
|
33152
|
-
function parseModifiers(
|
|
33170
|
+
function parseModifiers(permitConstAsModifier, stopOnStartOfClassStaticBlock) {
|
|
33153
33171
|
const pos = getNodePos();
|
|
33154
33172
|
let list, modifier, hasSeenStatic = false;
|
|
33155
|
-
while (modifier = tryParseModifier(
|
|
33173
|
+
while (modifier = tryParseModifier(permitConstAsModifier, stopOnStartOfClassStaticBlock, hasSeenStatic)) {
|
|
33156
33174
|
if (modifier.kind === 124 /* StaticKeyword */)
|
|
33157
33175
|
hasSeenStatic = true;
|
|
33158
33176
|
list = append(list, modifier);
|
|
@@ -35890,12 +35908,14 @@ var commandOptionsWithoutBuild = [
|
|
|
35890
35908
|
{
|
|
35891
35909
|
name: "moduleResolution",
|
|
35892
35910
|
type: new Map(getEntries({
|
|
35893
|
-
|
|
35911
|
+
node10: 2 /* Node10 */,
|
|
35912
|
+
node: 2 /* Node10 */,
|
|
35894
35913
|
classic: 1 /* Classic */,
|
|
35895
35914
|
node16: 3 /* Node16 */,
|
|
35896
35915
|
nodenext: 99 /* NodeNext */,
|
|
35897
35916
|
bundler: 100 /* Bundler */
|
|
35898
35917
|
})),
|
|
35918
|
+
deprecatedKeys: /* @__PURE__ */ new Set(["node"]),
|
|
35899
35919
|
affectsModuleResolution: true,
|
|
35900
35920
|
paramType: Diagnostics.STRATEGY,
|
|
35901
35921
|
category: Diagnostics.Modules,
|
|
@@ -36415,6 +36435,11 @@ var commandOptionsWithoutBuild = [
|
|
|
36415
36435
|
description: Diagnostics.Control_what_method_is_used_to_detect_module_format_JS_files,
|
|
36416
36436
|
category: Diagnostics.Language_and_Environment,
|
|
36417
36437
|
defaultValueDescription: Diagnostics.auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_with_module_Colon_node16_as_modules
|
|
36438
|
+
},
|
|
36439
|
+
{
|
|
36440
|
+
name: "ignoreDeprecations",
|
|
36441
|
+
type: "string",
|
|
36442
|
+
defaultValueDescription: void 0
|
|
36418
36443
|
}
|
|
36419
36444
|
];
|
|
36420
36445
|
var optionDeclarations = [
|
|
@@ -36539,8 +36564,9 @@ function createCompilerDiagnosticForInvalidCustomType(opt) {
|
|
|
36539
36564
|
return createDiagnosticForInvalidCustomType(opt, createCompilerDiagnostic);
|
|
36540
36565
|
}
|
|
36541
36566
|
function createDiagnosticForInvalidCustomType(opt, createDiagnostic) {
|
|
36542
|
-
const namesOfType = arrayFrom(opt.type.keys())
|
|
36543
|
-
|
|
36567
|
+
const namesOfType = arrayFrom(opt.type.keys());
|
|
36568
|
+
const stringNames = (opt.deprecatedKeys ? namesOfType.filter((k) => !opt.deprecatedKeys.has(k)) : namesOfType).map((key) => `'${key}'`).join(", ");
|
|
36569
|
+
return createDiagnostic(Diagnostics.Argument_for_0_option_must_be_Colon_1, `--${opt.name}`, stringNames);
|
|
36544
36570
|
}
|
|
36545
36571
|
function parseCustomTypeOption(opt, value, errors) {
|
|
36546
36572
|
return convertJsonOptionOfCustomType(opt, trimString(value || ""), errors);
|
|
@@ -37776,7 +37802,7 @@ function getExtendsConfigPath(extendedConfig, host, basePath, errors, createDiag
|
|
|
37776
37802
|
}
|
|
37777
37803
|
return extendedConfigPath;
|
|
37778
37804
|
}
|
|
37779
|
-
const resolved = nodeModuleNameResolver(extendedConfig, combinePaths(basePath, "tsconfig.json"), { moduleResolution: 2 /*
|
|
37805
|
+
const resolved = nodeModuleNameResolver(extendedConfig, combinePaths(basePath, "tsconfig.json"), { moduleResolution: 2 /* Node10 */ }, host, void 0, void 0, true);
|
|
37780
37806
|
if (resolved.resolvedModule) {
|
|
37781
37807
|
return resolved.resolvedModule.resolvedFileName;
|
|
37782
37808
|
}
|
|
@@ -38972,7 +38998,7 @@ function resolveModuleName(moduleName, containingFile, compilerOptions, host, ca
|
|
|
38972
38998
|
if (moduleResolution === void 0) {
|
|
38973
38999
|
switch (getEmitModuleKind(compilerOptions)) {
|
|
38974
39000
|
case 1 /* CommonJS */:
|
|
38975
|
-
moduleResolution = 2 /*
|
|
39001
|
+
moduleResolution = 2 /* Node10 */;
|
|
38976
39002
|
break;
|
|
38977
39003
|
case 100 /* Node16 */:
|
|
38978
39004
|
moduleResolution = 3 /* Node16 */;
|
|
@@ -39000,7 +39026,7 @@ function resolveModuleName(moduleName, containingFile, compilerOptions, host, ca
|
|
|
39000
39026
|
case 99 /* NodeNext */:
|
|
39001
39027
|
result = nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
39002
39028
|
break;
|
|
39003
|
-
case 2 /*
|
|
39029
|
+
case 2 /* Node10 */:
|
|
39004
39030
|
result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference);
|
|
39005
39031
|
break;
|
|
39006
39032
|
case 1 /* Classic */:
|
|
@@ -39189,7 +39215,7 @@ function tryResolveJSModuleWorker(moduleName, initialDir, host) {
|
|
|
39189
39215
|
0 /* None */,
|
|
39190
39216
|
moduleName,
|
|
39191
39217
|
initialDir,
|
|
39192
|
-
{ moduleResolution: 2 /*
|
|
39218
|
+
{ moduleResolution: 2 /* Node10 */, allowJs: true },
|
|
39193
39219
|
host,
|
|
39194
39220
|
void 0,
|
|
39195
39221
|
2 /* JavaScript */,
|
|
@@ -39242,7 +39268,7 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
|
|
|
39242
39268
|
trace(host, Diagnostics.Resolving_in_0_mode_with_conditions_1, features & 32 /* EsmMode */ ? "ESM" : "CJS", conditions.map((c) => `'${c}'`).join(", "));
|
|
39243
39269
|
}
|
|
39244
39270
|
let result;
|
|
39245
|
-
if (getEmitModuleResolutionKind(compilerOptions) === 2 /*
|
|
39271
|
+
if (getEmitModuleResolutionKind(compilerOptions) === 2 /* Node10 */) {
|
|
39246
39272
|
const priorityExtensions = extensions & (1 /* TypeScript */ | 4 /* Declaration */);
|
|
39247
39273
|
const secondaryExtensions = extensions & ~(1 /* TypeScript */ | 4 /* Declaration */);
|
|
39248
39274
|
result = priorityExtensions && tryResolve(priorityExtensions) || secondaryExtensions && tryResolve(secondaryExtensions) || void 0;
|
|
@@ -43947,8 +43973,8 @@ var intrinsicTypeKinds = new Map(getEntries({
|
|
|
43947
43973
|
Capitalize: 2 /* Capitalize */,
|
|
43948
43974
|
Uncapitalize: 3 /* Uncapitalize */
|
|
43949
43975
|
}));
|
|
43950
|
-
|
|
43951
|
-
}
|
|
43976
|
+
var SymbolLinks = class {
|
|
43977
|
+
};
|
|
43952
43978
|
function NodeLinks() {
|
|
43953
43979
|
this.flags = 0 /* None */;
|
|
43954
43980
|
}
|
|
@@ -44595,6 +44621,11 @@ function createTypeChecker(host) {
|
|
|
44595
44621
|
let lastFlowNode;
|
|
44596
44622
|
let lastFlowNodeReachable;
|
|
44597
44623
|
let flowTypeCache;
|
|
44624
|
+
const contextualTypeNodes = [];
|
|
44625
|
+
const contextualTypes = [];
|
|
44626
|
+
let contextualTypeCount = 0;
|
|
44627
|
+
let currentInferenceNode;
|
|
44628
|
+
let currentInferenceContext;
|
|
44598
44629
|
const emptyStringType = getStringLiteralType("");
|
|
44599
44630
|
const zeroType = getNumberLiteralType(0);
|
|
44600
44631
|
const zeroBigIntType = getBigIntLiteralType({ negative: false, base10Value: "0" });
|
|
@@ -44803,7 +44834,8 @@ function createTypeChecker(host) {
|
|
|
44803
44834
|
function createSymbol(flags, name, checkFlags) {
|
|
44804
44835
|
symbolCount++;
|
|
44805
44836
|
const symbol = new Symbol46(flags | 33554432 /* Transient */, name);
|
|
44806
|
-
symbol.
|
|
44837
|
+
symbol.links = new SymbolLinks();
|
|
44838
|
+
symbol.links.checkFlags = checkFlags || 0 /* None */;
|
|
44807
44839
|
return symbol;
|
|
44808
44840
|
}
|
|
44809
44841
|
function getExcludedSymbolFlags(flags) {
|
|
@@ -45028,18 +45060,16 @@ function createTypeChecker(host) {
|
|
|
45028
45060
|
}
|
|
45029
45061
|
}
|
|
45030
45062
|
function getSymbolLinks(symbol) {
|
|
45063
|
+
var _a2;
|
|
45031
45064
|
if (symbol.flags & 33554432 /* Transient */)
|
|
45032
|
-
return symbol;
|
|
45065
|
+
return symbol.links;
|
|
45033
45066
|
const id = getSymbolId(symbol);
|
|
45034
|
-
return symbolLinks[id]
|
|
45067
|
+
return (_a2 = symbolLinks[id]) != null ? _a2 : symbolLinks[id] = new SymbolLinks();
|
|
45035
45068
|
}
|
|
45036
45069
|
function getNodeLinks(node) {
|
|
45037
45070
|
const nodeId = getNodeId(node);
|
|
45038
45071
|
return nodeLinks[nodeId] || (nodeLinks[nodeId] = new NodeLinks());
|
|
45039
45072
|
}
|
|
45040
|
-
function tryGetNodeLinks(node) {
|
|
45041
|
-
return node.id ? nodeLinks[node.id] : void 0;
|
|
45042
|
-
}
|
|
45043
45073
|
function isGlobalSourceFile(node) {
|
|
45044
45074
|
return node.kind === 308 /* SourceFile */ && !isExternalOrCommonJsModule(node);
|
|
45045
45075
|
}
|
|
@@ -46565,7 +46595,7 @@ function createTypeChecker(host) {
|
|
|
46565
46595
|
}
|
|
46566
46596
|
function resolveExternalModuleName(location, moduleReferenceExpression, ignoreErrors) {
|
|
46567
46597
|
const isClassic = getEmitModuleResolutionKind(compilerOptions) === 1 /* Classic */;
|
|
46568
|
-
const errorMessage = isClassic ? Diagnostics.
|
|
46598
|
+
const errorMessage = isClassic ? Diagnostics.Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_nodenext_or_to_add_aliases_to_the_paths_option : Diagnostics.Cannot_find_module_0_or_its_corresponding_type_declarations;
|
|
46569
46599
|
return resolveExternalModuleNameWorker(location, moduleReferenceExpression, ignoreErrors ? void 0 : errorMessage);
|
|
46570
46600
|
}
|
|
46571
46601
|
function resolveExternalModuleNameWorker(location, moduleReferenceExpression, moduleNotFoundError, isForAugmentation = false) {
|
|
@@ -46831,8 +46861,8 @@ function createTypeChecker(host) {
|
|
|
46831
46861
|
const result = createSymbol(symbol.flags, symbol.escapedName);
|
|
46832
46862
|
result.declarations = symbol.declarations ? symbol.declarations.slice() : [];
|
|
46833
46863
|
result.parent = symbol.parent;
|
|
46834
|
-
result.target = symbol;
|
|
46835
|
-
result.originatingImport = referenceParent;
|
|
46864
|
+
result.links.target = symbol;
|
|
46865
|
+
result.links.originatingImport = referenceParent;
|
|
46836
46866
|
if (symbol.valueDeclaration)
|
|
46837
46867
|
result.valueDeclaration = symbol.valueDeclaration;
|
|
46838
46868
|
if (symbol.constEnumOnlyModule)
|
|
@@ -46842,7 +46872,7 @@ function createTypeChecker(host) {
|
|
|
46842
46872
|
if (symbol.exports)
|
|
46843
46873
|
result.exports = new Map(symbol.exports);
|
|
46844
46874
|
const resolvedModuleType = resolveStructuredTypeMembers(moduleType);
|
|
46845
|
-
result.type = createAnonymousType(result, resolvedModuleType.members, emptyArray, emptyArray, resolvedModuleType.indexInfos);
|
|
46875
|
+
result.links.type = createAnonymousType(result, resolvedModuleType.members, emptyArray, emptyArray, resolvedModuleType.indexInfos);
|
|
46846
46876
|
return result;
|
|
46847
46877
|
}
|
|
46848
46878
|
function hasExportAssignmentSymbol(moduleSymbol) {
|
|
@@ -48297,7 +48327,7 @@ function createTypeChecker(host) {
|
|
|
48297
48327
|
}
|
|
48298
48328
|
function shouldUsePlaceholderForProperty(propertySymbol, context) {
|
|
48299
48329
|
var _a2;
|
|
48300
|
-
return !!(getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */) && (contains(context.reverseMappedStack, propertySymbol) || ((_a2 = context.reverseMappedStack) == null ? void 0 : _a2[0]) && !(getObjectFlags(last(context.reverseMappedStack).propertyType) & 16 /* Anonymous */));
|
|
48330
|
+
return !!(getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */) && (contains(context.reverseMappedStack, propertySymbol) || ((_a2 = context.reverseMappedStack) == null ? void 0 : _a2[0]) && !(getObjectFlags(last(context.reverseMappedStack).links.propertyType) & 16 /* Anonymous */));
|
|
48301
48331
|
}
|
|
48302
48332
|
function addPropertyToElementList(propertySymbol, context, typeElements) {
|
|
48303
48333
|
var _a2;
|
|
@@ -48516,7 +48546,7 @@ function createTypeChecker(host) {
|
|
|
48516
48546
|
function typeParameterToDeclarationWithConstraint(type, context, constraintNode) {
|
|
48517
48547
|
const savedContextFlags = context.flags;
|
|
48518
48548
|
context.flags &= ~512 /* WriteTypeParametersInQualifiedName */;
|
|
48519
|
-
const modifiers = factory.createModifiersFromModifierFlags(
|
|
48549
|
+
const modifiers = factory.createModifiersFromModifierFlags(getTypeParameterModifiers(type));
|
|
48520
48550
|
const name = typeParameterToName(type, context);
|
|
48521
48551
|
const defaultParameter = getDefaultFromTypeParameter(type);
|
|
48522
48552
|
const defaultParameterNode = defaultParameter && typeToTypeNodeHelper(defaultParameter, context);
|
|
@@ -48673,7 +48703,7 @@ function createTypeChecker(host) {
|
|
|
48673
48703
|
const params = getTypeParametersOfClassOrInterface(
|
|
48674
48704
|
parentSymbol.flags & 2097152 /* Alias */ ? resolveAlias(parentSymbol) : parentSymbol
|
|
48675
48705
|
);
|
|
48676
|
-
typeParameterNodes = mapToTypeNodes(map(params, (t) => getMappedType(t, nextSymbol.mapper)), context);
|
|
48706
|
+
typeParameterNodes = mapToTypeNodes(map(params, (t) => getMappedType(t, nextSymbol.links.mapper)), context);
|
|
48677
48707
|
} else {
|
|
48678
48708
|
typeParameterNodes = typeParametersToTypeParameterDeclarations(symbol, context);
|
|
48679
48709
|
}
|
|
@@ -51150,7 +51180,7 @@ function createTypeChecker(host) {
|
|
|
51150
51180
|
);
|
|
51151
51181
|
}
|
|
51152
51182
|
const union = createSymbol(s.flags | exportedMember.flags, name);
|
|
51153
|
-
union.type = getUnionType([getTypeOfSymbol(s), getTypeOfSymbol(exportedMember)]);
|
|
51183
|
+
union.links.type = getUnionType([getTypeOfSymbol(s), getTypeOfSymbol(exportedMember)]);
|
|
51154
51184
|
union.valueDeclaration = exportedMember.valueDeclaration;
|
|
51155
51185
|
union.declarations = concatenate(exportedMember.declarations, s.declarations);
|
|
51156
51186
|
members.set(name, union);
|
|
@@ -51237,8 +51267,8 @@ function createTypeChecker(host) {
|
|
|
51237
51267
|
const text = getPropertyNameFromType(exprType);
|
|
51238
51268
|
const flags = 4 /* Property */ | (e.initializer ? 16777216 /* Optional */ : 0);
|
|
51239
51269
|
const symbol = createSymbol(flags, text);
|
|
51240
|
-
symbol.type = getTypeFromBindingElement(e, includePatternInType, reportErrors2);
|
|
51241
|
-
symbol.bindingElement = e;
|
|
51270
|
+
symbol.links.type = getTypeFromBindingElement(e, includePatternInType, reportErrors2);
|
|
51271
|
+
symbol.links.bindingElement = e;
|
|
51242
51272
|
members.set(symbol.escapedName, symbol);
|
|
51243
51273
|
});
|
|
51244
51274
|
const result = createAnonymousType(void 0, members, emptyArray, emptyArray, stringIndexInfo ? [stringIndexInfo] : emptyArray);
|
|
@@ -51346,7 +51376,7 @@ function createTypeChecker(host) {
|
|
|
51346
51376
|
const result = createSymbol(fileSymbol.flags, "exports");
|
|
51347
51377
|
result.declarations = fileSymbol.declarations ? fileSymbol.declarations.slice() : [];
|
|
51348
51378
|
result.parent = symbol;
|
|
51349
|
-
result.target = fileSymbol;
|
|
51379
|
+
result.links.target = fileSymbol;
|
|
51350
51380
|
if (fileSymbol.valueDeclaration)
|
|
51351
51381
|
result.valueDeclaration = fileSymbol.valueDeclaration;
|
|
51352
51382
|
if (fileSymbol.members)
|
|
@@ -51512,7 +51542,8 @@ function createTypeChecker(host) {
|
|
|
51512
51542
|
if (expando) {
|
|
51513
51543
|
const merged = mergeJSSymbols(symbol, expando);
|
|
51514
51544
|
if (merged) {
|
|
51515
|
-
symbol =
|
|
51545
|
+
symbol = merged;
|
|
51546
|
+
links = merged.links;
|
|
51516
51547
|
}
|
|
51517
51548
|
}
|
|
51518
51549
|
originalLinks.type = links.type = getTypeOfFuncClassEnumModuleWorker(symbol);
|
|
@@ -51609,7 +51640,7 @@ function createTypeChecker(host) {
|
|
|
51609
51640
|
function getWriteTypeOfSymbol(symbol) {
|
|
51610
51641
|
const checkFlags = getCheckFlags(symbol);
|
|
51611
51642
|
if (symbol.flags & 4 /* Property */) {
|
|
51612
|
-
return checkFlags & 2 /* SyntheticProperty */ ? checkFlags & 65536 /* DeferredType */ ? getWriteTypeOfSymbolWithDeferredType(symbol) || getTypeOfSymbolWithDeferredType(symbol) : symbol.writeType || symbol.type : getTypeOfSymbol(symbol);
|
|
51643
|
+
return checkFlags & 2 /* SyntheticProperty */ ? checkFlags & 65536 /* DeferredType */ ? getWriteTypeOfSymbolWithDeferredType(symbol) || getTypeOfSymbolWithDeferredType(symbol) : symbol.links.writeType || symbol.links.type : getTypeOfSymbol(symbol);
|
|
51613
51644
|
}
|
|
51614
51645
|
if (symbol.flags & 98304 /* Accessor */) {
|
|
51615
51646
|
return checkFlags & 1 /* Instantiated */ ? getWriteTypeOfInstantiatedSymbol(symbol) : getWriteTypeOfAccessors(symbol);
|
|
@@ -52011,7 +52042,8 @@ function createTypeChecker(host) {
|
|
|
52011
52042
|
const kind = symbol.flags & 32 /* Class */ ? 1 /* Class */ : 2 /* Interface */;
|
|
52012
52043
|
const merged = mergeJSSymbols(symbol, symbol.valueDeclaration && getAssignedClassSymbol(symbol.valueDeclaration));
|
|
52013
52044
|
if (merged) {
|
|
52014
|
-
symbol =
|
|
52045
|
+
symbol = merged;
|
|
52046
|
+
links = merged.links;
|
|
52015
52047
|
}
|
|
52016
52048
|
const type = originalLinks.declaredType = links.declaredType = createObjectType(kind, symbol);
|
|
52017
52049
|
const outerTypeParameters = getOuterTypeParametersOfClassOrInterface(symbol);
|
|
@@ -52287,7 +52319,7 @@ function createTypeChecker(host) {
|
|
|
52287
52319
|
error(declName || decl, Diagnostics.Duplicate_property_0, name);
|
|
52288
52320
|
lateSymbol = createSymbol(0 /* None */, memberName, 4096 /* Late */);
|
|
52289
52321
|
}
|
|
52290
|
-
lateSymbol.nameType = type;
|
|
52322
|
+
lateSymbol.links.nameType = type;
|
|
52291
52323
|
addDeclarationToLateBoundSymbol(lateSymbol, decl, symbolFlags);
|
|
52292
52324
|
if (lateSymbol.parent) {
|
|
52293
52325
|
Debug.assert(lateSymbol.parent === parent2, "Existing symbol parent should match new one");
|
|
@@ -52493,7 +52525,7 @@ function createTypeChecker(host) {
|
|
|
52493
52525
|
const flags = restType.target.elementFlags[i];
|
|
52494
52526
|
const checkFlags = flags & 12 /* Variable */ ? 32768 /* RestParameter */ : flags & 2 /* Optional */ ? 16384 /* OptionalParameter */ : 0;
|
|
52495
52527
|
const symbol = createSymbol(1 /* FunctionScopedVariable */, name, checkFlags);
|
|
52496
|
-
symbol.type = flags & 4 /* Rest */ ? createArrayType(t) : t;
|
|
52528
|
+
symbol.links.type = flags & 4 /* Rest */ ? createArrayType(t) : t;
|
|
52497
52529
|
return symbol;
|
|
52498
52530
|
});
|
|
52499
52531
|
return concatenate(sig.parameters.slice(0, restIndex), restParams);
|
|
@@ -52653,14 +52685,14 @@ function createTypeChecker(host) {
|
|
|
52653
52685
|
1 /* FunctionScopedVariable */ | (isOptional && !isRestParam ? 16777216 /* Optional */ : 0),
|
|
52654
52686
|
paramName || `arg${i}`
|
|
52655
52687
|
);
|
|
52656
|
-
paramSymbol.type = isRestParam ? createArrayType(unionParamType) : unionParamType;
|
|
52688
|
+
paramSymbol.links.type = isRestParam ? createArrayType(unionParamType) : unionParamType;
|
|
52657
52689
|
params[i] = paramSymbol;
|
|
52658
52690
|
}
|
|
52659
52691
|
if (needsExtraRestElement) {
|
|
52660
52692
|
const restParamSymbol = createSymbol(1 /* FunctionScopedVariable */, "args");
|
|
52661
|
-
restParamSymbol.type = createArrayType(getTypeAtPosition(shorter, longestCount));
|
|
52693
|
+
restParamSymbol.links.type = createArrayType(getTypeAtPosition(shorter, longestCount));
|
|
52662
52694
|
if (shorter === right) {
|
|
52663
|
-
restParamSymbol.type = instantiateType(restParamSymbol.type, mapper);
|
|
52695
|
+
restParamSymbol.links.type = instantiateType(restParamSymbol.links.type, mapper);
|
|
52664
52696
|
}
|
|
52665
52697
|
params[longestCount] = restParamSymbol;
|
|
52666
52698
|
}
|
|
@@ -52880,16 +52912,16 @@ function createTypeChecker(host) {
|
|
|
52880
52912
|
const checkFlags = 8192 /* ReverseMapped */ | (readonlyMask && isReadonlySymbol(prop) ? 8 /* Readonly */ : 0);
|
|
52881
52913
|
const inferredProp = createSymbol(4 /* Property */ | prop.flags & optionalMask, prop.escapedName, checkFlags);
|
|
52882
52914
|
inferredProp.declarations = prop.declarations;
|
|
52883
|
-
inferredProp.nameType = getSymbolLinks(prop).nameType;
|
|
52884
|
-
inferredProp.propertyType = getTypeOfSymbol(prop);
|
|
52915
|
+
inferredProp.links.nameType = getSymbolLinks(prop).nameType;
|
|
52916
|
+
inferredProp.links.propertyType = getTypeOfSymbol(prop);
|
|
52885
52917
|
if (type.constraintType.type.flags & 8388608 /* IndexedAccess */ && type.constraintType.type.objectType.flags & 262144 /* TypeParameter */ && type.constraintType.type.indexType.flags & 262144 /* TypeParameter */) {
|
|
52886
52918
|
const newTypeParam = type.constraintType.type.objectType;
|
|
52887
52919
|
const newMappedType = replaceIndexedAccess(type.mappedType, type.constraintType.type, newTypeParam);
|
|
52888
|
-
inferredProp.mappedType = newMappedType;
|
|
52889
|
-
inferredProp.constraintType = getIndexType(newTypeParam);
|
|
52920
|
+
inferredProp.links.mappedType = newMappedType;
|
|
52921
|
+
inferredProp.links.constraintType = getIndexType(newTypeParam);
|
|
52890
52922
|
} else {
|
|
52891
|
-
inferredProp.mappedType = type.mappedType;
|
|
52892
|
-
inferredProp.constraintType = type.constraintType;
|
|
52923
|
+
inferredProp.links.mappedType = type.mappedType;
|
|
52924
|
+
inferredProp.links.constraintType = type.constraintType;
|
|
52893
52925
|
}
|
|
52894
52926
|
members.set(prop.escapedName, inferredProp);
|
|
52895
52927
|
}
|
|
@@ -52965,8 +52997,8 @@ function createTypeChecker(host) {
|
|
|
52965
52997
|
const propName = getPropertyNameFromType(propNameType);
|
|
52966
52998
|
const existingProp = members.get(propName);
|
|
52967
52999
|
if (existingProp) {
|
|
52968
|
-
existingProp.nameType = getUnionType([existingProp.nameType, propNameType]);
|
|
52969
|
-
existingProp.keyType = getUnionType([existingProp.keyType, keyType]);
|
|
53000
|
+
existingProp.links.nameType = getUnionType([existingProp.links.nameType, propNameType]);
|
|
53001
|
+
existingProp.links.keyType = getUnionType([existingProp.links.keyType, keyType]);
|
|
52970
53002
|
} else {
|
|
52971
53003
|
const modifiersProp = isTypeUsableAsPropertyName(keyType) ? getPropertyOfType(modifiersType, getPropertyNameFromType(keyType)) : void 0;
|
|
52972
53004
|
const isOptional = !!(templateModifiers & 4 /* IncludeOptional */ || !(templateModifiers & 8 /* ExcludeOptional */) && modifiersProp && modifiersProp.flags & 16777216 /* Optional */);
|
|
@@ -52978,11 +53010,11 @@ function createTypeChecker(host) {
|
|
|
52978
53010
|
propName,
|
|
52979
53011
|
lateFlag | 262144 /* Mapped */ | (isReadonly ? 8 /* Readonly */ : 0) | (stripOptional ? 524288 /* StripOptional */ : 0)
|
|
52980
53012
|
);
|
|
52981
|
-
prop.mappedType = type;
|
|
52982
|
-
prop.nameType = propNameType;
|
|
52983
|
-
prop.keyType = keyType;
|
|
53013
|
+
prop.links.mappedType = type;
|
|
53014
|
+
prop.links.nameType = propNameType;
|
|
53015
|
+
prop.links.keyType = keyType;
|
|
52984
53016
|
if (modifiersProp) {
|
|
52985
|
-
prop.syntheticOrigin = modifiersProp;
|
|
53017
|
+
prop.links.syntheticOrigin = modifiersProp;
|
|
52986
53018
|
prop.declarations = nameType ? void 0 : modifiersProp.declarations;
|
|
52987
53019
|
}
|
|
52988
53020
|
members.set(propName, prop);
|
|
@@ -52996,23 +53028,23 @@ function createTypeChecker(host) {
|
|
|
52996
53028
|
}
|
|
52997
53029
|
}
|
|
52998
53030
|
function getTypeOfMappedSymbol(symbol) {
|
|
52999
|
-
if (!symbol.type) {
|
|
53000
|
-
const mappedType = symbol.mappedType;
|
|
53031
|
+
if (!symbol.links.type) {
|
|
53032
|
+
const mappedType = symbol.links.mappedType;
|
|
53001
53033
|
if (!pushTypeResolution(symbol, 0 /* Type */)) {
|
|
53002
53034
|
mappedType.containsError = true;
|
|
53003
53035
|
return errorType;
|
|
53004
53036
|
}
|
|
53005
53037
|
const templateType = getTemplateTypeFromMappedType(mappedType.target || mappedType);
|
|
53006
|
-
const mapper = appendTypeMapping(mappedType.mapper, getTypeParameterFromMappedType(mappedType), symbol.keyType);
|
|
53038
|
+
const mapper = appendTypeMapping(mappedType.mapper, getTypeParameterFromMappedType(mappedType), symbol.links.keyType);
|
|
53007
53039
|
const propType = instantiateType(templateType, mapper);
|
|
53008
|
-
let type = strictNullChecks && symbol.flags & 16777216 /* Optional */ && !maybeTypeOfKind(propType, 32768 /* Undefined */ | 16384 /* Void */) ? getOptionalType(propType, true) : symbol.checkFlags & 524288 /* StripOptional */ ? removeMissingOrUndefinedType(propType) : propType;
|
|
53040
|
+
let type = strictNullChecks && symbol.flags & 16777216 /* Optional */ && !maybeTypeOfKind(propType, 32768 /* Undefined */ | 16384 /* Void */) ? getOptionalType(propType, true) : symbol.links.checkFlags & 524288 /* StripOptional */ ? removeMissingOrUndefinedType(propType) : propType;
|
|
53009
53041
|
if (!popTypeResolution()) {
|
|
53010
53042
|
error(currentNode, Diagnostics.Type_of_property_0_circularly_references_itself_in_mapped_type_1, symbolToString(symbol), typeToString(mappedType));
|
|
53011
53043
|
type = errorType;
|
|
53012
53044
|
}
|
|
53013
|
-
symbol.type = type;
|
|
53045
|
+
symbol.links.type = type;
|
|
53014
53046
|
}
|
|
53015
|
-
return symbol.type;
|
|
53047
|
+
return symbol.links.type;
|
|
53016
53048
|
}
|
|
53017
53049
|
function getTypeParameterFromMappedType(type) {
|
|
53018
53050
|
return type.typeParameter || (type.typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfDeclaration(type.declaration.typeParameter)));
|
|
@@ -53182,6 +53214,10 @@ function createTypeChecker(host) {
|
|
|
53182
53214
|
function getConstraintOfTypeParameter(typeParameter) {
|
|
53183
53215
|
return hasNonCircularBaseConstraint(typeParameter) ? getConstraintFromTypeParameter(typeParameter) : void 0;
|
|
53184
53216
|
}
|
|
53217
|
+
function isConstTypeVariable(type) {
|
|
53218
|
+
var _a2;
|
|
53219
|
+
return !!(type.flags & 262144 /* TypeParameter */ && some((_a2 = type.symbol) == null ? void 0 : _a2.declarations, (d) => hasSyntacticModifier(d, 2048 /* Const */)) || type.flags & 8388608 /* IndexedAccess */ && isConstTypeVariable(type.objectType));
|
|
53220
|
+
}
|
|
53185
53221
|
function getConstraintOfIndexedAccess(type) {
|
|
53186
53222
|
return hasNonCircularBaseConstraint(type) ? getConstraintFromIndexedAccess(type) : void 0;
|
|
53187
53223
|
}
|
|
@@ -53427,7 +53463,7 @@ function createTypeChecker(host) {
|
|
|
53427
53463
|
return getReducedType(getApparentType(getReducedType(type)));
|
|
53428
53464
|
}
|
|
53429
53465
|
function createUnionOrIntersectionProperty(containingType, name, skipObjectFunctionPropertyAugment) {
|
|
53430
|
-
var _a2, _b;
|
|
53466
|
+
var _a2, _b, _c;
|
|
53431
53467
|
let singleProp;
|
|
53432
53468
|
let propSet;
|
|
53433
53469
|
let indexTypes;
|
|
@@ -53495,10 +53531,11 @@ function createTypeChecker(host) {
|
|
|
53495
53531
|
}
|
|
53496
53532
|
if (!propSet && !(checkFlags & 16 /* ReadPartial */) && !indexTypes) {
|
|
53497
53533
|
if (mergedInstantiations) {
|
|
53498
|
-
const
|
|
53499
|
-
clone2
|
|
53500
|
-
clone2.
|
|
53501
|
-
clone2.
|
|
53534
|
+
const links = (_a2 = tryCast(singleProp, isTransientSymbol)) == null ? void 0 : _a2.links;
|
|
53535
|
+
const clone2 = createSymbolWithType(singleProp, links == null ? void 0 : links.type);
|
|
53536
|
+
clone2.parent = (_c = (_b = singleProp.valueDeclaration) == null ? void 0 : _b.symbol) == null ? void 0 : _c.parent;
|
|
53537
|
+
clone2.links.containingType = containingType;
|
|
53538
|
+
clone2.links.mapper = links == null ? void 0 : links.mapper;
|
|
53502
53539
|
return clone2;
|
|
53503
53540
|
} else {
|
|
53504
53541
|
return singleProp;
|
|
@@ -53540,7 +53577,7 @@ function createTypeChecker(host) {
|
|
|
53540
53577
|
}
|
|
53541
53578
|
addRange(propTypes, indexTypes);
|
|
53542
53579
|
const result = createSymbol(4 /* Property */ | (optionalFlag != null ? optionalFlag : 0), name, syntheticFlag | checkFlags);
|
|
53543
|
-
result.containingType = containingType;
|
|
53580
|
+
result.links.containingType = containingType;
|
|
53544
53581
|
if (!hasNonUniformValueDeclaration && firstValueDeclaration) {
|
|
53545
53582
|
result.valueDeclaration = firstValueDeclaration;
|
|
53546
53583
|
if (firstValueDeclaration.symbol.parent) {
|
|
@@ -53548,16 +53585,16 @@ function createTypeChecker(host) {
|
|
|
53548
53585
|
}
|
|
53549
53586
|
}
|
|
53550
53587
|
result.declarations = declarations;
|
|
53551
|
-
result.nameType = nameType;
|
|
53588
|
+
result.links.nameType = nameType;
|
|
53552
53589
|
if (propTypes.length > 2) {
|
|
53553
|
-
result.checkFlags |= 65536 /* DeferredType */;
|
|
53554
|
-
result.deferralParent = containingType;
|
|
53555
|
-
result.deferralConstituents = propTypes;
|
|
53556
|
-
result.deferralWriteConstituents = writeTypes;
|
|
53590
|
+
result.links.checkFlags |= 65536 /* DeferredType */;
|
|
53591
|
+
result.links.deferralParent = containingType;
|
|
53592
|
+
result.links.deferralConstituents = propTypes;
|
|
53593
|
+
result.links.deferralWriteConstituents = writeTypes;
|
|
53557
53594
|
} else {
|
|
53558
|
-
result.type = isUnion ? getUnionType(propTypes) : getIntersectionType(propTypes);
|
|
53595
|
+
result.links.type = isUnion ? getUnionType(propTypes) : getIntersectionType(propTypes);
|
|
53559
53596
|
if (writeTypes) {
|
|
53560
|
-
result.writeType = isUnion ? getUnionType(writeTypes) : getIntersectionType(writeTypes);
|
|
53597
|
+
result.links.writeType = isUnion ? getUnionType(writeTypes) : getIntersectionType(writeTypes);
|
|
53561
53598
|
}
|
|
53562
53599
|
}
|
|
53563
53600
|
return result;
|
|
@@ -53894,12 +53931,12 @@ function createTypeChecker(host) {
|
|
|
53894
53931
|
const lastParamVariadicType = firstDefined(lastParamTags, (p) => p.typeExpression && isJSDocVariadicType(p.typeExpression.type) ? p.typeExpression.type : void 0);
|
|
53895
53932
|
const syntheticArgsSymbol = createSymbol(3 /* Variable */, "args", 32768 /* RestParameter */);
|
|
53896
53933
|
if (lastParamVariadicType) {
|
|
53897
|
-
syntheticArgsSymbol.type = createArrayType(getTypeFromTypeNode(lastParamVariadicType.type));
|
|
53934
|
+
syntheticArgsSymbol.links.type = createArrayType(getTypeFromTypeNode(lastParamVariadicType.type));
|
|
53898
53935
|
} else {
|
|
53899
|
-
syntheticArgsSymbol.checkFlags |= 65536 /* DeferredType */;
|
|
53900
|
-
syntheticArgsSymbol.deferralParent = neverType;
|
|
53901
|
-
syntheticArgsSymbol.deferralConstituents = [anyArrayType];
|
|
53902
|
-
syntheticArgsSymbol.deferralWriteConstituents = [anyArrayType];
|
|
53936
|
+
syntheticArgsSymbol.links.checkFlags |= 65536 /* DeferredType */;
|
|
53937
|
+
syntheticArgsSymbol.links.deferralParent = neverType;
|
|
53938
|
+
syntheticArgsSymbol.links.deferralConstituents = [anyArrayType];
|
|
53939
|
+
syntheticArgsSymbol.links.deferralWriteConstituents = [anyArrayType];
|
|
53903
53940
|
}
|
|
53904
53941
|
if (lastParamVariadicType) {
|
|
53905
53942
|
parameters.pop();
|
|
@@ -54513,7 +54550,7 @@ function createTypeChecker(host) {
|
|
|
54513
54550
|
if (!result) {
|
|
54514
54551
|
unresolvedSymbols.set(path, result = createSymbol(524288 /* TypeAlias */, text, 1048576 /* Unresolved */));
|
|
54515
54552
|
result.parent = parentSymbol;
|
|
54516
|
-
result.declaredType = unresolvedType;
|
|
54553
|
+
result.links.declaredType = unresolvedType;
|
|
54517
54554
|
}
|
|
54518
54555
|
return result;
|
|
54519
54556
|
}
|
|
@@ -54790,7 +54827,7 @@ function createTypeChecker(host) {
|
|
|
54790
54827
|
const importMetaType = getGlobalImportMetaType();
|
|
54791
54828
|
const metaPropertySymbol = createSymbol(4 /* Property */, "meta", 8 /* Readonly */);
|
|
54792
54829
|
metaPropertySymbol.parent = symbol;
|
|
54793
|
-
metaPropertySymbol.type = importMetaType;
|
|
54830
|
+
metaPropertySymbol.links.type = importMetaType;
|
|
54794
54831
|
const members = createSymbolTable([metaPropertySymbol]);
|
|
54795
54832
|
symbol.members = members;
|
|
54796
54833
|
deferredGlobalImportMetaExpressionType = createAnonymousType(symbol, members, emptyArray, emptyArray, emptyArray);
|
|
@@ -55015,8 +55052,8 @@ function createTypeChecker(host) {
|
|
|
55015
55052
|
"" + i,
|
|
55016
55053
|
readonly ? 8 /* Readonly */ : 0
|
|
55017
55054
|
);
|
|
55018
|
-
property.tupleLabelDeclaration = namedMemberDeclarations == null ? void 0 : namedMemberDeclarations[i];
|
|
55019
|
-
property.type = typeParameter;
|
|
55055
|
+
property.links.tupleLabelDeclaration = namedMemberDeclarations == null ? void 0 : namedMemberDeclarations[i];
|
|
55056
|
+
property.links.type = typeParameter;
|
|
55020
55057
|
properties.push(property);
|
|
55021
55058
|
}
|
|
55022
55059
|
}
|
|
@@ -55024,12 +55061,12 @@ function createTypeChecker(host) {
|
|
|
55024
55061
|
const fixedLength = properties.length;
|
|
55025
55062
|
const lengthSymbol = createSymbol(4 /* Property */, "length", readonly ? 8 /* Readonly */ : 0);
|
|
55026
55063
|
if (combinedFlags & 12 /* Variable */) {
|
|
55027
|
-
lengthSymbol.type = numberType;
|
|
55064
|
+
lengthSymbol.links.type = numberType;
|
|
55028
55065
|
} else {
|
|
55029
55066
|
const literalTypes = [];
|
|
55030
55067
|
for (let i = minLength; i <= arity; i++)
|
|
55031
55068
|
literalTypes.push(getNumberLiteralType(i));
|
|
55032
|
-
lengthSymbol.type = getUnionType(literalTypes);
|
|
55069
|
+
lengthSymbol.links.type = getUnionType(literalTypes);
|
|
55033
55070
|
}
|
|
55034
55071
|
properties.push(lengthSymbol);
|
|
55035
55072
|
const type = createObjectType(8 /* Tuple */ | 4 /* Reference */);
|
|
@@ -56623,10 +56660,10 @@ function createTypeChecker(host) {
|
|
|
56623
56660
|
const isSetonlyAccessor = prop.flags & 65536 /* SetAccessor */ && !(prop.flags & 32768 /* GetAccessor */);
|
|
56624
56661
|
const flags = 4 /* Property */ | 16777216 /* Optional */;
|
|
56625
56662
|
const result = createSymbol(flags, prop.escapedName, getIsLateCheckFlag(prop) | (readonly ? 8 /* Readonly */ : 0));
|
|
56626
|
-
result.type = isSetonlyAccessor ? undefinedType : addOptionality(getTypeOfSymbol(prop), true);
|
|
56663
|
+
result.links.type = isSetonlyAccessor ? undefinedType : addOptionality(getTypeOfSymbol(prop), true);
|
|
56627
56664
|
result.declarations = prop.declarations;
|
|
56628
|
-
result.nameType = getSymbolLinks(prop).nameType;
|
|
56629
|
-
result.syntheticOrigin = prop;
|
|
56665
|
+
result.links.nameType = getSymbolLinks(prop).nameType;
|
|
56666
|
+
result.links.syntheticOrigin = prop;
|
|
56630
56667
|
members.set(prop.escapedName, result);
|
|
56631
56668
|
}
|
|
56632
56669
|
}
|
|
@@ -56693,11 +56730,11 @@ function createTypeChecker(host) {
|
|
|
56693
56730
|
const declarations = concatenate(leftProp.declarations, rightProp.declarations);
|
|
56694
56731
|
const flags = 4 /* Property */ | leftProp.flags & 16777216 /* Optional */;
|
|
56695
56732
|
const result = createSymbol(flags, leftProp.escapedName);
|
|
56696
|
-
result.type = getUnionType([getTypeOfSymbol(leftProp), removeMissingOrUndefinedType(rightType)], 2 /* Subtype */);
|
|
56697
|
-
result.leftSpread = leftProp;
|
|
56698
|
-
result.rightSpread = rightProp;
|
|
56733
|
+
result.links.type = getUnionType([getTypeOfSymbol(leftProp), removeMissingOrUndefinedType(rightType)], 2 /* Subtype */);
|
|
56734
|
+
result.links.leftSpread = leftProp;
|
|
56735
|
+
result.links.rightSpread = rightProp;
|
|
56699
56736
|
result.declarations = declarations;
|
|
56700
|
-
result.nameType = getSymbolLinks(leftProp).nameType;
|
|
56737
|
+
result.links.nameType = getSymbolLinks(leftProp).nameType;
|
|
56701
56738
|
members.set(leftProp.escapedName, result);
|
|
56702
56739
|
}
|
|
56703
56740
|
} else {
|
|
@@ -56719,10 +56756,10 @@ function createTypeChecker(host) {
|
|
|
56719
56756
|
}
|
|
56720
56757
|
const flags = 4 /* Property */ | prop.flags & 16777216 /* Optional */;
|
|
56721
56758
|
const result = createSymbol(flags, prop.escapedName, getIsLateCheckFlag(prop) | (readonly ? 8 /* Readonly */ : 0));
|
|
56722
|
-
result.type = isSetonlyAccessor ? undefinedType : getTypeOfSymbol(prop);
|
|
56759
|
+
result.links.type = isSetonlyAccessor ? undefinedType : getTypeOfSymbol(prop);
|
|
56723
56760
|
result.declarations = prop.declarations;
|
|
56724
|
-
result.nameType = getSymbolLinks(prop).nameType;
|
|
56725
|
-
result.syntheticOrigin = prop;
|
|
56761
|
+
result.links.nameType = getSymbolLinks(prop).nameType;
|
|
56762
|
+
result.links.syntheticOrigin = prop;
|
|
56726
56763
|
return result;
|
|
56727
56764
|
}
|
|
56728
56765
|
function getIndexInfoWithReadonly(info, readonly) {
|
|
@@ -57087,13 +57124,13 @@ function createTypeChecker(host) {
|
|
|
57087
57124
|
const result = createSymbol(symbol.flags, symbol.escapedName, 1 /* Instantiated */ | getCheckFlags(symbol) & (8 /* Readonly */ | 4096 /* Late */ | 16384 /* OptionalParameter */ | 32768 /* RestParameter */));
|
|
57088
57125
|
result.declarations = symbol.declarations;
|
|
57089
57126
|
result.parent = symbol.parent;
|
|
57090
|
-
result.target = symbol;
|
|
57091
|
-
result.mapper = mapper;
|
|
57127
|
+
result.links.target = symbol;
|
|
57128
|
+
result.links.mapper = mapper;
|
|
57092
57129
|
if (symbol.valueDeclaration) {
|
|
57093
57130
|
result.valueDeclaration = symbol.valueDeclaration;
|
|
57094
57131
|
}
|
|
57095
57132
|
if (links.nameType) {
|
|
57096
|
-
result.nameType = links.nameType;
|
|
57133
|
+
result.links.nameType = links.nameType;
|
|
57097
57134
|
}
|
|
57098
57135
|
return result;
|
|
57099
57136
|
}
|
|
@@ -57608,13 +57645,10 @@ function createTypeChecker(host) {
|
|
|
57608
57645
|
}
|
|
57609
57646
|
}
|
|
57610
57647
|
function checkExpressionForMutableLocationWithContextualType(next, sourcePropType) {
|
|
57611
|
-
|
|
57612
|
-
|
|
57613
|
-
|
|
57614
|
-
|
|
57615
|
-
} finally {
|
|
57616
|
-
links.contextualType = void 0;
|
|
57617
|
-
}
|
|
57648
|
+
pushContextualType(next, sourcePropType);
|
|
57649
|
+
const result = checkExpressionForMutableLocation(next, 1 /* Contextual */);
|
|
57650
|
+
popContextualType();
|
|
57651
|
+
return result;
|
|
57618
57652
|
}
|
|
57619
57653
|
function elaborateElementwise(iterator, source, target, relation, containingMessageChain, errorOutputContainer) {
|
|
57620
57654
|
let reportedError = false;
|
|
@@ -57813,19 +57847,13 @@ function createTypeChecker(host) {
|
|
|
57813
57847
|
if (isTupleLikeType(source)) {
|
|
57814
57848
|
return elaborateElementwise(generateLimitedTupleElements(node, target), source, target, relation, containingMessageChain, errorOutputContainer);
|
|
57815
57849
|
}
|
|
57816
|
-
|
|
57817
|
-
const
|
|
57818
|
-
|
|
57819
|
-
|
|
57820
|
-
|
|
57821
|
-
links.contextualType = oldContext;
|
|
57822
|
-
if (isTupleLikeType(tupleizedType)) {
|
|
57823
|
-
return elaborateElementwise(generateLimitedTupleElements(node, target), tupleizedType, target, relation, containingMessageChain, errorOutputContainer);
|
|
57824
|
-
}
|
|
57825
|
-
return false;
|
|
57826
|
-
} finally {
|
|
57827
|
-
links.contextualType = oldContext;
|
|
57850
|
+
pushContextualType(node, target);
|
|
57851
|
+
const tupleizedType = checkArrayLiteral(node, 1 /* Contextual */, true);
|
|
57852
|
+
popContextualType();
|
|
57853
|
+
if (isTupleLikeType(tupleizedType)) {
|
|
57854
|
+
return elaborateElementwise(generateLimitedTupleElements(node, target), tupleizedType, target, relation, containingMessageChain, errorOutputContainer);
|
|
57828
57855
|
}
|
|
57856
|
+
return false;
|
|
57829
57857
|
}
|
|
57830
57858
|
function* generateObjectLiteralElements(node) {
|
|
57831
57859
|
if (!length(node.properties))
|
|
@@ -58927,6 +58955,9 @@ function createTypeChecker(host) {
|
|
|
58927
58955
|
if (result2 && !inPropertyCheck && (target2.flags & 2097152 /* Intersection */ && !isGenericObjectType(target2) && source2.flags & (524288 /* Object */ | 2097152 /* Intersection */) || isNonGenericObjectType(target2) && !isArrayOrTupleType(target2) && source2.flags & 2097152 /* Intersection */ && getApparentType(source2).flags & 3670016 /* StructuredType */ && !some(source2.types, (t) => !!(getObjectFlags(t) & 262144 /* NonInferrableType */)))) {
|
|
58928
58956
|
inPropertyCheck = true;
|
|
58929
58957
|
result2 &= propertiesRelatedTo(source2, target2, reportErrors2, void 0, 0 /* None */);
|
|
58958
|
+
if (result2 && isObjectLiteralType2(source2) && getObjectFlags(source2) & 8192 /* FreshLiteral */) {
|
|
58959
|
+
result2 &= indexSignaturesRelatedTo(source2, target2, false, reportErrors2, 0 /* None */);
|
|
58960
|
+
}
|
|
58930
58961
|
inPropertyCheck = false;
|
|
58931
58962
|
}
|
|
58932
58963
|
}
|
|
@@ -59828,7 +59859,7 @@ function createTypeChecker(host) {
|
|
|
59828
59859
|
}
|
|
59829
59860
|
return result2;
|
|
59830
59861
|
}
|
|
59831
|
-
function membersRelatedToIndexInfo(source2, targetInfo, reportErrors2) {
|
|
59862
|
+
function membersRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState) {
|
|
59832
59863
|
let result2 = -1 /* True */;
|
|
59833
59864
|
const keyType = targetInfo.keyType;
|
|
59834
59865
|
const props = source2.flags & 2097152 /* Intersection */ ? getPropertiesOfUnionOrIntersectionType(source2) : getPropertiesOfObjectType(source2);
|
|
@@ -59839,7 +59870,7 @@ function createTypeChecker(host) {
|
|
|
59839
59870
|
if (isApplicableIndexType(getLiteralTypeFromProperty(prop, 8576 /* StringOrNumberLiteralOrUnique */), keyType)) {
|
|
59840
59871
|
const propType = getNonMissingTypeOfSymbol(prop);
|
|
59841
59872
|
const type = exactOptionalPropertyTypes || propType.flags & 32768 /* Undefined */ || keyType === numberType || !(prop.flags & 16777216 /* Optional */) ? propType : getTypeWithFacts(propType, 524288 /* NEUndefined */);
|
|
59842
|
-
const related = isRelatedTo(type, targetInfo.type, 3 /* Both */, reportErrors2);
|
|
59873
|
+
const related = isRelatedTo(type, targetInfo.type, 3 /* Both */, reportErrors2, void 0, intersectionState);
|
|
59843
59874
|
if (!related) {
|
|
59844
59875
|
if (reportErrors2) {
|
|
59845
59876
|
reportError(Diagnostics.Property_0_is_incompatible_with_index_signature, symbolToString(prop));
|
|
@@ -59893,7 +59924,7 @@ function createTypeChecker(host) {
|
|
|
59893
59924
|
return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2);
|
|
59894
59925
|
}
|
|
59895
59926
|
if (!(intersectionState & 1 /* Source */) && isObjectTypeWithInferableIndex(source2)) {
|
|
59896
|
-
return membersRelatedToIndexInfo(source2, targetInfo, reportErrors2);
|
|
59927
|
+
return membersRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState);
|
|
59897
59928
|
}
|
|
59898
59929
|
if (reportErrors2) {
|
|
59899
59930
|
reportError(Diagnostics.Index_signature_for_type_0_is_missing_in_type_1, typeToString(targetInfo.keyType), typeToString(source2));
|
|
@@ -60027,7 +60058,7 @@ function createTypeChecker(host) {
|
|
|
60027
60058
|
links.variances = emptyArray;
|
|
60028
60059
|
const variances = [];
|
|
60029
60060
|
for (const tp of typeParameters) {
|
|
60030
|
-
const modifiers =
|
|
60061
|
+
const modifiers = getTypeParameterModifiers(tp);
|
|
60031
60062
|
let variance = modifiers & 65536 /* Out */ ? modifiers & 32768 /* In */ ? 0 /* Invariant */ : 1 /* Covariant */ : modifiers & 32768 /* In */ ? 2 /* Contravariant */ : void 0;
|
|
60032
60063
|
if (variance === void 0) {
|
|
60033
60064
|
let unmeasurable = false;
|
|
@@ -60070,9 +60101,9 @@ function createTypeChecker(host) {
|
|
|
60070
60101
|
function isMarkerType(type) {
|
|
60071
60102
|
return markerTypes.has(getTypeId(type));
|
|
60072
60103
|
}
|
|
60073
|
-
function
|
|
60074
|
-
var _a2
|
|
60075
|
-
return (
|
|
60104
|
+
function getTypeParameterModifiers(tp) {
|
|
60105
|
+
var _a2;
|
|
60106
|
+
return reduceLeft((_a2 = tp.symbol) == null ? void 0 : _a2.declarations, (modifiers, d) => modifiers | getEffectiveModifierFlags(d), 0 /* None */) & (32768 /* In */ | 65536 /* Out */ | 2048 /* Const */);
|
|
60076
60107
|
}
|
|
60077
60108
|
function hasCovariantVoidArgument(typeArguments, variances) {
|
|
60078
60109
|
for (let i = 0; i < variances.length; i++) {
|
|
@@ -60131,7 +60162,7 @@ function createTypeChecker(host) {
|
|
|
60131
60162
|
}
|
|
60132
60163
|
function forEachProperty2(prop, callback) {
|
|
60133
60164
|
if (getCheckFlags(prop) & 6 /* Synthetic */) {
|
|
60134
|
-
for (const t of prop.containingType.types) {
|
|
60165
|
+
for (const t of prop.links.containingType.types) {
|
|
60135
60166
|
const p = getPropertyOfType(t, prop.escapedName);
|
|
60136
60167
|
const result = p && forEachProperty2(p, callback);
|
|
60137
60168
|
if (result) {
|
|
@@ -60545,14 +60576,14 @@ function createTypeChecker(host) {
|
|
|
60545
60576
|
const symbol = createSymbol(source.flags, source.escapedName, getCheckFlags(source) & 8 /* Readonly */);
|
|
60546
60577
|
symbol.declarations = source.declarations;
|
|
60547
60578
|
symbol.parent = source.parent;
|
|
60548
|
-
symbol.type = type;
|
|
60549
|
-
symbol.target = source;
|
|
60579
|
+
symbol.links.type = type;
|
|
60580
|
+
symbol.links.target = source;
|
|
60550
60581
|
if (source.valueDeclaration) {
|
|
60551
60582
|
symbol.valueDeclaration = source.valueDeclaration;
|
|
60552
60583
|
}
|
|
60553
60584
|
const nameType = getSymbolLinks(source).nameType;
|
|
60554
60585
|
if (nameType) {
|
|
60555
|
-
symbol.nameType = nameType;
|
|
60586
|
+
symbol.links.nameType = nameType;
|
|
60556
60587
|
}
|
|
60557
60588
|
return symbol;
|
|
60558
60589
|
}
|
|
@@ -60933,7 +60964,7 @@ function createTypeChecker(host) {
|
|
|
60933
60964
|
}
|
|
60934
60965
|
const name = escapeLeadingUnderscores(t.value);
|
|
60935
60966
|
const literalProp = createSymbol(4 /* Property */, name);
|
|
60936
|
-
literalProp.type = anyType;
|
|
60967
|
+
literalProp.links.type = anyType;
|
|
60937
60968
|
if (t.symbol) {
|
|
60938
60969
|
literalProp.declarations = t.symbol.declarations;
|
|
60939
60970
|
literalProp.valueDeclaration = t.symbol.valueDeclaration;
|
|
@@ -60981,7 +61012,7 @@ function createTypeChecker(host) {
|
|
|
60981
61012
|
function getTypeOfReverseMappedSymbol(symbol) {
|
|
60982
61013
|
const links = getSymbolLinks(symbol);
|
|
60983
61014
|
if (!links.type) {
|
|
60984
|
-
links.type = inferReverseMappedType(symbol.propertyType, symbol.mappedType, symbol.constraintType);
|
|
61015
|
+
links.type = inferReverseMappedType(symbol.links.propertyType, symbol.links.mappedType, symbol.links.constraintType);
|
|
60985
61016
|
}
|
|
60986
61017
|
return links.type;
|
|
60987
61018
|
}
|
|
@@ -61709,7 +61740,7 @@ function createTypeChecker(host) {
|
|
|
61709
61740
|
}
|
|
61710
61741
|
function getCovariantInference(inference, signature) {
|
|
61711
61742
|
const candidates = unionObjectAndArrayLiteralCandidates(inference.candidates);
|
|
61712
|
-
const primitiveConstraint = hasPrimitiveConstraint(inference.typeParameter);
|
|
61743
|
+
const primitiveConstraint = hasPrimitiveConstraint(inference.typeParameter) || isConstTypeVariable(inference.typeParameter);
|
|
61713
61744
|
const widenLiteralTypes = !primitiveConstraint && inference.topLevel && (inference.isFixed || !isTypeParameterAtTopLevel(getReturnTypeOfSignature(signature), inference.typeParameter));
|
|
61714
61745
|
const baseCandidates = primitiveConstraint ? sameMap(candidates, getRegularTypeOfLiteralType) : widenLiteralTypes ? sameMap(candidates, getWidenedLiteralType) : candidates;
|
|
61715
61746
|
const unwidenedType = inference.priority & 416 /* PriorityImpliesCombination */ ? getUnionType(baseCandidates, 2 /* Subtype */) : getCommonSupertype(baseCandidates);
|
|
@@ -61964,10 +61995,10 @@ function createTypeChecker(host) {
|
|
|
61964
61995
|
if (type && type.flags & 1048576 /* Union */) {
|
|
61965
61996
|
const prop = getUnionOrIntersectionProperty(type, name);
|
|
61966
61997
|
if (prop && getCheckFlags(prop) & 2 /* SyntheticProperty */) {
|
|
61967
|
-
if (prop.isDiscriminantProperty === void 0) {
|
|
61968
|
-
prop.isDiscriminantProperty = (prop.checkFlags & 192 /* Discriminant */) === 192 /* Discriminant */ && !isGenericType(getTypeOfSymbol(prop));
|
|
61998
|
+
if (prop.links.isDiscriminantProperty === void 0) {
|
|
61999
|
+
prop.links.isDiscriminantProperty = (prop.links.checkFlags & 192 /* Discriminant */) === 192 /* Discriminant */ && !isGenericType(getTypeOfSymbol(prop));
|
|
61969
62000
|
}
|
|
61970
|
-
return !!prop.isDiscriminantProperty;
|
|
62001
|
+
return !!prop.links.isDiscriminantProperty;
|
|
61971
62002
|
}
|
|
61972
62003
|
}
|
|
61973
62004
|
return false;
|
|
@@ -62489,7 +62520,7 @@ function createTypeChecker(host) {
|
|
|
62489
62520
|
}
|
|
62490
62521
|
if (symbol.flags & (3 /* Variable */ | 4 /* Property */)) {
|
|
62491
62522
|
if (getCheckFlags(symbol) & 262144 /* Mapped */) {
|
|
62492
|
-
const origin = symbol.syntheticOrigin;
|
|
62523
|
+
const origin = symbol.links.syntheticOrigin;
|
|
62493
62524
|
if (origin && getExplicitTypeOfSymbol(origin)) {
|
|
62494
62525
|
return getTypeOfSymbol(symbol);
|
|
62495
62526
|
}
|
|
@@ -64570,7 +64601,7 @@ function createTypeChecker(host) {
|
|
|
64570
64601
|
return nameStr !== void 0 && getTypeOfPropertyOfContextualType(thisType, nameStr) || void 0;
|
|
64571
64602
|
}
|
|
64572
64603
|
function isCircularMappedProperty(symbol) {
|
|
64573
|
-
return !!(getCheckFlags(symbol) & 262144 /* Mapped */ && !symbol.type && findResolutionCycleStartIndex(symbol, 0 /* Type */) >= 0);
|
|
64604
|
+
return !!(getCheckFlags(symbol) & 262144 /* Mapped */ && !symbol.links.type && findResolutionCycleStartIndex(symbol, 0 /* Type */) >= 0);
|
|
64574
64605
|
}
|
|
64575
64606
|
function getTypeOfPropertyOfContextualType(type, name, nameType) {
|
|
64576
64607
|
return mapType(type, (t) => {
|
|
@@ -64764,13 +64795,12 @@ function createTypeChecker(host) {
|
|
|
64764
64795
|
return type;
|
|
64765
64796
|
}
|
|
64766
64797
|
function getContextualType2(node, contextFlags) {
|
|
64767
|
-
var _a2;
|
|
64768
64798
|
if (node.flags & 33554432 /* InWithStatement */) {
|
|
64769
64799
|
return void 0;
|
|
64770
64800
|
}
|
|
64771
|
-
const
|
|
64772
|
-
if (
|
|
64773
|
-
return
|
|
64801
|
+
const index = findContextualNode(node);
|
|
64802
|
+
if (index >= 0) {
|
|
64803
|
+
return contextualTypes[index];
|
|
64774
64804
|
}
|
|
64775
64805
|
const { parent: parent2 } = node;
|
|
64776
64806
|
switch (parent2.kind) {
|
|
@@ -64792,7 +64822,7 @@ function createTypeChecker(host) {
|
|
|
64792
64822
|
return getContextualTypeForArgument(parent2, node);
|
|
64793
64823
|
case 213 /* TypeAssertionExpression */:
|
|
64794
64824
|
case 231 /* AsExpression */:
|
|
64795
|
-
return isConstTypeReference(parent2.type) ?
|
|
64825
|
+
return isConstTypeReference(parent2.type) ? getContextualType2(parent2, contextFlags) : getTypeFromTypeNode(parent2.type);
|
|
64796
64826
|
case 223 /* BinaryExpression */:
|
|
64797
64827
|
return getContextualTypeForBinaryOperand(node, contextFlags);
|
|
64798
64828
|
case 299 /* PropertyAssignment */:
|
|
@@ -64812,7 +64842,7 @@ function createTypeChecker(host) {
|
|
|
64812
64842
|
return getContextualTypeForSubstitutionExpression(parent2.parent, node);
|
|
64813
64843
|
case 214 /* ParenthesizedExpression */: {
|
|
64814
64844
|
const tag = isInJSFile(parent2) ? getJSDocTypeTag(parent2) : void 0;
|
|
64815
|
-
return !tag ? getContextualType2(parent2, contextFlags) : isJSDocTypeTag(tag) && isConstTypeReference(tag.typeExpression.type) ?
|
|
64845
|
+
return !tag ? getContextualType2(parent2, contextFlags) : isJSDocTypeTag(tag) && isConstTypeReference(tag.typeExpression.type) ? getContextualType2(parent2, contextFlags) : getTypeFromTypeNode(tag.typeExpression.type);
|
|
64816
64846
|
}
|
|
64817
64847
|
case 232 /* NonNullExpression */:
|
|
64818
64848
|
return getContextualType2(parent2, contextFlags);
|
|
@@ -64830,22 +64860,31 @@ function createTypeChecker(host) {
|
|
|
64830
64860
|
return getContextualJsxElementAttributesType(parent2, contextFlags);
|
|
64831
64861
|
}
|
|
64832
64862
|
return void 0;
|
|
64833
|
-
|
|
64834
|
-
|
|
64863
|
+
}
|
|
64864
|
+
function pushContextualType(node, type) {
|
|
64865
|
+
contextualTypeNodes[contextualTypeCount] = node;
|
|
64866
|
+
contextualTypes[contextualTypeCount] = type;
|
|
64867
|
+
contextualTypeCount++;
|
|
64868
|
+
}
|
|
64869
|
+
function popContextualType() {
|
|
64870
|
+
contextualTypeCount--;
|
|
64871
|
+
}
|
|
64872
|
+
function findContextualNode(node) {
|
|
64873
|
+
for (let i = contextualTypeCount - 1; i >= 0; i--) {
|
|
64874
|
+
if (node === contextualTypeNodes[i]) {
|
|
64875
|
+
return i;
|
|
64876
|
+
}
|
|
64835
64877
|
}
|
|
64878
|
+
return -1;
|
|
64836
64879
|
}
|
|
64837
64880
|
function getInferenceContext(node) {
|
|
64838
|
-
return
|
|
64839
|
-
var _a2;
|
|
64840
|
-
return (_a2 = tryGetNodeLinks(n)) == null ? void 0 : _a2.inferenceContext;
|
|
64841
|
-
});
|
|
64881
|
+
return isNodeDescendantOf(node, currentInferenceNode) ? currentInferenceContext : void 0;
|
|
64842
64882
|
}
|
|
64843
64883
|
function getContextualJsxElementAttributesType(node, contextFlags) {
|
|
64844
|
-
var _a2;
|
|
64845
64884
|
if (isJsxOpeningElement(node) && contextFlags !== 4 /* Completions */) {
|
|
64846
|
-
const
|
|
64847
|
-
if (
|
|
64848
|
-
return
|
|
64885
|
+
const index = findContextualNode(node.parent);
|
|
64886
|
+
if (index >= 0) {
|
|
64887
|
+
return contextualTypes[index];
|
|
64849
64888
|
}
|
|
64850
64889
|
}
|
|
64851
64890
|
return getContextualTypeForArgumentAtIndex(node, 0);
|
|
@@ -64992,14 +65031,14 @@ function createTypeChecker(host) {
|
|
|
64992
65031
|
1 /* FunctionScopedVariable */ | (isOptional && !isRestParam ? 16777216 /* Optional */ : 0),
|
|
64993
65032
|
paramName || `arg${i}`
|
|
64994
65033
|
);
|
|
64995
|
-
paramSymbol.type = isRestParam ? createArrayType(unionParamType) : unionParamType;
|
|
65034
|
+
paramSymbol.links.type = isRestParam ? createArrayType(unionParamType) : unionParamType;
|
|
64996
65035
|
params[i] = paramSymbol;
|
|
64997
65036
|
}
|
|
64998
65037
|
if (needsExtraRestElement) {
|
|
64999
65038
|
const restParamSymbol = createSymbol(1 /* FunctionScopedVariable */, "args");
|
|
65000
|
-
restParamSymbol.type = createArrayType(getTypeAtPosition(shorter, longestCount));
|
|
65039
|
+
restParamSymbol.links.type = createArrayType(getTypeAtPosition(shorter, longestCount));
|
|
65001
65040
|
if (shorter === right) {
|
|
65002
|
-
restParamSymbol.type = instantiateType(restParamSymbol.type, mapper);
|
|
65041
|
+
restParamSymbol.links.type = instantiateType(restParamSymbol.links.type, mapper);
|
|
65003
65042
|
}
|
|
65004
65043
|
params[longestCount] = restParamSymbol;
|
|
65005
65044
|
}
|
|
@@ -65102,9 +65141,11 @@ function createTypeChecker(host) {
|
|
|
65102
65141
|
const elementCount = elements.length;
|
|
65103
65142
|
const elementTypes = [];
|
|
65104
65143
|
const elementFlags = [];
|
|
65105
|
-
|
|
65144
|
+
pushContextualType(node, getContextualType2(node, void 0));
|
|
65106
65145
|
const inDestructuringPattern = isAssignmentTarget(node);
|
|
65107
65146
|
const inConstContext = isConstContext(node);
|
|
65147
|
+
const contextualType = getApparentTypeOfContextualType(node, void 0);
|
|
65148
|
+
const inTupleContext = !!contextualType && someType(contextualType, isTupleLikeType);
|
|
65108
65149
|
let hasOmittedExpression = false;
|
|
65109
65150
|
for (let i = 0; i < elementCount; i++) {
|
|
65110
65151
|
const e = elements[i];
|
|
@@ -65129,21 +65170,21 @@ function createTypeChecker(host) {
|
|
|
65129
65170
|
elementTypes.push(undefinedOrMissingType);
|
|
65130
65171
|
elementFlags.push(2 /* Optional */);
|
|
65131
65172
|
} else {
|
|
65132
|
-
const
|
|
65133
|
-
const type = checkExpressionForMutableLocation(e, checkMode, elementContextualType, forceTuple);
|
|
65173
|
+
const type = checkExpressionForMutableLocation(e, checkMode, forceTuple);
|
|
65134
65174
|
elementTypes.push(addOptionality(type, true, hasOmittedExpression));
|
|
65135
65175
|
elementFlags.push(hasOmittedExpression ? 2 /* Optional */ : 1 /* Required */);
|
|
65136
|
-
if (
|
|
65176
|
+
if (inTupleContext && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && isContextSensitive(e)) {
|
|
65137
65177
|
const inferenceContext = getInferenceContext(node);
|
|
65138
65178
|
Debug.assert(inferenceContext);
|
|
65139
65179
|
addIntraExpressionInferenceSite(inferenceContext, e, type);
|
|
65140
65180
|
}
|
|
65141
65181
|
}
|
|
65142
65182
|
}
|
|
65183
|
+
popContextualType();
|
|
65143
65184
|
if (inDestructuringPattern) {
|
|
65144
65185
|
return createTupleType(elementTypes, elementFlags);
|
|
65145
65186
|
}
|
|
65146
|
-
if (forceTuple || inConstContext ||
|
|
65187
|
+
if (forceTuple || inConstContext || inTupleContext) {
|
|
65147
65188
|
return createArrayLiteralType(createTupleType(elementTypes, elementFlags, inConstContext));
|
|
65148
65189
|
}
|
|
65149
65190
|
return createArrayLiteralType(createArrayType(elementTypes.length ? getUnionType(sameMap(elementTypes, (t, i) => elementFlags[i] & 8 /* Variadic */ ? getIndexedAccessTypeOrUndefined(t, numberType) || anyType : t), 2 /* Subtype */) : strictNullChecks ? implicitNeverType : undefinedWideningType, inConstContext));
|
|
@@ -65230,12 +65271,14 @@ function createTypeChecker(host) {
|
|
|
65230
65271
|
return links.immediateTarget;
|
|
65231
65272
|
}
|
|
65232
65273
|
function checkObjectLiteral(node, checkMode) {
|
|
65274
|
+
var _a2;
|
|
65233
65275
|
const inDestructuringPattern = isAssignmentTarget(node);
|
|
65234
65276
|
checkGrammarObjectLiteralExpression(node, inDestructuringPattern);
|
|
65235
65277
|
const allPropertiesTable = strictNullChecks ? createSymbolTable() : void 0;
|
|
65236
65278
|
let propertiesTable = createSymbolTable();
|
|
65237
65279
|
let propertiesArray = [];
|
|
65238
65280
|
let spread = emptyObjectType;
|
|
65281
|
+
pushContextualType(node, getContextualType2(node, void 0));
|
|
65239
65282
|
const contextualType = getApparentTypeOfContextualType(node, void 0);
|
|
65240
65283
|
const contextualTypeHasPattern = contextualType && contextualType.pattern && (contextualType.pattern.kind === 203 /* ObjectBindingPattern */ || contextualType.pattern.kind === 207 /* ObjectLiteralExpression */);
|
|
65241
65284
|
const inConstContext = isConstContext(node);
|
|
@@ -65272,7 +65315,7 @@ function createTypeChecker(host) {
|
|
|
65272
65315
|
const nameType = computedNameType && isTypeUsableAsPropertyName(computedNameType) ? computedNameType : void 0;
|
|
65273
65316
|
const prop = nameType ? createSymbol(4 /* Property */ | member.flags, getPropertyNameFromType(nameType), checkFlags | 4096 /* Late */) : createSymbol(4 /* Property */ | member.flags, member.escapedName, checkFlags);
|
|
65274
65317
|
if (nameType) {
|
|
65275
|
-
prop.nameType = nameType;
|
|
65318
|
+
prop.links.nameType = nameType;
|
|
65276
65319
|
}
|
|
65277
65320
|
if (inDestructuringPattern) {
|
|
65278
65321
|
const isOptional = memberDecl.kind === 299 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer) || memberDecl.kind === 300 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer;
|
|
@@ -65297,8 +65340,8 @@ function createTypeChecker(host) {
|
|
|
65297
65340
|
if (member.valueDeclaration) {
|
|
65298
65341
|
prop.valueDeclaration = member.valueDeclaration;
|
|
65299
65342
|
}
|
|
65300
|
-
prop.type = type;
|
|
65301
|
-
prop.target = member;
|
|
65343
|
+
prop.links.type = type;
|
|
65344
|
+
prop.links.target = member;
|
|
65302
65345
|
member = prop;
|
|
65303
65346
|
allPropertiesTable == null ? void 0 : allPropertiesTable.set(prop.escapedName, prop);
|
|
65304
65347
|
if (contextualType && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && (memberDecl.kind === 299 /* PropertyAssignment */ || memberDecl.kind === 171 /* MethodDeclaration */) && isContextSensitive(memberDecl)) {
|
|
@@ -65357,6 +65400,7 @@ function createTypeChecker(host) {
|
|
|
65357
65400
|
}
|
|
65358
65401
|
propertiesArray.push(member);
|
|
65359
65402
|
}
|
|
65403
|
+
popContextualType();
|
|
65360
65404
|
if (contextualTypeHasPattern) {
|
|
65361
65405
|
const rootPatternParent = findAncestor(
|
|
65362
65406
|
contextualType.pattern.parent,
|
|
@@ -65371,7 +65415,7 @@ function createTypeChecker(host) {
|
|
|
65371
65415
|
if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) {
|
|
65372
65416
|
if (!(prop.flags & 16777216 /* Optional */)) {
|
|
65373
65417
|
error(
|
|
65374
|
-
prop.valueDeclaration || prop.bindingElement,
|
|
65418
|
+
prop.valueDeclaration || ((_a2 = tryCast(prop, isTransientSymbol)) == null ? void 0 : _a2.links.bindingElement),
|
|
65375
65419
|
Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value
|
|
65376
65420
|
);
|
|
65377
65421
|
}
|
|
@@ -65481,8 +65525,8 @@ function createTypeChecker(host) {
|
|
|
65481
65525
|
if (member.valueDeclaration) {
|
|
65482
65526
|
attributeSymbol.valueDeclaration = member.valueDeclaration;
|
|
65483
65527
|
}
|
|
65484
|
-
attributeSymbol.type = exprType;
|
|
65485
|
-
attributeSymbol.target = member;
|
|
65528
|
+
attributeSymbol.links.type = exprType;
|
|
65529
|
+
attributeSymbol.links.target = member;
|
|
65486
65530
|
attributesTable.set(attributeSymbol.escapedName, attributeSymbol);
|
|
65487
65531
|
allAttributesTable == null ? void 0 : allAttributesTable.set(attributeSymbol.escapedName, attributeSymbol);
|
|
65488
65532
|
if (attributeDecl.name.escapedText === jsxChildrenPropertyName) {
|
|
@@ -65530,7 +65574,7 @@ function createTypeChecker(host) {
|
|
|
65530
65574
|
const contextualType = getApparentTypeOfContextualType(openingLikeElement.attributes, void 0);
|
|
65531
65575
|
const childrenContextualType = contextualType && getTypeOfPropertyOfContextualType(contextualType, jsxChildrenPropertyName);
|
|
65532
65576
|
const childrenPropSymbol = createSymbol(4 /* Property */, jsxChildrenPropertyName);
|
|
65533
|
-
childrenPropSymbol.type = childrenTypes.length === 1 ? childrenTypes[0] : childrenContextualType && someType(childrenContextualType, isTupleLikeType) ? createTupleType(childrenTypes) : createArrayType(getUnionType(childrenTypes));
|
|
65577
|
+
childrenPropSymbol.links.type = childrenTypes.length === 1 ? childrenTypes[0] : childrenContextualType && someType(childrenContextualType, isTupleLikeType) ? createTupleType(childrenTypes) : createArrayType(getUnionType(childrenTypes));
|
|
65534
65578
|
childrenPropSymbol.valueDeclaration = factory.createPropertySignature(void 0, unescapeLeadingUnderscores(jsxChildrenPropertyName), void 0, void 0);
|
|
65535
65579
|
setParent(childrenPropSymbol.valueDeclaration, attributes);
|
|
65536
65580
|
childrenPropSymbol.valueDeclaration.symbol = childrenPropSymbol;
|
|
@@ -65636,7 +65680,7 @@ function createTypeChecker(host) {
|
|
|
65636
65680
|
return void 0;
|
|
65637
65681
|
}
|
|
65638
65682
|
const isClassic = getEmitModuleResolutionKind(compilerOptions) === 1 /* Classic */;
|
|
65639
|
-
const errorMessage = isClassic ? Diagnostics.
|
|
65683
|
+
const errorMessage = isClassic ? Diagnostics.Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_nodenext_or_to_add_aliases_to_the_paths_option : Diagnostics.Cannot_find_module_0_or_its_corresponding_type_declarations;
|
|
65640
65684
|
const mod = resolveExternalModule(location, runtimeImportSpecifier, errorMessage, location);
|
|
65641
65685
|
const result = mod && mod !== unknownSymbol ? getMergedSymbol(resolveSymbol(mod)) : void 0;
|
|
65642
65686
|
if (links) {
|
|
@@ -66944,6 +66988,7 @@ function createTypeChecker(host) {
|
|
|
66944
66988
|
const types = [];
|
|
66945
66989
|
const flags = [];
|
|
66946
66990
|
const names = [];
|
|
66991
|
+
const inConstContext = isConstTypeVariable(restType);
|
|
66947
66992
|
for (let i = index; i < argCount; i++) {
|
|
66948
66993
|
const arg = args[i];
|
|
66949
66994
|
if (isSpreadArgument(arg)) {
|
|
@@ -66958,7 +67003,7 @@ function createTypeChecker(host) {
|
|
|
66958
67003
|
} else {
|
|
66959
67004
|
const contextualType = getIndexedAccessType(restType, getNumberLiteralType(i - index), 256 /* Contextual */);
|
|
66960
67005
|
const argType = checkExpressionWithContextualType(arg, contextualType, context, checkMode);
|
|
66961
|
-
const hasPrimitiveContextualType = maybeTypeOfKind(contextualType, 131068 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
|
|
67006
|
+
const hasPrimitiveContextualType = inConstContext || maybeTypeOfKind(contextualType, 131068 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
|
|
66962
67007
|
types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType));
|
|
66963
67008
|
flags.push(1 /* Required */);
|
|
66964
67009
|
}
|
|
@@ -66966,7 +67011,7 @@ function createTypeChecker(host) {
|
|
|
66966
67011
|
names.push(arg.tupleNameSource);
|
|
66967
67012
|
}
|
|
66968
67013
|
}
|
|
66969
|
-
return createTupleType(types, flags,
|
|
67014
|
+
return createTupleType(types, flags, inConstContext, length(names) === length(types) ? names : void 0);
|
|
66970
67015
|
}
|
|
66971
67016
|
function checkTypeArguments(signature, typeArgumentNodes, reportErrors2, headMessage) {
|
|
66972
67017
|
const isJavascript = isInJSFile(signature.declaration);
|
|
@@ -68041,7 +68086,7 @@ function createTypeChecker(host) {
|
|
|
68041
68086
|
returnNode ? factory.createTypeReferenceNode(returnNode, void 0) : factory.createKeywordTypeNode(131 /* AnyKeyword */)
|
|
68042
68087
|
);
|
|
68043
68088
|
const parameterSymbol = createSymbol(1 /* FunctionScopedVariable */, "props");
|
|
68044
|
-
parameterSymbol.type = result;
|
|
68089
|
+
parameterSymbol.links.type = result;
|
|
68045
68090
|
return createSignature(
|
|
68046
68091
|
declaration,
|
|
68047
68092
|
void 0,
|
|
@@ -68334,8 +68379,8 @@ function createTypeChecker(host) {
|
|
|
68334
68379
|
const memberTable = createSymbolTable();
|
|
68335
68380
|
const newSymbol = createSymbol(2097152 /* Alias */, "default" /* Default */);
|
|
68336
68381
|
newSymbol.parent = originalSymbol;
|
|
68337
|
-
newSymbol.nameType = getStringLiteralType("default");
|
|
68338
|
-
newSymbol.aliasTarget = resolveSymbol(symbol);
|
|
68382
|
+
newSymbol.links.nameType = getStringLiteralType("default");
|
|
68383
|
+
newSymbol.links.aliasTarget = resolveSymbol(symbol);
|
|
68339
68384
|
memberTable.set("default" /* Default */, newSymbol);
|
|
68340
68385
|
return createAnonymousType(anonymousSymbol, memberTable, emptyArray, emptyArray, emptyArray);
|
|
68341
68386
|
}
|
|
@@ -68361,7 +68406,7 @@ function createTypeChecker(host) {
|
|
|
68361
68406
|
if (hasSyntheticDefault) {
|
|
68362
68407
|
const anonymousSymbol = createSymbol(2048 /* TypeLiteral */, "__type" /* Type */);
|
|
68363
68408
|
const defaultContainingObject = createDefaultPropertyWrapperForModule(symbol, originalSymbol, anonymousSymbol);
|
|
68364
|
-
anonymousSymbol.type = defaultContainingObject;
|
|
68409
|
+
anonymousSymbol.links.type = defaultContainingObject;
|
|
68365
68410
|
synthType.syntheticType = isValidSpreadType(type) ? getSpreadType(type, defaultContainingObject, anonymousSymbol, 0, false) : defaultContainingObject;
|
|
68366
68411
|
} else {
|
|
68367
68412
|
synthType.syntheticType = type;
|
|
@@ -68430,12 +68475,9 @@ function createTypeChecker(host) {
|
|
|
68430
68475
|
return op === 40 /* MinusToken */ && (arg.kind === 8 /* NumericLiteral */ || arg.kind === 9 /* BigIntLiteral */) || op === 39 /* PlusToken */ && arg.kind === 8 /* NumericLiteral */;
|
|
68431
68476
|
case 208 /* PropertyAccessExpression */:
|
|
68432
68477
|
case 209 /* ElementAccessExpression */:
|
|
68433
|
-
const expr = node.expression;
|
|
68434
|
-
|
|
68435
|
-
|
|
68436
|
-
symbol = resolveAlias(symbol);
|
|
68437
|
-
}
|
|
68438
|
-
return !!(symbol && getAllSymbolFlags(symbol) & 384 /* Enum */);
|
|
68478
|
+
const expr = skipParentheses(node.expression);
|
|
68479
|
+
const symbol = isEntityNameExpression(expr) ? resolveEntityName(expr, 111551 /* Value */, true) : void 0;
|
|
68480
|
+
return !!(symbol && symbol.flags & 384 /* Enum */);
|
|
68439
68481
|
}
|
|
68440
68482
|
return false;
|
|
68441
68483
|
}
|
|
@@ -68896,7 +68938,7 @@ function createTypeChecker(host) {
|
|
|
68896
68938
|
const symbol = createSymbol(0 /* None */, "NewTargetExpression");
|
|
68897
68939
|
const targetPropertySymbol = createSymbol(4 /* Property */, "target", 8 /* Readonly */);
|
|
68898
68940
|
targetPropertySymbol.parent = symbol;
|
|
68899
|
-
targetPropertySymbol.type = targetType;
|
|
68941
|
+
targetPropertySymbol.links.type = targetType;
|
|
68900
68942
|
const members = createSymbolTable([targetPropertySymbol]);
|
|
68901
68943
|
symbol.members = members;
|
|
68902
68944
|
return createAnonymousType(symbol, members, emptyArray, emptyArray, emptyArray);
|
|
@@ -70343,23 +70385,21 @@ function createTypeChecker(host) {
|
|
|
70343
70385
|
return node;
|
|
70344
70386
|
}
|
|
70345
70387
|
function checkExpressionWithContextualType(node, contextualType, inferenceContext, checkMode) {
|
|
70346
|
-
const
|
|
70347
|
-
|
|
70348
|
-
const
|
|
70349
|
-
const saveInferenceContext =
|
|
70350
|
-
|
|
70351
|
-
|
|
70352
|
-
|
|
70353
|
-
|
|
70354
|
-
|
|
70355
|
-
|
|
70356
|
-
|
|
70357
|
-
|
|
70358
|
-
|
|
70359
|
-
|
|
70360
|
-
|
|
70361
|
-
links.inferenceContext = saveInferenceContext;
|
|
70362
|
-
}
|
|
70388
|
+
const contextNode = getContextNode2(node);
|
|
70389
|
+
pushContextualType(contextNode, contextualType);
|
|
70390
|
+
const saveInferenceNode = currentInferenceNode;
|
|
70391
|
+
const saveInferenceContext = currentInferenceContext;
|
|
70392
|
+
currentInferenceNode = contextNode;
|
|
70393
|
+
currentInferenceContext = inferenceContext;
|
|
70394
|
+
const type = checkExpression(node, checkMode | 1 /* Contextual */ | (inferenceContext ? 2 /* Inferential */ : 0));
|
|
70395
|
+
if (inferenceContext && inferenceContext.intraExpressionInferenceSites) {
|
|
70396
|
+
inferenceContext.intraExpressionInferenceSites = void 0;
|
|
70397
|
+
}
|
|
70398
|
+
const result = maybeTypeOfKind(type, 2944 /* Literal */) && isLiteralOfContextualType(type, instantiateContextualType(contextualType, node, void 0)) ? getRegularTypeOfLiteralType(type) : type;
|
|
70399
|
+
currentInferenceNode = saveInferenceNode;
|
|
70400
|
+
currentInferenceContext = saveInferenceContext;
|
|
70401
|
+
popContextualType();
|
|
70402
|
+
return result;
|
|
70363
70403
|
}
|
|
70364
70404
|
function checkExpressionCached(node, checkMode) {
|
|
70365
70405
|
if (checkMode) {
|
|
@@ -70431,11 +70471,15 @@ function createTypeChecker(host) {
|
|
|
70431
70471
|
}
|
|
70432
70472
|
function isConstContext(node) {
|
|
70433
70473
|
const parent2 = node.parent;
|
|
70434
|
-
return isAssertionExpression(parent2) && isConstTypeReference(parent2.type) || isJSDocTypeAssertion(parent2) && isConstTypeReference(getJSDocTypeAssertionType(parent2)) || (isParenthesizedExpression(parent2) || isArrayLiteralExpression(parent2) || isSpreadElement(parent2)) && isConstContext(parent2) || (isPropertyAssignment(parent2) || isShorthandPropertyAssignment(parent2) || isTemplateSpan(parent2)) && isConstContext(parent2.parent);
|
|
70474
|
+
return isAssertionExpression(parent2) && isConstTypeReference(parent2.type) || isJSDocTypeAssertion(parent2) && isConstTypeReference(getJSDocTypeAssertionType(parent2)) || isValidConstAssertionArgument(node) && isConstTypeParameterContext(node) || (isParenthesizedExpression(parent2) || isArrayLiteralExpression(parent2) || isSpreadElement(parent2)) && isConstContext(parent2) || (isPropertyAssignment(parent2) || isShorthandPropertyAssignment(parent2) || isTemplateSpan(parent2)) && isConstContext(parent2.parent);
|
|
70435
70475
|
}
|
|
70436
|
-
function
|
|
70476
|
+
function isConstTypeParameterContext(node) {
|
|
70477
|
+
const contextualType = getContextualType2(node, 0 /* None */);
|
|
70478
|
+
return !!contextualType && someType(contextualType, isConstTypeVariable);
|
|
70479
|
+
}
|
|
70480
|
+
function checkExpressionForMutableLocation(node, checkMode, forceTuple) {
|
|
70437
70481
|
const type = checkExpression(node, checkMode, forceTuple);
|
|
70438
|
-
return isConstContext(node) || isCommonJsExportedExpression(node) ? getRegularTypeOfLiteralType(type) : isTypeAssertion3(node) ? type : getWidenedLiteralLikeTypeForContextualType(type, instantiateContextualType(
|
|
70482
|
+
return isConstContext(node) || isCommonJsExportedExpression(node) ? getRegularTypeOfLiteralType(type) : isTypeAssertion3(node) ? type : getWidenedLiteralLikeTypeForContextualType(type, instantiateContextualType(getContextualType2(node, void 0), node, void 0));
|
|
70439
70483
|
}
|
|
70440
70484
|
function checkPropertyAssignment(node, checkMode) {
|
|
70441
70485
|
if (node.name.kind === 164 /* ComputedPropertyName */) {
|
|
@@ -70619,14 +70663,10 @@ function createTypeChecker(host) {
|
|
|
70619
70663
|
if (links.contextFreeType) {
|
|
70620
70664
|
return links.contextFreeType;
|
|
70621
70665
|
}
|
|
70622
|
-
|
|
70623
|
-
links.
|
|
70624
|
-
|
|
70625
|
-
|
|
70626
|
-
return type;
|
|
70627
|
-
} finally {
|
|
70628
|
-
links.contextualType = saveContextualType;
|
|
70629
|
-
}
|
|
70666
|
+
pushContextualType(node, anyType);
|
|
70667
|
+
const type = links.contextFreeType = checkExpression(node, 4 /* SkipContextSensitive */);
|
|
70668
|
+
popContextualType();
|
|
70669
|
+
return type;
|
|
70630
70670
|
}
|
|
70631
70671
|
function checkExpression(node, checkMode, forceTuple) {
|
|
70632
70672
|
var _a2, _b;
|
|
@@ -70803,7 +70843,7 @@ function createTypeChecker(host) {
|
|
|
70803
70843
|
var _a2, _b;
|
|
70804
70844
|
if (isInterfaceDeclaration(node.parent) || isClassLike(node.parent) || isTypeAliasDeclaration(node.parent)) {
|
|
70805
70845
|
const typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfDeclaration(node));
|
|
70806
|
-
const modifiers =
|
|
70846
|
+
const modifiers = getTypeParameterModifiers(typeParameter) & (32768 /* In */ | 65536 /* Out */);
|
|
70807
70847
|
if (modifiers) {
|
|
70808
70848
|
const symbol = getSymbolOfDeclaration(node.parent);
|
|
70809
70849
|
if (isTypeAliasDeclaration(node.parent) && !(getObjectFlags(getDeclaredTypeOfSymbol(symbol)) & (16 /* Anonymous */ | 32 /* Mapped */))) {
|
|
@@ -74434,7 +74474,7 @@ function createTypeChecker(host) {
|
|
|
74434
74474
|
);
|
|
74435
74475
|
}
|
|
74436
74476
|
function getTargetSymbol(s) {
|
|
74437
|
-
return getCheckFlags(s) & 1 /* Instantiated */ ? s.target : s;
|
|
74477
|
+
return getCheckFlags(s) & 1 /* Instantiated */ ? s.links.target : s;
|
|
74438
74478
|
}
|
|
74439
74479
|
function getClassOrInterfaceDeclarationsOfSymbol(symbol) {
|
|
74440
74480
|
return filter(symbol.declarations, (d) => d.kind === 260 /* ClassDeclaration */ || d.kind === 261 /* InterfaceDeclaration */);
|
|
@@ -76497,7 +76537,7 @@ function createTypeChecker(host) {
|
|
|
76497
76537
|
if (getCheckFlags(symbol) & 6 /* Synthetic */) {
|
|
76498
76538
|
return mapDefined(getSymbolLinks(symbol).containingType.types, (type) => getPropertyOfType(type, symbol.escapedName));
|
|
76499
76539
|
} else if (symbol.flags & 33554432 /* Transient */) {
|
|
76500
|
-
const { leftSpread, rightSpread, syntheticOrigin } = symbol;
|
|
76540
|
+
const { links: { leftSpread, rightSpread, syntheticOrigin } } = symbol;
|
|
76501
76541
|
return leftSpread ? [leftSpread, rightSpread] : syntheticOrigin ? [syntheticOrigin] : singleElementArray(tryGetTarget(symbol));
|
|
76502
76542
|
}
|
|
76503
76543
|
return void 0;
|
|
@@ -77375,16 +77415,20 @@ function createTypeChecker(host) {
|
|
|
77375
77415
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_an_index_signature, tokenToString(modifier.kind));
|
|
77376
77416
|
}
|
|
77377
77417
|
}
|
|
77378
|
-
if (modifier.kind !== 101 /* InKeyword */ && modifier.kind !== 145 /* OutKeyword */) {
|
|
77418
|
+
if (modifier.kind !== 101 /* InKeyword */ && modifier.kind !== 145 /* OutKeyword */ && modifier.kind !== 85 /* ConstKeyword */) {
|
|
77379
77419
|
if (node.kind === 165 /* TypeParameter */) {
|
|
77380
77420
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_type_parameter, tokenToString(modifier.kind));
|
|
77381
77421
|
}
|
|
77382
77422
|
}
|
|
77383
77423
|
switch (modifier.kind) {
|
|
77384
77424
|
case 85 /* ConstKeyword */:
|
|
77385
|
-
if (node.kind !== 263 /* EnumDeclaration */) {
|
|
77425
|
+
if (node.kind !== 263 /* EnumDeclaration */ && node.kind !== 165 /* TypeParameter */) {
|
|
77386
77426
|
return grammarErrorOnNode(node, Diagnostics.A_class_member_cannot_have_the_0_keyword, tokenToString(85 /* ConstKeyword */));
|
|
77387
77427
|
}
|
|
77428
|
+
const parent2 = node.parent;
|
|
77429
|
+
if (node.kind === 165 /* TypeParameter */ && !(isFunctionLikeDeclaration(parent2) || isClassDeclaration(parent2) || isFunctionTypeNode(parent2) || isConstructorTypeNode(parent2) || isCallSignatureDeclaration(parent2) || isConstructSignatureDeclaration(parent2) || isMethodSignature(parent2))) {
|
|
77430
|
+
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_can_only_appear_on_a_type_parameter_of_a_function_method_or_class, tokenToString(modifier.kind));
|
|
77431
|
+
}
|
|
77388
77432
|
break;
|
|
77389
77433
|
case 161 /* OverrideKeyword */:
|
|
77390
77434
|
if (flags & 16384 /* Override */) {
|
|
@@ -83907,7 +83951,7 @@ function transformClassFields(context) {
|
|
|
83907
83951
|
if (isClassWithConstructorReference) {
|
|
83908
83952
|
enableSubstitutionForClassAliases();
|
|
83909
83953
|
const alias = factory2.cloneNode(temp);
|
|
83910
|
-
alias.
|
|
83954
|
+
alias.autoGenerate.flags &= ~8 /* ReservedInNestedScopes */;
|
|
83911
83955
|
classAliases[getOriginalNodeId(node)] = alias;
|
|
83912
83956
|
}
|
|
83913
83957
|
setEmitFlags(classExpression, 131072 /* Indented */ | getEmitFlags(classExpression));
|
|
@@ -94203,7 +94247,7 @@ function transformModule(context) {
|
|
|
94203
94247
|
return factory2.createPropertyAccessExpression(externalHelpersModuleName, node);
|
|
94204
94248
|
}
|
|
94205
94249
|
return node;
|
|
94206
|
-
} else if (!(isGeneratedIdentifier(node) && !(node.
|
|
94250
|
+
} else if (!(isGeneratedIdentifier(node) && !(node.autoGenerate.flags & 64 /* AllowNameSubstitution */)) && !isLocalName(node)) {
|
|
94207
94251
|
const exportContainer = resolver.getReferencedExportContainer(node, isExportName(node));
|
|
94208
94252
|
if (exportContainer && exportContainer.kind === 308 /* SourceFile */) {
|
|
94209
94253
|
return setTextRange(
|
|
@@ -102058,10 +102102,10 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
102058
102102
|
}
|
|
102059
102103
|
}
|
|
102060
102104
|
function generateName(name) {
|
|
102061
|
-
if ((name.
|
|
102062
|
-
return generateNameCached(getNodeForGeneratedName(name), isPrivateIdentifier(name), name.
|
|
102105
|
+
if ((name.autoGenerate.flags & 7 /* KindMask */) === 4 /* Node */) {
|
|
102106
|
+
return generateNameCached(getNodeForGeneratedName(name), isPrivateIdentifier(name), name.autoGenerate.flags, name.autoGenerate.prefix, name.autoGenerate.suffix);
|
|
102063
102107
|
} else {
|
|
102064
|
-
const autoGenerateId = name.
|
|
102108
|
+
const autoGenerateId = name.autoGenerate.id;
|
|
102065
102109
|
return autoGeneratedIdToGeneratedName[autoGenerateId] || (autoGeneratedIdToGeneratedName[autoGenerateId] = makeName(name));
|
|
102066
102110
|
}
|
|
102067
102111
|
}
|
|
@@ -102244,26 +102288,26 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
102244
102288
|
}
|
|
102245
102289
|
}
|
|
102246
102290
|
function makeName(name) {
|
|
102247
|
-
const prefix = formatGeneratedNamePart(name.
|
|
102248
|
-
const suffix = formatGeneratedNamePart(name.
|
|
102249
|
-
switch (name.
|
|
102291
|
+
const prefix = formatGeneratedNamePart(name.autoGenerate.prefix, generateName);
|
|
102292
|
+
const suffix = formatGeneratedNamePart(name.autoGenerate.suffix);
|
|
102293
|
+
switch (name.autoGenerate.flags & 7 /* KindMask */) {
|
|
102250
102294
|
case 1 /* Auto */:
|
|
102251
|
-
return makeTempVariableName(TempFlags.Auto, !!(name.
|
|
102295
|
+
return makeTempVariableName(TempFlags.Auto, !!(name.autoGenerate.flags & 8 /* ReservedInNestedScopes */), isPrivateIdentifier(name), prefix, suffix);
|
|
102252
102296
|
case 2 /* Loop */:
|
|
102253
102297
|
Debug.assertNode(name, isIdentifier);
|
|
102254
|
-
return makeTempVariableName(TempFlags._i, !!(name.
|
|
102298
|
+
return makeTempVariableName(TempFlags._i, !!(name.autoGenerate.flags & 8 /* ReservedInNestedScopes */), false, prefix, suffix);
|
|
102255
102299
|
case 3 /* Unique */:
|
|
102256
102300
|
return makeUniqueName2(
|
|
102257
102301
|
idText(name),
|
|
102258
|
-
name.
|
|
102259
|
-
!!(name.
|
|
102260
|
-
!!(name.
|
|
102302
|
+
name.autoGenerate.flags & 32 /* FileLevel */ ? isFileLevelUniqueName2 : isUniqueName,
|
|
102303
|
+
!!(name.autoGenerate.flags & 16 /* Optimistic */),
|
|
102304
|
+
!!(name.autoGenerate.flags & 8 /* ReservedInNestedScopes */),
|
|
102261
102305
|
isPrivateIdentifier(name),
|
|
102262
102306
|
prefix,
|
|
102263
102307
|
suffix
|
|
102264
102308
|
);
|
|
102265
102309
|
}
|
|
102266
|
-
return Debug.fail(`Unsupported GeneratedIdentifierKind: ${Debug.formatEnum(name.
|
|
102310
|
+
return Debug.fail(`Unsupported GeneratedIdentifierKind: ${Debug.formatEnum(name.autoGenerate.flags & 7 /* KindMask */, GeneratedIdentifierFlags, true)}.`);
|
|
102267
102311
|
}
|
|
102268
102312
|
function pipelineEmitWithComments(hint, node) {
|
|
102269
102313
|
const pipelinePhase = getNextPipelinePhase(2 /* Comments */, hint, node);
|
|
@@ -103906,19 +103950,20 @@ function shouldProgramCreateNewSourceFiles(program, newOptions) {
|
|
|
103906
103950
|
return false;
|
|
103907
103951
|
return optionsHaveChanges(program.getCompilerOptions(), newOptions, sourceFileAffectingCompilerOptions);
|
|
103908
103952
|
}
|
|
103909
|
-
function createCreateProgramOptions(rootNames, options, host, oldProgram, configFileParsingDiagnostics) {
|
|
103953
|
+
function createCreateProgramOptions(rootNames, options, host, oldProgram, configFileParsingDiagnostics, typeScriptVersion3) {
|
|
103910
103954
|
return {
|
|
103911
103955
|
rootNames,
|
|
103912
103956
|
options,
|
|
103913
103957
|
host,
|
|
103914
103958
|
oldProgram,
|
|
103915
|
-
configFileParsingDiagnostics
|
|
103959
|
+
configFileParsingDiagnostics,
|
|
103960
|
+
typeScriptVersion: typeScriptVersion3
|
|
103916
103961
|
};
|
|
103917
103962
|
}
|
|
103918
103963
|
function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) {
|
|
103919
103964
|
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
103920
103965
|
const createProgramOptions = isArray(rootNamesOrOptions) ? createCreateProgramOptions(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : rootNamesOrOptions;
|
|
103921
|
-
const { rootNames, options, configFileParsingDiagnostics, projectReferences } = createProgramOptions;
|
|
103966
|
+
const { rootNames, options, configFileParsingDiagnostics, projectReferences, typeScriptVersion: typeScriptVersion3 } = createProgramOptions;
|
|
103922
103967
|
let { oldProgram } = createProgramOptions;
|
|
103923
103968
|
let processingDefaultLibFiles;
|
|
103924
103969
|
let processingOtherFiles;
|
|
@@ -105677,7 +105722,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
105677
105722
|
i++;
|
|
105678
105723
|
}
|
|
105679
105724
|
const resolveFrom = combinePaths(currentDirectory, `__lib_node_modules_lookup_${libFileName}__.ts`);
|
|
105680
|
-
const localOverrideModuleResult = resolveModuleName("@typescript/lib-" + path, resolveFrom, { moduleResolution: 2 /*
|
|
105725
|
+
const localOverrideModuleResult = resolveModuleName("@typescript/lib-" + path, resolveFrom, { moduleResolution: 2 /* Node10 */ }, host, moduleResolutionCache);
|
|
105681
105726
|
if (localOverrideModuleResult == null ? void 0 : localOverrideModuleResult.resolvedModule) {
|
|
105682
105727
|
return localOverrideModuleResult.resolvedModule.resolvedFileName;
|
|
105683
105728
|
}
|
|
@@ -105850,6 +105895,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
105850
105895
|
} else if (options.incremental && !outputFile && !options.configFilePath) {
|
|
105851
105896
|
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBuildInfoFile_is_specified));
|
|
105852
105897
|
}
|
|
105898
|
+
verifyDeprecatedCompilerOptions();
|
|
105853
105899
|
verifyProjectReferences();
|
|
105854
105900
|
if (options.composite) {
|
|
105855
105901
|
const rootPaths = new Set(rootNames.map(toPath3));
|
|
@@ -105960,8 +106006,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
105960
106006
|
}
|
|
105961
106007
|
}
|
|
105962
106008
|
if (getResolveJsonModule(options)) {
|
|
105963
|
-
if (getEmitModuleResolutionKind(options)
|
|
105964
|
-
createDiagnosticForOptionName(Diagnostics.
|
|
106009
|
+
if (getEmitModuleResolutionKind(options) === 1 /* Classic */) {
|
|
106010
|
+
createDiagnosticForOptionName(Diagnostics.Option_resolveJsonModule_cannot_be_specified_when_moduleResolution_is_set_to_classic, "resolveJsonModule");
|
|
105965
106011
|
} else if (!hasJsonModuleEmitEnabled(options)) {
|
|
105966
106012
|
createDiagnosticForOptionName(Diagnostics.Option_resolveJsonModule_can_only_be_specified_when_module_code_generation_is_commonjs_amd_es2015_or_esNext, "resolveJsonModule", "module");
|
|
105967
106013
|
}
|
|
@@ -106069,6 +106115,56 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
106069
106115
|
}
|
|
106070
106116
|
}
|
|
106071
106117
|
}
|
|
106118
|
+
function verifyDeprecatedCompilerOptions() {
|
|
106119
|
+
const version2 = typeScriptVersion3 || versionMajorMinor;
|
|
106120
|
+
const ignoreDeprecations = options.ignoreDeprecations;
|
|
106121
|
+
if (ignoreDeprecations) {
|
|
106122
|
+
if (ignoreDeprecations === "5.0" /* v5_0 */ && (version2 === "5.0" /* v5_0 */ || version2 === "5.5" /* v5_5 */)) {
|
|
106123
|
+
return;
|
|
106124
|
+
} else {
|
|
106125
|
+
createOptionValueDiagnostic("ignoreDeprecations", Diagnostics.Invalid_value_for_ignoreDeprecations);
|
|
106126
|
+
}
|
|
106127
|
+
}
|
|
106128
|
+
if (options.target === 0 /* ES3 */) {
|
|
106129
|
+
createDeprecatedDiagnosticForOption(version2, "target", "ES3");
|
|
106130
|
+
}
|
|
106131
|
+
if (options.noImplicitUseStrict) {
|
|
106132
|
+
createDeprecatedDiagnosticForOption(version2, "noImplicitUseStrict");
|
|
106133
|
+
}
|
|
106134
|
+
if (options.keyofStringsOnly) {
|
|
106135
|
+
createDeprecatedDiagnosticForOption(version2, "keyofStringsOnly");
|
|
106136
|
+
}
|
|
106137
|
+
if (options.suppressExcessPropertyErrors) {
|
|
106138
|
+
createDeprecatedDiagnosticForOption(version2, "suppressExcessPropertyErrors");
|
|
106139
|
+
}
|
|
106140
|
+
if (options.suppressImplicitAnyIndexErrors) {
|
|
106141
|
+
createDeprecatedDiagnosticForOption(version2, "suppressImplicitAnyIndexErrors");
|
|
106142
|
+
}
|
|
106143
|
+
if (options.noStrictGenericChecks) {
|
|
106144
|
+
createDeprecatedDiagnosticForOption(version2, "noStrictGenericChecks");
|
|
106145
|
+
}
|
|
106146
|
+
if (options.charset) {
|
|
106147
|
+
createDeprecatedDiagnosticForOption(version2, "charset");
|
|
106148
|
+
}
|
|
106149
|
+
if (options.out) {
|
|
106150
|
+
createDeprecatedDiagnosticForOption(version2, "out");
|
|
106151
|
+
}
|
|
106152
|
+
}
|
|
106153
|
+
function createDeprecatedDiagnosticForOption(version2, name, value) {
|
|
106154
|
+
if (version2 === "6.0" /* v6_0 */) {
|
|
106155
|
+
createDiagnosticForOption(!value, name, void 0, Diagnostics.Flag_0_is_deprecated_Please_remove_it_from_your_configuration, value || name);
|
|
106156
|
+
} else {
|
|
106157
|
+
createDiagnosticForOption(
|
|
106158
|
+
!value,
|
|
106159
|
+
name,
|
|
106160
|
+
void 0,
|
|
106161
|
+
Diagnostics.Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_ignoreDeprecations_Colon_2_to_silence_this_error,
|
|
106162
|
+
value || name,
|
|
106163
|
+
"5.5" /* v5_5 */,
|
|
106164
|
+
"5.0" /* v5_0 */
|
|
106165
|
+
);
|
|
106166
|
+
}
|
|
106167
|
+
}
|
|
106072
106168
|
function createDiagnosticExplainingFile(file, fileProcessingReason, diagnostic, args) {
|
|
106073
106169
|
var _a3;
|
|
106074
106170
|
let fileIncludeReasons;
|
|
@@ -112629,6 +112725,7 @@ __export(ts_exports3, {
|
|
|
112629
112725
|
ContextFlags: () => ContextFlags,
|
|
112630
112726
|
CoreServicesShimHostAdapter: () => CoreServicesShimHostAdapter,
|
|
112631
112727
|
Debug: () => Debug,
|
|
112728
|
+
DeprecationVersion: () => DeprecationVersion,
|
|
112632
112729
|
DiagnosticCategory: () => DiagnosticCategory,
|
|
112633
112730
|
Diagnostics: () => Diagnostics,
|
|
112634
112731
|
DocumentHighlights: () => DocumentHighlights,
|
|
@@ -116822,7 +116919,7 @@ function getModuleSpecifierResolverHost(program, host) {
|
|
|
116822
116919
|
};
|
|
116823
116920
|
}
|
|
116824
116921
|
function moduleResolutionUsesNodeModules(moduleResolution) {
|
|
116825
|
-
return moduleResolution === 2 /*
|
|
116922
|
+
return moduleResolution === 2 /* Node10 */ || moduleResolution >= 3 /* Node16 */ && moduleResolution <= 99 /* NodeNext */;
|
|
116826
116923
|
}
|
|
116827
116924
|
function makeImportIfNecessary(defaultImport, namedImports, moduleSpecifier, quotePreference) {
|
|
116828
116925
|
return defaultImport || namedImports && namedImports.length ? makeImport(defaultImport, namedImports, moduleSpecifier, quotePreference) : void 0;
|
|
@@ -117282,18 +117379,15 @@ function getScriptKind(fileName, host) {
|
|
|
117282
117379
|
}
|
|
117283
117380
|
function getSymbolTarget(symbol, checker) {
|
|
117284
117381
|
let next = symbol;
|
|
117285
|
-
while (isAliasSymbol(next) ||
|
|
117286
|
-
if (
|
|
117287
|
-
next = next.target;
|
|
117382
|
+
while (isAliasSymbol(next) || isTransientSymbol(next) && next.links.target) {
|
|
117383
|
+
if (isTransientSymbol(next) && next.links.target) {
|
|
117384
|
+
next = next.links.target;
|
|
117288
117385
|
} else {
|
|
117289
117386
|
next = skipAlias(next, checker);
|
|
117290
117387
|
}
|
|
117291
117388
|
}
|
|
117292
117389
|
return next;
|
|
117293
117390
|
}
|
|
117294
|
-
function isTransientSymbol2(symbol) {
|
|
117295
|
-
return (symbol.flags & 33554432 /* Transient */) !== 0;
|
|
117296
|
-
}
|
|
117297
117391
|
function isAliasSymbol(symbol) {
|
|
117298
117392
|
return (symbol.flags & 2097152 /* Alias */) !== 0;
|
|
117299
117393
|
}
|
|
@@ -122066,6 +122160,8 @@ var TokenOrIdentifierObject = class {
|
|
|
122066
122160
|
};
|
|
122067
122161
|
var SymbolObject = class {
|
|
122068
122162
|
constructor(flags, name) {
|
|
122163
|
+
this.id = 0;
|
|
122164
|
+
this.mergeId = 0;
|
|
122069
122165
|
this.flags = flags;
|
|
122070
122166
|
this.escapedName = name;
|
|
122071
122167
|
}
|
|
@@ -122087,8 +122183,8 @@ var SymbolObject = class {
|
|
|
122087
122183
|
getDocumentationComment(checker) {
|
|
122088
122184
|
if (!this.documentationComment) {
|
|
122089
122185
|
this.documentationComment = emptyArray;
|
|
122090
|
-
if (!this.declarations && this.target && this.target.tupleLabelDeclaration) {
|
|
122091
|
-
const labelDecl = this.target.tupleLabelDeclaration;
|
|
122186
|
+
if (!this.declarations && isTransientSymbol(this) && this.links.target && isTransientSymbol(this.links.target) && this.links.target.links.tupleLabelDeclaration) {
|
|
122187
|
+
const labelDecl = this.links.target.links.tupleLabelDeclaration;
|
|
122092
122188
|
this.documentationComment = getDocumentationComment([labelDecl], checker);
|
|
122093
122189
|
} else {
|
|
122094
122190
|
this.documentationComment = getDocumentationComment(this.declarations, checker);
|
|
@@ -128841,7 +128937,7 @@ function compareModuleSpecifiers(a, b, importingFile, program, allowsImportingSp
|
|
|
128841
128937
|
}
|
|
128842
128938
|
function isFixPossiblyReExportingImportingFile(fix, importingFile, compilerOptions, toPath3) {
|
|
128843
128939
|
var _a2;
|
|
128844
|
-
if (fix.isReExport && ((_a2 = fix.exportInfo) == null ? void 0 : _a2.moduleFileName) && getEmitModuleResolutionKind(compilerOptions) === 2 /*
|
|
128940
|
+
if (fix.isReExport && ((_a2 = fix.exportInfo) == null ? void 0 : _a2.moduleFileName) && getEmitModuleResolutionKind(compilerOptions) === 2 /* Node10 */ && isIndexFileName(fix.exportInfo.moduleFileName)) {
|
|
128845
128941
|
const reExportDir = toPath3(getDirectoryPath(fix.exportInfo.moduleFileName));
|
|
128846
128942
|
return startsWith(importingFile.path, reExportDir);
|
|
128847
128943
|
}
|
|
@@ -129989,7 +130085,7 @@ registerCodeFix({
|
|
|
129989
130085
|
});
|
|
129990
130086
|
function createObjectTypeFromLabeledExpression(checker, label, expression) {
|
|
129991
130087
|
const member = checker.createSymbol(4 /* Property */, label.escapedText);
|
|
129992
|
-
member.type = checker.getTypeAtLocation(expression);
|
|
130088
|
+
member.links.type = checker.getTypeAtLocation(expression);
|
|
129993
130089
|
const members = createSymbolTable([member]);
|
|
129994
130090
|
return checker.createAnonymousType(void 0, members, [], [], []);
|
|
129995
130091
|
}
|
|
@@ -132603,7 +132699,7 @@ function inferTypeFromReferences(program, references, cancellationToken) {
|
|
|
132603
132699
|
const members = mapEntries(props, (name, types) => {
|
|
132604
132700
|
const isOptional = types.length < anons.length ? 16777216 /* Optional */ : 0;
|
|
132605
132701
|
const s = checker.createSymbol(4 /* Property */ | isOptional, name);
|
|
132606
|
-
s.type = checker.getUnionType(types);
|
|
132702
|
+
s.links.type = checker.getUnionType(types);
|
|
132607
132703
|
return [name, s];
|
|
132608
132704
|
});
|
|
132609
132705
|
const indexInfos = [];
|
|
@@ -132657,7 +132753,7 @@ function inferTypeFromReferences(program, references, cancellationToken) {
|
|
|
132657
132753
|
if (usage.properties) {
|
|
132658
132754
|
usage.properties.forEach((u, name) => {
|
|
132659
132755
|
const symbol = checker.createSymbol(4 /* Property */, name);
|
|
132660
|
-
symbol.type = combineFromUsage(u);
|
|
132756
|
+
symbol.links.type = combineFromUsage(u);
|
|
132661
132757
|
members.set(name, symbol);
|
|
132662
132758
|
});
|
|
132663
132759
|
}
|
|
@@ -132733,6 +132829,7 @@ function inferTypeFromReferences(program, references, cancellationToken) {
|
|
|
132733
132829
|
return [];
|
|
132734
132830
|
}
|
|
132735
132831
|
function inferFromSignatures(genericSig, usageSig, typeParameter) {
|
|
132832
|
+
var _a2;
|
|
132736
132833
|
const types = [];
|
|
132737
132834
|
for (let i = 0; i < genericSig.parameters.length; i++) {
|
|
132738
132835
|
const genericParam = genericSig.parameters[i];
|
|
@@ -132746,7 +132843,7 @@ function inferTypeFromReferences(program, references, cancellationToken) {
|
|
|
132746
132843
|
if (elementType) {
|
|
132747
132844
|
genericParamType = elementType;
|
|
132748
132845
|
}
|
|
132749
|
-
const targetType = usageParam.type || (usageParam.valueDeclaration ? checker.getTypeOfSymbolAtLocation(usageParam, usageParam.valueDeclaration) : checker.getAnyType());
|
|
132846
|
+
const targetType = ((_a2 = tryCast(usageParam, isTransientSymbol)) == null ? void 0 : _a2.links.type) || (usageParam.valueDeclaration ? checker.getTypeOfSymbolAtLocation(usageParam, usageParam.valueDeclaration) : checker.getAnyType());
|
|
132750
132847
|
types.push(...inferTypeParameters(genericParamType, targetType, typeParameter));
|
|
132751
132848
|
}
|
|
132752
132849
|
const genericReturn = checker.getReturnTypeOfSignature(genericSig);
|
|
@@ -132762,7 +132859,7 @@ function inferTypeFromReferences(program, references, cancellationToken) {
|
|
|
132762
132859
|
const length2 = Math.max(...calls.map((c) => c.argumentTypes.length));
|
|
132763
132860
|
for (let i = 0; i < length2; i++) {
|
|
132764
132861
|
const symbol = checker.createSymbol(1 /* FunctionScopedVariable */, escapeLeadingUnderscores(`arg${i}`));
|
|
132765
|
-
symbol.type = combineTypes(calls.map((call) => call.argumentTypes[i] || checker.getUndefinedType()));
|
|
132862
|
+
symbol.links.type = combineTypes(calls.map((call) => call.argumentTypes[i] || checker.getUndefinedType()));
|
|
132766
132863
|
if (calls.some((call) => call.argumentTypes[i] === void 0)) {
|
|
132767
132864
|
symbol.flags |= 16777216 /* Optional */;
|
|
132768
132865
|
}
|
|
@@ -132920,7 +133017,7 @@ function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, con
|
|
|
132920
133017
|
if (declaration && isAutoAccessorPropertyDeclaration(declaration)) {
|
|
132921
133018
|
modifierFlags |= 128 /* Accessor */;
|
|
132922
133019
|
}
|
|
132923
|
-
const modifiers =
|
|
133020
|
+
const modifiers = createModifiers();
|
|
132924
133021
|
const type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration));
|
|
132925
133022
|
const optional = !!(symbol.flags & 16777216 /* Optional */);
|
|
132926
133023
|
const ambient = !!(enclosingDeclaration.flags & 16777216 /* Ambient */) || isAmbient;
|
|
@@ -133013,6 +133110,19 @@ function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, con
|
|
|
133013
133110
|
if (method)
|
|
133014
133111
|
addClassElement(method);
|
|
133015
133112
|
}
|
|
133113
|
+
function createModifiers() {
|
|
133114
|
+
let modifiers2;
|
|
133115
|
+
if (modifierFlags) {
|
|
133116
|
+
modifiers2 = combine(modifiers2, factory.createModifiersFromModifierFlags(modifierFlags));
|
|
133117
|
+
}
|
|
133118
|
+
if (shouldAddOverrideKeyword()) {
|
|
133119
|
+
modifiers2 = append(modifiers2, factory.createToken(161 /* OverrideKeyword */));
|
|
133120
|
+
}
|
|
133121
|
+
return modifiers2 && factory.createNodeArray(modifiers2);
|
|
133122
|
+
}
|
|
133123
|
+
function shouldAddOverrideKeyword() {
|
|
133124
|
+
return !!(context.program.getCompilerOptions().noImplicitOverride && declaration && hasAbstractModifier(declaration));
|
|
133125
|
+
}
|
|
133016
133126
|
function createName(node) {
|
|
133017
133127
|
if (isIdentifier(node) && node.escapedText === "constructor") {
|
|
133018
133128
|
return factory.createComputedPropertyName(factory.createStringLiteral(idText(node), quotePreference === 0 /* Single */));
|
|
@@ -133030,14 +133140,15 @@ function createSignatureDeclarationFromSignature(kind, context, quotePreference,
|
|
|
133030
133140
|
const program = context.program;
|
|
133031
133141
|
const checker = program.getTypeChecker();
|
|
133032
133142
|
const scriptTarget = getEmitScriptTarget(program.getCompilerOptions());
|
|
133143
|
+
const isJs = isInJSFile(enclosingDeclaration);
|
|
133033
133144
|
const flags = 1 /* NoTruncation */ | 256 /* SuppressAnyReturnType */ | 524288 /* AllowEmptyTuple */ | (quotePreference === 0 /* Single */ ? 268435456 /* UseSingleQuotesForStringLiteralType */ : 0 /* None */);
|
|
133034
133145
|
const signatureDeclaration = checker.signatureToSignatureDeclaration(signature, kind, enclosingDeclaration, flags, getNoopSymbolTrackerWithResolver(context));
|
|
133035
133146
|
if (!signatureDeclaration) {
|
|
133036
133147
|
return void 0;
|
|
133037
133148
|
}
|
|
133038
|
-
let typeParameters = signatureDeclaration.typeParameters;
|
|
133149
|
+
let typeParameters = isJs ? void 0 : signatureDeclaration.typeParameters;
|
|
133039
133150
|
let parameters = signatureDeclaration.parameters;
|
|
133040
|
-
let type = signatureDeclaration.type;
|
|
133151
|
+
let type = isJs ? void 0 : signatureDeclaration.type;
|
|
133041
133152
|
if (importAdder) {
|
|
133042
133153
|
if (typeParameters) {
|
|
133043
133154
|
const newTypeParameters = sameMap(typeParameters, (typeParameterDecl) => {
|
|
@@ -133070,18 +133181,20 @@ function createSignatureDeclarationFromSignature(kind, context, quotePreference,
|
|
|
133070
133181
|
}
|
|
133071
133182
|
}
|
|
133072
133183
|
const newParameters = sameMap(parameters, (parameterDecl) => {
|
|
133073
|
-
|
|
133074
|
-
|
|
133075
|
-
|
|
133076
|
-
|
|
133077
|
-
|
|
133184
|
+
let type2 = isJs ? void 0 : parameterDecl.type;
|
|
133185
|
+
if (type2) {
|
|
133186
|
+
const importableReference = tryGetAutoImportableReferenceFromTypeNode(type2, scriptTarget);
|
|
133187
|
+
if (importableReference) {
|
|
133188
|
+
type2 = importableReference.typeNode;
|
|
133189
|
+
importSymbols(importAdder, importableReference.symbols);
|
|
133190
|
+
}
|
|
133078
133191
|
}
|
|
133079
133192
|
return factory.updateParameterDeclaration(
|
|
133080
133193
|
parameterDecl,
|
|
133081
133194
|
parameterDecl.modifiers,
|
|
133082
133195
|
parameterDecl.dotDotDotToken,
|
|
133083
133196
|
parameterDecl.name,
|
|
133084
|
-
parameterDecl.questionToken,
|
|
133197
|
+
isJs ? void 0 : parameterDecl.questionToken,
|
|
133085
133198
|
type2,
|
|
133086
133199
|
parameterDecl.initializer
|
|
133087
133200
|
);
|
|
@@ -133694,11 +133807,11 @@ function getActionsForInvalidImportLocation(context) {
|
|
|
133694
133807
|
}
|
|
133695
133808
|
function getImportCodeFixesForExpression(context, expr) {
|
|
133696
133809
|
const type = context.program.getTypeChecker().getTypeAtLocation(expr);
|
|
133697
|
-
if (!(type.symbol && type.symbol.originatingImport)) {
|
|
133810
|
+
if (!(type.symbol && isTransientSymbol(type.symbol) && type.symbol.links.originatingImport)) {
|
|
133698
133811
|
return [];
|
|
133699
133812
|
}
|
|
133700
133813
|
const fixes = [];
|
|
133701
|
-
const relatedImport = type.symbol.originatingImport;
|
|
133814
|
+
const relatedImport = type.symbol.links.originatingImport;
|
|
133702
133815
|
if (!isImportCall(relatedImport)) {
|
|
133703
133816
|
addRange(fixes, getCodeFixesForImportDeclaration(context, relatedImport));
|
|
133704
133817
|
}
|
|
@@ -147418,7 +147531,10 @@ function itemInfoForParameters(candidateSignature, checker, enclosingDeclaration
|
|
|
147418
147531
|
}
|
|
147419
147532
|
});
|
|
147420
147533
|
const lists = checker.getExpandedParameters(candidateSignature);
|
|
147421
|
-
const isVariadic = !checker.hasEffectiveRestParameter(candidateSignature) ? (_) => false : lists.length === 1 ? (_) => true : (pList) =>
|
|
147534
|
+
const isVariadic = !checker.hasEffectiveRestParameter(candidateSignature) ? (_) => false : lists.length === 1 ? (_) => true : (pList) => {
|
|
147535
|
+
var _a2;
|
|
147536
|
+
return !!(pList.length && ((_a2 = tryCast(pList[pList.length - 1], isTransientSymbol)) == null ? void 0 : _a2.links.checkFlags) & 32768 /* RestParameter */);
|
|
147537
|
+
};
|
|
147422
147538
|
return lists.map((parameterList) => ({
|
|
147423
147539
|
isVariadic: isVariadic(parameterList),
|
|
147424
147540
|
parameters: parameterList.map((p) => createSignatureHelpParameterForParameter(p, checker, enclosingDeclaration, sourceFile, printer)),
|
|
@@ -147432,7 +147548,7 @@ function createSignatureHelpParameterForParameter(parameter, checker, enclosingD
|
|
|
147432
147548
|
printer.writeNode(4 /* Unspecified */, param, sourceFile, writer);
|
|
147433
147549
|
});
|
|
147434
147550
|
const isOptional = checker.isOptionalParameter(parameter.valueDeclaration);
|
|
147435
|
-
const isRest = !!(parameter.checkFlags & 32768 /* RestParameter */);
|
|
147551
|
+
const isRest = isTransientSymbol(parameter) && !!(parameter.links.checkFlags & 32768 /* RestParameter */);
|
|
147436
147552
|
return { name: parameter.name, documentation: parameter.getDocumentationComment(checker), displayParts, isOptional, isRest };
|
|
147437
147553
|
}
|
|
147438
147554
|
function createSignatureHelpParameterForTypeParameter(typeParameter, checker, enclosingDeclaration, sourceFile, printer) {
|
|
@@ -147715,7 +147831,7 @@ function getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeCheck
|
|
|
147715
147831
|
if (flags & 131072 /* Signature */)
|
|
147716
147832
|
return "index" /* indexSignatureElement */;
|
|
147717
147833
|
if (flags & 4 /* Property */) {
|
|
147718
|
-
if (flags & 33554432 /* Transient */ && symbol.checkFlags & 6 /* Synthetic */) {
|
|
147834
|
+
if (flags & 33554432 /* Transient */ && symbol.links.checkFlags & 6 /* Synthetic */) {
|
|
147719
147835
|
const unionPropertyKind = forEach(typeChecker.getRootSymbols(symbol), (rootSymbol) => {
|
|
147720
147836
|
const rootSymbolFlags = rootSymbol.getFlags();
|
|
147721
147837
|
if (rootSymbolFlags & (98308 /* PropertyOrAccessor */ | 3 /* Variable */)) {
|
|
@@ -148095,8 +148211,8 @@ function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, so
|
|
|
148095
148211
|
} else {
|
|
148096
148212
|
addRange(displayParts, typeToDisplayParts(typeChecker, type, enclosingDeclaration));
|
|
148097
148213
|
}
|
|
148098
|
-
if (symbol.target && symbol.target.tupleLabelDeclaration) {
|
|
148099
|
-
const labelDecl = symbol.target.tupleLabelDeclaration;
|
|
148214
|
+
if (isTransientSymbol(symbol) && symbol.links.target && isTransientSymbol(symbol.links.target) && symbol.links.target.links.tupleLabelDeclaration) {
|
|
148215
|
+
const labelDecl = symbol.links.target.links.tupleLabelDeclaration;
|
|
148100
148216
|
Debug.assertNode(labelDecl.name, isIdentifier);
|
|
148101
148217
|
displayParts.push(spacePart());
|
|
148102
148218
|
displayParts.push(punctuationPart(20 /* OpenParenToken */));
|
|
@@ -160514,7 +160630,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
160514
160630
|
return void 0;
|
|
160515
160631
|
const entrypoints = getEntrypointsFromPackageJsonInfo(
|
|
160516
160632
|
packageJson,
|
|
160517
|
-
{ moduleResolution: 2 /*
|
|
160633
|
+
{ moduleResolution: 2 /* Node10 */ },
|
|
160518
160634
|
project,
|
|
160519
160635
|
project.getModuleResolutionCache()
|
|
160520
160636
|
);
|
|
@@ -163393,6 +163509,7 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
163393
163509
|
ContextFlags,
|
|
163394
163510
|
CoreServicesShimHostAdapter,
|
|
163395
163511
|
Debug,
|
|
163512
|
+
DeprecationVersion,
|
|
163396
163513
|
DiagnosticCategory,
|
|
163397
163514
|
Diagnostics,
|
|
163398
163515
|
DocumentHighlights,
|