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/tsc.js
CHANGED
|
@@ -23,7 +23,7 @@ var __export = (target, all) => {
|
|
|
23
23
|
|
|
24
24
|
// src/compiler/corePublic.ts
|
|
25
25
|
var versionMajorMinor = "5.0";
|
|
26
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
26
|
+
var version = `${versionMajorMinor}.0-dev.20221217`;
|
|
27
27
|
|
|
28
28
|
// src/compiler/core.ts
|
|
29
29
|
var emptyArray = [];
|
|
@@ -3714,7 +3714,7 @@ function diagnosticCategoryName(d, lowerCase = true) {
|
|
|
3714
3714
|
}
|
|
3715
3715
|
var ModuleResolutionKind = /* @__PURE__ */ ((ModuleResolutionKind2) => {
|
|
3716
3716
|
ModuleResolutionKind2[ModuleResolutionKind2["Classic"] = 1] = "Classic";
|
|
3717
|
-
ModuleResolutionKind2[ModuleResolutionKind2["
|
|
3717
|
+
ModuleResolutionKind2[ModuleResolutionKind2["Node10"] = 2] = "Node10";
|
|
3718
3718
|
ModuleResolutionKind2[ModuleResolutionKind2["Node16"] = 3] = "Node16";
|
|
3719
3719
|
ModuleResolutionKind2[ModuleResolutionKind2["NodeNext"] = 99] = "NodeNext";
|
|
3720
3720
|
ModuleResolutionKind2[ModuleResolutionKind2["Bundler"] = 100] = "Bundler";
|
|
@@ -5807,6 +5807,7 @@ var Diagnostics = {
|
|
|
5807
5807
|
_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"),
|
|
5808
5808
|
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."),
|
|
5809
5809
|
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."),
|
|
5810
|
+
_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"),
|
|
5810
5811
|
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."),
|
|
5811
5812
|
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."),
|
|
5812
5813
|
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."),
|
|
@@ -6425,7 +6426,7 @@ var Diagnostics = {
|
|
|
6425
6426
|
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."),
|
|
6426
6427
|
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."),
|
|
6427
6428
|
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."),
|
|
6428
|
-
|
|
6429
|
+
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?"),
|
|
6429
6430
|
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."),
|
|
6430
6431
|
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'?"),
|
|
6431
6432
|
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."),
|
|
@@ -6607,7 +6608,7 @@ var Diagnostics = {
|
|
|
6607
6608
|
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."),
|
|
6608
6609
|
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."),
|
|
6609
6610
|
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}'."),
|
|
6610
|
-
|
|
6611
|
+
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'."),
|
|
6611
6612
|
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'."),
|
|
6612
6613
|
Unknown_build_option_0: diag(5072, 1 /* Error */, "Unknown_build_option_0_5072", "Unknown build option '{0}'."),
|
|
6613
6614
|
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}."),
|
|
@@ -6638,6 +6639,9 @@ var Diagnostics = {
|
|
|
6638
6639
|
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'."),
|
|
6639
6640
|
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.`),
|
|
6640
6641
|
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."),
|
|
6642
|
+
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.`),
|
|
6643
|
+
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."),
|
|
6644
|
+
Invalid_value_for_ignoreDeprecations: diag(5103, 1 /* Error */, "Invalid_value_for_ignoreDeprecations_5103", "Invalid value for '--ignoreDeprecations'."),
|
|
6641
6645
|
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."),
|
|
6642
6646
|
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."),
|
|
6643
6647
|
Generates_corresponding_d_ts_file: diag(6002, 3 /* Message */, "Generates_corresponding_d_ts_file_6002", "Generates corresponding '.d.ts' file."),
|
|
@@ -9953,12 +9957,10 @@ function formatJSDocLink(link) {
|
|
|
9953
9957
|
}
|
|
9954
9958
|
function getEffectiveTypeParameterDeclarations(node) {
|
|
9955
9959
|
if (isJSDocSignature(node)) {
|
|
9956
|
-
if (
|
|
9957
|
-
const
|
|
9958
|
-
|
|
9959
|
-
|
|
9960
|
-
if (overloadTag) {
|
|
9961
|
-
return flatMap(node.parent.tags, (tag) => isJSDocTemplateTag(tag) ? tag.typeParameters : void 0);
|
|
9960
|
+
if (isJSDocOverloadTag(node.parent)) {
|
|
9961
|
+
const jsDoc = getJSDocRoot(node.parent);
|
|
9962
|
+
if (jsDoc && length(jsDoc.tags)) {
|
|
9963
|
+
return flatMap(jsDoc.tags, (tag) => isJSDocTemplateTag(tag) ? tag.typeParameters : void 0);
|
|
9962
9964
|
}
|
|
9963
9965
|
}
|
|
9964
9966
|
return emptyArray;
|
|
@@ -10103,10 +10105,10 @@ function isAssertionKey(node) {
|
|
|
10103
10105
|
return isStringLiteral(node) || isIdentifier(node);
|
|
10104
10106
|
}
|
|
10105
10107
|
function isGeneratedIdentifier(node) {
|
|
10106
|
-
return isIdentifier(node) &&
|
|
10108
|
+
return isIdentifier(node) && node.autoGenerate !== void 0;
|
|
10107
10109
|
}
|
|
10108
10110
|
function isGeneratedPrivateIdentifier(node) {
|
|
10109
|
-
return isPrivateIdentifier(node) &&
|
|
10111
|
+
return isPrivateIdentifier(node) && node.autoGenerate !== void 0;
|
|
10110
10112
|
}
|
|
10111
10113
|
function isPrivateIdentifierClassElementDeclaration(node) {
|
|
10112
10114
|
return (isPropertyDeclaration(node) || isMethodOrAccessor(node)) && isPrivateIdentifier(node.name);
|
|
@@ -10775,18 +10777,6 @@ function changesAffectingProgramStructure(oldOptions, newOptions) {
|
|
|
10775
10777
|
function optionsHaveChanges(oldOptions, newOptions, optionDeclarations2) {
|
|
10776
10778
|
return oldOptions !== newOptions && optionDeclarations2.some((o) => !isJsonEqual(getCompilerOptionValue(oldOptions, o), getCompilerOptionValue(newOptions, o)));
|
|
10777
10779
|
}
|
|
10778
|
-
function forEachAncestor(node, callback) {
|
|
10779
|
-
while (true) {
|
|
10780
|
-
const res = callback(node);
|
|
10781
|
-
if (res === "quit")
|
|
10782
|
-
return void 0;
|
|
10783
|
-
if (res !== void 0)
|
|
10784
|
-
return res;
|
|
10785
|
-
if (isSourceFile(node))
|
|
10786
|
-
return void 0;
|
|
10787
|
-
node = node.parent;
|
|
10788
|
-
}
|
|
10789
|
-
}
|
|
10790
10780
|
function forEachEntry(map2, callback) {
|
|
10791
10781
|
const iterator = map2.entries();
|
|
10792
10782
|
for (let iterResult = iterator.next(); !iterResult.done; iterResult = iterator.next()) {
|
|
@@ -11355,7 +11345,7 @@ function tryGetTextOfPropertyName(name) {
|
|
|
11355
11345
|
switch (name.kind) {
|
|
11356
11346
|
case 79 /* Identifier */:
|
|
11357
11347
|
case 80 /* PrivateIdentifier */:
|
|
11358
|
-
return name.
|
|
11348
|
+
return name.autoGenerate ? void 0 : name.escapedText;
|
|
11359
11349
|
case 10 /* StringLiteral */:
|
|
11360
11350
|
case 8 /* NumericLiteral */:
|
|
11361
11351
|
case 14 /* NoSubstitutionTemplateLiteral */:
|
|
@@ -14412,7 +14402,7 @@ function closeFileWatcher(watcher) {
|
|
|
14412
14402
|
watcher.close();
|
|
14413
14403
|
}
|
|
14414
14404
|
function getCheckFlags(symbol) {
|
|
14415
|
-
return symbol.flags & 33554432 /* Transient */ ? symbol.checkFlags : 0;
|
|
14405
|
+
return symbol.flags & 33554432 /* Transient */ ? symbol.links.checkFlags : 0;
|
|
14416
14406
|
}
|
|
14417
14407
|
function getDeclarationModifierFlagsFromSymbol(s, isWrite = false) {
|
|
14418
14408
|
if (s.valueDeclaration) {
|
|
@@ -14421,7 +14411,7 @@ function getDeclarationModifierFlagsFromSymbol(s, isWrite = false) {
|
|
|
14421
14411
|
return s.parent && s.parent.flags & 32 /* Class */ ? flags : flags & ~28 /* AccessibilityModifier */;
|
|
14422
14412
|
}
|
|
14423
14413
|
if (getCheckFlags(s) & 6 /* Synthetic */) {
|
|
14424
|
-
const checkFlags = s.checkFlags;
|
|
14414
|
+
const checkFlags = s.links.checkFlags;
|
|
14425
14415
|
const accessModifier = checkFlags & 1024 /* ContainsPrivate */ ? 8 /* Private */ : checkFlags & 256 /* ContainsPublic */ ? 4 /* Public */ : 16 /* Protected */;
|
|
14426
14416
|
const staticModifier = checkFlags & 2048 /* ContainsStatic */ ? 32 /* Static */ : 0;
|
|
14427
14417
|
return accessModifier | staticModifier;
|
|
@@ -14620,9 +14610,16 @@ function Symbol4(flags, name) {
|
|
|
14620
14610
|
this.escapedName = name;
|
|
14621
14611
|
this.declarations = void 0;
|
|
14622
14612
|
this.valueDeclaration = void 0;
|
|
14623
|
-
this.id =
|
|
14624
|
-
this.mergeId =
|
|
14613
|
+
this.id = 0;
|
|
14614
|
+
this.mergeId = 0;
|
|
14625
14615
|
this.parent = void 0;
|
|
14616
|
+
this.members = void 0;
|
|
14617
|
+
this.exports = void 0;
|
|
14618
|
+
this.exportSymbol = void 0;
|
|
14619
|
+
this.constEnumOnlyModule = void 0;
|
|
14620
|
+
this.isReferenced = void 0;
|
|
14621
|
+
this.isAssigned = void 0;
|
|
14622
|
+
this.links = void 0;
|
|
14626
14623
|
}
|
|
14627
14624
|
function Type3(checker, flags) {
|
|
14628
14625
|
this.flags = flags;
|
|
@@ -14928,7 +14925,7 @@ function getEmitModuleResolutionKind(compilerOptions) {
|
|
|
14928
14925
|
if (moduleResolution === void 0) {
|
|
14929
14926
|
switch (getEmitModuleKind(compilerOptions)) {
|
|
14930
14927
|
case 1 /* CommonJS */:
|
|
14931
|
-
moduleResolution = 2 /*
|
|
14928
|
+
moduleResolution = 2 /* Node10 */;
|
|
14932
14929
|
break;
|
|
14933
14930
|
case 100 /* Node16 */:
|
|
14934
14931
|
moduleResolution = 3 /* Node16 */;
|
|
@@ -17225,15 +17222,23 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
17225
17222
|
const node = baseFactory2.createBaseIdentifierNode(79 /* Identifier */);
|
|
17226
17223
|
node.originalKeywordKind = originalKeywordKind;
|
|
17227
17224
|
node.escapedText = escapedText;
|
|
17228
|
-
node.
|
|
17225
|
+
node.autoGenerate = void 0;
|
|
17226
|
+
node.typeArguments = void 0;
|
|
17227
|
+
node.hasExtendedUnicodeEscape = void 0;
|
|
17228
|
+
node.jsDoc = void 0;
|
|
17229
|
+
node.jsDocCache = void 0;
|
|
17230
|
+
node.flowNode = void 0;
|
|
17231
|
+
node.symbol = void 0;
|
|
17229
17232
|
return node;
|
|
17230
17233
|
}
|
|
17231
17234
|
function createBaseGeneratedIdentifier(text, autoGenerateFlags, prefix, suffix) {
|
|
17232
17235
|
const node = createBaseIdentifier(escapeLeadingUnderscores(text), void 0);
|
|
17233
|
-
node.
|
|
17234
|
-
|
|
17235
|
-
|
|
17236
|
-
|
|
17236
|
+
node.autoGenerate = {
|
|
17237
|
+
flags: autoGenerateFlags,
|
|
17238
|
+
id: nextAutoGenerateId,
|
|
17239
|
+
prefix,
|
|
17240
|
+
suffix
|
|
17241
|
+
};
|
|
17237
17242
|
nextAutoGenerateId++;
|
|
17238
17243
|
return node;
|
|
17239
17244
|
}
|
|
@@ -17247,10 +17252,6 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
17247
17252
|
const node = createBaseIdentifier(escapeLeadingUnderscores(text), originalKeywordKind);
|
|
17248
17253
|
node.typeArguments = asNodeArray(typeArguments);
|
|
17249
17254
|
node.hasExtendedUnicodeEscape = hasExtendedUnicodeEscape;
|
|
17250
|
-
node.jsDoc = void 0;
|
|
17251
|
-
node.jsDocCache = void 0;
|
|
17252
|
-
node.flowNode = void 0;
|
|
17253
|
-
node.symbol = void 0;
|
|
17254
17255
|
if (node.originalKeywordKind === 133 /* AwaitKeyword */) {
|
|
17255
17256
|
node.transformFlags |= 67108864 /* ContainsPossibleTopLevelAwait */;
|
|
17256
17257
|
}
|
|
@@ -17295,7 +17296,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
17295
17296
|
function createBasePrivateIdentifier(escapedText) {
|
|
17296
17297
|
const node = baseFactory2.createBasePrivateIdentifierNode(80 /* PrivateIdentifier */);
|
|
17297
17298
|
node.escapedText = escapedText;
|
|
17298
|
-
node.
|
|
17299
|
+
node.autoGenerate = void 0;
|
|
17299
17300
|
node.transformFlags |= 16777216 /* ContainsClassFields */;
|
|
17300
17301
|
return node;
|
|
17301
17302
|
}
|
|
@@ -17306,10 +17307,12 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
17306
17307
|
}
|
|
17307
17308
|
function createBaseGeneratedPrivateIdentifier(text, autoGenerateFlags, prefix, suffix) {
|
|
17308
17309
|
const node = createBasePrivateIdentifier(escapeLeadingUnderscores(text));
|
|
17309
|
-
node.
|
|
17310
|
-
|
|
17311
|
-
|
|
17312
|
-
|
|
17310
|
+
node.autoGenerate = {
|
|
17311
|
+
flags: autoGenerateFlags,
|
|
17312
|
+
id: nextAutoGenerateId,
|
|
17313
|
+
prefix,
|
|
17314
|
+
suffix
|
|
17315
|
+
};
|
|
17313
17316
|
nextAutoGenerateId++;
|
|
17314
17317
|
return node;
|
|
17315
17318
|
}
|
|
@@ -20102,10 +20105,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
20102
20105
|
function cloneGeneratedIdentifier(node) {
|
|
20103
20106
|
const clone2 = createBaseIdentifier(node.escapedText, void 0);
|
|
20104
20107
|
clone2.flags |= node.flags & ~8 /* Synthesized */;
|
|
20105
|
-
clone2.
|
|
20106
|
-
clone2.autoGenerateId = node.autoGenerateId;
|
|
20107
|
-
clone2.autoGeneratePrefix = node.autoGeneratePrefix;
|
|
20108
|
-
clone2.autoGenerateSuffix = node.autoGenerateSuffix;
|
|
20108
|
+
clone2.autoGenerate = { ...node.autoGenerate };
|
|
20109
20109
|
clone2.transformFlags = node.transformFlags;
|
|
20110
20110
|
setOriginalNode(clone2, node);
|
|
20111
20111
|
return clone2;
|
|
@@ -20126,10 +20126,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
20126
20126
|
function cloneGeneratedPrivateIdentifier(node) {
|
|
20127
20127
|
const clone2 = createBasePrivateIdentifier(node.escapedText);
|
|
20128
20128
|
clone2.flags |= node.flags & ~8 /* Synthesized */;
|
|
20129
|
-
clone2.
|
|
20130
|
-
clone2.autoGenerateId = node.autoGenerateId;
|
|
20131
|
-
clone2.autoGeneratePrefix = node.autoGeneratePrefix;
|
|
20132
|
-
clone2.autoGenerateSuffix = node.autoGenerateSuffix;
|
|
20129
|
+
clone2.autoGenerate = { ...node.autoGenerate };
|
|
20133
20130
|
clone2.transformFlags = node.transformFlags;
|
|
20134
20131
|
setOriginalNode(clone2, node);
|
|
20135
20132
|
return clone2;
|
|
@@ -23328,13 +23325,13 @@ function elideNodes(factory2, nodes) {
|
|
|
23328
23325
|
return setTextRange(factory2.createNodeArray([], nodes.hasTrailingComma), nodes);
|
|
23329
23326
|
}
|
|
23330
23327
|
function getNodeForGeneratedName(name) {
|
|
23331
|
-
if (name.
|
|
23332
|
-
const autoGenerateId = name.
|
|
23328
|
+
if (name.autoGenerate.flags & 4 /* Node */) {
|
|
23329
|
+
const autoGenerateId = name.autoGenerate.id;
|
|
23333
23330
|
let node = name;
|
|
23334
23331
|
let original = node.original;
|
|
23335
23332
|
while (original) {
|
|
23336
23333
|
node = original;
|
|
23337
|
-
if (isMemberName(node) && !!(node.
|
|
23334
|
+
if (isMemberName(node) && (node.autoGenerate === void 0 || !!(node.autoGenerate.flags & 4 /* Node */) && node.autoGenerate.id !== autoGenerateId)) {
|
|
23338
23335
|
break;
|
|
23339
23336
|
}
|
|
23340
23337
|
original = node.original;
|
|
@@ -23871,6 +23868,7 @@ var forEachChildTable = {
|
|
|
23871
23868
|
[346 /* JSDocThisTag */]: forEachChildInJSDocTypeLikeTag,
|
|
23872
23869
|
[343 /* JSDocEnumTag */]: forEachChildInJSDocTypeLikeTag,
|
|
23873
23870
|
[352 /* JSDocThrowsTag */]: forEachChildInJSDocTypeLikeTag,
|
|
23871
|
+
[342 /* JSDocOverloadTag */]: forEachChildInJSDocTypeLikeTag,
|
|
23874
23872
|
[326 /* JSDocSignature */]: function forEachChildInJSDocSignature(node, cbNode, _cbNodes) {
|
|
23875
23873
|
return forEach(node.typeParameters, cbNode) || forEach(node.parameters, cbNode) || visitNode2(cbNode, node.type);
|
|
23876
23874
|
},
|
|
@@ -24970,7 +24968,7 @@ var Parser;
|
|
|
24970
24968
|
case ParsingContext.ArrayBindingElements:
|
|
24971
24969
|
return token() === 27 /* CommaToken */ || token() === 25 /* DotDotDotToken */ || isBindingIdentifierOrPrivateIdentifierOrPattern();
|
|
24972
24970
|
case ParsingContext.TypeParameters:
|
|
24973
|
-
return token() === 101 /* InKeyword */ || isIdentifier2();
|
|
24971
|
+
return token() === 101 /* InKeyword */ || token() === 85 /* ConstKeyword */ || isIdentifier2();
|
|
24974
24972
|
case ParsingContext.ArrayLiteralMembers:
|
|
24975
24973
|
switch (token()) {
|
|
24976
24974
|
case 27 /* CommaToken */:
|
|
@@ -25675,7 +25673,7 @@ var Parser;
|
|
|
25675
25673
|
}
|
|
25676
25674
|
function parseTypeParameter() {
|
|
25677
25675
|
const pos = getNodePos();
|
|
25678
|
-
const modifiers = parseModifiers();
|
|
25676
|
+
const modifiers = parseModifiers(true);
|
|
25679
25677
|
const name = parseIdentifier();
|
|
25680
25678
|
let constraint;
|
|
25681
25679
|
let expression;
|
|
@@ -26638,11 +26636,12 @@ var Parser;
|
|
|
26638
26636
|
return Tristate.False;
|
|
26639
26637
|
} else {
|
|
26640
26638
|
Debug.assert(first2 === 29 /* LessThanToken */);
|
|
26641
|
-
if (!isIdentifier2()) {
|
|
26639
|
+
if (!isIdentifier2() && token() !== 85 /* ConstKeyword */) {
|
|
26642
26640
|
return Tristate.False;
|
|
26643
26641
|
}
|
|
26644
26642
|
if (languageVariant === 1 /* JSX */) {
|
|
26645
26643
|
const isArrowFunctionInJsx = lookAhead(() => {
|
|
26644
|
+
parseOptional(85 /* ConstKeyword */);
|
|
26646
26645
|
const third = nextToken();
|
|
26647
26646
|
if (third === 94 /* ExtendsKeyword */) {
|
|
26648
26647
|
const fourth = nextToken();
|
|
@@ -28365,10 +28364,10 @@ var Parser;
|
|
|
28365
28364
|
}
|
|
28366
28365
|
return list && createNodeArray(list, pos);
|
|
28367
28366
|
}
|
|
28368
|
-
function tryParseModifier(
|
|
28367
|
+
function tryParseModifier(permitConstAsModifier, stopOnStartOfClassStaticBlock, hasSeenStaticModifier) {
|
|
28369
28368
|
const pos = getNodePos();
|
|
28370
28369
|
const kind = token();
|
|
28371
|
-
if (token() === 85 /* ConstKeyword */ &&
|
|
28370
|
+
if (token() === 85 /* ConstKeyword */ && permitConstAsModifier) {
|
|
28372
28371
|
if (!tryParse(nextTokenIsOnSameLineAndCanFollowModifier)) {
|
|
28373
28372
|
return void 0;
|
|
28374
28373
|
}
|
|
@@ -28392,10 +28391,10 @@ var Parser;
|
|
|
28392
28391
|
setTextRangePosEnd(decoratorsAndModifiers, decorators.pos, modifiers.end);
|
|
28393
28392
|
return decoratorsAndModifiers;
|
|
28394
28393
|
}
|
|
28395
|
-
function parseModifiers(
|
|
28394
|
+
function parseModifiers(permitConstAsModifier, stopOnStartOfClassStaticBlock) {
|
|
28396
28395
|
const pos = getNodePos();
|
|
28397
28396
|
let list, modifier, hasSeenStatic = false;
|
|
28398
|
-
while (modifier = tryParseModifier(
|
|
28397
|
+
while (modifier = tryParseModifier(permitConstAsModifier, stopOnStartOfClassStaticBlock, hasSeenStatic)) {
|
|
28399
28398
|
if (modifier.kind === 124 /* StaticKeyword */)
|
|
28400
28399
|
hasSeenStatic = true;
|
|
28401
28400
|
list = append(list, modifier);
|
|
@@ -31133,12 +31132,14 @@ var commandOptionsWithoutBuild = [
|
|
|
31133
31132
|
{
|
|
31134
31133
|
name: "moduleResolution",
|
|
31135
31134
|
type: new Map(getEntries({
|
|
31136
|
-
|
|
31135
|
+
node10: 2 /* Node10 */,
|
|
31136
|
+
node: 2 /* Node10 */,
|
|
31137
31137
|
classic: 1 /* Classic */,
|
|
31138
31138
|
node16: 3 /* Node16 */,
|
|
31139
31139
|
nodenext: 99 /* NodeNext */,
|
|
31140
31140
|
bundler: 100 /* Bundler */
|
|
31141
31141
|
})),
|
|
31142
|
+
deprecatedKeys: /* @__PURE__ */ new Set(["node"]),
|
|
31142
31143
|
affectsModuleResolution: true,
|
|
31143
31144
|
paramType: Diagnostics.STRATEGY,
|
|
31144
31145
|
category: Diagnostics.Modules,
|
|
@@ -31658,6 +31659,11 @@ var commandOptionsWithoutBuild = [
|
|
|
31658
31659
|
description: Diagnostics.Control_what_method_is_used_to_detect_module_format_JS_files,
|
|
31659
31660
|
category: Diagnostics.Language_and_Environment,
|
|
31660
31661
|
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
|
|
31662
|
+
},
|
|
31663
|
+
{
|
|
31664
|
+
name: "ignoreDeprecations",
|
|
31665
|
+
type: "string",
|
|
31666
|
+
defaultValueDescription: void 0
|
|
31661
31667
|
}
|
|
31662
31668
|
];
|
|
31663
31669
|
var optionDeclarations = [
|
|
@@ -31782,8 +31788,9 @@ function createCompilerDiagnosticForInvalidCustomType(opt) {
|
|
|
31782
31788
|
return createDiagnosticForInvalidCustomType(opt, createCompilerDiagnostic);
|
|
31783
31789
|
}
|
|
31784
31790
|
function createDiagnosticForInvalidCustomType(opt, createDiagnostic) {
|
|
31785
|
-
const namesOfType = arrayFrom(opt.type.keys())
|
|
31786
|
-
|
|
31791
|
+
const namesOfType = arrayFrom(opt.type.keys());
|
|
31792
|
+
const stringNames = (opt.deprecatedKeys ? namesOfType.filter((k) => !opt.deprecatedKeys.has(k)) : namesOfType).map((key) => `'${key}'`).join(", ");
|
|
31793
|
+
return createDiagnostic(Diagnostics.Argument_for_0_option_must_be_Colon_1, `--${opt.name}`, stringNames);
|
|
31787
31794
|
}
|
|
31788
31795
|
function parseCustomTypeOption(opt, value, errors) {
|
|
31789
31796
|
return convertJsonOptionOfCustomType(opt, trimString(value || ""), errors);
|
|
@@ -33009,7 +33016,7 @@ function getExtendsConfigPath(extendedConfig, host, basePath, errors, createDiag
|
|
|
33009
33016
|
}
|
|
33010
33017
|
return extendedConfigPath;
|
|
33011
33018
|
}
|
|
33012
|
-
const resolved = nodeModuleNameResolver(extendedConfig, combinePaths(basePath, "tsconfig.json"), { moduleResolution: 2 /*
|
|
33019
|
+
const resolved = nodeModuleNameResolver(extendedConfig, combinePaths(basePath, "tsconfig.json"), { moduleResolution: 2 /* Node10 */ }, host, void 0, void 0, true);
|
|
33013
33020
|
if (resolved.resolvedModule) {
|
|
33014
33021
|
return resolved.resolvedModule.resolvedFileName;
|
|
33015
33022
|
}
|
|
@@ -34145,7 +34152,7 @@ function resolveModuleName(moduleName, containingFile, compilerOptions, host, ca
|
|
|
34145
34152
|
if (moduleResolution === void 0) {
|
|
34146
34153
|
switch (getEmitModuleKind(compilerOptions)) {
|
|
34147
34154
|
case 1 /* CommonJS */:
|
|
34148
|
-
moduleResolution = 2 /*
|
|
34155
|
+
moduleResolution = 2 /* Node10 */;
|
|
34149
34156
|
break;
|
|
34150
34157
|
case 100 /* Node16 */:
|
|
34151
34158
|
moduleResolution = 3 /* Node16 */;
|
|
@@ -34173,7 +34180,7 @@ function resolveModuleName(moduleName, containingFile, compilerOptions, host, ca
|
|
|
34173
34180
|
case 99 /* NodeNext */:
|
|
34174
34181
|
result = nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
34175
34182
|
break;
|
|
34176
|
-
case 2 /*
|
|
34183
|
+
case 2 /* Node10 */:
|
|
34177
34184
|
result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference);
|
|
34178
34185
|
break;
|
|
34179
34186
|
case 1 /* Classic */:
|
|
@@ -34362,7 +34369,7 @@ function tryResolveJSModuleWorker(moduleName, initialDir, host) {
|
|
|
34362
34369
|
0 /* None */,
|
|
34363
34370
|
moduleName,
|
|
34364
34371
|
initialDir,
|
|
34365
|
-
{ moduleResolution: 2 /*
|
|
34372
|
+
{ moduleResolution: 2 /* Node10 */, allowJs: true },
|
|
34366
34373
|
host,
|
|
34367
34374
|
void 0,
|
|
34368
34375
|
2 /* JavaScript */,
|
|
@@ -34415,7 +34422,7 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
|
|
|
34415
34422
|
trace(host, Diagnostics.Resolving_in_0_mode_with_conditions_1, features & 32 /* EsmMode */ ? "ESM" : "CJS", conditions.map((c) => `'${c}'`).join(", "));
|
|
34416
34423
|
}
|
|
34417
34424
|
let result;
|
|
34418
|
-
if (getEmitModuleResolutionKind(compilerOptions) === 2 /*
|
|
34425
|
+
if (getEmitModuleResolutionKind(compilerOptions) === 2 /* Node10 */) {
|
|
34419
34426
|
const priorityExtensions = extensions & (1 /* TypeScript */ | 4 /* Declaration */);
|
|
34420
34427
|
const secondaryExtensions = extensions & ~(1 /* TypeScript */ | 4 /* Declaration */);
|
|
34421
34428
|
result = priorityExtensions && tryResolve(priorityExtensions) || secondaryExtensions && tryResolve(secondaryExtensions) || void 0;
|
|
@@ -38991,8 +38998,8 @@ var intrinsicTypeKinds = new Map(getEntries({
|
|
|
38991
38998
|
Capitalize: 2 /* Capitalize */,
|
|
38992
38999
|
Uncapitalize: 3 /* Uncapitalize */
|
|
38993
39000
|
}));
|
|
38994
|
-
|
|
38995
|
-
}
|
|
39001
|
+
var SymbolLinks = class {
|
|
39002
|
+
};
|
|
38996
39003
|
function NodeLinks() {
|
|
38997
39004
|
this.flags = 0 /* None */;
|
|
38998
39005
|
}
|
|
@@ -39639,6 +39646,11 @@ function createTypeChecker(host) {
|
|
|
39639
39646
|
let lastFlowNode;
|
|
39640
39647
|
let lastFlowNodeReachable;
|
|
39641
39648
|
let flowTypeCache;
|
|
39649
|
+
const contextualTypeNodes = [];
|
|
39650
|
+
const contextualTypes = [];
|
|
39651
|
+
let contextualTypeCount = 0;
|
|
39652
|
+
let currentInferenceNode;
|
|
39653
|
+
let currentInferenceContext;
|
|
39642
39654
|
const emptyStringType = getStringLiteralType("");
|
|
39643
39655
|
const zeroType = getNumberLiteralType(0);
|
|
39644
39656
|
const zeroBigIntType = getBigIntLiteralType({ negative: false, base10Value: "0" });
|
|
@@ -39847,7 +39859,8 @@ function createTypeChecker(host) {
|
|
|
39847
39859
|
function createSymbol(flags, name, checkFlags) {
|
|
39848
39860
|
symbolCount++;
|
|
39849
39861
|
const symbol = new Symbol12(flags | 33554432 /* Transient */, name);
|
|
39850
|
-
symbol.
|
|
39862
|
+
symbol.links = new SymbolLinks();
|
|
39863
|
+
symbol.links.checkFlags = checkFlags || 0 /* None */;
|
|
39851
39864
|
return symbol;
|
|
39852
39865
|
}
|
|
39853
39866
|
function getExcludedSymbolFlags(flags) {
|
|
@@ -40072,18 +40085,16 @@ function createTypeChecker(host) {
|
|
|
40072
40085
|
}
|
|
40073
40086
|
}
|
|
40074
40087
|
function getSymbolLinks(symbol) {
|
|
40088
|
+
var _a2;
|
|
40075
40089
|
if (symbol.flags & 33554432 /* Transient */)
|
|
40076
|
-
return symbol;
|
|
40090
|
+
return symbol.links;
|
|
40077
40091
|
const id = getSymbolId(symbol);
|
|
40078
|
-
return symbolLinks[id]
|
|
40092
|
+
return (_a2 = symbolLinks[id]) != null ? _a2 : symbolLinks[id] = new SymbolLinks();
|
|
40079
40093
|
}
|
|
40080
40094
|
function getNodeLinks(node) {
|
|
40081
40095
|
const nodeId = getNodeId(node);
|
|
40082
40096
|
return nodeLinks[nodeId] || (nodeLinks[nodeId] = new NodeLinks());
|
|
40083
40097
|
}
|
|
40084
|
-
function tryGetNodeLinks(node) {
|
|
40085
|
-
return node.id ? nodeLinks[node.id] : void 0;
|
|
40086
|
-
}
|
|
40087
40098
|
function isGlobalSourceFile(node) {
|
|
40088
40099
|
return node.kind === 308 /* SourceFile */ && !isExternalOrCommonJsModule(node);
|
|
40089
40100
|
}
|
|
@@ -41609,7 +41620,7 @@ function createTypeChecker(host) {
|
|
|
41609
41620
|
}
|
|
41610
41621
|
function resolveExternalModuleName(location, moduleReferenceExpression, ignoreErrors) {
|
|
41611
41622
|
const isClassic = getEmitModuleResolutionKind(compilerOptions) === 1 /* Classic */;
|
|
41612
|
-
const errorMessage = isClassic ? Diagnostics.
|
|
41623
|
+
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;
|
|
41613
41624
|
return resolveExternalModuleNameWorker(location, moduleReferenceExpression, ignoreErrors ? void 0 : errorMessage);
|
|
41614
41625
|
}
|
|
41615
41626
|
function resolveExternalModuleNameWorker(location, moduleReferenceExpression, moduleNotFoundError, isForAugmentation = false) {
|
|
@@ -41875,8 +41886,8 @@ function createTypeChecker(host) {
|
|
|
41875
41886
|
const result = createSymbol(symbol.flags, symbol.escapedName);
|
|
41876
41887
|
result.declarations = symbol.declarations ? symbol.declarations.slice() : [];
|
|
41877
41888
|
result.parent = symbol.parent;
|
|
41878
|
-
result.target = symbol;
|
|
41879
|
-
result.originatingImport = referenceParent;
|
|
41889
|
+
result.links.target = symbol;
|
|
41890
|
+
result.links.originatingImport = referenceParent;
|
|
41880
41891
|
if (symbol.valueDeclaration)
|
|
41881
41892
|
result.valueDeclaration = symbol.valueDeclaration;
|
|
41882
41893
|
if (symbol.constEnumOnlyModule)
|
|
@@ -41886,7 +41897,7 @@ function createTypeChecker(host) {
|
|
|
41886
41897
|
if (symbol.exports)
|
|
41887
41898
|
result.exports = new Map(symbol.exports);
|
|
41888
41899
|
const resolvedModuleType = resolveStructuredTypeMembers(moduleType);
|
|
41889
|
-
result.type = createAnonymousType(result, resolvedModuleType.members, emptyArray, emptyArray, resolvedModuleType.indexInfos);
|
|
41900
|
+
result.links.type = createAnonymousType(result, resolvedModuleType.members, emptyArray, emptyArray, resolvedModuleType.indexInfos);
|
|
41890
41901
|
return result;
|
|
41891
41902
|
}
|
|
41892
41903
|
function hasExportAssignmentSymbol(moduleSymbol) {
|
|
@@ -43341,7 +43352,7 @@ function createTypeChecker(host) {
|
|
|
43341
43352
|
}
|
|
43342
43353
|
function shouldUsePlaceholderForProperty(propertySymbol, context) {
|
|
43343
43354
|
var _a2;
|
|
43344
|
-
return !!(getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */) && (contains(context.reverseMappedStack, propertySymbol) || ((_a2 = context.reverseMappedStack) == null ? void 0 : _a2[0]) && !(getObjectFlags(last(context.reverseMappedStack).propertyType) & 16 /* Anonymous */));
|
|
43355
|
+
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 */));
|
|
43345
43356
|
}
|
|
43346
43357
|
function addPropertyToElementList(propertySymbol, context, typeElements) {
|
|
43347
43358
|
var _a2;
|
|
@@ -43560,7 +43571,7 @@ function createTypeChecker(host) {
|
|
|
43560
43571
|
function typeParameterToDeclarationWithConstraint(type, context, constraintNode) {
|
|
43561
43572
|
const savedContextFlags = context.flags;
|
|
43562
43573
|
context.flags &= ~512 /* WriteTypeParametersInQualifiedName */;
|
|
43563
|
-
const modifiers = factory.createModifiersFromModifierFlags(
|
|
43574
|
+
const modifiers = factory.createModifiersFromModifierFlags(getTypeParameterModifiers(type));
|
|
43564
43575
|
const name = typeParameterToName(type, context);
|
|
43565
43576
|
const defaultParameter = getDefaultFromTypeParameter(type);
|
|
43566
43577
|
const defaultParameterNode = defaultParameter && typeToTypeNodeHelper(defaultParameter, context);
|
|
@@ -43717,7 +43728,7 @@ function createTypeChecker(host) {
|
|
|
43717
43728
|
const params = getTypeParametersOfClassOrInterface(
|
|
43718
43729
|
parentSymbol.flags & 2097152 /* Alias */ ? resolveAlias(parentSymbol) : parentSymbol
|
|
43719
43730
|
);
|
|
43720
|
-
typeParameterNodes = mapToTypeNodes(map(params, (t) => getMappedType(t, nextSymbol.mapper)), context);
|
|
43731
|
+
typeParameterNodes = mapToTypeNodes(map(params, (t) => getMappedType(t, nextSymbol.links.mapper)), context);
|
|
43721
43732
|
} else {
|
|
43722
43733
|
typeParameterNodes = typeParametersToTypeParameterDeclarations(symbol, context);
|
|
43723
43734
|
}
|
|
@@ -46194,7 +46205,7 @@ function createTypeChecker(host) {
|
|
|
46194
46205
|
);
|
|
46195
46206
|
}
|
|
46196
46207
|
const union = createSymbol(s.flags | exportedMember.flags, name);
|
|
46197
|
-
union.type = getUnionType([getTypeOfSymbol(s), getTypeOfSymbol(exportedMember)]);
|
|
46208
|
+
union.links.type = getUnionType([getTypeOfSymbol(s), getTypeOfSymbol(exportedMember)]);
|
|
46198
46209
|
union.valueDeclaration = exportedMember.valueDeclaration;
|
|
46199
46210
|
union.declarations = concatenate(exportedMember.declarations, s.declarations);
|
|
46200
46211
|
members.set(name, union);
|
|
@@ -46281,8 +46292,8 @@ function createTypeChecker(host) {
|
|
|
46281
46292
|
const text = getPropertyNameFromType(exprType);
|
|
46282
46293
|
const flags = 4 /* Property */ | (e.initializer ? 16777216 /* Optional */ : 0);
|
|
46283
46294
|
const symbol = createSymbol(flags, text);
|
|
46284
|
-
symbol.type = getTypeFromBindingElement(e, includePatternInType, reportErrors2);
|
|
46285
|
-
symbol.bindingElement = e;
|
|
46295
|
+
symbol.links.type = getTypeFromBindingElement(e, includePatternInType, reportErrors2);
|
|
46296
|
+
symbol.links.bindingElement = e;
|
|
46286
46297
|
members.set(symbol.escapedName, symbol);
|
|
46287
46298
|
});
|
|
46288
46299
|
const result = createAnonymousType(void 0, members, emptyArray, emptyArray, stringIndexInfo ? [stringIndexInfo] : emptyArray);
|
|
@@ -46390,7 +46401,7 @@ function createTypeChecker(host) {
|
|
|
46390
46401
|
const result = createSymbol(fileSymbol.flags, "exports");
|
|
46391
46402
|
result.declarations = fileSymbol.declarations ? fileSymbol.declarations.slice() : [];
|
|
46392
46403
|
result.parent = symbol;
|
|
46393
|
-
result.target = fileSymbol;
|
|
46404
|
+
result.links.target = fileSymbol;
|
|
46394
46405
|
if (fileSymbol.valueDeclaration)
|
|
46395
46406
|
result.valueDeclaration = fileSymbol.valueDeclaration;
|
|
46396
46407
|
if (fileSymbol.members)
|
|
@@ -46556,7 +46567,8 @@ function createTypeChecker(host) {
|
|
|
46556
46567
|
if (expando) {
|
|
46557
46568
|
const merged = mergeJSSymbols(symbol, expando);
|
|
46558
46569
|
if (merged) {
|
|
46559
|
-
symbol =
|
|
46570
|
+
symbol = merged;
|
|
46571
|
+
links = merged.links;
|
|
46560
46572
|
}
|
|
46561
46573
|
}
|
|
46562
46574
|
originalLinks.type = links.type = getTypeOfFuncClassEnumModuleWorker(symbol);
|
|
@@ -46653,7 +46665,7 @@ function createTypeChecker(host) {
|
|
|
46653
46665
|
function getWriteTypeOfSymbol(symbol) {
|
|
46654
46666
|
const checkFlags = getCheckFlags(symbol);
|
|
46655
46667
|
if (symbol.flags & 4 /* Property */) {
|
|
46656
|
-
return checkFlags & 2 /* SyntheticProperty */ ? checkFlags & 65536 /* DeferredType */ ? getWriteTypeOfSymbolWithDeferredType(symbol) || getTypeOfSymbolWithDeferredType(symbol) : symbol.writeType || symbol.type : getTypeOfSymbol(symbol);
|
|
46668
|
+
return checkFlags & 2 /* SyntheticProperty */ ? checkFlags & 65536 /* DeferredType */ ? getWriteTypeOfSymbolWithDeferredType(symbol) || getTypeOfSymbolWithDeferredType(symbol) : symbol.links.writeType || symbol.links.type : getTypeOfSymbol(symbol);
|
|
46657
46669
|
}
|
|
46658
46670
|
if (symbol.flags & 98304 /* Accessor */) {
|
|
46659
46671
|
return checkFlags & 1 /* Instantiated */ ? getWriteTypeOfInstantiatedSymbol(symbol) : getWriteTypeOfAccessors(symbol);
|
|
@@ -47055,7 +47067,8 @@ function createTypeChecker(host) {
|
|
|
47055
47067
|
const kind = symbol.flags & 32 /* Class */ ? 1 /* Class */ : 2 /* Interface */;
|
|
47056
47068
|
const merged = mergeJSSymbols(symbol, symbol.valueDeclaration && getAssignedClassSymbol(symbol.valueDeclaration));
|
|
47057
47069
|
if (merged) {
|
|
47058
|
-
symbol =
|
|
47070
|
+
symbol = merged;
|
|
47071
|
+
links = merged.links;
|
|
47059
47072
|
}
|
|
47060
47073
|
const type = originalLinks.declaredType = links.declaredType = createObjectType(kind, symbol);
|
|
47061
47074
|
const outerTypeParameters = getOuterTypeParametersOfClassOrInterface(symbol);
|
|
@@ -47331,7 +47344,7 @@ function createTypeChecker(host) {
|
|
|
47331
47344
|
error(declName || decl, Diagnostics.Duplicate_property_0, name);
|
|
47332
47345
|
lateSymbol = createSymbol(0 /* None */, memberName, 4096 /* Late */);
|
|
47333
47346
|
}
|
|
47334
|
-
lateSymbol.nameType = type;
|
|
47347
|
+
lateSymbol.links.nameType = type;
|
|
47335
47348
|
addDeclarationToLateBoundSymbol(lateSymbol, decl, symbolFlags);
|
|
47336
47349
|
if (lateSymbol.parent) {
|
|
47337
47350
|
Debug.assert(lateSymbol.parent === parent, "Existing symbol parent should match new one");
|
|
@@ -47537,7 +47550,7 @@ function createTypeChecker(host) {
|
|
|
47537
47550
|
const flags = restType.target.elementFlags[i];
|
|
47538
47551
|
const checkFlags = flags & 12 /* Variable */ ? 32768 /* RestParameter */ : flags & 2 /* Optional */ ? 16384 /* OptionalParameter */ : 0;
|
|
47539
47552
|
const symbol = createSymbol(1 /* FunctionScopedVariable */, name, checkFlags);
|
|
47540
|
-
symbol.type = flags & 4 /* Rest */ ? createArrayType(t) : t;
|
|
47553
|
+
symbol.links.type = flags & 4 /* Rest */ ? createArrayType(t) : t;
|
|
47541
47554
|
return symbol;
|
|
47542
47555
|
});
|
|
47543
47556
|
return concatenate(sig.parameters.slice(0, restIndex), restParams);
|
|
@@ -47697,14 +47710,14 @@ function createTypeChecker(host) {
|
|
|
47697
47710
|
1 /* FunctionScopedVariable */ | (isOptional && !isRestParam ? 16777216 /* Optional */ : 0),
|
|
47698
47711
|
paramName || `arg${i}`
|
|
47699
47712
|
);
|
|
47700
|
-
paramSymbol.type = isRestParam ? createArrayType(unionParamType) : unionParamType;
|
|
47713
|
+
paramSymbol.links.type = isRestParam ? createArrayType(unionParamType) : unionParamType;
|
|
47701
47714
|
params[i] = paramSymbol;
|
|
47702
47715
|
}
|
|
47703
47716
|
if (needsExtraRestElement) {
|
|
47704
47717
|
const restParamSymbol = createSymbol(1 /* FunctionScopedVariable */, "args");
|
|
47705
|
-
restParamSymbol.type = createArrayType(getTypeAtPosition(shorter, longestCount));
|
|
47718
|
+
restParamSymbol.links.type = createArrayType(getTypeAtPosition(shorter, longestCount));
|
|
47706
47719
|
if (shorter === right) {
|
|
47707
|
-
restParamSymbol.type = instantiateType(restParamSymbol.type, mapper);
|
|
47720
|
+
restParamSymbol.links.type = instantiateType(restParamSymbol.links.type, mapper);
|
|
47708
47721
|
}
|
|
47709
47722
|
params[longestCount] = restParamSymbol;
|
|
47710
47723
|
}
|
|
@@ -47924,16 +47937,16 @@ function createTypeChecker(host) {
|
|
|
47924
47937
|
const checkFlags = 8192 /* ReverseMapped */ | (readonlyMask && isReadonlySymbol(prop) ? 8 /* Readonly */ : 0);
|
|
47925
47938
|
const inferredProp = createSymbol(4 /* Property */ | prop.flags & optionalMask, prop.escapedName, checkFlags);
|
|
47926
47939
|
inferredProp.declarations = prop.declarations;
|
|
47927
|
-
inferredProp.nameType = getSymbolLinks(prop).nameType;
|
|
47928
|
-
inferredProp.propertyType = getTypeOfSymbol(prop);
|
|
47940
|
+
inferredProp.links.nameType = getSymbolLinks(prop).nameType;
|
|
47941
|
+
inferredProp.links.propertyType = getTypeOfSymbol(prop);
|
|
47929
47942
|
if (type.constraintType.type.flags & 8388608 /* IndexedAccess */ && type.constraintType.type.objectType.flags & 262144 /* TypeParameter */ && type.constraintType.type.indexType.flags & 262144 /* TypeParameter */) {
|
|
47930
47943
|
const newTypeParam = type.constraintType.type.objectType;
|
|
47931
47944
|
const newMappedType = replaceIndexedAccess(type.mappedType, type.constraintType.type, newTypeParam);
|
|
47932
|
-
inferredProp.mappedType = newMappedType;
|
|
47933
|
-
inferredProp.constraintType = getIndexType(newTypeParam);
|
|
47945
|
+
inferredProp.links.mappedType = newMappedType;
|
|
47946
|
+
inferredProp.links.constraintType = getIndexType(newTypeParam);
|
|
47934
47947
|
} else {
|
|
47935
|
-
inferredProp.mappedType = type.mappedType;
|
|
47936
|
-
inferredProp.constraintType = type.constraintType;
|
|
47948
|
+
inferredProp.links.mappedType = type.mappedType;
|
|
47949
|
+
inferredProp.links.constraintType = type.constraintType;
|
|
47937
47950
|
}
|
|
47938
47951
|
members.set(prop.escapedName, inferredProp);
|
|
47939
47952
|
}
|
|
@@ -48009,8 +48022,8 @@ function createTypeChecker(host) {
|
|
|
48009
48022
|
const propName = getPropertyNameFromType(propNameType);
|
|
48010
48023
|
const existingProp = members.get(propName);
|
|
48011
48024
|
if (existingProp) {
|
|
48012
|
-
existingProp.nameType = getUnionType([existingProp.nameType, propNameType]);
|
|
48013
|
-
existingProp.keyType = getUnionType([existingProp.keyType, keyType]);
|
|
48025
|
+
existingProp.links.nameType = getUnionType([existingProp.links.nameType, propNameType]);
|
|
48026
|
+
existingProp.links.keyType = getUnionType([existingProp.links.keyType, keyType]);
|
|
48014
48027
|
} else {
|
|
48015
48028
|
const modifiersProp = isTypeUsableAsPropertyName(keyType) ? getPropertyOfType(modifiersType, getPropertyNameFromType(keyType)) : void 0;
|
|
48016
48029
|
const isOptional = !!(templateModifiers & 4 /* IncludeOptional */ || !(templateModifiers & 8 /* ExcludeOptional */) && modifiersProp && modifiersProp.flags & 16777216 /* Optional */);
|
|
@@ -48022,11 +48035,11 @@ function createTypeChecker(host) {
|
|
|
48022
48035
|
propName,
|
|
48023
48036
|
lateFlag | 262144 /* Mapped */ | (isReadonly ? 8 /* Readonly */ : 0) | (stripOptional ? 524288 /* StripOptional */ : 0)
|
|
48024
48037
|
);
|
|
48025
|
-
prop.mappedType = type;
|
|
48026
|
-
prop.nameType = propNameType;
|
|
48027
|
-
prop.keyType = keyType;
|
|
48038
|
+
prop.links.mappedType = type;
|
|
48039
|
+
prop.links.nameType = propNameType;
|
|
48040
|
+
prop.links.keyType = keyType;
|
|
48028
48041
|
if (modifiersProp) {
|
|
48029
|
-
prop.syntheticOrigin = modifiersProp;
|
|
48042
|
+
prop.links.syntheticOrigin = modifiersProp;
|
|
48030
48043
|
prop.declarations = nameType ? void 0 : modifiersProp.declarations;
|
|
48031
48044
|
}
|
|
48032
48045
|
members.set(propName, prop);
|
|
@@ -48040,23 +48053,23 @@ function createTypeChecker(host) {
|
|
|
48040
48053
|
}
|
|
48041
48054
|
}
|
|
48042
48055
|
function getTypeOfMappedSymbol(symbol) {
|
|
48043
|
-
if (!symbol.type) {
|
|
48044
|
-
const mappedType = symbol.mappedType;
|
|
48056
|
+
if (!symbol.links.type) {
|
|
48057
|
+
const mappedType = symbol.links.mappedType;
|
|
48045
48058
|
if (!pushTypeResolution(symbol, 0 /* Type */)) {
|
|
48046
48059
|
mappedType.containsError = true;
|
|
48047
48060
|
return errorType;
|
|
48048
48061
|
}
|
|
48049
48062
|
const templateType = getTemplateTypeFromMappedType(mappedType.target || mappedType);
|
|
48050
|
-
const mapper = appendTypeMapping(mappedType.mapper, getTypeParameterFromMappedType(mappedType), symbol.keyType);
|
|
48063
|
+
const mapper = appendTypeMapping(mappedType.mapper, getTypeParameterFromMappedType(mappedType), symbol.links.keyType);
|
|
48051
48064
|
const propType = instantiateType(templateType, mapper);
|
|
48052
|
-
let type = strictNullChecks && symbol.flags & 16777216 /* Optional */ && !maybeTypeOfKind(propType, 32768 /* Undefined */ | 16384 /* Void */) ? getOptionalType(propType, true) : symbol.checkFlags & 524288 /* StripOptional */ ? removeMissingOrUndefinedType(propType) : propType;
|
|
48065
|
+
let type = strictNullChecks && symbol.flags & 16777216 /* Optional */ && !maybeTypeOfKind(propType, 32768 /* Undefined */ | 16384 /* Void */) ? getOptionalType(propType, true) : symbol.links.checkFlags & 524288 /* StripOptional */ ? removeMissingOrUndefinedType(propType) : propType;
|
|
48053
48066
|
if (!popTypeResolution()) {
|
|
48054
48067
|
error(currentNode, Diagnostics.Type_of_property_0_circularly_references_itself_in_mapped_type_1, symbolToString(symbol), typeToString(mappedType));
|
|
48055
48068
|
type = errorType;
|
|
48056
48069
|
}
|
|
48057
|
-
symbol.type = type;
|
|
48070
|
+
symbol.links.type = type;
|
|
48058
48071
|
}
|
|
48059
|
-
return symbol.type;
|
|
48072
|
+
return symbol.links.type;
|
|
48060
48073
|
}
|
|
48061
48074
|
function getTypeParameterFromMappedType(type) {
|
|
48062
48075
|
return type.typeParameter || (type.typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfDeclaration(type.declaration.typeParameter)));
|
|
@@ -48226,6 +48239,10 @@ function createTypeChecker(host) {
|
|
|
48226
48239
|
function getConstraintOfTypeParameter(typeParameter) {
|
|
48227
48240
|
return hasNonCircularBaseConstraint(typeParameter) ? getConstraintFromTypeParameter(typeParameter) : void 0;
|
|
48228
48241
|
}
|
|
48242
|
+
function isConstTypeVariable(type) {
|
|
48243
|
+
var _a2;
|
|
48244
|
+
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));
|
|
48245
|
+
}
|
|
48229
48246
|
function getConstraintOfIndexedAccess(type) {
|
|
48230
48247
|
return hasNonCircularBaseConstraint(type) ? getConstraintFromIndexedAccess(type) : void 0;
|
|
48231
48248
|
}
|
|
@@ -48471,7 +48488,7 @@ function createTypeChecker(host) {
|
|
|
48471
48488
|
return getReducedType(getApparentType(getReducedType(type)));
|
|
48472
48489
|
}
|
|
48473
48490
|
function createUnionOrIntersectionProperty(containingType, name, skipObjectFunctionPropertyAugment) {
|
|
48474
|
-
var _a2, _b;
|
|
48491
|
+
var _a2, _b, _c;
|
|
48475
48492
|
let singleProp;
|
|
48476
48493
|
let propSet;
|
|
48477
48494
|
let indexTypes;
|
|
@@ -48539,10 +48556,11 @@ function createTypeChecker(host) {
|
|
|
48539
48556
|
}
|
|
48540
48557
|
if (!propSet && !(checkFlags & 16 /* ReadPartial */) && !indexTypes) {
|
|
48541
48558
|
if (mergedInstantiations) {
|
|
48542
|
-
const
|
|
48543
|
-
clone2
|
|
48544
|
-
clone2.
|
|
48545
|
-
clone2.
|
|
48559
|
+
const links = (_a2 = tryCast(singleProp, isTransientSymbol)) == null ? void 0 : _a2.links;
|
|
48560
|
+
const clone2 = createSymbolWithType(singleProp, links == null ? void 0 : links.type);
|
|
48561
|
+
clone2.parent = (_c = (_b = singleProp.valueDeclaration) == null ? void 0 : _b.symbol) == null ? void 0 : _c.parent;
|
|
48562
|
+
clone2.links.containingType = containingType;
|
|
48563
|
+
clone2.links.mapper = links == null ? void 0 : links.mapper;
|
|
48546
48564
|
return clone2;
|
|
48547
48565
|
} else {
|
|
48548
48566
|
return singleProp;
|
|
@@ -48584,7 +48602,7 @@ function createTypeChecker(host) {
|
|
|
48584
48602
|
}
|
|
48585
48603
|
addRange(propTypes, indexTypes);
|
|
48586
48604
|
const result = createSymbol(4 /* Property */ | (optionalFlag != null ? optionalFlag : 0), name, syntheticFlag | checkFlags);
|
|
48587
|
-
result.containingType = containingType;
|
|
48605
|
+
result.links.containingType = containingType;
|
|
48588
48606
|
if (!hasNonUniformValueDeclaration && firstValueDeclaration) {
|
|
48589
48607
|
result.valueDeclaration = firstValueDeclaration;
|
|
48590
48608
|
if (firstValueDeclaration.symbol.parent) {
|
|
@@ -48592,16 +48610,16 @@ function createTypeChecker(host) {
|
|
|
48592
48610
|
}
|
|
48593
48611
|
}
|
|
48594
48612
|
result.declarations = declarations;
|
|
48595
|
-
result.nameType = nameType;
|
|
48613
|
+
result.links.nameType = nameType;
|
|
48596
48614
|
if (propTypes.length > 2) {
|
|
48597
|
-
result.checkFlags |= 65536 /* DeferredType */;
|
|
48598
|
-
result.deferralParent = containingType;
|
|
48599
|
-
result.deferralConstituents = propTypes;
|
|
48600
|
-
result.deferralWriteConstituents = writeTypes;
|
|
48615
|
+
result.links.checkFlags |= 65536 /* DeferredType */;
|
|
48616
|
+
result.links.deferralParent = containingType;
|
|
48617
|
+
result.links.deferralConstituents = propTypes;
|
|
48618
|
+
result.links.deferralWriteConstituents = writeTypes;
|
|
48601
48619
|
} else {
|
|
48602
|
-
result.type = isUnion ? getUnionType(propTypes) : getIntersectionType(propTypes);
|
|
48620
|
+
result.links.type = isUnion ? getUnionType(propTypes) : getIntersectionType(propTypes);
|
|
48603
48621
|
if (writeTypes) {
|
|
48604
|
-
result.writeType = isUnion ? getUnionType(writeTypes) : getIntersectionType(writeTypes);
|
|
48622
|
+
result.links.writeType = isUnion ? getUnionType(writeTypes) : getIntersectionType(writeTypes);
|
|
48605
48623
|
}
|
|
48606
48624
|
}
|
|
48607
48625
|
return result;
|
|
@@ -48938,12 +48956,12 @@ function createTypeChecker(host) {
|
|
|
48938
48956
|
const lastParamVariadicType = firstDefined(lastParamTags, (p) => p.typeExpression && isJSDocVariadicType(p.typeExpression.type) ? p.typeExpression.type : void 0);
|
|
48939
48957
|
const syntheticArgsSymbol = createSymbol(3 /* Variable */, "args", 32768 /* RestParameter */);
|
|
48940
48958
|
if (lastParamVariadicType) {
|
|
48941
|
-
syntheticArgsSymbol.type = createArrayType(getTypeFromTypeNode(lastParamVariadicType.type));
|
|
48959
|
+
syntheticArgsSymbol.links.type = createArrayType(getTypeFromTypeNode(lastParamVariadicType.type));
|
|
48942
48960
|
} else {
|
|
48943
|
-
syntheticArgsSymbol.checkFlags |= 65536 /* DeferredType */;
|
|
48944
|
-
syntheticArgsSymbol.deferralParent = neverType;
|
|
48945
|
-
syntheticArgsSymbol.deferralConstituents = [anyArrayType];
|
|
48946
|
-
syntheticArgsSymbol.deferralWriteConstituents = [anyArrayType];
|
|
48961
|
+
syntheticArgsSymbol.links.checkFlags |= 65536 /* DeferredType */;
|
|
48962
|
+
syntheticArgsSymbol.links.deferralParent = neverType;
|
|
48963
|
+
syntheticArgsSymbol.links.deferralConstituents = [anyArrayType];
|
|
48964
|
+
syntheticArgsSymbol.links.deferralWriteConstituents = [anyArrayType];
|
|
48947
48965
|
}
|
|
48948
48966
|
if (lastParamVariadicType) {
|
|
48949
48967
|
parameters.pop();
|
|
@@ -49557,7 +49575,7 @@ function createTypeChecker(host) {
|
|
|
49557
49575
|
if (!result) {
|
|
49558
49576
|
unresolvedSymbols.set(path, result = createSymbol(524288 /* TypeAlias */, text, 1048576 /* Unresolved */));
|
|
49559
49577
|
result.parent = parentSymbol;
|
|
49560
|
-
result.declaredType = unresolvedType;
|
|
49578
|
+
result.links.declaredType = unresolvedType;
|
|
49561
49579
|
}
|
|
49562
49580
|
return result;
|
|
49563
49581
|
}
|
|
@@ -49834,7 +49852,7 @@ function createTypeChecker(host) {
|
|
|
49834
49852
|
const importMetaType = getGlobalImportMetaType();
|
|
49835
49853
|
const metaPropertySymbol = createSymbol(4 /* Property */, "meta", 8 /* Readonly */);
|
|
49836
49854
|
metaPropertySymbol.parent = symbol;
|
|
49837
|
-
metaPropertySymbol.type = importMetaType;
|
|
49855
|
+
metaPropertySymbol.links.type = importMetaType;
|
|
49838
49856
|
const members = createSymbolTable([metaPropertySymbol]);
|
|
49839
49857
|
symbol.members = members;
|
|
49840
49858
|
deferredGlobalImportMetaExpressionType = createAnonymousType(symbol, members, emptyArray, emptyArray, emptyArray);
|
|
@@ -50059,8 +50077,8 @@ function createTypeChecker(host) {
|
|
|
50059
50077
|
"" + i,
|
|
50060
50078
|
readonly ? 8 /* Readonly */ : 0
|
|
50061
50079
|
);
|
|
50062
|
-
property.tupleLabelDeclaration = namedMemberDeclarations == null ? void 0 : namedMemberDeclarations[i];
|
|
50063
|
-
property.type = typeParameter;
|
|
50080
|
+
property.links.tupleLabelDeclaration = namedMemberDeclarations == null ? void 0 : namedMemberDeclarations[i];
|
|
50081
|
+
property.links.type = typeParameter;
|
|
50064
50082
|
properties.push(property);
|
|
50065
50083
|
}
|
|
50066
50084
|
}
|
|
@@ -50068,12 +50086,12 @@ function createTypeChecker(host) {
|
|
|
50068
50086
|
const fixedLength = properties.length;
|
|
50069
50087
|
const lengthSymbol = createSymbol(4 /* Property */, "length", readonly ? 8 /* Readonly */ : 0);
|
|
50070
50088
|
if (combinedFlags & 12 /* Variable */) {
|
|
50071
|
-
lengthSymbol.type = numberType;
|
|
50089
|
+
lengthSymbol.links.type = numberType;
|
|
50072
50090
|
} else {
|
|
50073
50091
|
const literalTypes = [];
|
|
50074
50092
|
for (let i = minLength; i <= arity; i++)
|
|
50075
50093
|
literalTypes.push(getNumberLiteralType(i));
|
|
50076
|
-
lengthSymbol.type = getUnionType(literalTypes);
|
|
50094
|
+
lengthSymbol.links.type = getUnionType(literalTypes);
|
|
50077
50095
|
}
|
|
50078
50096
|
properties.push(lengthSymbol);
|
|
50079
50097
|
const type = createObjectType(8 /* Tuple */ | 4 /* Reference */);
|
|
@@ -51667,10 +51685,10 @@ function createTypeChecker(host) {
|
|
|
51667
51685
|
const isSetonlyAccessor = prop.flags & 65536 /* SetAccessor */ && !(prop.flags & 32768 /* GetAccessor */);
|
|
51668
51686
|
const flags = 4 /* Property */ | 16777216 /* Optional */;
|
|
51669
51687
|
const result = createSymbol(flags, prop.escapedName, getIsLateCheckFlag(prop) | (readonly ? 8 /* Readonly */ : 0));
|
|
51670
|
-
result.type = isSetonlyAccessor ? undefinedType : addOptionality(getTypeOfSymbol(prop), true);
|
|
51688
|
+
result.links.type = isSetonlyAccessor ? undefinedType : addOptionality(getTypeOfSymbol(prop), true);
|
|
51671
51689
|
result.declarations = prop.declarations;
|
|
51672
|
-
result.nameType = getSymbolLinks(prop).nameType;
|
|
51673
|
-
result.syntheticOrigin = prop;
|
|
51690
|
+
result.links.nameType = getSymbolLinks(prop).nameType;
|
|
51691
|
+
result.links.syntheticOrigin = prop;
|
|
51674
51692
|
members.set(prop.escapedName, result);
|
|
51675
51693
|
}
|
|
51676
51694
|
}
|
|
@@ -51737,11 +51755,11 @@ function createTypeChecker(host) {
|
|
|
51737
51755
|
const declarations = concatenate(leftProp.declarations, rightProp.declarations);
|
|
51738
51756
|
const flags = 4 /* Property */ | leftProp.flags & 16777216 /* Optional */;
|
|
51739
51757
|
const result = createSymbol(flags, leftProp.escapedName);
|
|
51740
|
-
result.type = getUnionType([getTypeOfSymbol(leftProp), removeMissingOrUndefinedType(rightType)], 2 /* Subtype */);
|
|
51741
|
-
result.leftSpread = leftProp;
|
|
51742
|
-
result.rightSpread = rightProp;
|
|
51758
|
+
result.links.type = getUnionType([getTypeOfSymbol(leftProp), removeMissingOrUndefinedType(rightType)], 2 /* Subtype */);
|
|
51759
|
+
result.links.leftSpread = leftProp;
|
|
51760
|
+
result.links.rightSpread = rightProp;
|
|
51743
51761
|
result.declarations = declarations;
|
|
51744
|
-
result.nameType = getSymbolLinks(leftProp).nameType;
|
|
51762
|
+
result.links.nameType = getSymbolLinks(leftProp).nameType;
|
|
51745
51763
|
members.set(leftProp.escapedName, result);
|
|
51746
51764
|
}
|
|
51747
51765
|
} else {
|
|
@@ -51763,10 +51781,10 @@ function createTypeChecker(host) {
|
|
|
51763
51781
|
}
|
|
51764
51782
|
const flags = 4 /* Property */ | prop.flags & 16777216 /* Optional */;
|
|
51765
51783
|
const result = createSymbol(flags, prop.escapedName, getIsLateCheckFlag(prop) | (readonly ? 8 /* Readonly */ : 0));
|
|
51766
|
-
result.type = isSetonlyAccessor ? undefinedType : getTypeOfSymbol(prop);
|
|
51784
|
+
result.links.type = isSetonlyAccessor ? undefinedType : getTypeOfSymbol(prop);
|
|
51767
51785
|
result.declarations = prop.declarations;
|
|
51768
|
-
result.nameType = getSymbolLinks(prop).nameType;
|
|
51769
|
-
result.syntheticOrigin = prop;
|
|
51786
|
+
result.links.nameType = getSymbolLinks(prop).nameType;
|
|
51787
|
+
result.links.syntheticOrigin = prop;
|
|
51770
51788
|
return result;
|
|
51771
51789
|
}
|
|
51772
51790
|
function getIndexInfoWithReadonly(info, readonly) {
|
|
@@ -52131,13 +52149,13 @@ function createTypeChecker(host) {
|
|
|
52131
52149
|
const result = createSymbol(symbol.flags, symbol.escapedName, 1 /* Instantiated */ | getCheckFlags(symbol) & (8 /* Readonly */ | 4096 /* Late */ | 16384 /* OptionalParameter */ | 32768 /* RestParameter */));
|
|
52132
52150
|
result.declarations = symbol.declarations;
|
|
52133
52151
|
result.parent = symbol.parent;
|
|
52134
|
-
result.target = symbol;
|
|
52135
|
-
result.mapper = mapper;
|
|
52152
|
+
result.links.target = symbol;
|
|
52153
|
+
result.links.mapper = mapper;
|
|
52136
52154
|
if (symbol.valueDeclaration) {
|
|
52137
52155
|
result.valueDeclaration = symbol.valueDeclaration;
|
|
52138
52156
|
}
|
|
52139
52157
|
if (links.nameType) {
|
|
52140
|
-
result.nameType = links.nameType;
|
|
52158
|
+
result.links.nameType = links.nameType;
|
|
52141
52159
|
}
|
|
52142
52160
|
return result;
|
|
52143
52161
|
}
|
|
@@ -52652,13 +52670,10 @@ function createTypeChecker(host) {
|
|
|
52652
52670
|
}
|
|
52653
52671
|
}
|
|
52654
52672
|
function checkExpressionForMutableLocationWithContextualType(next, sourcePropType) {
|
|
52655
|
-
|
|
52656
|
-
|
|
52657
|
-
|
|
52658
|
-
|
|
52659
|
-
} finally {
|
|
52660
|
-
links.contextualType = void 0;
|
|
52661
|
-
}
|
|
52673
|
+
pushContextualType(next, sourcePropType);
|
|
52674
|
+
const result = checkExpressionForMutableLocation(next, 1 /* Contextual */);
|
|
52675
|
+
popContextualType();
|
|
52676
|
+
return result;
|
|
52662
52677
|
}
|
|
52663
52678
|
function elaborateElementwise(iterator, source, target, relation, containingMessageChain, errorOutputContainer) {
|
|
52664
52679
|
let reportedError = false;
|
|
@@ -52857,19 +52872,13 @@ function createTypeChecker(host) {
|
|
|
52857
52872
|
if (isTupleLikeType(source)) {
|
|
52858
52873
|
return elaborateElementwise(generateLimitedTupleElements(node, target), source, target, relation, containingMessageChain, errorOutputContainer);
|
|
52859
52874
|
}
|
|
52860
|
-
|
|
52861
|
-
const
|
|
52862
|
-
|
|
52863
|
-
|
|
52864
|
-
|
|
52865
|
-
links.contextualType = oldContext;
|
|
52866
|
-
if (isTupleLikeType(tupleizedType)) {
|
|
52867
|
-
return elaborateElementwise(generateLimitedTupleElements(node, target), tupleizedType, target, relation, containingMessageChain, errorOutputContainer);
|
|
52868
|
-
}
|
|
52869
|
-
return false;
|
|
52870
|
-
} finally {
|
|
52871
|
-
links.contextualType = oldContext;
|
|
52875
|
+
pushContextualType(node, target);
|
|
52876
|
+
const tupleizedType = checkArrayLiteral(node, 1 /* Contextual */, true);
|
|
52877
|
+
popContextualType();
|
|
52878
|
+
if (isTupleLikeType(tupleizedType)) {
|
|
52879
|
+
return elaborateElementwise(generateLimitedTupleElements(node, target), tupleizedType, target, relation, containingMessageChain, errorOutputContainer);
|
|
52872
52880
|
}
|
|
52881
|
+
return false;
|
|
52873
52882
|
}
|
|
52874
52883
|
function* generateObjectLiteralElements(node) {
|
|
52875
52884
|
if (!length(node.properties))
|
|
@@ -53971,6 +53980,9 @@ function createTypeChecker(host) {
|
|
|
53971
53980
|
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 */)))) {
|
|
53972
53981
|
inPropertyCheck = true;
|
|
53973
53982
|
result2 &= propertiesRelatedTo(source2, target2, reportErrors2, void 0, 0 /* None */);
|
|
53983
|
+
if (result2 && isObjectLiteralType(source2) && getObjectFlags(source2) & 8192 /* FreshLiteral */) {
|
|
53984
|
+
result2 &= indexSignaturesRelatedTo(source2, target2, false, reportErrors2, 0 /* None */);
|
|
53985
|
+
}
|
|
53974
53986
|
inPropertyCheck = false;
|
|
53975
53987
|
}
|
|
53976
53988
|
}
|
|
@@ -54872,7 +54884,7 @@ function createTypeChecker(host) {
|
|
|
54872
54884
|
}
|
|
54873
54885
|
return result2;
|
|
54874
54886
|
}
|
|
54875
|
-
function membersRelatedToIndexInfo(source2, targetInfo, reportErrors2) {
|
|
54887
|
+
function membersRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState) {
|
|
54876
54888
|
let result2 = -1 /* True */;
|
|
54877
54889
|
const keyType = targetInfo.keyType;
|
|
54878
54890
|
const props = source2.flags & 2097152 /* Intersection */ ? getPropertiesOfUnionOrIntersectionType(source2) : getPropertiesOfObjectType(source2);
|
|
@@ -54883,7 +54895,7 @@ function createTypeChecker(host) {
|
|
|
54883
54895
|
if (isApplicableIndexType(getLiteralTypeFromProperty(prop, 8576 /* StringOrNumberLiteralOrUnique */), keyType)) {
|
|
54884
54896
|
const propType = getNonMissingTypeOfSymbol(prop);
|
|
54885
54897
|
const type = exactOptionalPropertyTypes || propType.flags & 32768 /* Undefined */ || keyType === numberType || !(prop.flags & 16777216 /* Optional */) ? propType : getTypeWithFacts(propType, 524288 /* NEUndefined */);
|
|
54886
|
-
const related = isRelatedTo(type, targetInfo.type, 3 /* Both */, reportErrors2);
|
|
54898
|
+
const related = isRelatedTo(type, targetInfo.type, 3 /* Both */, reportErrors2, void 0, intersectionState);
|
|
54887
54899
|
if (!related) {
|
|
54888
54900
|
if (reportErrors2) {
|
|
54889
54901
|
reportError(Diagnostics.Property_0_is_incompatible_with_index_signature, symbolToString(prop));
|
|
@@ -54937,7 +54949,7 @@ function createTypeChecker(host) {
|
|
|
54937
54949
|
return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2);
|
|
54938
54950
|
}
|
|
54939
54951
|
if (!(intersectionState & 1 /* Source */) && isObjectTypeWithInferableIndex(source2)) {
|
|
54940
|
-
return membersRelatedToIndexInfo(source2, targetInfo, reportErrors2);
|
|
54952
|
+
return membersRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState);
|
|
54941
54953
|
}
|
|
54942
54954
|
if (reportErrors2) {
|
|
54943
54955
|
reportError(Diagnostics.Index_signature_for_type_0_is_missing_in_type_1, typeToString(targetInfo.keyType), typeToString(source2));
|
|
@@ -55071,7 +55083,7 @@ function createTypeChecker(host) {
|
|
|
55071
55083
|
links.variances = emptyArray;
|
|
55072
55084
|
const variances = [];
|
|
55073
55085
|
for (const tp of typeParameters) {
|
|
55074
|
-
const modifiers =
|
|
55086
|
+
const modifiers = getTypeParameterModifiers(tp);
|
|
55075
55087
|
let variance = modifiers & 65536 /* Out */ ? modifiers & 32768 /* In */ ? 0 /* Invariant */ : 1 /* Covariant */ : modifiers & 32768 /* In */ ? 2 /* Contravariant */ : void 0;
|
|
55076
55088
|
if (variance === void 0) {
|
|
55077
55089
|
let unmeasurable = false;
|
|
@@ -55114,9 +55126,9 @@ function createTypeChecker(host) {
|
|
|
55114
55126
|
function isMarkerType(type) {
|
|
55115
55127
|
return markerTypes.has(getTypeId(type));
|
|
55116
55128
|
}
|
|
55117
|
-
function
|
|
55118
|
-
var _a2
|
|
55119
|
-
return (
|
|
55129
|
+
function getTypeParameterModifiers(tp) {
|
|
55130
|
+
var _a2;
|
|
55131
|
+
return reduceLeft((_a2 = tp.symbol) == null ? void 0 : _a2.declarations, (modifiers, d) => modifiers | getEffectiveModifierFlags(d), 0 /* None */) & (32768 /* In */ | 65536 /* Out */ | 2048 /* Const */);
|
|
55120
55132
|
}
|
|
55121
55133
|
function hasCovariantVoidArgument(typeArguments, variances) {
|
|
55122
55134
|
for (let i = 0; i < variances.length; i++) {
|
|
@@ -55175,7 +55187,7 @@ function createTypeChecker(host) {
|
|
|
55175
55187
|
}
|
|
55176
55188
|
function forEachProperty(prop, callback) {
|
|
55177
55189
|
if (getCheckFlags(prop) & 6 /* Synthetic */) {
|
|
55178
|
-
for (const t of prop.containingType.types) {
|
|
55190
|
+
for (const t of prop.links.containingType.types) {
|
|
55179
55191
|
const p = getPropertyOfType(t, prop.escapedName);
|
|
55180
55192
|
const result = p && forEachProperty(p, callback);
|
|
55181
55193
|
if (result) {
|
|
@@ -55589,14 +55601,14 @@ function createTypeChecker(host) {
|
|
|
55589
55601
|
const symbol = createSymbol(source.flags, source.escapedName, getCheckFlags(source) & 8 /* Readonly */);
|
|
55590
55602
|
symbol.declarations = source.declarations;
|
|
55591
55603
|
symbol.parent = source.parent;
|
|
55592
|
-
symbol.type = type;
|
|
55593
|
-
symbol.target = source;
|
|
55604
|
+
symbol.links.type = type;
|
|
55605
|
+
symbol.links.target = source;
|
|
55594
55606
|
if (source.valueDeclaration) {
|
|
55595
55607
|
symbol.valueDeclaration = source.valueDeclaration;
|
|
55596
55608
|
}
|
|
55597
55609
|
const nameType = getSymbolLinks(source).nameType;
|
|
55598
55610
|
if (nameType) {
|
|
55599
|
-
symbol.nameType = nameType;
|
|
55611
|
+
symbol.links.nameType = nameType;
|
|
55600
55612
|
}
|
|
55601
55613
|
return symbol;
|
|
55602
55614
|
}
|
|
@@ -55977,7 +55989,7 @@ function createTypeChecker(host) {
|
|
|
55977
55989
|
}
|
|
55978
55990
|
const name = escapeLeadingUnderscores(t.value);
|
|
55979
55991
|
const literalProp = createSymbol(4 /* Property */, name);
|
|
55980
|
-
literalProp.type = anyType;
|
|
55992
|
+
literalProp.links.type = anyType;
|
|
55981
55993
|
if (t.symbol) {
|
|
55982
55994
|
literalProp.declarations = t.symbol.declarations;
|
|
55983
55995
|
literalProp.valueDeclaration = t.symbol.valueDeclaration;
|
|
@@ -56025,7 +56037,7 @@ function createTypeChecker(host) {
|
|
|
56025
56037
|
function getTypeOfReverseMappedSymbol(symbol) {
|
|
56026
56038
|
const links = getSymbolLinks(symbol);
|
|
56027
56039
|
if (!links.type) {
|
|
56028
|
-
links.type = inferReverseMappedType(symbol.propertyType, symbol.mappedType, symbol.constraintType);
|
|
56040
|
+
links.type = inferReverseMappedType(symbol.links.propertyType, symbol.links.mappedType, symbol.links.constraintType);
|
|
56029
56041
|
}
|
|
56030
56042
|
return links.type;
|
|
56031
56043
|
}
|
|
@@ -56753,7 +56765,7 @@ function createTypeChecker(host) {
|
|
|
56753
56765
|
}
|
|
56754
56766
|
function getCovariantInference(inference, signature) {
|
|
56755
56767
|
const candidates = unionObjectAndArrayLiteralCandidates(inference.candidates);
|
|
56756
|
-
const primitiveConstraint = hasPrimitiveConstraint(inference.typeParameter);
|
|
56768
|
+
const primitiveConstraint = hasPrimitiveConstraint(inference.typeParameter) || isConstTypeVariable(inference.typeParameter);
|
|
56757
56769
|
const widenLiteralTypes = !primitiveConstraint && inference.topLevel && (inference.isFixed || !isTypeParameterAtTopLevel(getReturnTypeOfSignature(signature), inference.typeParameter));
|
|
56758
56770
|
const baseCandidates = primitiveConstraint ? sameMap(candidates, getRegularTypeOfLiteralType) : widenLiteralTypes ? sameMap(candidates, getWidenedLiteralType) : candidates;
|
|
56759
56771
|
const unwidenedType = inference.priority & 416 /* PriorityImpliesCombination */ ? getUnionType(baseCandidates, 2 /* Subtype */) : getCommonSupertype(baseCandidates);
|
|
@@ -57008,10 +57020,10 @@ function createTypeChecker(host) {
|
|
|
57008
57020
|
if (type && type.flags & 1048576 /* Union */) {
|
|
57009
57021
|
const prop = getUnionOrIntersectionProperty(type, name);
|
|
57010
57022
|
if (prop && getCheckFlags(prop) & 2 /* SyntheticProperty */) {
|
|
57011
|
-
if (prop.isDiscriminantProperty === void 0) {
|
|
57012
|
-
prop.isDiscriminantProperty = (prop.checkFlags & 192 /* Discriminant */) === 192 /* Discriminant */ && !isGenericType(getTypeOfSymbol(prop));
|
|
57023
|
+
if (prop.links.isDiscriminantProperty === void 0) {
|
|
57024
|
+
prop.links.isDiscriminantProperty = (prop.links.checkFlags & 192 /* Discriminant */) === 192 /* Discriminant */ && !isGenericType(getTypeOfSymbol(prop));
|
|
57013
57025
|
}
|
|
57014
|
-
return !!prop.isDiscriminantProperty;
|
|
57026
|
+
return !!prop.links.isDiscriminantProperty;
|
|
57015
57027
|
}
|
|
57016
57028
|
}
|
|
57017
57029
|
return false;
|
|
@@ -57533,7 +57545,7 @@ function createTypeChecker(host) {
|
|
|
57533
57545
|
}
|
|
57534
57546
|
if (symbol.flags & (3 /* Variable */ | 4 /* Property */)) {
|
|
57535
57547
|
if (getCheckFlags(symbol) & 262144 /* Mapped */) {
|
|
57536
|
-
const origin = symbol.syntheticOrigin;
|
|
57548
|
+
const origin = symbol.links.syntheticOrigin;
|
|
57537
57549
|
if (origin && getExplicitTypeOfSymbol(origin)) {
|
|
57538
57550
|
return getTypeOfSymbol(symbol);
|
|
57539
57551
|
}
|
|
@@ -59614,7 +59626,7 @@ function createTypeChecker(host) {
|
|
|
59614
59626
|
return nameStr !== void 0 && getTypeOfPropertyOfContextualType(thisType, nameStr) || void 0;
|
|
59615
59627
|
}
|
|
59616
59628
|
function isCircularMappedProperty(symbol) {
|
|
59617
|
-
return !!(getCheckFlags(symbol) & 262144 /* Mapped */ && !symbol.type && findResolutionCycleStartIndex(symbol, 0 /* Type */) >= 0);
|
|
59629
|
+
return !!(getCheckFlags(symbol) & 262144 /* Mapped */ && !symbol.links.type && findResolutionCycleStartIndex(symbol, 0 /* Type */) >= 0);
|
|
59618
59630
|
}
|
|
59619
59631
|
function getTypeOfPropertyOfContextualType(type, name, nameType) {
|
|
59620
59632
|
return mapType(type, (t) => {
|
|
@@ -59808,13 +59820,12 @@ function createTypeChecker(host) {
|
|
|
59808
59820
|
return type;
|
|
59809
59821
|
}
|
|
59810
59822
|
function getContextualType(node, contextFlags) {
|
|
59811
|
-
var _a2;
|
|
59812
59823
|
if (node.flags & 33554432 /* InWithStatement */) {
|
|
59813
59824
|
return void 0;
|
|
59814
59825
|
}
|
|
59815
|
-
const
|
|
59816
|
-
if (
|
|
59817
|
-
return
|
|
59826
|
+
const index = findContextualNode(node);
|
|
59827
|
+
if (index >= 0) {
|
|
59828
|
+
return contextualTypes[index];
|
|
59818
59829
|
}
|
|
59819
59830
|
const { parent } = node;
|
|
59820
59831
|
switch (parent.kind) {
|
|
@@ -59836,7 +59847,7 @@ function createTypeChecker(host) {
|
|
|
59836
59847
|
return getContextualTypeForArgument(parent, node);
|
|
59837
59848
|
case 213 /* TypeAssertionExpression */:
|
|
59838
59849
|
case 231 /* AsExpression */:
|
|
59839
|
-
return isConstTypeReference(parent.type) ?
|
|
59850
|
+
return isConstTypeReference(parent.type) ? getContextualType(parent, contextFlags) : getTypeFromTypeNode(parent.type);
|
|
59840
59851
|
case 223 /* BinaryExpression */:
|
|
59841
59852
|
return getContextualTypeForBinaryOperand(node, contextFlags);
|
|
59842
59853
|
case 299 /* PropertyAssignment */:
|
|
@@ -59856,7 +59867,7 @@ function createTypeChecker(host) {
|
|
|
59856
59867
|
return getContextualTypeForSubstitutionExpression(parent.parent, node);
|
|
59857
59868
|
case 214 /* ParenthesizedExpression */: {
|
|
59858
59869
|
const tag = isInJSFile(parent) ? getJSDocTypeTag(parent) : void 0;
|
|
59859
|
-
return !tag ? getContextualType(parent, contextFlags) : isJSDocTypeTag(tag) && isConstTypeReference(tag.typeExpression.type) ?
|
|
59870
|
+
return !tag ? getContextualType(parent, contextFlags) : isJSDocTypeTag(tag) && isConstTypeReference(tag.typeExpression.type) ? getContextualType(parent, contextFlags) : getTypeFromTypeNode(tag.typeExpression.type);
|
|
59860
59871
|
}
|
|
59861
59872
|
case 232 /* NonNullExpression */:
|
|
59862
59873
|
return getContextualType(parent, contextFlags);
|
|
@@ -59874,22 +59885,31 @@ function createTypeChecker(host) {
|
|
|
59874
59885
|
return getContextualJsxElementAttributesType(parent, contextFlags);
|
|
59875
59886
|
}
|
|
59876
59887
|
return void 0;
|
|
59877
|
-
|
|
59878
|
-
|
|
59888
|
+
}
|
|
59889
|
+
function pushContextualType(node, type) {
|
|
59890
|
+
contextualTypeNodes[contextualTypeCount] = node;
|
|
59891
|
+
contextualTypes[contextualTypeCount] = type;
|
|
59892
|
+
contextualTypeCount++;
|
|
59893
|
+
}
|
|
59894
|
+
function popContextualType() {
|
|
59895
|
+
contextualTypeCount--;
|
|
59896
|
+
}
|
|
59897
|
+
function findContextualNode(node) {
|
|
59898
|
+
for (let i = contextualTypeCount - 1; i >= 0; i--) {
|
|
59899
|
+
if (node === contextualTypeNodes[i]) {
|
|
59900
|
+
return i;
|
|
59901
|
+
}
|
|
59879
59902
|
}
|
|
59903
|
+
return -1;
|
|
59880
59904
|
}
|
|
59881
59905
|
function getInferenceContext(node) {
|
|
59882
|
-
return
|
|
59883
|
-
var _a2;
|
|
59884
|
-
return (_a2 = tryGetNodeLinks(n)) == null ? void 0 : _a2.inferenceContext;
|
|
59885
|
-
});
|
|
59906
|
+
return isNodeDescendantOf(node, currentInferenceNode) ? currentInferenceContext : void 0;
|
|
59886
59907
|
}
|
|
59887
59908
|
function getContextualJsxElementAttributesType(node, contextFlags) {
|
|
59888
|
-
var _a2;
|
|
59889
59909
|
if (isJsxOpeningElement(node) && contextFlags !== 4 /* Completions */) {
|
|
59890
|
-
const
|
|
59891
|
-
if (
|
|
59892
|
-
return
|
|
59910
|
+
const index = findContextualNode(node.parent);
|
|
59911
|
+
if (index >= 0) {
|
|
59912
|
+
return contextualTypes[index];
|
|
59893
59913
|
}
|
|
59894
59914
|
}
|
|
59895
59915
|
return getContextualTypeForArgumentAtIndex(node, 0);
|
|
@@ -60036,14 +60056,14 @@ function createTypeChecker(host) {
|
|
|
60036
60056
|
1 /* FunctionScopedVariable */ | (isOptional && !isRestParam ? 16777216 /* Optional */ : 0),
|
|
60037
60057
|
paramName || `arg${i}`
|
|
60038
60058
|
);
|
|
60039
|
-
paramSymbol.type = isRestParam ? createArrayType(unionParamType) : unionParamType;
|
|
60059
|
+
paramSymbol.links.type = isRestParam ? createArrayType(unionParamType) : unionParamType;
|
|
60040
60060
|
params[i] = paramSymbol;
|
|
60041
60061
|
}
|
|
60042
60062
|
if (needsExtraRestElement) {
|
|
60043
60063
|
const restParamSymbol = createSymbol(1 /* FunctionScopedVariable */, "args");
|
|
60044
|
-
restParamSymbol.type = createArrayType(getTypeAtPosition(shorter, longestCount));
|
|
60064
|
+
restParamSymbol.links.type = createArrayType(getTypeAtPosition(shorter, longestCount));
|
|
60045
60065
|
if (shorter === right) {
|
|
60046
|
-
restParamSymbol.type = instantiateType(restParamSymbol.type, mapper);
|
|
60066
|
+
restParamSymbol.links.type = instantiateType(restParamSymbol.links.type, mapper);
|
|
60047
60067
|
}
|
|
60048
60068
|
params[longestCount] = restParamSymbol;
|
|
60049
60069
|
}
|
|
@@ -60146,9 +60166,11 @@ function createTypeChecker(host) {
|
|
|
60146
60166
|
const elementCount = elements.length;
|
|
60147
60167
|
const elementTypes = [];
|
|
60148
60168
|
const elementFlags = [];
|
|
60149
|
-
|
|
60169
|
+
pushContextualType(node, getContextualType(node, void 0));
|
|
60150
60170
|
const inDestructuringPattern = isAssignmentTarget(node);
|
|
60151
60171
|
const inConstContext = isConstContext(node);
|
|
60172
|
+
const contextualType = getApparentTypeOfContextualType(node, void 0);
|
|
60173
|
+
const inTupleContext = !!contextualType && someType(contextualType, isTupleLikeType);
|
|
60152
60174
|
let hasOmittedExpression = false;
|
|
60153
60175
|
for (let i = 0; i < elementCount; i++) {
|
|
60154
60176
|
const e = elements[i];
|
|
@@ -60173,21 +60195,21 @@ function createTypeChecker(host) {
|
|
|
60173
60195
|
elementTypes.push(undefinedOrMissingType);
|
|
60174
60196
|
elementFlags.push(2 /* Optional */);
|
|
60175
60197
|
} else {
|
|
60176
|
-
const
|
|
60177
|
-
const type = checkExpressionForMutableLocation(e, checkMode, elementContextualType, forceTuple);
|
|
60198
|
+
const type = checkExpressionForMutableLocation(e, checkMode, forceTuple);
|
|
60178
60199
|
elementTypes.push(addOptionality(type, true, hasOmittedExpression));
|
|
60179
60200
|
elementFlags.push(hasOmittedExpression ? 2 /* Optional */ : 1 /* Required */);
|
|
60180
|
-
if (
|
|
60201
|
+
if (inTupleContext && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && isContextSensitive(e)) {
|
|
60181
60202
|
const inferenceContext = getInferenceContext(node);
|
|
60182
60203
|
Debug.assert(inferenceContext);
|
|
60183
60204
|
addIntraExpressionInferenceSite(inferenceContext, e, type);
|
|
60184
60205
|
}
|
|
60185
60206
|
}
|
|
60186
60207
|
}
|
|
60208
|
+
popContextualType();
|
|
60187
60209
|
if (inDestructuringPattern) {
|
|
60188
60210
|
return createTupleType(elementTypes, elementFlags);
|
|
60189
60211
|
}
|
|
60190
|
-
if (forceTuple || inConstContext ||
|
|
60212
|
+
if (forceTuple || inConstContext || inTupleContext) {
|
|
60191
60213
|
return createArrayLiteralType(createTupleType(elementTypes, elementFlags, inConstContext));
|
|
60192
60214
|
}
|
|
60193
60215
|
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));
|
|
@@ -60274,12 +60296,14 @@ function createTypeChecker(host) {
|
|
|
60274
60296
|
return links.immediateTarget;
|
|
60275
60297
|
}
|
|
60276
60298
|
function checkObjectLiteral(node, checkMode) {
|
|
60299
|
+
var _a2;
|
|
60277
60300
|
const inDestructuringPattern = isAssignmentTarget(node);
|
|
60278
60301
|
checkGrammarObjectLiteralExpression(node, inDestructuringPattern);
|
|
60279
60302
|
const allPropertiesTable = strictNullChecks ? createSymbolTable() : void 0;
|
|
60280
60303
|
let propertiesTable = createSymbolTable();
|
|
60281
60304
|
let propertiesArray = [];
|
|
60282
60305
|
let spread = emptyObjectType;
|
|
60306
|
+
pushContextualType(node, getContextualType(node, void 0));
|
|
60283
60307
|
const contextualType = getApparentTypeOfContextualType(node, void 0);
|
|
60284
60308
|
const contextualTypeHasPattern = contextualType && contextualType.pattern && (contextualType.pattern.kind === 203 /* ObjectBindingPattern */ || contextualType.pattern.kind === 207 /* ObjectLiteralExpression */);
|
|
60285
60309
|
const inConstContext = isConstContext(node);
|
|
@@ -60316,7 +60340,7 @@ function createTypeChecker(host) {
|
|
|
60316
60340
|
const nameType = computedNameType && isTypeUsableAsPropertyName(computedNameType) ? computedNameType : void 0;
|
|
60317
60341
|
const prop = nameType ? createSymbol(4 /* Property */ | member.flags, getPropertyNameFromType(nameType), checkFlags | 4096 /* Late */) : createSymbol(4 /* Property */ | member.flags, member.escapedName, checkFlags);
|
|
60318
60342
|
if (nameType) {
|
|
60319
|
-
prop.nameType = nameType;
|
|
60343
|
+
prop.links.nameType = nameType;
|
|
60320
60344
|
}
|
|
60321
60345
|
if (inDestructuringPattern) {
|
|
60322
60346
|
const isOptional = memberDecl.kind === 299 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer) || memberDecl.kind === 300 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer;
|
|
@@ -60341,8 +60365,8 @@ function createTypeChecker(host) {
|
|
|
60341
60365
|
if (member.valueDeclaration) {
|
|
60342
60366
|
prop.valueDeclaration = member.valueDeclaration;
|
|
60343
60367
|
}
|
|
60344
|
-
prop.type = type;
|
|
60345
|
-
prop.target = member;
|
|
60368
|
+
prop.links.type = type;
|
|
60369
|
+
prop.links.target = member;
|
|
60346
60370
|
member = prop;
|
|
60347
60371
|
allPropertiesTable == null ? void 0 : allPropertiesTable.set(prop.escapedName, prop);
|
|
60348
60372
|
if (contextualType && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && (memberDecl.kind === 299 /* PropertyAssignment */ || memberDecl.kind === 171 /* MethodDeclaration */) && isContextSensitive(memberDecl)) {
|
|
@@ -60401,6 +60425,7 @@ function createTypeChecker(host) {
|
|
|
60401
60425
|
}
|
|
60402
60426
|
propertiesArray.push(member);
|
|
60403
60427
|
}
|
|
60428
|
+
popContextualType();
|
|
60404
60429
|
if (contextualTypeHasPattern) {
|
|
60405
60430
|
const rootPatternParent = findAncestor(
|
|
60406
60431
|
contextualType.pattern.parent,
|
|
@@ -60415,7 +60440,7 @@ function createTypeChecker(host) {
|
|
|
60415
60440
|
if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) {
|
|
60416
60441
|
if (!(prop.flags & 16777216 /* Optional */)) {
|
|
60417
60442
|
error(
|
|
60418
|
-
prop.valueDeclaration || prop.bindingElement,
|
|
60443
|
+
prop.valueDeclaration || ((_a2 = tryCast(prop, isTransientSymbol)) == null ? void 0 : _a2.links.bindingElement),
|
|
60419
60444
|
Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value
|
|
60420
60445
|
);
|
|
60421
60446
|
}
|
|
@@ -60525,8 +60550,8 @@ function createTypeChecker(host) {
|
|
|
60525
60550
|
if (member.valueDeclaration) {
|
|
60526
60551
|
attributeSymbol.valueDeclaration = member.valueDeclaration;
|
|
60527
60552
|
}
|
|
60528
|
-
attributeSymbol.type = exprType;
|
|
60529
|
-
attributeSymbol.target = member;
|
|
60553
|
+
attributeSymbol.links.type = exprType;
|
|
60554
|
+
attributeSymbol.links.target = member;
|
|
60530
60555
|
attributesTable.set(attributeSymbol.escapedName, attributeSymbol);
|
|
60531
60556
|
allAttributesTable == null ? void 0 : allAttributesTable.set(attributeSymbol.escapedName, attributeSymbol);
|
|
60532
60557
|
if (attributeDecl.name.escapedText === jsxChildrenPropertyName) {
|
|
@@ -60574,7 +60599,7 @@ function createTypeChecker(host) {
|
|
|
60574
60599
|
const contextualType = getApparentTypeOfContextualType(openingLikeElement.attributes, void 0);
|
|
60575
60600
|
const childrenContextualType = contextualType && getTypeOfPropertyOfContextualType(contextualType, jsxChildrenPropertyName);
|
|
60576
60601
|
const childrenPropSymbol = createSymbol(4 /* Property */, jsxChildrenPropertyName);
|
|
60577
|
-
childrenPropSymbol.type = childrenTypes.length === 1 ? childrenTypes[0] : childrenContextualType && someType(childrenContextualType, isTupleLikeType) ? createTupleType(childrenTypes) : createArrayType(getUnionType(childrenTypes));
|
|
60602
|
+
childrenPropSymbol.links.type = childrenTypes.length === 1 ? childrenTypes[0] : childrenContextualType && someType(childrenContextualType, isTupleLikeType) ? createTupleType(childrenTypes) : createArrayType(getUnionType(childrenTypes));
|
|
60578
60603
|
childrenPropSymbol.valueDeclaration = factory.createPropertySignature(void 0, unescapeLeadingUnderscores(jsxChildrenPropertyName), void 0, void 0);
|
|
60579
60604
|
setParent(childrenPropSymbol.valueDeclaration, attributes);
|
|
60580
60605
|
childrenPropSymbol.valueDeclaration.symbol = childrenPropSymbol;
|
|
@@ -60680,7 +60705,7 @@ function createTypeChecker(host) {
|
|
|
60680
60705
|
return void 0;
|
|
60681
60706
|
}
|
|
60682
60707
|
const isClassic = getEmitModuleResolutionKind(compilerOptions) === 1 /* Classic */;
|
|
60683
|
-
const errorMessage = isClassic ? Diagnostics.
|
|
60708
|
+
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;
|
|
60684
60709
|
const mod = resolveExternalModule(location, runtimeImportSpecifier, errorMessage, location);
|
|
60685
60710
|
const result = mod && mod !== unknownSymbol ? getMergedSymbol(resolveSymbol(mod)) : void 0;
|
|
60686
60711
|
if (links) {
|
|
@@ -61988,6 +62013,7 @@ function createTypeChecker(host) {
|
|
|
61988
62013
|
const types = [];
|
|
61989
62014
|
const flags = [];
|
|
61990
62015
|
const names = [];
|
|
62016
|
+
const inConstContext = isConstTypeVariable(restType);
|
|
61991
62017
|
for (let i = index; i < argCount; i++) {
|
|
61992
62018
|
const arg = args[i];
|
|
61993
62019
|
if (isSpreadArgument(arg)) {
|
|
@@ -62002,7 +62028,7 @@ function createTypeChecker(host) {
|
|
|
62002
62028
|
} else {
|
|
62003
62029
|
const contextualType = getIndexedAccessType(restType, getNumberLiteralType(i - index), 256 /* Contextual */);
|
|
62004
62030
|
const argType = checkExpressionWithContextualType(arg, contextualType, context, checkMode);
|
|
62005
|
-
const hasPrimitiveContextualType = maybeTypeOfKind(contextualType, 131068 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
|
|
62031
|
+
const hasPrimitiveContextualType = inConstContext || maybeTypeOfKind(contextualType, 131068 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
|
|
62006
62032
|
types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType));
|
|
62007
62033
|
flags.push(1 /* Required */);
|
|
62008
62034
|
}
|
|
@@ -62010,7 +62036,7 @@ function createTypeChecker(host) {
|
|
|
62010
62036
|
names.push(arg.tupleNameSource);
|
|
62011
62037
|
}
|
|
62012
62038
|
}
|
|
62013
|
-
return createTupleType(types, flags,
|
|
62039
|
+
return createTupleType(types, flags, inConstContext, length(names) === length(types) ? names : void 0);
|
|
62014
62040
|
}
|
|
62015
62041
|
function checkTypeArguments(signature, typeArgumentNodes, reportErrors2, headMessage) {
|
|
62016
62042
|
const isJavascript = isInJSFile(signature.declaration);
|
|
@@ -63085,7 +63111,7 @@ function createTypeChecker(host) {
|
|
|
63085
63111
|
returnNode ? factory.createTypeReferenceNode(returnNode, void 0) : factory.createKeywordTypeNode(131 /* AnyKeyword */)
|
|
63086
63112
|
);
|
|
63087
63113
|
const parameterSymbol = createSymbol(1 /* FunctionScopedVariable */, "props");
|
|
63088
|
-
parameterSymbol.type = result;
|
|
63114
|
+
parameterSymbol.links.type = result;
|
|
63089
63115
|
return createSignature(
|
|
63090
63116
|
declaration,
|
|
63091
63117
|
void 0,
|
|
@@ -63378,8 +63404,8 @@ function createTypeChecker(host) {
|
|
|
63378
63404
|
const memberTable = createSymbolTable();
|
|
63379
63405
|
const newSymbol = createSymbol(2097152 /* Alias */, "default" /* Default */);
|
|
63380
63406
|
newSymbol.parent = originalSymbol;
|
|
63381
|
-
newSymbol.nameType = getStringLiteralType("default");
|
|
63382
|
-
newSymbol.aliasTarget = resolveSymbol(symbol);
|
|
63407
|
+
newSymbol.links.nameType = getStringLiteralType("default");
|
|
63408
|
+
newSymbol.links.aliasTarget = resolveSymbol(symbol);
|
|
63383
63409
|
memberTable.set("default" /* Default */, newSymbol);
|
|
63384
63410
|
return createAnonymousType(anonymousSymbol, memberTable, emptyArray, emptyArray, emptyArray);
|
|
63385
63411
|
}
|
|
@@ -63405,7 +63431,7 @@ function createTypeChecker(host) {
|
|
|
63405
63431
|
if (hasSyntheticDefault) {
|
|
63406
63432
|
const anonymousSymbol = createSymbol(2048 /* TypeLiteral */, "__type" /* Type */);
|
|
63407
63433
|
const defaultContainingObject = createDefaultPropertyWrapperForModule(symbol, originalSymbol, anonymousSymbol);
|
|
63408
|
-
anonymousSymbol.type = defaultContainingObject;
|
|
63434
|
+
anonymousSymbol.links.type = defaultContainingObject;
|
|
63409
63435
|
synthType.syntheticType = isValidSpreadType(type) ? getSpreadType(type, defaultContainingObject, anonymousSymbol, 0, false) : defaultContainingObject;
|
|
63410
63436
|
} else {
|
|
63411
63437
|
synthType.syntheticType = type;
|
|
@@ -63474,12 +63500,9 @@ function createTypeChecker(host) {
|
|
|
63474
63500
|
return op === 40 /* MinusToken */ && (arg.kind === 8 /* NumericLiteral */ || arg.kind === 9 /* BigIntLiteral */) || op === 39 /* PlusToken */ && arg.kind === 8 /* NumericLiteral */;
|
|
63475
63501
|
case 208 /* PropertyAccessExpression */:
|
|
63476
63502
|
case 209 /* ElementAccessExpression */:
|
|
63477
|
-
const expr = node.expression;
|
|
63478
|
-
|
|
63479
|
-
|
|
63480
|
-
symbol = resolveAlias(symbol);
|
|
63481
|
-
}
|
|
63482
|
-
return !!(symbol && getAllSymbolFlags(symbol) & 384 /* Enum */);
|
|
63503
|
+
const expr = skipParentheses(node.expression);
|
|
63504
|
+
const symbol = isEntityNameExpression(expr) ? resolveEntityName(expr, 111551 /* Value */, true) : void 0;
|
|
63505
|
+
return !!(symbol && symbol.flags & 384 /* Enum */);
|
|
63483
63506
|
}
|
|
63484
63507
|
return false;
|
|
63485
63508
|
}
|
|
@@ -63940,7 +63963,7 @@ function createTypeChecker(host) {
|
|
|
63940
63963
|
const symbol = createSymbol(0 /* None */, "NewTargetExpression");
|
|
63941
63964
|
const targetPropertySymbol = createSymbol(4 /* Property */, "target", 8 /* Readonly */);
|
|
63942
63965
|
targetPropertySymbol.parent = symbol;
|
|
63943
|
-
targetPropertySymbol.type = targetType;
|
|
63966
|
+
targetPropertySymbol.links.type = targetType;
|
|
63944
63967
|
const members = createSymbolTable([targetPropertySymbol]);
|
|
63945
63968
|
symbol.members = members;
|
|
63946
63969
|
return createAnonymousType(symbol, members, emptyArray, emptyArray, emptyArray);
|
|
@@ -65387,23 +65410,21 @@ function createTypeChecker(host) {
|
|
|
65387
65410
|
return node;
|
|
65388
65411
|
}
|
|
65389
65412
|
function checkExpressionWithContextualType(node, contextualType, inferenceContext, checkMode) {
|
|
65390
|
-
const
|
|
65391
|
-
|
|
65392
|
-
const
|
|
65393
|
-
const saveInferenceContext =
|
|
65394
|
-
|
|
65395
|
-
|
|
65396
|
-
|
|
65397
|
-
|
|
65398
|
-
|
|
65399
|
-
|
|
65400
|
-
|
|
65401
|
-
|
|
65402
|
-
|
|
65403
|
-
|
|
65404
|
-
|
|
65405
|
-
links.inferenceContext = saveInferenceContext;
|
|
65406
|
-
}
|
|
65413
|
+
const contextNode = getContextNode(node);
|
|
65414
|
+
pushContextualType(contextNode, contextualType);
|
|
65415
|
+
const saveInferenceNode = currentInferenceNode;
|
|
65416
|
+
const saveInferenceContext = currentInferenceContext;
|
|
65417
|
+
currentInferenceNode = contextNode;
|
|
65418
|
+
currentInferenceContext = inferenceContext;
|
|
65419
|
+
const type = checkExpression(node, checkMode | 1 /* Contextual */ | (inferenceContext ? 2 /* Inferential */ : 0));
|
|
65420
|
+
if (inferenceContext && inferenceContext.intraExpressionInferenceSites) {
|
|
65421
|
+
inferenceContext.intraExpressionInferenceSites = void 0;
|
|
65422
|
+
}
|
|
65423
|
+
const result = maybeTypeOfKind(type, 2944 /* Literal */) && isLiteralOfContextualType(type, instantiateContextualType(contextualType, node, void 0)) ? getRegularTypeOfLiteralType(type) : type;
|
|
65424
|
+
currentInferenceNode = saveInferenceNode;
|
|
65425
|
+
currentInferenceContext = saveInferenceContext;
|
|
65426
|
+
popContextualType();
|
|
65427
|
+
return result;
|
|
65407
65428
|
}
|
|
65408
65429
|
function checkExpressionCached(node, checkMode) {
|
|
65409
65430
|
if (checkMode) {
|
|
@@ -65475,11 +65496,15 @@ function createTypeChecker(host) {
|
|
|
65475
65496
|
}
|
|
65476
65497
|
function isConstContext(node) {
|
|
65477
65498
|
const parent = node.parent;
|
|
65478
|
-
return isAssertionExpression(parent) && isConstTypeReference(parent.type) || isJSDocTypeAssertion(parent) && isConstTypeReference(getJSDocTypeAssertionType(parent)) || (isParenthesizedExpression(parent) || isArrayLiteralExpression(parent) || isSpreadElement(parent)) && isConstContext(parent) || (isPropertyAssignment(parent) || isShorthandPropertyAssignment(parent) || isTemplateSpan(parent)) && isConstContext(parent.parent);
|
|
65499
|
+
return isAssertionExpression(parent) && isConstTypeReference(parent.type) || isJSDocTypeAssertion(parent) && isConstTypeReference(getJSDocTypeAssertionType(parent)) || isValidConstAssertionArgument(node) && isConstTypeParameterContext(node) || (isParenthesizedExpression(parent) || isArrayLiteralExpression(parent) || isSpreadElement(parent)) && isConstContext(parent) || (isPropertyAssignment(parent) || isShorthandPropertyAssignment(parent) || isTemplateSpan(parent)) && isConstContext(parent.parent);
|
|
65500
|
+
}
|
|
65501
|
+
function isConstTypeParameterContext(node) {
|
|
65502
|
+
const contextualType = getContextualType(node, 0 /* None */);
|
|
65503
|
+
return !!contextualType && someType(contextualType, isConstTypeVariable);
|
|
65479
65504
|
}
|
|
65480
|
-
function checkExpressionForMutableLocation(node, checkMode,
|
|
65505
|
+
function checkExpressionForMutableLocation(node, checkMode, forceTuple) {
|
|
65481
65506
|
const type = checkExpression(node, checkMode, forceTuple);
|
|
65482
|
-
return isConstContext(node) || isCommonJsExportedExpression(node) ? getRegularTypeOfLiteralType(type) : isTypeAssertion(node) ? type : getWidenedLiteralLikeTypeForContextualType(type, instantiateContextualType(
|
|
65507
|
+
return isConstContext(node) || isCommonJsExportedExpression(node) ? getRegularTypeOfLiteralType(type) : isTypeAssertion(node) ? type : getWidenedLiteralLikeTypeForContextualType(type, instantiateContextualType(getContextualType(node, void 0), node, void 0));
|
|
65483
65508
|
}
|
|
65484
65509
|
function checkPropertyAssignment(node, checkMode) {
|
|
65485
65510
|
if (node.name.kind === 164 /* ComputedPropertyName */) {
|
|
@@ -65663,14 +65688,10 @@ function createTypeChecker(host) {
|
|
|
65663
65688
|
if (links.contextFreeType) {
|
|
65664
65689
|
return links.contextFreeType;
|
|
65665
65690
|
}
|
|
65666
|
-
|
|
65667
|
-
links.
|
|
65668
|
-
|
|
65669
|
-
|
|
65670
|
-
return type;
|
|
65671
|
-
} finally {
|
|
65672
|
-
links.contextualType = saveContextualType;
|
|
65673
|
-
}
|
|
65691
|
+
pushContextualType(node, anyType);
|
|
65692
|
+
const type = links.contextFreeType = checkExpression(node, 4 /* SkipContextSensitive */);
|
|
65693
|
+
popContextualType();
|
|
65694
|
+
return type;
|
|
65674
65695
|
}
|
|
65675
65696
|
function checkExpression(node, checkMode, forceTuple) {
|
|
65676
65697
|
var _a2, _b;
|
|
@@ -65847,7 +65868,7 @@ function createTypeChecker(host) {
|
|
|
65847
65868
|
var _a2, _b;
|
|
65848
65869
|
if (isInterfaceDeclaration(node.parent) || isClassLike(node.parent) || isTypeAliasDeclaration(node.parent)) {
|
|
65849
65870
|
const typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfDeclaration(node));
|
|
65850
|
-
const modifiers =
|
|
65871
|
+
const modifiers = getTypeParameterModifiers(typeParameter) & (32768 /* In */ | 65536 /* Out */);
|
|
65851
65872
|
if (modifiers) {
|
|
65852
65873
|
const symbol = getSymbolOfDeclaration(node.parent);
|
|
65853
65874
|
if (isTypeAliasDeclaration(node.parent) && !(getObjectFlags(getDeclaredTypeOfSymbol(symbol)) & (16 /* Anonymous */ | 32 /* Mapped */))) {
|
|
@@ -69478,7 +69499,7 @@ function createTypeChecker(host) {
|
|
|
69478
69499
|
);
|
|
69479
69500
|
}
|
|
69480
69501
|
function getTargetSymbol(s) {
|
|
69481
|
-
return getCheckFlags(s) & 1 /* Instantiated */ ? s.target : s;
|
|
69502
|
+
return getCheckFlags(s) & 1 /* Instantiated */ ? s.links.target : s;
|
|
69482
69503
|
}
|
|
69483
69504
|
function getClassOrInterfaceDeclarationsOfSymbol(symbol) {
|
|
69484
69505
|
return filter(symbol.declarations, (d) => d.kind === 260 /* ClassDeclaration */ || d.kind === 261 /* InterfaceDeclaration */);
|
|
@@ -71541,7 +71562,7 @@ function createTypeChecker(host) {
|
|
|
71541
71562
|
if (getCheckFlags(symbol) & 6 /* Synthetic */) {
|
|
71542
71563
|
return mapDefined(getSymbolLinks(symbol).containingType.types, (type) => getPropertyOfType(type, symbol.escapedName));
|
|
71543
71564
|
} else if (symbol.flags & 33554432 /* Transient */) {
|
|
71544
|
-
const { leftSpread, rightSpread, syntheticOrigin } = symbol;
|
|
71565
|
+
const { links: { leftSpread, rightSpread, syntheticOrigin } } = symbol;
|
|
71545
71566
|
return leftSpread ? [leftSpread, rightSpread] : syntheticOrigin ? [syntheticOrigin] : singleElementArray(tryGetTarget(symbol));
|
|
71546
71567
|
}
|
|
71547
71568
|
return void 0;
|
|
@@ -72419,16 +72440,20 @@ function createTypeChecker(host) {
|
|
|
72419
72440
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_an_index_signature, tokenToString(modifier.kind));
|
|
72420
72441
|
}
|
|
72421
72442
|
}
|
|
72422
|
-
if (modifier.kind !== 101 /* InKeyword */ && modifier.kind !== 145 /* OutKeyword */) {
|
|
72443
|
+
if (modifier.kind !== 101 /* InKeyword */ && modifier.kind !== 145 /* OutKeyword */ && modifier.kind !== 85 /* ConstKeyword */) {
|
|
72423
72444
|
if (node.kind === 165 /* TypeParameter */) {
|
|
72424
72445
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_type_parameter, tokenToString(modifier.kind));
|
|
72425
72446
|
}
|
|
72426
72447
|
}
|
|
72427
72448
|
switch (modifier.kind) {
|
|
72428
72449
|
case 85 /* ConstKeyword */:
|
|
72429
|
-
if (node.kind !== 263 /* EnumDeclaration */) {
|
|
72450
|
+
if (node.kind !== 263 /* EnumDeclaration */ && node.kind !== 165 /* TypeParameter */) {
|
|
72430
72451
|
return grammarErrorOnNode(node, Diagnostics.A_class_member_cannot_have_the_0_keyword, tokenToString(85 /* ConstKeyword */));
|
|
72431
72452
|
}
|
|
72453
|
+
const parent = node.parent;
|
|
72454
|
+
if (node.kind === 165 /* TypeParameter */ && !(isFunctionLikeDeclaration(parent) || isClassDeclaration(parent) || isFunctionTypeNode(parent) || isConstructorTypeNode(parent) || isCallSignatureDeclaration(parent) || isConstructSignatureDeclaration(parent) || isMethodSignature(parent))) {
|
|
72455
|
+
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_can_only_appear_on_a_type_parameter_of_a_function_method_or_class, tokenToString(modifier.kind));
|
|
72456
|
+
}
|
|
72432
72457
|
break;
|
|
72433
72458
|
case 161 /* OverrideKeyword */:
|
|
72434
72459
|
if (flags & 16384 /* Override */) {
|
|
@@ -78786,7 +78811,7 @@ function transformClassFields(context) {
|
|
|
78786
78811
|
if (isClassWithConstructorReference) {
|
|
78787
78812
|
enableSubstitutionForClassAliases();
|
|
78788
78813
|
const alias = factory2.cloneNode(temp);
|
|
78789
|
-
alias.
|
|
78814
|
+
alias.autoGenerate.flags &= ~8 /* ReservedInNestedScopes */;
|
|
78790
78815
|
classAliases[getOriginalNodeId(node)] = alias;
|
|
78791
78816
|
}
|
|
78792
78817
|
setEmitFlags(classExpression, 131072 /* Indented */ | getEmitFlags(classExpression));
|
|
@@ -89082,7 +89107,7 @@ function transformModule(context) {
|
|
|
89082
89107
|
return factory2.createPropertyAccessExpression(externalHelpersModuleName, node);
|
|
89083
89108
|
}
|
|
89084
89109
|
return node;
|
|
89085
|
-
} else if (!(isGeneratedIdentifier(node) && !(node.
|
|
89110
|
+
} else if (!(isGeneratedIdentifier(node) && !(node.autoGenerate.flags & 64 /* AllowNameSubstitution */)) && !isLocalName(node)) {
|
|
89086
89111
|
const exportContainer = resolver.getReferencedExportContainer(node, isExportName(node));
|
|
89087
89112
|
if (exportContainer && exportContainer.kind === 308 /* SourceFile */) {
|
|
89088
89113
|
return setTextRange(
|
|
@@ -96926,10 +96951,10 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
96926
96951
|
}
|
|
96927
96952
|
}
|
|
96928
96953
|
function generateName(name) {
|
|
96929
|
-
if ((name.
|
|
96930
|
-
return generateNameCached(getNodeForGeneratedName(name), isPrivateIdentifier(name), name.
|
|
96954
|
+
if ((name.autoGenerate.flags & 7 /* KindMask */) === 4 /* Node */) {
|
|
96955
|
+
return generateNameCached(getNodeForGeneratedName(name), isPrivateIdentifier(name), name.autoGenerate.flags, name.autoGenerate.prefix, name.autoGenerate.suffix);
|
|
96931
96956
|
} else {
|
|
96932
|
-
const autoGenerateId = name.
|
|
96957
|
+
const autoGenerateId = name.autoGenerate.id;
|
|
96933
96958
|
return autoGeneratedIdToGeneratedName[autoGenerateId] || (autoGeneratedIdToGeneratedName[autoGenerateId] = makeName(name));
|
|
96934
96959
|
}
|
|
96935
96960
|
}
|
|
@@ -97112,26 +97137,26 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
97112
97137
|
}
|
|
97113
97138
|
}
|
|
97114
97139
|
function makeName(name) {
|
|
97115
|
-
const prefix = formatGeneratedNamePart(name.
|
|
97116
|
-
const suffix = formatGeneratedNamePart(name.
|
|
97117
|
-
switch (name.
|
|
97140
|
+
const prefix = formatGeneratedNamePart(name.autoGenerate.prefix, generateName);
|
|
97141
|
+
const suffix = formatGeneratedNamePart(name.autoGenerate.suffix);
|
|
97142
|
+
switch (name.autoGenerate.flags & 7 /* KindMask */) {
|
|
97118
97143
|
case 1 /* Auto */:
|
|
97119
|
-
return makeTempVariableName(TempFlags.Auto, !!(name.
|
|
97144
|
+
return makeTempVariableName(TempFlags.Auto, !!(name.autoGenerate.flags & 8 /* ReservedInNestedScopes */), isPrivateIdentifier(name), prefix, suffix);
|
|
97120
97145
|
case 2 /* Loop */:
|
|
97121
97146
|
Debug.assertNode(name, isIdentifier);
|
|
97122
|
-
return makeTempVariableName(TempFlags._i, !!(name.
|
|
97147
|
+
return makeTempVariableName(TempFlags._i, !!(name.autoGenerate.flags & 8 /* ReservedInNestedScopes */), false, prefix, suffix);
|
|
97123
97148
|
case 3 /* Unique */:
|
|
97124
97149
|
return makeUniqueName(
|
|
97125
97150
|
idText(name),
|
|
97126
|
-
name.
|
|
97127
|
-
!!(name.
|
|
97128
|
-
!!(name.
|
|
97151
|
+
name.autoGenerate.flags & 32 /* FileLevel */ ? isFileLevelUniqueName2 : isUniqueName,
|
|
97152
|
+
!!(name.autoGenerate.flags & 16 /* Optimistic */),
|
|
97153
|
+
!!(name.autoGenerate.flags & 8 /* ReservedInNestedScopes */),
|
|
97129
97154
|
isPrivateIdentifier(name),
|
|
97130
97155
|
prefix,
|
|
97131
97156
|
suffix
|
|
97132
97157
|
);
|
|
97133
97158
|
}
|
|
97134
|
-
return Debug.fail(`Unsupported GeneratedIdentifierKind: ${Debug.formatEnum(name.
|
|
97159
|
+
return Debug.fail(`Unsupported GeneratedIdentifierKind: ${Debug.formatEnum(name.autoGenerate.flags & 7 /* KindMask */, GeneratedIdentifierFlags, true)}.`);
|
|
97135
97160
|
}
|
|
97136
97161
|
function pipelineEmitWithComments(hint, node) {
|
|
97137
97162
|
const pipelinePhase = getNextPipelinePhase(2 /* Comments */, hint, node);
|
|
@@ -98720,19 +98745,20 @@ function shouldProgramCreateNewSourceFiles(program, newOptions) {
|
|
|
98720
98745
|
return false;
|
|
98721
98746
|
return optionsHaveChanges(program.getCompilerOptions(), newOptions, sourceFileAffectingCompilerOptions);
|
|
98722
98747
|
}
|
|
98723
|
-
function createCreateProgramOptions(rootNames, options, host, oldProgram, configFileParsingDiagnostics) {
|
|
98748
|
+
function createCreateProgramOptions(rootNames, options, host, oldProgram, configFileParsingDiagnostics, typeScriptVersion2) {
|
|
98724
98749
|
return {
|
|
98725
98750
|
rootNames,
|
|
98726
98751
|
options,
|
|
98727
98752
|
host,
|
|
98728
98753
|
oldProgram,
|
|
98729
|
-
configFileParsingDiagnostics
|
|
98754
|
+
configFileParsingDiagnostics,
|
|
98755
|
+
typeScriptVersion: typeScriptVersion2
|
|
98730
98756
|
};
|
|
98731
98757
|
}
|
|
98732
98758
|
function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) {
|
|
98733
98759
|
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
98734
98760
|
const createProgramOptions = isArray(rootNamesOrOptions) ? createCreateProgramOptions(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : rootNamesOrOptions;
|
|
98735
|
-
const { rootNames, options, configFileParsingDiagnostics, projectReferences } = createProgramOptions;
|
|
98761
|
+
const { rootNames, options, configFileParsingDiagnostics, projectReferences, typeScriptVersion: typeScriptVersion2 } = createProgramOptions;
|
|
98736
98762
|
let { oldProgram } = createProgramOptions;
|
|
98737
98763
|
let processingDefaultLibFiles;
|
|
98738
98764
|
let processingOtherFiles;
|
|
@@ -100491,7 +100517,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
100491
100517
|
i++;
|
|
100492
100518
|
}
|
|
100493
100519
|
const resolveFrom = combinePaths(currentDirectory, `__lib_node_modules_lookup_${libFileName}__.ts`);
|
|
100494
|
-
const localOverrideModuleResult = resolveModuleName("@typescript/lib-" + path, resolveFrom, { moduleResolution: 2 /*
|
|
100520
|
+
const localOverrideModuleResult = resolveModuleName("@typescript/lib-" + path, resolveFrom, { moduleResolution: 2 /* Node10 */ }, host, moduleResolutionCache);
|
|
100495
100521
|
if (localOverrideModuleResult == null ? void 0 : localOverrideModuleResult.resolvedModule) {
|
|
100496
100522
|
return localOverrideModuleResult.resolvedModule.resolvedFileName;
|
|
100497
100523
|
}
|
|
@@ -100664,6 +100690,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
100664
100690
|
} else if (options.incremental && !outputFile && !options.configFilePath) {
|
|
100665
100691
|
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBuildInfoFile_is_specified));
|
|
100666
100692
|
}
|
|
100693
|
+
verifyDeprecatedCompilerOptions();
|
|
100667
100694
|
verifyProjectReferences();
|
|
100668
100695
|
if (options.composite) {
|
|
100669
100696
|
const rootPaths = new Set(rootNames.map(toPath3));
|
|
@@ -100774,8 +100801,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
100774
100801
|
}
|
|
100775
100802
|
}
|
|
100776
100803
|
if (getResolveJsonModule(options)) {
|
|
100777
|
-
if (getEmitModuleResolutionKind(options)
|
|
100778
|
-
createDiagnosticForOptionName(Diagnostics.
|
|
100804
|
+
if (getEmitModuleResolutionKind(options) === 1 /* Classic */) {
|
|
100805
|
+
createDiagnosticForOptionName(Diagnostics.Option_resolveJsonModule_cannot_be_specified_when_moduleResolution_is_set_to_classic, "resolveJsonModule");
|
|
100779
100806
|
} else if (!hasJsonModuleEmitEnabled(options)) {
|
|
100780
100807
|
createDiagnosticForOptionName(Diagnostics.Option_resolveJsonModule_can_only_be_specified_when_module_code_generation_is_commonjs_amd_es2015_or_esNext, "resolveJsonModule", "module");
|
|
100781
100808
|
}
|
|
@@ -100883,6 +100910,56 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
100883
100910
|
}
|
|
100884
100911
|
}
|
|
100885
100912
|
}
|
|
100913
|
+
function verifyDeprecatedCompilerOptions() {
|
|
100914
|
+
const version2 = typeScriptVersion2 || versionMajorMinor;
|
|
100915
|
+
const ignoreDeprecations = options.ignoreDeprecations;
|
|
100916
|
+
if (ignoreDeprecations) {
|
|
100917
|
+
if (ignoreDeprecations === "5.0" /* v5_0 */ && (version2 === "5.0" /* v5_0 */ || version2 === "5.5" /* v5_5 */)) {
|
|
100918
|
+
return;
|
|
100919
|
+
} else {
|
|
100920
|
+
createOptionValueDiagnostic("ignoreDeprecations", Diagnostics.Invalid_value_for_ignoreDeprecations);
|
|
100921
|
+
}
|
|
100922
|
+
}
|
|
100923
|
+
if (options.target === 0 /* ES3 */) {
|
|
100924
|
+
createDeprecatedDiagnosticForOption(version2, "target", "ES3");
|
|
100925
|
+
}
|
|
100926
|
+
if (options.noImplicitUseStrict) {
|
|
100927
|
+
createDeprecatedDiagnosticForOption(version2, "noImplicitUseStrict");
|
|
100928
|
+
}
|
|
100929
|
+
if (options.keyofStringsOnly) {
|
|
100930
|
+
createDeprecatedDiagnosticForOption(version2, "keyofStringsOnly");
|
|
100931
|
+
}
|
|
100932
|
+
if (options.suppressExcessPropertyErrors) {
|
|
100933
|
+
createDeprecatedDiagnosticForOption(version2, "suppressExcessPropertyErrors");
|
|
100934
|
+
}
|
|
100935
|
+
if (options.suppressImplicitAnyIndexErrors) {
|
|
100936
|
+
createDeprecatedDiagnosticForOption(version2, "suppressImplicitAnyIndexErrors");
|
|
100937
|
+
}
|
|
100938
|
+
if (options.noStrictGenericChecks) {
|
|
100939
|
+
createDeprecatedDiagnosticForOption(version2, "noStrictGenericChecks");
|
|
100940
|
+
}
|
|
100941
|
+
if (options.charset) {
|
|
100942
|
+
createDeprecatedDiagnosticForOption(version2, "charset");
|
|
100943
|
+
}
|
|
100944
|
+
if (options.out) {
|
|
100945
|
+
createDeprecatedDiagnosticForOption(version2, "out");
|
|
100946
|
+
}
|
|
100947
|
+
}
|
|
100948
|
+
function createDeprecatedDiagnosticForOption(version2, name, value) {
|
|
100949
|
+
if (version2 === "6.0" /* v6_0 */) {
|
|
100950
|
+
createDiagnosticForOption(!value, name, void 0, Diagnostics.Flag_0_is_deprecated_Please_remove_it_from_your_configuration, value || name);
|
|
100951
|
+
} else {
|
|
100952
|
+
createDiagnosticForOption(
|
|
100953
|
+
!value,
|
|
100954
|
+
name,
|
|
100955
|
+
void 0,
|
|
100956
|
+
Diagnostics.Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_ignoreDeprecations_Colon_2_to_silence_this_error,
|
|
100957
|
+
value || name,
|
|
100958
|
+
"5.5" /* v5_5 */,
|
|
100959
|
+
"5.0" /* v5_0 */
|
|
100960
|
+
);
|
|
100961
|
+
}
|
|
100962
|
+
}
|
|
100886
100963
|
function createDiagnosticExplainingFile(file, fileProcessingReason, diagnostic, args) {
|
|
100887
100964
|
var _a3;
|
|
100888
100965
|
let fileIncludeReasons;
|