@typescript-deploys/pr-build 5.6.0-pr-59170-7 → 5.6.0-pr-59217-14
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 +315 -190
- package/lib/typescript.d.ts +1 -0
- package/lib/typescript.js +370 -223
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.6";
|
|
21
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20240715`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -3416,10 +3416,12 @@ var RelationComparisonResult = /* @__PURE__ */ ((RelationComparisonResult3) => {
|
|
|
3416
3416
|
RelationComparisonResult3[RelationComparisonResult3["None"] = 0] = "None";
|
|
3417
3417
|
RelationComparisonResult3[RelationComparisonResult3["Succeeded"] = 1] = "Succeeded";
|
|
3418
3418
|
RelationComparisonResult3[RelationComparisonResult3["Failed"] = 2] = "Failed";
|
|
3419
|
-
RelationComparisonResult3[RelationComparisonResult3["Reported"] = 4] = "Reported";
|
|
3420
3419
|
RelationComparisonResult3[RelationComparisonResult3["ReportsUnmeasurable"] = 8] = "ReportsUnmeasurable";
|
|
3421
3420
|
RelationComparisonResult3[RelationComparisonResult3["ReportsUnreliable"] = 16] = "ReportsUnreliable";
|
|
3422
3421
|
RelationComparisonResult3[RelationComparisonResult3["ReportsMask"] = 24] = "ReportsMask";
|
|
3422
|
+
RelationComparisonResult3[RelationComparisonResult3["ComplexityOverflow"] = 32] = "ComplexityOverflow";
|
|
3423
|
+
RelationComparisonResult3[RelationComparisonResult3["StackDepthOverflow"] = 64] = "StackDepthOverflow";
|
|
3424
|
+
RelationComparisonResult3[RelationComparisonResult3["Overflow"] = 96] = "Overflow";
|
|
3423
3425
|
return RelationComparisonResult3;
|
|
3424
3426
|
})(RelationComparisonResult || {});
|
|
3425
3427
|
var GeneratedIdentifierFlags = /* @__PURE__ */ ((GeneratedIdentifierFlags2) => {
|
|
@@ -6372,7 +6374,6 @@ var Diagnostics = {
|
|
|
6372
6374
|
The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES5_Consider_using_a_standard_function_or_method: diag(2522, 1 /* Error */, "The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES5_Consider_using_a_sta_2522", "The 'arguments' object cannot be referenced in an async function or method in ES5. Consider using a standard function or method."),
|
|
6373
6375
|
yield_expressions_cannot_be_used_in_a_parameter_initializer: diag(2523, 1 /* Error */, "yield_expressions_cannot_be_used_in_a_parameter_initializer_2523", "'yield' expressions cannot be used in a parameter initializer."),
|
|
6374
6376
|
await_expressions_cannot_be_used_in_a_parameter_initializer: diag(2524, 1 /* Error */, "await_expressions_cannot_be_used_in_a_parameter_initializer_2524", "'await' expressions cannot be used in a parameter initializer."),
|
|
6375
|
-
Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value: diag(2525, 1 /* Error */, "Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value_2525", "Initializer provides no value for this binding element and the binding element has no default value."),
|
|
6376
6377
|
A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface: diag(2526, 1 /* Error */, "A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface_2526", "A 'this' type is available only in a non-static member of a class or interface."),
|
|
6377
6378
|
The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary: diag(2527, 1 /* Error */, "The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary_2527", "The inferred type of '{0}' references an inaccessible '{1}' type. A type annotation is necessary."),
|
|
6378
6379
|
A_module_cannot_have_multiple_default_exports: diag(2528, 1 /* Error */, "A_module_cannot_have_multiple_default_exports_2528", "A module cannot have multiple default exports."),
|
|
@@ -6685,6 +6686,9 @@ var Diagnostics = {
|
|
|
6685
6686
|
Import_0_conflicts_with_global_value_used_in_this_file_so_must_be_declared_with_a_type_only_import_when_isolatedModules_is_enabled: diag(2866, 1 /* Error */, "Import_0_conflicts_with_global_value_used_in_this_file_so_must_be_declared_with_a_type_only_import_w_2866", "Import '{0}' conflicts with global value used in this file, so must be declared with a type-only import when 'isolatedModules' is enabled."),
|
|
6686
6687
|
Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_Bun_Try_npm_i_save_dev_types_Slashbun: diag(2867, 1 /* Error */, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_Bun_Try_npm_i_save_dev_types_Slashbun_2867", "Cannot find name '{0}'. Do you need to install type definitions for Bun? Try `npm i --save-dev @types/bun`."),
|
|
6687
6688
|
Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_Bun_Try_npm_i_save_dev_types_Slashbun_and_then_add_bun_to_the_types_field_in_your_tsconfig: diag(2868, 1 /* Error */, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_Bun_Try_npm_i_save_dev_types_Slashbun_2868", "Cannot find name '{0}'. Do you need to install type definitions for Bun? Try `npm i --save-dev @types/bun` and then add 'bun' to the types field in your tsconfig."),
|
|
6689
|
+
This_expression_is_always_truthy_Did_you_mean_to_test_something_else: diag(2869, 1 /* Error */, "This_expression_is_always_truthy_Did_you_mean_to_test_something_else_2869", "This expression is always truthy. Did you mean to test something else?"),
|
|
6690
|
+
This_expression_is_always_falsy_Did_you_mean_to_test_something_else: diag(2870, 1 /* Error */, "This_expression_is_always_falsy_Did_you_mean_to_test_something_else_2870", "This expression is always falsy. Did you mean to test something else?"),
|
|
6691
|
+
Using_on_this_expression_appears_unintentional_because_it_always_evaluates_to_the_same_nullishness: diag(2871, 1 /* Error */, "Using_on_this_expression_appears_unintentional_because_it_always_evaluates_to_the_same_nullishness_2871", "Using ?? on this expression appears unintentional because it always evaluates to the same nullishness."),
|
|
6688
6692
|
Import_declaration_0_is_using_private_name_1: diag(4e3, 1 /* Error */, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
|
|
6689
6693
|
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, 1 /* Error */, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
|
|
6690
6694
|
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, 1 /* Error */, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
|
|
@@ -6761,7 +6765,7 @@ var Diagnostics = {
|
|
|
6761
6765
|
Extends_clause_for_inferred_type_0_has_or_is_using_private_name_1: diag(4085, 1 /* Error */, "Extends_clause_for_inferred_type_0_has_or_is_using_private_name_1_4085", "Extends clause for inferred type '{0}' has or is using private name '{1}'."),
|
|
6762
6766
|
Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: diag(4091, 1 /* Error */, "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4091", "Parameter '{0}' of index signature from exported interface has or is using name '{1}' from private module '{2}'."),
|
|
6763
6767
|
Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1: diag(4092, 1 /* Error */, "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1_4092", "Parameter '{0}' of index signature from exported interface has or is using private name '{1}'."),
|
|
6764
|
-
|
|
6768
|
+
Property_0_of_exported_anonymous_class_type_may_not_be_private_or_protected: diag(4094, 1 /* Error */, "Property_0_of_exported_anonymous_class_type_may_not_be_private_or_protected_4094", "Property '{0}' of exported anonymous class type may not be private or protected."),
|
|
6765
6769
|
Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4095, 1 /* Error */, "Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_4095", "Public static method '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named."),
|
|
6766
6770
|
Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: diag(4096, 1 /* Error */, "Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4096", "Public static method '{0}' of exported class has or is using name '{1}' from private module '{2}'."),
|
|
6767
6771
|
Public_static_method_0_of_exported_class_has_or_is_using_private_name_1: diag(4097, 1 /* Error */, "Public_static_method_0_of_exported_class_has_or_is_using_private_name_1_4097", "Public static method '{0}' of exported class has or is using private name '{1}'."),
|
|
@@ -6999,7 +7003,6 @@ var Diagnostics = {
|
|
|
6999
7003
|
Parse_in_strict_mode_and_emit_use_strict_for_each_source_file: diag(6141, 3 /* Message */, "Parse_in_strict_mode_and_emit_use_strict_for_each_source_file_6141", 'Parse in strict mode and emit "use strict" for each source file.'),
|
|
7000
7004
|
Module_0_was_resolved_to_1_but_jsx_is_not_set: diag(6142, 1 /* Error */, "Module_0_was_resolved_to_1_but_jsx_is_not_set_6142", "Module '{0}' was resolved to '{1}', but '--jsx' is not set."),
|
|
7001
7005
|
Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1: diag(6144, 3 /* Message */, "Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1_6144", "Module '{0}' was resolved as locally declared ambient module in file '{1}'."),
|
|
7002
|
-
Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified: diag(6145, 3 /* Message */, "Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified_6145", "Module '{0}' was resolved as ambient module declared in '{1}' since this file was not modified."),
|
|
7003
7006
|
Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h: diag(6146, 3 /* Message */, "Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h_6146", "Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'."),
|
|
7004
7007
|
Resolution_for_module_0_was_found_in_cache_from_location_1: diag(6147, 3 /* Message */, "Resolution_for_module_0_was_found_in_cache_from_location_1_6147", "Resolution for module '{0}' was found in cache from location '{1}'."),
|
|
7005
7008
|
Directory_0_does_not_exist_skipping_all_lookups_in_it: diag(6148, 3 /* Message */, "Directory_0_does_not_exist_skipping_all_lookups_in_it_6148", "Directory '{0}' does not exist, skipping all lookups in it."),
|
|
@@ -8550,6 +8553,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8550
8553
|
hasExtendedUnicodeEscape: () => (tokenFlags & 8 /* ExtendedUnicodeEscape */) !== 0,
|
|
8551
8554
|
hasPrecedingLineBreak: () => (tokenFlags & 1 /* PrecedingLineBreak */) !== 0,
|
|
8552
8555
|
hasPrecedingJSDocComment: () => (tokenFlags & 2 /* PrecedingJSDocComment */) !== 0,
|
|
8556
|
+
hasPrecedingJSDocLeadingAsterisks: () => (tokenFlags & 32768 /* PrecedingJSDocLeadingAsterisks */) !== 0,
|
|
8553
8557
|
isIdentifier: () => token === 80 /* Identifier */ || token > 118 /* LastReservedWord */,
|
|
8554
8558
|
isReservedWord: () => token >= 83 /* FirstReservedWord */ && token <= 118 /* LastReservedWord */,
|
|
8555
8559
|
isUnterminated: () => (tokenFlags & 4 /* Unterminated */) !== 0,
|
|
@@ -9190,7 +9194,6 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9190
9194
|
function scan() {
|
|
9191
9195
|
fullStartPos = pos;
|
|
9192
9196
|
tokenFlags = 0 /* None */;
|
|
9193
|
-
let asteriskSeen = false;
|
|
9194
9197
|
while (true) {
|
|
9195
9198
|
tokenStart = pos;
|
|
9196
9199
|
if (pos >= end) {
|
|
@@ -9306,8 +9309,8 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9306
9309
|
return pos += 2, token = 43 /* AsteriskAsteriskToken */;
|
|
9307
9310
|
}
|
|
9308
9311
|
pos++;
|
|
9309
|
-
if (skipJsDocLeadingAsterisks &&
|
|
9310
|
-
|
|
9312
|
+
if (skipJsDocLeadingAsterisks && (tokenFlags & 32768 /* PrecedingJSDocLeadingAsterisks */) === 0 && tokenFlags & 1 /* PrecedingLineBreak */) {
|
|
9313
|
+
tokenFlags |= 32768 /* PrecedingJSDocLeadingAsterisks */;
|
|
9311
9314
|
continue;
|
|
9312
9315
|
}
|
|
9313
9316
|
return token = 42 /* AsteriskToken */;
|
|
@@ -12745,7 +12748,7 @@ function getTokenPosOfNode(node, sourceFile, includeJsDoc) {
|
|
|
12745
12748
|
}
|
|
12746
12749
|
if (isJSDocNode(node) || node.kind === 12 /* JsxText */) {
|
|
12747
12750
|
return skipTrivia(
|
|
12748
|
-
(sourceFile
|
|
12751
|
+
(sourceFile ?? getSourceFileOfNode(node)).text,
|
|
12749
12752
|
node.pos,
|
|
12750
12753
|
/*stopAfterLineBreak*/
|
|
12751
12754
|
false,
|
|
@@ -12757,13 +12760,14 @@ function getTokenPosOfNode(node, sourceFile, includeJsDoc) {
|
|
|
12757
12760
|
return getTokenPosOfNode(node.jsDoc[0], sourceFile);
|
|
12758
12761
|
}
|
|
12759
12762
|
if (node.kind === 352 /* SyntaxList */) {
|
|
12760
|
-
|
|
12763
|
+
sourceFile ?? (sourceFile = getSourceFileOfNode(node));
|
|
12764
|
+
const first2 = firstOrUndefined(getNodeChildren(node, sourceFile));
|
|
12761
12765
|
if (first2) {
|
|
12762
12766
|
return getTokenPosOfNode(first2, sourceFile, includeJsDoc);
|
|
12763
12767
|
}
|
|
12764
12768
|
}
|
|
12765
12769
|
return skipTrivia(
|
|
12766
|
-
(sourceFile
|
|
12770
|
+
(sourceFile ?? getSourceFileOfNode(node)).text,
|
|
12767
12771
|
node.pos,
|
|
12768
12772
|
/*stopAfterLineBreak*/
|
|
12769
12773
|
false,
|
|
@@ -23511,7 +23515,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
23511
23515
|
}
|
|
23512
23516
|
function createSyntaxList(children) {
|
|
23513
23517
|
const node = createBaseNode(352 /* SyntaxList */);
|
|
23514
|
-
|
|
23518
|
+
node._children = children;
|
|
23515
23519
|
return node;
|
|
23516
23520
|
}
|
|
23517
23521
|
function createNotEmittedStatement(original) {
|
|
@@ -26287,17 +26291,31 @@ function isJSDocImportTag(node) {
|
|
|
26287
26291
|
}
|
|
26288
26292
|
|
|
26289
26293
|
// src/compiler/factory/nodeChildren.ts
|
|
26290
|
-
var
|
|
26291
|
-
function getNodeChildren(node) {
|
|
26292
|
-
|
|
26293
|
-
|
|
26294
|
+
var sourceFileToNodeChildren = /* @__PURE__ */ new WeakMap();
|
|
26295
|
+
function getNodeChildren(node, sourceFile) {
|
|
26296
|
+
var _a;
|
|
26297
|
+
const kind = node.kind;
|
|
26298
|
+
if (!isNodeKind(kind)) {
|
|
26299
|
+
return emptyArray;
|
|
26300
|
+
}
|
|
26301
|
+
if (kind === 352 /* SyntaxList */) {
|
|
26302
|
+
return node._children;
|
|
26303
|
+
}
|
|
26304
|
+
return (_a = sourceFileToNodeChildren.get(sourceFile)) == null ? void 0 : _a.get(node);
|
|
26294
26305
|
}
|
|
26295
|
-
function
|
|
26296
|
-
|
|
26297
|
-
|
|
26306
|
+
function unsetNodeChildren(node, origSourceFile) {
|
|
26307
|
+
var _a;
|
|
26308
|
+
if (node.kind === 352 /* SyntaxList */) {
|
|
26309
|
+
Debug.fail("Did not expect to unset the children of a SyntaxList.");
|
|
26310
|
+
}
|
|
26311
|
+
(_a = sourceFileToNodeChildren.get(origSourceFile)) == null ? void 0 : _a.delete(node);
|
|
26298
26312
|
}
|
|
26299
|
-
function
|
|
26300
|
-
|
|
26313
|
+
function transferSourceFileChildren(sourceFile, targetSourceFile) {
|
|
26314
|
+
const map2 = sourceFileToNodeChildren.get(sourceFile);
|
|
26315
|
+
if (map2 !== void 0) {
|
|
26316
|
+
sourceFileToNodeChildren.delete(sourceFile);
|
|
26317
|
+
sourceFileToNodeChildren.set(targetSourceFile, map2);
|
|
26318
|
+
}
|
|
26301
26319
|
}
|
|
26302
26320
|
|
|
26303
26321
|
// src/compiler/factory/utilities.ts
|
|
@@ -28933,7 +28951,7 @@ var Parser;
|
|
|
28933
28951
|
function createIdentifier(isIdentifier3, diagnosticMessage, privateIdentifierDiagnosticMessage) {
|
|
28934
28952
|
if (isIdentifier3) {
|
|
28935
28953
|
identifierCount++;
|
|
28936
|
-
const pos = getNodePos();
|
|
28954
|
+
const pos = scanner.hasPrecedingJSDocLeadingAsterisks() ? scanner.getTokenStart() : getNodePos();
|
|
28937
28955
|
const originalKeywordKind = token();
|
|
28938
28956
|
const text = internIdentifier(scanner.getTokenValue());
|
|
28939
28957
|
const hasExtendedUnicodeEscape = scanner.hasExtendedUnicodeEscape();
|
|
@@ -34887,6 +34905,7 @@ var IncrementalParser;
|
|
|
34887
34905
|
aggressiveChecks
|
|
34888
34906
|
);
|
|
34889
34907
|
result.impliedNodeFormat = sourceFile.impliedNodeFormat;
|
|
34908
|
+
transferSourceFileChildren(sourceFile, result);
|
|
34890
34909
|
return result;
|
|
34891
34910
|
}
|
|
34892
34911
|
IncrementalParser2.updateSourceFile = updateSourceFile;
|
|
@@ -34922,7 +34941,7 @@ var IncrementalParser;
|
|
|
34922
34941
|
}
|
|
34923
34942
|
}
|
|
34924
34943
|
}
|
|
34925
|
-
function moveElementEntirelyPastChangeRange(element, isArray2, delta, oldText, newText, aggressiveChecks) {
|
|
34944
|
+
function moveElementEntirelyPastChangeRange(element, origSourceFile, isArray2, delta, oldText, newText, aggressiveChecks) {
|
|
34926
34945
|
if (isArray2) {
|
|
34927
34946
|
visitArray2(element);
|
|
34928
34947
|
} else {
|
|
@@ -34934,7 +34953,7 @@ var IncrementalParser;
|
|
|
34934
34953
|
if (aggressiveChecks && shouldCheckNode(node)) {
|
|
34935
34954
|
text = oldText.substring(node.pos, node.end);
|
|
34936
34955
|
}
|
|
34937
|
-
unsetNodeChildren(node);
|
|
34956
|
+
unsetNodeChildren(node, origSourceFile);
|
|
34938
34957
|
setTextRangePosEnd(node, node.pos + delta, node.end + delta);
|
|
34939
34958
|
if (aggressiveChecks && shouldCheckNode(node)) {
|
|
34940
34959
|
Debug.assert(text === newText.substring(node.pos, node.end));
|
|
@@ -35008,6 +35027,7 @@ var IncrementalParser;
|
|
|
35008
35027
|
if (child.pos > changeRangeOldEnd) {
|
|
35009
35028
|
moveElementEntirelyPastChangeRange(
|
|
35010
35029
|
child,
|
|
35030
|
+
sourceFile,
|
|
35011
35031
|
/*isArray*/
|
|
35012
35032
|
false,
|
|
35013
35033
|
delta,
|
|
@@ -35020,7 +35040,7 @@ var IncrementalParser;
|
|
|
35020
35040
|
const fullEnd = child.end;
|
|
35021
35041
|
if (fullEnd >= changeStart) {
|
|
35022
35042
|
markAsIntersectingIncrementalChange(child);
|
|
35023
|
-
unsetNodeChildren(child);
|
|
35043
|
+
unsetNodeChildren(child, sourceFile);
|
|
35024
35044
|
adjustIntersectingElement(child, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta);
|
|
35025
35045
|
forEachChild(child, visitNode3, visitArray2);
|
|
35026
35046
|
if (hasJSDocNodes(child)) {
|
|
@@ -35038,6 +35058,7 @@ var IncrementalParser;
|
|
|
35038
35058
|
if (array.pos > changeRangeOldEnd) {
|
|
35039
35059
|
moveElementEntirelyPastChangeRange(
|
|
35040
35060
|
array,
|
|
35061
|
+
sourceFile,
|
|
35041
35062
|
/*isArray*/
|
|
35042
35063
|
true,
|
|
35043
35064
|
delta,
|
|
@@ -36060,6 +36081,7 @@ var commandOptionsWithoutBuild = [
|
|
|
36060
36081
|
type: "boolean",
|
|
36061
36082
|
affectsEmit: true,
|
|
36062
36083
|
affectsBuildInfo: true,
|
|
36084
|
+
affectsSourceFile: true,
|
|
36063
36085
|
category: Diagnostics.Emit,
|
|
36064
36086
|
description: Diagnostics.Allow_importing_helper_functions_from_tslib_once_per_project_instead_of_including_them_per_file,
|
|
36065
36087
|
defaultValueDescription: false
|
|
@@ -36524,6 +36546,7 @@ var commandOptionsWithoutBuild = [
|
|
|
36524
36546
|
affectsEmit: true,
|
|
36525
36547
|
affectsBuildInfo: true,
|
|
36526
36548
|
affectsModuleResolution: true,
|
|
36549
|
+
affectsSourceFile: true,
|
|
36527
36550
|
category: Diagnostics.Language_and_Environment,
|
|
36528
36551
|
description: Diagnostics.Specify_module_specifier_used_to_import_the_JSX_factory_functions_when_using_jsx_Colon_react_jsx_Asterisk,
|
|
36529
36552
|
defaultValueDescription: "react"
|
|
@@ -45499,13 +45522,6 @@ function createTypeChecker(host) {
|
|
|
45499
45522
|
/*withAugmentations*/
|
|
45500
45523
|
true
|
|
45501
45524
|
),
|
|
45502
|
-
tryFindAmbientModuleWithoutAugmentations: (moduleName) => {
|
|
45503
|
-
return tryFindAmbientModule(
|
|
45504
|
-
moduleName,
|
|
45505
|
-
/*withAugmentations*/
|
|
45506
|
-
false
|
|
45507
|
-
);
|
|
45508
|
-
},
|
|
45509
45525
|
getApparentType,
|
|
45510
45526
|
getUnionType,
|
|
45511
45527
|
isTypeAssignableTo,
|
|
@@ -46048,6 +46064,7 @@ function createTypeChecker(host) {
|
|
|
46048
46064
|
};
|
|
46049
46065
|
var amalgamatedDuplicates;
|
|
46050
46066
|
var reverseMappedCache = /* @__PURE__ */ new Map();
|
|
46067
|
+
var reverseHomomorphicMappedCache = /* @__PURE__ */ new Map();
|
|
46051
46068
|
var ambientModulesCache;
|
|
46052
46069
|
var patternAmbientModules;
|
|
46053
46070
|
var patternAmbientModuleAugmentations;
|
|
@@ -46118,6 +46135,7 @@ function createTypeChecker(host) {
|
|
|
46118
46135
|
var contextualTypes = [];
|
|
46119
46136
|
var contextualIsCache = [];
|
|
46120
46137
|
var contextualTypeCount = 0;
|
|
46138
|
+
var contextualBindingPatterns = [];
|
|
46121
46139
|
var inferenceContextNodes = [];
|
|
46122
46140
|
var inferenceContexts = [];
|
|
46123
46141
|
var inferenceContextCount = 0;
|
|
@@ -49412,11 +49430,11 @@ function createTypeChecker(host) {
|
|
|
49412
49430
|
function tryReuseExistingTypeNode(context, typeNode, type, host2, addUndefined) {
|
|
49413
49431
|
const originalType = type;
|
|
49414
49432
|
if (addUndefined) {
|
|
49415
|
-
type = getOptionalType(type);
|
|
49433
|
+
type = getOptionalType(type, !isParameter(host2));
|
|
49416
49434
|
}
|
|
49417
49435
|
const clone = tryReuseExistingNonParameterTypeNode(context, typeNode, type, host2);
|
|
49418
49436
|
if (clone) {
|
|
49419
|
-
if (addUndefined && !someType(getTypeFromTypeNode2(context, typeNode), (t) => !!(t.flags & 32768 /* Undefined */))) {
|
|
49437
|
+
if (addUndefined && containsNonMissingUndefinedType(type) && !someType(getTypeFromTypeNode2(context, typeNode), (t) => !!(t.flags & 32768 /* Undefined */))) {
|
|
49420
49438
|
return factory.createUnionTypeNode([clone, factory.createKeywordTypeNode(157 /* UndefinedKeyword */)]);
|
|
49421
49439
|
}
|
|
49422
49440
|
return clone;
|
|
@@ -50276,7 +50294,21 @@ function createTypeChecker(host) {
|
|
|
50276
50294
|
}
|
|
50277
50295
|
function shouldUsePlaceholderForProperty(propertySymbol, context) {
|
|
50278
50296
|
var _a;
|
|
50279
|
-
|
|
50297
|
+
const depth = 3;
|
|
50298
|
+
return !!(getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */) && (contains(context.reverseMappedStack, propertySymbol) || ((_a = context.reverseMappedStack) == null ? void 0 : _a[0]) && !(getObjectFlags(last(context.reverseMappedStack).links.propertyType) & 16 /* Anonymous */) || isDeeplyNestedReverseMappedTypeProperty());
|
|
50299
|
+
function isDeeplyNestedReverseMappedTypeProperty() {
|
|
50300
|
+
var _a2;
|
|
50301
|
+
if ((((_a2 = context.reverseMappedStack) == null ? void 0 : _a2.length) ?? 0) < depth) {
|
|
50302
|
+
return false;
|
|
50303
|
+
}
|
|
50304
|
+
for (let i = 0; i < depth; i++) {
|
|
50305
|
+
const prop = context.reverseMappedStack[context.reverseMappedStack.length - 1 - i];
|
|
50306
|
+
if (prop.links.mappedType.symbol !== propertySymbol.links.mappedType.symbol) {
|
|
50307
|
+
return false;
|
|
50308
|
+
}
|
|
50309
|
+
}
|
|
50310
|
+
return true;
|
|
50311
|
+
}
|
|
50280
50312
|
}
|
|
50281
50313
|
function addPropertyToElementList(propertySymbol, context, typeElements) {
|
|
50282
50314
|
var _a;
|
|
@@ -51363,8 +51395,8 @@ function createTypeChecker(host) {
|
|
|
51363
51395
|
return enclosingDeclaration;
|
|
51364
51396
|
}
|
|
51365
51397
|
function serializeTypeForDeclaration(context, declaration, type, symbol) {
|
|
51366
|
-
var _a;
|
|
51367
|
-
const
|
|
51398
|
+
var _a, _b;
|
|
51399
|
+
const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration);
|
|
51368
51400
|
const enclosingDeclaration = context.enclosingDeclaration;
|
|
51369
51401
|
const oldFlags = context.flags;
|
|
51370
51402
|
if (declaration && hasInferredType(declaration) && !(context.flags & -2147483648 /* NoSyntacticPrinter */)) {
|
|
@@ -51375,6 +51407,7 @@ function createTypeChecker(host) {
|
|
|
51375
51407
|
const declWithExistingAnnotation = declaration && getNonlocalEffectiveTypeAnnotationNode(declaration) ? declaration : getDeclarationWithTypeAnnotation(symbol);
|
|
51376
51408
|
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
|
|
51377
51409
|
const existing = getNonlocalEffectiveTypeAnnotationNode(declWithExistingAnnotation);
|
|
51410
|
+
const addUndefined = addUndefinedForParameter || !!(symbol.flags & 4 /* Property */ && symbol.flags & 16777216 /* Optional */ && isOptionalDeclaration(declWithExistingAnnotation) && ((_a = symbol.links) == null ? void 0 : _a.mappedType) && containsNonMissingUndefinedType(type));
|
|
51378
51411
|
const result2 = !isTypePredicateNode(existing) && tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined);
|
|
51379
51412
|
if (result2) {
|
|
51380
51413
|
context.flags = oldFlags;
|
|
@@ -51385,9 +51418,9 @@ function createTypeChecker(host) {
|
|
|
51385
51418
|
if (type.flags & 8192 /* UniqueESSymbol */ && type.symbol === symbol && (!context.enclosingDeclaration || some(symbol.declarations, (d) => getSourceFileOfNode(d) === getSourceFileOfNode(context.enclosingDeclaration)))) {
|
|
51386
51419
|
context.flags |= 1048576 /* AllowUniqueESSymbolType */;
|
|
51387
51420
|
}
|
|
51388
|
-
const decl = declaration ?? symbol.valueDeclaration ?? ((
|
|
51421
|
+
const decl = declaration ?? symbol.valueDeclaration ?? ((_b = symbol.declarations) == null ? void 0 : _b[0]);
|
|
51389
51422
|
const expr = decl && isDeclarationWithPossibleInnerTypeNodeReuse(decl) ? getPossibleTypeNodeReuseExpression(decl) : void 0;
|
|
51390
|
-
const result = expressionOrTypeToTypeNode(context, expr, type,
|
|
51423
|
+
const result = expressionOrTypeToTypeNode(context, expr, type, addUndefinedForParameter);
|
|
51391
51424
|
context.flags = oldFlags;
|
|
51392
51425
|
return result;
|
|
51393
51426
|
}
|
|
@@ -51422,7 +51455,7 @@ function createTypeChecker(host) {
|
|
|
51422
51455
|
const typePredicate = getTypePredicateOfSignature(signature);
|
|
51423
51456
|
const type = getReturnTypeOfSignature(signature);
|
|
51424
51457
|
if (context.enclosingDeclaration && (!isErrorType(type) || context.flags & 1 /* AllowUnresolvedNames */) && signature.declaration && !nodeIsSynthesized(signature.declaration)) {
|
|
51425
|
-
const annotation =
|
|
51458
|
+
const annotation = getNonlocalEffectiveReturnTypeAnnotationNode(signature.declaration);
|
|
51426
51459
|
if (annotation) {
|
|
51427
51460
|
const result = tryReuseExistingTypeNode(context, annotation, type, context.enclosingDeclaration);
|
|
51428
51461
|
if (result) {
|
|
@@ -51918,7 +51951,10 @@ function createTypeChecker(host) {
|
|
|
51918
51951
|
);
|
|
51919
51952
|
}
|
|
51920
51953
|
if (isNamedDeclaration(node) && node.name.kind === 167 /* ComputedPropertyName */ && !isLateBindableName(node.name)) {
|
|
51921
|
-
if (!
|
|
51954
|
+
if (!hasDynamicName(node)) {
|
|
51955
|
+
return visitEachChild2(node, visitExistingNodeTreeSymbols);
|
|
51956
|
+
}
|
|
51957
|
+
if (!(context.flags & 1 /* AllowUnresolvedNames */ && isEntityNameExpression(node.name.expression) && checkComputedPropertyName(node.name).flags & 1 /* Any */)) {
|
|
51922
51958
|
return void 0;
|
|
51923
51959
|
}
|
|
51924
51960
|
}
|
|
@@ -54124,6 +54160,7 @@ function createTypeChecker(host) {
|
|
|
54124
54160
|
} else if (strictNullChecks && pattern.parent.initializer && !hasTypeFacts(getTypeOfInitializer(pattern.parent.initializer), 65536 /* EQUndefined */)) {
|
|
54125
54161
|
parentType = getTypeWithFacts(parentType, 524288 /* NEUndefined */);
|
|
54126
54162
|
}
|
|
54163
|
+
const accessFlags = 32 /* ExpressionPosition */ | (noTupleBoundsCheck || hasDefaultValue(declaration) ? 16 /* AllowMissing */ : 0);
|
|
54127
54164
|
let type;
|
|
54128
54165
|
if (pattern.kind === 206 /* ObjectBindingPattern */) {
|
|
54129
54166
|
if (declaration.dotDotDotToken) {
|
|
@@ -54142,7 +54179,7 @@ function createTypeChecker(host) {
|
|
|
54142
54179
|
} else {
|
|
54143
54180
|
const name = declaration.propertyName || declaration.name;
|
|
54144
54181
|
const indexType = getLiteralTypeFromPropertyName(name);
|
|
54145
|
-
const declaredType = getIndexedAccessType(parentType, indexType,
|
|
54182
|
+
const declaredType = getIndexedAccessType(parentType, indexType, accessFlags, name);
|
|
54146
54183
|
type = getFlowTypeOfDestructuring(declaration, declaredType);
|
|
54147
54184
|
}
|
|
54148
54185
|
} else {
|
|
@@ -54153,7 +54190,6 @@ function createTypeChecker(host) {
|
|
|
54153
54190
|
type = everyType(baseConstraint, isTupleType) ? mapType(baseConstraint, (t) => sliceTupleType(t, index)) : createArrayType(elementType);
|
|
54154
54191
|
} else if (isArrayLikeType(parentType)) {
|
|
54155
54192
|
const indexType = getNumberLiteralType(index);
|
|
54156
|
-
const accessFlags = 32 /* ExpressionPosition */ | (noTupleBoundsCheck || hasDefaultValue(declaration) ? 16 /* NoTupleBoundsCheck */ : 0);
|
|
54157
54193
|
const declaredType = getIndexedAccessTypeOrUndefined(parentType, indexType, accessFlags, declaration.name) || errorType;
|
|
54158
54194
|
type = getFlowTypeOfDestructuring(declaration, declaredType);
|
|
54159
54195
|
} else {
|
|
@@ -54639,7 +54675,7 @@ function createTypeChecker(host) {
|
|
|
54639
54675
|
/*reportErrors*/
|
|
54640
54676
|
false
|
|
54641
54677
|
) : unknownType;
|
|
54642
|
-
return addOptionality(widenTypeInferredFromInitializer(element, checkDeclarationInitializer(element,
|
|
54678
|
+
return addOptionality(widenTypeInferredFromInitializer(element, checkDeclarationInitializer(element, 0 /* Normal */, contextualType)));
|
|
54643
54679
|
}
|
|
54644
54680
|
if (isBindingPattern(element.name)) {
|
|
54645
54681
|
return getTypeFromBindingPattern(element.name, includePatternInType, reportErrors2);
|
|
@@ -54710,7 +54746,10 @@ function createTypeChecker(host) {
|
|
|
54710
54746
|
return result;
|
|
54711
54747
|
}
|
|
54712
54748
|
function getTypeFromBindingPattern(pattern, includePatternInType = false, reportErrors2 = false) {
|
|
54713
|
-
|
|
54749
|
+
if (includePatternInType) contextualBindingPatterns.push(pattern);
|
|
54750
|
+
const result = pattern.kind === 206 /* ObjectBindingPattern */ ? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors2) : getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors2);
|
|
54751
|
+
if (includePatternInType) contextualBindingPatterns.pop();
|
|
54752
|
+
return result;
|
|
54714
54753
|
}
|
|
54715
54754
|
function getWidenedTypeForVariableLikeDeclaration(declaration, reportErrors2) {
|
|
54716
54755
|
return widenTypeForVariableLikeDeclaration(getTypeForVariableLikeDeclaration(
|
|
@@ -54791,18 +54830,18 @@ function createTypeChecker(host) {
|
|
|
54791
54830
|
}
|
|
54792
54831
|
return false;
|
|
54793
54832
|
}
|
|
54794
|
-
function getTypeOfVariableOrParameterOrProperty(symbol
|
|
54833
|
+
function getTypeOfVariableOrParameterOrProperty(symbol) {
|
|
54795
54834
|
const links = getSymbolLinks(symbol);
|
|
54796
54835
|
if (!links.type) {
|
|
54797
|
-
const type = getTypeOfVariableOrParameterOrPropertyWorker(symbol
|
|
54798
|
-
if (!links.type && !isParameterOfContextSensitiveSignature(symbol)
|
|
54836
|
+
const type = getTypeOfVariableOrParameterOrPropertyWorker(symbol);
|
|
54837
|
+
if (!links.type && !isParameterOfContextSensitiveSignature(symbol)) {
|
|
54799
54838
|
links.type = type;
|
|
54800
54839
|
}
|
|
54801
54840
|
return type;
|
|
54802
54841
|
}
|
|
54803
54842
|
return links.type;
|
|
54804
54843
|
}
|
|
54805
|
-
function getTypeOfVariableOrParameterOrPropertyWorker(symbol
|
|
54844
|
+
function getTypeOfVariableOrParameterOrPropertyWorker(symbol) {
|
|
54806
54845
|
if (symbol.flags & 4194304 /* Prototype */) {
|
|
54807
54846
|
return getTypeOfPrototypeProperty(symbol);
|
|
54808
54847
|
}
|
|
@@ -54837,9 +54876,6 @@ function createTypeChecker(host) {
|
|
|
54837
54876
|
if (symbol.flags & 512 /* ValueModule */ && !(symbol.flags & 67108864 /* Assignment */)) {
|
|
54838
54877
|
return getTypeOfFuncClassEnumModule(symbol);
|
|
54839
54878
|
}
|
|
54840
|
-
if (isBindingElement(declaration) && checkMode === 1 /* Contextual */) {
|
|
54841
|
-
return errorType;
|
|
54842
|
-
}
|
|
54843
54879
|
return reportCircularityError(symbol);
|
|
54844
54880
|
}
|
|
54845
54881
|
let type;
|
|
@@ -54877,9 +54913,6 @@ function createTypeChecker(host) {
|
|
|
54877
54913
|
if (symbol.flags & 512 /* ValueModule */ && !(symbol.flags & 67108864 /* Assignment */)) {
|
|
54878
54914
|
return getTypeOfFuncClassEnumModule(symbol);
|
|
54879
54915
|
}
|
|
54880
|
-
if (isBindingElement(declaration) && checkMode === 1 /* Contextual */) {
|
|
54881
|
-
return type;
|
|
54882
|
-
}
|
|
54883
54916
|
return reportCircularityError(symbol);
|
|
54884
54917
|
}
|
|
54885
54918
|
return type;
|
|
@@ -55108,7 +55141,7 @@ function createTypeChecker(host) {
|
|
|
55108
55141
|
}
|
|
55109
55142
|
return getTypeOfSymbol(symbol);
|
|
55110
55143
|
}
|
|
55111
|
-
function getTypeOfSymbol(symbol
|
|
55144
|
+
function getTypeOfSymbol(symbol) {
|
|
55112
55145
|
const checkFlags = getCheckFlags(symbol);
|
|
55113
55146
|
if (checkFlags & 65536 /* DeferredType */) {
|
|
55114
55147
|
return getTypeOfSymbolWithDeferredType(symbol);
|
|
@@ -55123,7 +55156,7 @@ function createTypeChecker(host) {
|
|
|
55123
55156
|
return getTypeOfReverseMappedSymbol(symbol);
|
|
55124
55157
|
}
|
|
55125
55158
|
if (symbol.flags & (3 /* Variable */ | 4 /* Property */)) {
|
|
55126
|
-
return getTypeOfVariableOrParameterOrProperty(symbol
|
|
55159
|
+
return getTypeOfVariableOrParameterOrProperty(symbol);
|
|
55127
55160
|
}
|
|
55128
55161
|
if (symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 384 /* Enum */ | 512 /* ValueModule */)) {
|
|
55129
55162
|
return getTypeOfFuncClassEnumModule(symbol);
|
|
@@ -58009,7 +58042,7 @@ function createTypeChecker(host) {
|
|
|
58009
58042
|
);
|
|
58010
58043
|
}
|
|
58011
58044
|
function createSignatureTypeMapper(signature, typeArguments) {
|
|
58012
|
-
return createTypeMapper(signature.typeParameters, typeArguments);
|
|
58045
|
+
return createTypeMapper(sameMap(signature.typeParameters, (tp) => tp.mapper ? instantiateType(tp, tp.mapper) : tp), typeArguments);
|
|
58013
58046
|
}
|
|
58014
58047
|
function getErasedSignature(signature) {
|
|
58015
58048
|
return signature.typeParameters ? signature.erasedSignatureCache || (signature.erasedSignatureCache = createErasedSignature(signature)) : signature;
|
|
@@ -60273,7 +60306,7 @@ function createTypeChecker(host) {
|
|
|
60273
60306
|
}
|
|
60274
60307
|
if (everyType(objectType, isTupleType) && isNumericLiteralName(propName)) {
|
|
60275
60308
|
const index = +propName;
|
|
60276
|
-
if (accessNode && everyType(objectType, (t) => !(t.target.combinedFlags & 12 /* Variable */)) && !(accessFlags & 16 /*
|
|
60309
|
+
if (accessNode && everyType(objectType, (t) => !(t.target.combinedFlags & 12 /* Variable */)) && !(accessFlags & 16 /* AllowMissing */)) {
|
|
60277
60310
|
const indexNode = getIndexNodeForAccessExpression(accessNode);
|
|
60278
60311
|
if (isTupleType(objectType)) {
|
|
60279
60312
|
if (index < 0) {
|
|
@@ -60412,6 +60445,9 @@ function createTypeChecker(host) {
|
|
|
60412
60445
|
return void 0;
|
|
60413
60446
|
}
|
|
60414
60447
|
}
|
|
60448
|
+
if (accessFlags & 16 /* AllowMissing */ && isObjectLiteralType(objectType)) {
|
|
60449
|
+
return undefinedType;
|
|
60450
|
+
}
|
|
60415
60451
|
if (isJSLiteralType(objectType)) {
|
|
60416
60452
|
return anyType;
|
|
60417
60453
|
}
|
|
@@ -62665,6 +62701,10 @@ function createTypeChecker(host) {
|
|
|
62665
62701
|
function containsUndefinedType(type) {
|
|
62666
62702
|
return !!((type.flags & 1048576 /* Union */ ? type.types[0] : type).flags & 32768 /* Undefined */);
|
|
62667
62703
|
}
|
|
62704
|
+
function containsNonMissingUndefinedType(type) {
|
|
62705
|
+
const candidate = type.flags & 1048576 /* Union */ ? type.types[0] : type;
|
|
62706
|
+
return !!(candidate.flags & 32768 /* Undefined */) && candidate !== missingType;
|
|
62707
|
+
}
|
|
62668
62708
|
function isStringIndexSignatureOnlyType(type) {
|
|
62669
62709
|
return type.flags & 524288 /* Object */ && !isGenericMappedType(type) && getPropertiesOfType(type).length === 0 && getIndexInfosOfType(type).length === 1 && !!getIndexInfoOfType(type, stringType) || type.flags & 3145728 /* UnionOrIntersection */ && every(type.types, isStringIndexSignatureOnlyType) || false;
|
|
62670
62710
|
}
|
|
@@ -62679,7 +62719,7 @@ function createTypeChecker(host) {
|
|
|
62679
62719
|
}
|
|
62680
62720
|
const id = getSymbolId(sourceSymbol) + "," + getSymbolId(targetSymbol);
|
|
62681
62721
|
const entry = enumRelation.get(id);
|
|
62682
|
-
if (entry !== void 0 && !(
|
|
62722
|
+
if (entry !== void 0 && !(entry & 2 /* Failed */ && errorReporter)) {
|
|
62683
62723
|
return !!(entry & 1 /* Succeeded */);
|
|
62684
62724
|
}
|
|
62685
62725
|
const targetEnumType = getTypeOfSymbol(targetSymbol);
|
|
@@ -62694,10 +62734,8 @@ function createTypeChecker(host) {
|
|
|
62694
62734
|
void 0,
|
|
62695
62735
|
64 /* UseFullyQualifiedType */
|
|
62696
62736
|
));
|
|
62697
|
-
enumRelation.set(id, 2 /* Failed */ | 4 /* Reported */);
|
|
62698
|
-
} else {
|
|
62699
|
-
enumRelation.set(id, 2 /* Failed */);
|
|
62700
62737
|
}
|
|
62738
|
+
enumRelation.set(id, 2 /* Failed */);
|
|
62701
62739
|
return false;
|
|
62702
62740
|
}
|
|
62703
62741
|
const sourceValue = getEnumMemberValue(getDeclarationOfKind(sourceProperty, 306 /* EnumMember */)).value;
|
|
@@ -62706,26 +62744,22 @@ function createTypeChecker(host) {
|
|
|
62706
62744
|
const sourceIsString = typeof sourceValue === "string";
|
|
62707
62745
|
const targetIsString = typeof targetValue === "string";
|
|
62708
62746
|
if (sourceValue !== void 0 && targetValue !== void 0) {
|
|
62709
|
-
if (
|
|
62710
|
-
enumRelation.set(id, 2 /* Failed */);
|
|
62711
|
-
} else {
|
|
62747
|
+
if (errorReporter) {
|
|
62712
62748
|
const escapedSource = sourceIsString ? `"${escapeString(sourceValue)}"` : sourceValue;
|
|
62713
62749
|
const escapedTarget = targetIsString ? `"${escapeString(targetValue)}"` : targetValue;
|
|
62714
62750
|
errorReporter(Diagnostics.Each_declaration_of_0_1_differs_in_its_value_where_2_was_expected_but_3_was_given, symbolName(targetSymbol), symbolName(targetProperty), escapedTarget, escapedSource);
|
|
62715
|
-
enumRelation.set(id, 2 /* Failed */ | 4 /* Reported */);
|
|
62716
62751
|
}
|
|
62752
|
+
enumRelation.set(id, 2 /* Failed */);
|
|
62717
62753
|
return false;
|
|
62718
62754
|
}
|
|
62719
62755
|
if (sourceIsString || targetIsString) {
|
|
62720
|
-
if (
|
|
62721
|
-
enumRelation.set(id, 2 /* Failed */);
|
|
62722
|
-
} else {
|
|
62756
|
+
if (errorReporter) {
|
|
62723
62757
|
const knownStringValue = sourceValue ?? targetValue;
|
|
62724
62758
|
Debug.assert(typeof knownStringValue === "string");
|
|
62725
62759
|
const escapedValue = `"${escapeString(knownStringValue)}"`;
|
|
62726
62760
|
errorReporter(Diagnostics.One_value_of_0_1_is_the_string_2_and_the_other_is_assumed_to_be_an_unknown_numeric_value, symbolName(targetSymbol), symbolName(targetProperty), escapedValue);
|
|
62727
|
-
enumRelation.set(id, 2 /* Failed */ | 4 /* Reported */);
|
|
62728
62761
|
}
|
|
62762
|
+
enumRelation.set(id, 2 /* Failed */);
|
|
62729
62763
|
return false;
|
|
62730
62764
|
}
|
|
62731
62765
|
}
|
|
@@ -62883,7 +62917,7 @@ function createTypeChecker(host) {
|
|
|
62883
62917
|
/*ignoreConstraints*/
|
|
62884
62918
|
false
|
|
62885
62919
|
);
|
|
62886
|
-
relation.set(id,
|
|
62920
|
+
relation.set(id, 2 /* Failed */ | (relationCount <= 0 ? 32 /* ComplexityOverflow */ : 64 /* StackDepthOverflow */));
|
|
62887
62921
|
(_a = tracing) == null ? void 0 : _a.instant(tracing.Phase.CheckTypes, "checkTypeRelatedTo_DepthLimit", { sourceId: source.id, targetId: target.id, depth: sourceDepth, targetDepth });
|
|
62888
62922
|
const message = relationCount <= 0 ? Diagnostics.Excessive_complexity_comparing_types_0_and_1 : Diagnostics.Excessive_stack_depth_comparing_types_0_and_1;
|
|
62889
62923
|
const diag2 = error(errorNode || currentNode, message, typeToString(source), typeToString(target));
|
|
@@ -63736,7 +63770,7 @@ function createTypeChecker(host) {
|
|
|
63736
63770
|
);
|
|
63737
63771
|
const entry = relation.get(id);
|
|
63738
63772
|
if (entry !== void 0) {
|
|
63739
|
-
if (reportErrors2 && entry & 2 /* Failed */ && !(entry &
|
|
63773
|
+
if (reportErrors2 && entry & 2 /* Failed */ && !(entry & 96 /* Overflow */)) {
|
|
63740
63774
|
} else {
|
|
63741
63775
|
if (outofbandVarianceMarkerHandler) {
|
|
63742
63776
|
const saved = entry & 24 /* ReportsMask */;
|
|
@@ -63747,6 +63781,11 @@ function createTypeChecker(host) {
|
|
|
63747
63781
|
instantiateType(source2, reportUnreliableMapper);
|
|
63748
63782
|
}
|
|
63749
63783
|
}
|
|
63784
|
+
if (reportErrors2 && entry & 96 /* Overflow */) {
|
|
63785
|
+
const message = entry & 32 /* ComplexityOverflow */ ? Diagnostics.Excessive_complexity_comparing_types_0_and_1 : Diagnostics.Excessive_stack_depth_comparing_types_0_and_1;
|
|
63786
|
+
reportError(message, typeToString(source2), typeToString(target2));
|
|
63787
|
+
overrideNextErrorInfo++;
|
|
63788
|
+
}
|
|
63750
63789
|
return entry & 1 /* Succeeded */ ? -1 /* True */ : 0 /* False */;
|
|
63751
63790
|
}
|
|
63752
63791
|
}
|
|
@@ -63844,7 +63883,7 @@ function createTypeChecker(host) {
|
|
|
63844
63883
|
}
|
|
63845
63884
|
}
|
|
63846
63885
|
} else {
|
|
63847
|
-
relation.set(id,
|
|
63886
|
+
relation.set(id, 2 /* Failed */ | propagatingVarianceFlags);
|
|
63848
63887
|
relationCount--;
|
|
63849
63888
|
resetMaybeStack(
|
|
63850
63889
|
/*markAllAsSucceeded*/
|
|
@@ -66314,11 +66353,11 @@ function createTypeChecker(host) {
|
|
|
66314
66353
|
}
|
|
66315
66354
|
function inferTypeForHomomorphicMappedType(source, target, constraint) {
|
|
66316
66355
|
const cacheKey = source.id + "," + target.id + "," + constraint.id;
|
|
66317
|
-
if (
|
|
66318
|
-
return
|
|
66356
|
+
if (reverseHomomorphicMappedCache.has(cacheKey)) {
|
|
66357
|
+
return reverseHomomorphicMappedCache.get(cacheKey);
|
|
66319
66358
|
}
|
|
66320
66359
|
const type = createReverseMappedType(source, target, constraint);
|
|
66321
|
-
|
|
66360
|
+
reverseHomomorphicMappedCache.set(cacheKey, type);
|
|
66322
66361
|
return type;
|
|
66323
66362
|
}
|
|
66324
66363
|
function isPartiallyInferableType(type) {
|
|
@@ -69880,9 +69919,9 @@ function createTypeChecker(host) {
|
|
|
69880
69919
|
);
|
|
69881
69920
|
}
|
|
69882
69921
|
}
|
|
69883
|
-
function getNarrowedTypeOfSymbol(symbol, location
|
|
69922
|
+
function getNarrowedTypeOfSymbol(symbol, location) {
|
|
69884
69923
|
var _a;
|
|
69885
|
-
const type = getTypeOfSymbol(symbol
|
|
69924
|
+
const type = getTypeOfSymbol(symbol);
|
|
69886
69925
|
const declaration = symbol.valueDeclaration;
|
|
69887
69926
|
if (declaration) {
|
|
69888
69927
|
if (isBindingElement(declaration) && !declaration.initializer && !declaration.dotDotDotToken && declaration.parent.elements.length >= 2) {
|
|
@@ -70021,7 +70060,10 @@ function createTypeChecker(host) {
|
|
|
70021
70060
|
}
|
|
70022
70061
|
const localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
|
|
70023
70062
|
let declaration = localOrExportSymbol.valueDeclaration;
|
|
70024
|
-
|
|
70063
|
+
if (declaration && declaration.kind === 208 /* BindingElement */ && contains(contextualBindingPatterns, declaration.parent) && findAncestor(node, (parent) => parent === declaration.parent)) {
|
|
70064
|
+
return nonInferrableAnyType;
|
|
70065
|
+
}
|
|
70066
|
+
let type = getNarrowedTypeOfSymbol(localOrExportSymbol, node);
|
|
70025
70067
|
const assignmentKind = getAssignmentTargetKind(node);
|
|
70026
70068
|
if (assignmentKind) {
|
|
70027
70069
|
if (!(localOrExportSymbol.flags & 3 /* Variable */) && !(isInJSFile(node) && localOrExportSymbol.flags & 512 /* ValueModule */)) {
|
|
@@ -71714,7 +71756,7 @@ function createTypeChecker(host) {
|
|
|
71714
71756
|
return node.isSpread ? getIndexedAccessType(node.type, numberType) : node.type;
|
|
71715
71757
|
}
|
|
71716
71758
|
function hasDefaultValue(node) {
|
|
71717
|
-
return node.kind === 208 /* BindingElement */ && !!node.initializer || node.kind === 226 /* BinaryExpression */ && node.operatorToken.kind === 64 /* EqualsToken */;
|
|
71759
|
+
return node.kind === 208 /* BindingElement */ && !!node.initializer || node.kind === 303 /* PropertyAssignment */ && hasDefaultValue(node.initializer) || node.kind === 304 /* ShorthandPropertyAssignment */ && !!node.objectAssignmentInitializer || node.kind === 226 /* BinaryExpression */ && node.operatorToken.kind === 64 /* EqualsToken */;
|
|
71718
71760
|
}
|
|
71719
71761
|
function isSpreadIntoCallOrNew(node) {
|
|
71720
71762
|
const parent = walkUpParenthesizedExpressions(node.parent);
|
|
@@ -71883,7 +71925,6 @@ function createTypeChecker(host) {
|
|
|
71883
71925
|
return links.immediateTarget;
|
|
71884
71926
|
}
|
|
71885
71927
|
function checkObjectLiteral(node, checkMode = 0 /* Normal */) {
|
|
71886
|
-
var _a;
|
|
71887
71928
|
const inDestructuringPattern = isAssignmentTarget(node);
|
|
71888
71929
|
checkGrammarObjectLiteralExpression(node, inDestructuringPattern);
|
|
71889
71930
|
const allPropertiesTable = strictNullChecks ? createSymbolTable() : void 0;
|
|
@@ -71938,11 +71979,8 @@ function createTypeChecker(host) {
|
|
|
71938
71979
|
if (nameType) {
|
|
71939
71980
|
prop.links.nameType = nameType;
|
|
71940
71981
|
}
|
|
71941
|
-
if (inDestructuringPattern) {
|
|
71942
|
-
|
|
71943
|
-
if (isOptional) {
|
|
71944
|
-
prop.flags |= 16777216 /* Optional */;
|
|
71945
|
-
}
|
|
71982
|
+
if (inDestructuringPattern && hasDefaultValue(memberDecl)) {
|
|
71983
|
+
prop.flags |= 16777216 /* Optional */;
|
|
71946
71984
|
} else if (contextualTypeHasPattern && !(getObjectFlags(contextualType) & 512 /* ObjectLiteralPatternWithComputedProperties */)) {
|
|
71947
71985
|
const impliedProp = getPropertyOfType(contextualType, member.escapedName);
|
|
71948
71986
|
if (impliedProp) {
|
|
@@ -72017,21 +72055,6 @@ function createTypeChecker(host) {
|
|
|
72017
72055
|
propertiesArray.push(member);
|
|
72018
72056
|
}
|
|
72019
72057
|
popContextualType();
|
|
72020
|
-
if (contextualTypeHasPattern) {
|
|
72021
|
-
const rootPatternParent = findAncestor(contextualType.pattern.parent, (n) => n.kind === 260 /* VariableDeclaration */ || n.kind === 226 /* BinaryExpression */ || n.kind === 169 /* Parameter */);
|
|
72022
|
-
const spreadOrOutsideRootObject = findAncestor(node, (n) => n === rootPatternParent || n.kind === 305 /* SpreadAssignment */);
|
|
72023
|
-
if (spreadOrOutsideRootObject.kind !== 305 /* SpreadAssignment */) {
|
|
72024
|
-
for (const prop of getPropertiesOfType(contextualType)) {
|
|
72025
|
-
if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) {
|
|
72026
|
-
if (!(prop.flags & 16777216 /* Optional */)) {
|
|
72027
|
-
error(prop.valueDeclaration || ((_a = tryCast(prop, isTransientSymbol)) == null ? void 0 : _a.links.bindingElement), Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value);
|
|
72028
|
-
}
|
|
72029
|
-
propertiesTable.set(prop.escapedName, prop);
|
|
72030
|
-
propertiesArray.push(prop);
|
|
72031
|
-
}
|
|
72032
|
-
}
|
|
72033
|
-
}
|
|
72034
|
-
}
|
|
72035
72058
|
if (isErrorType(spread)) {
|
|
72036
72059
|
return errorType;
|
|
72037
72060
|
}
|
|
@@ -77309,7 +77332,7 @@ function createTypeChecker(host) {
|
|
|
77309
77332
|
);
|
|
77310
77333
|
}
|
|
77311
77334
|
}
|
|
77312
|
-
const elementType = getIndexedAccessType(objectLiteralType, exprType, 32 /* ExpressionPosition
|
|
77335
|
+
const elementType = getIndexedAccessType(objectLiteralType, exprType, 32 /* ExpressionPosition */ | (hasDefaultValue(property) ? 16 /* AllowMissing */ : 0), name);
|
|
77313
77336
|
const type = getFlowTypeOfDestructuring(property, elementType);
|
|
77314
77337
|
return checkDestructuringAssignment(property.kind === 304 /* ShorthandPropertyAssignment */ ? property : property.initializer, type);
|
|
77315
77338
|
} else if (property.kind === 305 /* SpreadAssignment */) {
|
|
@@ -77358,7 +77381,7 @@ function createTypeChecker(host) {
|
|
|
77358
77381
|
if (element.kind !== 230 /* SpreadElement */) {
|
|
77359
77382
|
const indexType = getNumberLiteralType(elementIndex);
|
|
77360
77383
|
if (isArrayLikeType(sourceType)) {
|
|
77361
|
-
const accessFlags = 32 /* ExpressionPosition */ | (hasDefaultValue(element) ? 16 /*
|
|
77384
|
+
const accessFlags = 32 /* ExpressionPosition */ | (hasDefaultValue(element) ? 16 /* AllowMissing */ : 0);
|
|
77362
77385
|
const elementType2 = getIndexedAccessTypeOrUndefined(sourceType, indexType, accessFlags, createSyntheticExpression(element, indexType)) || errorType;
|
|
77363
77386
|
const assignedType = hasDefaultValue(element) ? getTypeWithFacts(elementType2, 524288 /* NEUndefined */) : elementType2;
|
|
77364
77387
|
const type = getFlowTypeOfDestructuring(element, assignedType);
|
|
@@ -77508,7 +77531,7 @@ function createTypeChecker(host) {
|
|
|
77508
77531
|
setLastResult(state, checkExpression(node.right, checkMode));
|
|
77509
77532
|
return state;
|
|
77510
77533
|
}
|
|
77511
|
-
|
|
77534
|
+
checkNullishCoalesceOperands(node);
|
|
77512
77535
|
const operator = node.operatorToken.kind;
|
|
77513
77536
|
if (operator === 64 /* EqualsToken */ && (node.left.kind === 210 /* ObjectLiteralExpression */ || node.left.kind === 209 /* ArrayLiteralExpression */)) {
|
|
77514
77537
|
state.skip = true;
|
|
@@ -77541,7 +77564,9 @@ function createTypeChecker(host) {
|
|
|
77541
77564
|
if (operator === 56 /* AmpersandAmpersandToken */ || isIfStatement(parent)) {
|
|
77542
77565
|
checkTestingKnownTruthyCallableOrAwaitableOrEnumMemberType(node.left, leftType, isIfStatement(parent) ? parent.thenStatement : void 0);
|
|
77543
77566
|
}
|
|
77544
|
-
|
|
77567
|
+
if (isBinaryLogicalOperator(operator)) {
|
|
77568
|
+
checkTruthinessOfType(leftType, node.left);
|
|
77569
|
+
}
|
|
77545
77570
|
}
|
|
77546
77571
|
}
|
|
77547
77572
|
}
|
|
@@ -77598,7 +77623,7 @@ function createTypeChecker(host) {
|
|
|
77598
77623
|
state.typeStack[state.stackIndex + 1] = type;
|
|
77599
77624
|
}
|
|
77600
77625
|
}
|
|
77601
|
-
function
|
|
77626
|
+
function checkNullishCoalesceOperands(node) {
|
|
77602
77627
|
const { left, operatorToken, right } = node;
|
|
77603
77628
|
if (operatorToken.kind === 61 /* QuestionQuestionToken */) {
|
|
77604
77629
|
if (isBinaryExpression(left) && (left.operatorToken.kind === 57 /* BarBarToken */ || left.operatorToken.kind === 56 /* AmpersandAmpersandToken */)) {
|
|
@@ -77607,7 +77632,48 @@ function createTypeChecker(host) {
|
|
|
77607
77632
|
if (isBinaryExpression(right) && (right.operatorToken.kind === 57 /* BarBarToken */ || right.operatorToken.kind === 56 /* AmpersandAmpersandToken */)) {
|
|
77608
77633
|
grammarErrorOnNode(right, Diagnostics._0_and_1_operations_cannot_be_mixed_without_parentheses, tokenToString(right.operatorToken.kind), tokenToString(operatorToken.kind));
|
|
77609
77634
|
}
|
|
77635
|
+
const leftTarget = skipOuterExpressions(left, 15 /* All */);
|
|
77636
|
+
if (getSyntacticNullishnessSemantics(leftTarget) !== 3 /* Sometimes */) {
|
|
77637
|
+
error(leftTarget, Diagnostics.Using_on_this_expression_appears_unintentional_because_it_always_evaluates_to_the_same_nullishness);
|
|
77638
|
+
}
|
|
77639
|
+
}
|
|
77640
|
+
}
|
|
77641
|
+
function getSyntacticNullishnessSemantics(node) {
|
|
77642
|
+
switch (node.kind) {
|
|
77643
|
+
case 223 /* AwaitExpression */:
|
|
77644
|
+
case 213 /* CallExpression */:
|
|
77645
|
+
case 212 /* ElementAccessExpression */:
|
|
77646
|
+
case 214 /* NewExpression */:
|
|
77647
|
+
case 211 /* PropertyAccessExpression */:
|
|
77648
|
+
case 229 /* YieldExpression */:
|
|
77649
|
+
return 3 /* Sometimes */;
|
|
77650
|
+
case 226 /* BinaryExpression */:
|
|
77651
|
+
switch (node.operatorToken.kind) {
|
|
77652
|
+
case 64 /* EqualsToken */:
|
|
77653
|
+
case 61 /* QuestionQuestionToken */:
|
|
77654
|
+
case 78 /* QuestionQuestionEqualsToken */:
|
|
77655
|
+
case 57 /* BarBarToken */:
|
|
77656
|
+
case 76 /* BarBarEqualsToken */:
|
|
77657
|
+
case 56 /* AmpersandAmpersandToken */:
|
|
77658
|
+
case 77 /* AmpersandAmpersandEqualsToken */:
|
|
77659
|
+
return 3 /* Sometimes */;
|
|
77660
|
+
}
|
|
77661
|
+
return 2 /* Never */;
|
|
77662
|
+
case 106 /* NullKeyword */:
|
|
77663
|
+
return 1 /* Always */;
|
|
77664
|
+
case 216 /* TypeAssertionExpression */:
|
|
77665
|
+
case 234 /* AsExpression */:
|
|
77666
|
+
case 217 /* ParenthesizedExpression */:
|
|
77667
|
+
return getSyntacticNullishnessSemantics(node.expression);
|
|
77668
|
+
case 227 /* ConditionalExpression */:
|
|
77669
|
+
return getSyntacticNullishnessSemantics(node.whenTrue) | getSyntacticNullishnessSemantics(node.whenFalse);
|
|
77670
|
+
case 80 /* Identifier */:
|
|
77671
|
+
if (node.escapedText === "undefined") {
|
|
77672
|
+
return 1 /* Always */;
|
|
77673
|
+
}
|
|
77674
|
+
return 3 /* Sometimes */;
|
|
77610
77675
|
}
|
|
77676
|
+
return 2 /* Never */;
|
|
77611
77677
|
}
|
|
77612
77678
|
function checkBinaryLikeExpression(left, operatorToken, right, checkMode, errorNode) {
|
|
77613
77679
|
const operator = operatorToken.kind;
|
|
@@ -77615,7 +77681,7 @@ function createTypeChecker(host) {
|
|
|
77615
77681
|
return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode, right.kind === 110 /* ThisKeyword */);
|
|
77616
77682
|
}
|
|
77617
77683
|
let leftType;
|
|
77618
|
-
if (
|
|
77684
|
+
if (isBinaryLogicalOperator(operator)) {
|
|
77619
77685
|
leftType = checkTruthinessExpression(left, checkMode);
|
|
77620
77686
|
} else {
|
|
77621
77687
|
leftType = checkExpression(left, checkMode);
|
|
@@ -78197,9 +78263,56 @@ function createTypeChecker(host) {
|
|
|
78197
78263
|
void 0,
|
|
78198
78264
|
checkMode || 0 /* Normal */
|
|
78199
78265
|
) : checkExpressionCached(initializer, checkMode));
|
|
78200
|
-
|
|
78266
|
+
if (isParameter(isBindingElement(declaration) ? walkUpBindingElementsAndPatterns(declaration) : declaration)) {
|
|
78267
|
+
if (declaration.name.kind === 206 /* ObjectBindingPattern */ && isObjectLiteralType(type)) {
|
|
78268
|
+
return padObjectLiteralType(type, declaration.name);
|
|
78269
|
+
}
|
|
78270
|
+
if (declaration.name.kind === 207 /* ArrayBindingPattern */ && isTupleType(type)) {
|
|
78271
|
+
return padTupleType(type, declaration.name);
|
|
78272
|
+
}
|
|
78273
|
+
}
|
|
78274
|
+
return type;
|
|
78275
|
+
}
|
|
78276
|
+
function padObjectLiteralType(type, pattern) {
|
|
78277
|
+
let missingElements;
|
|
78278
|
+
for (const e of pattern.elements) {
|
|
78279
|
+
if (e.initializer) {
|
|
78280
|
+
const name = getPropertyNameFromBindingElement(e);
|
|
78281
|
+
if (name && !getPropertyOfType(type, name)) {
|
|
78282
|
+
missingElements = append(missingElements, e);
|
|
78283
|
+
}
|
|
78284
|
+
}
|
|
78285
|
+
}
|
|
78286
|
+
if (!missingElements) {
|
|
78287
|
+
return type;
|
|
78288
|
+
}
|
|
78289
|
+
const members = createSymbolTable();
|
|
78290
|
+
for (const prop of getPropertiesOfObjectType(type)) {
|
|
78291
|
+
members.set(prop.escapedName, prop);
|
|
78292
|
+
}
|
|
78293
|
+
for (const e of missingElements) {
|
|
78294
|
+
const symbol = createSymbol(4 /* Property */ | 16777216 /* Optional */, getPropertyNameFromBindingElement(e));
|
|
78295
|
+
symbol.links.type = getTypeFromBindingElement(
|
|
78296
|
+
e,
|
|
78297
|
+
/*includePatternInType*/
|
|
78298
|
+
false,
|
|
78299
|
+
/*reportErrors*/
|
|
78300
|
+
false
|
|
78301
|
+
);
|
|
78302
|
+
members.set(symbol.escapedName, symbol);
|
|
78303
|
+
}
|
|
78304
|
+
const result = createAnonymousType(type.symbol, members, emptyArray, emptyArray, getIndexInfosOfType(type));
|
|
78305
|
+
result.objectFlags = type.objectFlags;
|
|
78306
|
+
return result;
|
|
78307
|
+
}
|
|
78308
|
+
function getPropertyNameFromBindingElement(e) {
|
|
78309
|
+
const exprType = getLiteralTypeFromPropertyName(e.propertyName || e.name);
|
|
78310
|
+
return isTypeUsableAsPropertyName(exprType) ? getPropertyNameFromType(exprType) : void 0;
|
|
78201
78311
|
}
|
|
78202
78312
|
function padTupleType(type, pattern) {
|
|
78313
|
+
if (type.target.combinedFlags & 12 /* Variable */ || getTypeReferenceArity(type) >= pattern.elements.length) {
|
|
78314
|
+
return type;
|
|
78315
|
+
}
|
|
78203
78316
|
const patternElements = pattern.elements;
|
|
78204
78317
|
const elementTypes = getElementTypes(type).slice();
|
|
78205
78318
|
const elementFlags = type.target.elementFlags.slice();
|
|
@@ -81171,9 +81284,53 @@ function createTypeChecker(host) {
|
|
|
81171
81284
|
function checkTruthinessOfType(type, node) {
|
|
81172
81285
|
if (type.flags & 16384 /* Void */) {
|
|
81173
81286
|
error(node, Diagnostics.An_expression_of_type_void_cannot_be_tested_for_truthiness);
|
|
81287
|
+
} else {
|
|
81288
|
+
const semantics = getSyntacticTruthySemantics(node);
|
|
81289
|
+
if (semantics !== 3 /* Sometimes */) {
|
|
81290
|
+
error(
|
|
81291
|
+
node,
|
|
81292
|
+
semantics === 1 /* Always */ ? Diagnostics.This_expression_is_always_truthy_Did_you_mean_to_test_something_else : Diagnostics.This_expression_is_always_falsy_Did_you_mean_to_test_something_else
|
|
81293
|
+
);
|
|
81294
|
+
}
|
|
81174
81295
|
}
|
|
81175
81296
|
return type;
|
|
81176
81297
|
}
|
|
81298
|
+
function getSyntacticTruthySemantics(node) {
|
|
81299
|
+
switch (node.kind) {
|
|
81300
|
+
case 9 /* NumericLiteral */:
|
|
81301
|
+
if (node.text === "0" || node.text === "1") {
|
|
81302
|
+
return 3 /* Sometimes */;
|
|
81303
|
+
}
|
|
81304
|
+
return 1 /* Always */;
|
|
81305
|
+
case 209 /* ArrayLiteralExpression */:
|
|
81306
|
+
case 219 /* ArrowFunction */:
|
|
81307
|
+
case 10 /* BigIntLiteral */:
|
|
81308
|
+
case 231 /* ClassExpression */:
|
|
81309
|
+
case 218 /* FunctionExpression */:
|
|
81310
|
+
case 284 /* JsxElement */:
|
|
81311
|
+
case 285 /* JsxSelfClosingElement */:
|
|
81312
|
+
case 210 /* ObjectLiteralExpression */:
|
|
81313
|
+
case 14 /* RegularExpressionLiteral */:
|
|
81314
|
+
return 1 /* Always */;
|
|
81315
|
+
case 222 /* VoidExpression */:
|
|
81316
|
+
return 2 /* Never */;
|
|
81317
|
+
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
81318
|
+
case 11 /* StringLiteral */:
|
|
81319
|
+
return !!node.text ? 1 /* Always */ : 2 /* Never */;
|
|
81320
|
+
case 216 /* TypeAssertionExpression */:
|
|
81321
|
+
case 234 /* AsExpression */:
|
|
81322
|
+
case 217 /* ParenthesizedExpression */:
|
|
81323
|
+
return getSyntacticTruthySemantics(node.expression);
|
|
81324
|
+
case 227 /* ConditionalExpression */:
|
|
81325
|
+
return getSyntacticTruthySemantics(node.whenTrue) | getSyntacticTruthySemantics(node.whenFalse);
|
|
81326
|
+
case 80 /* Identifier */:
|
|
81327
|
+
if (node.escapedText === "undefined") {
|
|
81328
|
+
return 2 /* Never */;
|
|
81329
|
+
}
|
|
81330
|
+
return 3 /* Sometimes */;
|
|
81331
|
+
}
|
|
81332
|
+
return 3 /* Sometimes */;
|
|
81333
|
+
}
|
|
81177
81334
|
function checkTruthinessExpression(node, checkMode) {
|
|
81178
81335
|
return checkTruthinessOfType(checkExpression(node, checkMode), node);
|
|
81179
81336
|
}
|
|
@@ -110974,6 +111131,7 @@ function transformDeclarations(context) {
|
|
|
110974
111131
|
}
|
|
110975
111132
|
function reportInferenceFallback(node) {
|
|
110976
111133
|
if (!isolatedDeclarations || isSourceFileJS(currentSourceFile)) return;
|
|
111134
|
+
if (getSourceFileOfNode(node) !== currentSourceFile) return;
|
|
110977
111135
|
if (isVariableDeclaration(node) && resolver.isExpandoFunctionDeclaration(node)) {
|
|
110978
111136
|
reportExpandoFunctionErrors(node);
|
|
110979
111137
|
} else {
|
|
@@ -111018,7 +111176,10 @@ function transformDeclarations(context) {
|
|
|
111018
111176
|
function reportPrivateInBaseOfClassExpression(propertyName) {
|
|
111019
111177
|
if (errorNameNode || errorFallbackNode) {
|
|
111020
111178
|
context.addDiagnostic(
|
|
111021
|
-
|
|
111179
|
+
addRelatedInfo(
|
|
111180
|
+
createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.Property_0_of_exported_anonymous_class_type_may_not_be_private_or_protected, propertyName),
|
|
111181
|
+
...isVariableDeclaration((errorNameNode || errorFallbackNode).parent) ? [createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.Add_a_type_annotation_to_the_variable_0, errorDeclarationNameWithFallback())] : []
|
|
111182
|
+
)
|
|
111022
111183
|
);
|
|
111023
111184
|
}
|
|
111024
111185
|
}
|
|
@@ -119226,7 +119387,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119226
119387
|
let commonSourceDirectory;
|
|
119227
119388
|
let typeChecker;
|
|
119228
119389
|
let classifiableNames;
|
|
119229
|
-
const ambientModuleNameToUnmodifiedFileName = /* @__PURE__ */ new Map();
|
|
119230
119390
|
let fileReasons = createMultiMap();
|
|
119231
119391
|
let filesWithReferencesProcessed;
|
|
119232
119392
|
let fileReasonsToChain;
|
|
@@ -119475,7 +119635,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119475
119635
|
const newFile = getSourceFileByPath(oldSourceFile.resolvedPath);
|
|
119476
119636
|
if (shouldCreateNewSourceFile || !newFile || newFile.impliedNodeFormat !== oldSourceFile.impliedNodeFormat || // old file wasn't redirect but new file is
|
|
119477
119637
|
oldSourceFile.resolvedPath === oldSourceFile.path && newFile.resolvedPath !== oldSourceFile.path) {
|
|
119478
|
-
host.onReleaseOldSourceFile(oldSourceFile, oldProgram.getCompilerOptions(), !!getSourceFileByPath(oldSourceFile.path));
|
|
119638
|
+
host.onReleaseOldSourceFile(oldSourceFile, oldProgram.getCompilerOptions(), !!getSourceFileByPath(oldSourceFile.path), newFile);
|
|
119479
119639
|
}
|
|
119480
119640
|
}
|
|
119481
119641
|
if (!host.getParsedCommandLine) {
|
|
@@ -119485,7 +119645,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119485
119645
|
resolvedProjectReference.sourceFile,
|
|
119486
119646
|
oldProgram.getCompilerOptions(),
|
|
119487
119647
|
/*hasSourceFileByPath*/
|
|
119488
|
-
false
|
|
119648
|
+
false,
|
|
119649
|
+
/*newSourceFileByResolvedPath*/
|
|
119650
|
+
void 0
|
|
119489
119651
|
);
|
|
119490
119652
|
}
|
|
119491
119653
|
});
|
|
@@ -119814,35 +119976,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119814
119976
|
getResolutionFromOldProgram: (name, mode) => oldProgram == null ? void 0 : oldProgram.getResolvedModule(containingFile, name, mode),
|
|
119815
119977
|
getResolved: getResolvedModuleFromResolution,
|
|
119816
119978
|
canReuseResolutionsInFile: () => containingFile === (oldProgram == null ? void 0 : oldProgram.getSourceFile(containingFile.fileName)) && !hasInvalidatedResolutions(containingFile.path),
|
|
119817
|
-
|
|
119979
|
+
resolveToOwnAmbientModule: true
|
|
119818
119980
|
});
|
|
119819
119981
|
}
|
|
119820
|
-
function moduleNameResolvesToAmbientModule(moduleName, file) {
|
|
119821
|
-
if (contains(file.ambientModuleNames, moduleName.text)) {
|
|
119822
|
-
if (isTraceEnabled(options, host)) {
|
|
119823
|
-
trace(host, Diagnostics.Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1, moduleName.text, getNormalizedAbsolutePath(file.originalFileName, currentDirectory));
|
|
119824
|
-
}
|
|
119825
|
-
return true;
|
|
119826
|
-
} else {
|
|
119827
|
-
return moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName, file);
|
|
119828
|
-
}
|
|
119829
|
-
}
|
|
119830
|
-
function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName, file) {
|
|
119831
|
-
var _a2;
|
|
119832
|
-
const resolutionToFile = (_a2 = oldProgram == null ? void 0 : oldProgram.getResolvedModule(file, moduleName.text, getModeForUsageLocation2(file, moduleName))) == null ? void 0 : _a2.resolvedModule;
|
|
119833
|
-
const resolvedFile = resolutionToFile && oldProgram.getSourceFile(resolutionToFile.resolvedFileName);
|
|
119834
|
-
if (resolutionToFile && resolvedFile) {
|
|
119835
|
-
return false;
|
|
119836
|
-
}
|
|
119837
|
-
const unmodifiedFile = ambientModuleNameToUnmodifiedFileName.get(moduleName.text);
|
|
119838
|
-
if (!unmodifiedFile) {
|
|
119839
|
-
return false;
|
|
119840
|
-
}
|
|
119841
|
-
if (isTraceEnabled(options, host)) {
|
|
119842
|
-
trace(host, Diagnostics.Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified, moduleName.text, unmodifiedFile);
|
|
119843
|
-
}
|
|
119844
|
-
return true;
|
|
119845
|
-
}
|
|
119846
119982
|
function resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectiveNames, containingFile) {
|
|
119847
119983
|
const containingSourceFile = !isString(containingFile) ? containingFile : void 0;
|
|
119848
119984
|
return resolveNamesReusingOldState({
|
|
@@ -119870,10 +120006,10 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119870
120006
|
getResolutionFromOldProgram,
|
|
119871
120007
|
getResolved,
|
|
119872
120008
|
canReuseResolutionsInFile,
|
|
119873
|
-
|
|
120009
|
+
resolveToOwnAmbientModule
|
|
119874
120010
|
}) {
|
|
119875
120011
|
if (!entries.length) return emptyArray;
|
|
119876
|
-
if (structureIsReused === 0 /* Not */ && (!
|
|
120012
|
+
if (structureIsReused === 0 /* Not */ && (!resolveToOwnAmbientModule || !containingSourceFile.ambientModuleNames.length)) {
|
|
119877
120013
|
return resolutionWorker(
|
|
119878
120014
|
entries,
|
|
119879
120015
|
containingFile,
|
|
@@ -119909,12 +120045,23 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119909
120045
|
continue;
|
|
119910
120046
|
}
|
|
119911
120047
|
}
|
|
119912
|
-
if (
|
|
119913
|
-
|
|
119914
|
-
|
|
119915
|
-
|
|
119916
|
-
|
|
120048
|
+
if (resolveToOwnAmbientModule) {
|
|
120049
|
+
const name = nameAndModeGetter.getName(entry);
|
|
120050
|
+
if (contains(containingSourceFile.ambientModuleNames, name)) {
|
|
120051
|
+
if (isTraceEnabled(options, host)) {
|
|
120052
|
+
trace(
|
|
120053
|
+
host,
|
|
120054
|
+
Diagnostics.Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1,
|
|
120055
|
+
name,
|
|
120056
|
+
getNormalizedAbsolutePath(containingSourceFile.originalFileName, currentDirectory)
|
|
120057
|
+
);
|
|
120058
|
+
}
|
|
120059
|
+
(result ?? (result = new Array(entries.length)))[i] = emptyResolution;
|
|
120060
|
+
continue;
|
|
120061
|
+
}
|
|
119917
120062
|
}
|
|
120063
|
+
(unknownEntries ?? (unknownEntries = [])).push(entry);
|
|
120064
|
+
(unknownEntryIndices ?? (unknownEntryIndices = [])).push(i);
|
|
119918
120065
|
}
|
|
119919
120066
|
if (!unknownEntries) return result;
|
|
119920
120067
|
const resolutions = resolutionWorker(unknownEntries, containingFile, reusedNames);
|
|
@@ -120048,10 +120195,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120048
120195
|
} else if (hasInvalidatedResolutions(oldSourceFile.path)) {
|
|
120049
120196
|
structureIsReused = 1 /* SafeModules */;
|
|
120050
120197
|
modifiedSourceFiles.push(newSourceFile);
|
|
120051
|
-
} else {
|
|
120052
|
-
for (const moduleName of oldSourceFile.ambientModuleNames) {
|
|
120053
|
-
ambientModuleNameToUnmodifiedFileName.set(moduleName, oldSourceFile.fileName);
|
|
120054
|
-
}
|
|
120055
120198
|
}
|
|
120056
120199
|
newSourceFiles.push(newSourceFile);
|
|
120057
120200
|
}
|
|
@@ -124579,7 +124722,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
124579
124722
|
let filesWithChangedSetOfUnresolvedImports;
|
|
124580
124723
|
let filesWithInvalidatedResolutions;
|
|
124581
124724
|
let filesWithInvalidatedNonRelativeUnresolvedImports;
|
|
124582
|
-
const nonRelativeExternalModuleResolutions =
|
|
124725
|
+
const nonRelativeExternalModuleResolutions = /* @__PURE__ */ new Set();
|
|
124583
124726
|
const resolutionsWithFailedLookups = /* @__PURE__ */ new Set();
|
|
124584
124727
|
const resolutionsWithOnlyAffectingLocations = /* @__PURE__ */ new Set();
|
|
124585
124728
|
const resolvedFileToResolution = /* @__PURE__ */ new Map();
|
|
@@ -124730,8 +124873,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
124730
124873
|
moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
124731
124874
|
typeReferenceDirectiveResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
124732
124875
|
libraryResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
124733
|
-
|
|
124734
|
-
nonRelativeExternalModuleResolutions.clear();
|
|
124876
|
+
watchFailedLookupLocationOfNonRelativeModuleResolutions();
|
|
124735
124877
|
isSymlinkCache.clear();
|
|
124736
124878
|
}
|
|
124737
124879
|
function cleanupLibResolutionWatching(newProgram) {
|
|
@@ -124750,8 +124892,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
124750
124892
|
function finishCachingPerDirectoryResolution(newProgram, oldProgram) {
|
|
124751
124893
|
filesWithInvalidatedNonRelativeUnresolvedImports = void 0;
|
|
124752
124894
|
allModuleAndTypeResolutionsAreInvalidated = false;
|
|
124753
|
-
|
|
124754
|
-
nonRelativeExternalModuleResolutions.clear();
|
|
124895
|
+
watchFailedLookupLocationOfNonRelativeModuleResolutions();
|
|
124755
124896
|
if (newProgram !== oldProgram) {
|
|
124756
124897
|
cleanupLibResolutionWatching(newProgram);
|
|
124757
124898
|
newProgram == null ? void 0 : newProgram.getSourceFiles().forEach((newFile) => {
|
|
@@ -125014,7 +125155,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
125014
125155
|
if (!deferWatchingNonRelativeResolution || isExternalModuleNameRelative(name)) {
|
|
125015
125156
|
watchFailedLookupLocationOfResolution(resolution);
|
|
125016
125157
|
} else {
|
|
125017
|
-
nonRelativeExternalModuleResolutions.add(
|
|
125158
|
+
nonRelativeExternalModuleResolutions.add(resolution);
|
|
125018
125159
|
}
|
|
125019
125160
|
const resolved = getResolutionWithResolvedFileName(resolution);
|
|
125020
125161
|
if (resolved && resolved.resolvedFileName) {
|
|
@@ -125150,17 +125291,9 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
125150
125291
|
(_a = watcher == null ? void 0 : watcher.symlinks) == null ? void 0 : _a.forEach((path2) => invalidateAffectingFileWatcher(path2, packageJsonMap));
|
|
125151
125292
|
packageJsonMap == null ? void 0 : packageJsonMap.delete(resolutionHost.toPath(path));
|
|
125152
125293
|
}
|
|
125153
|
-
function watchFailedLookupLocationOfNonRelativeModuleResolutions(
|
|
125154
|
-
|
|
125155
|
-
|
|
125156
|
-
resolutions.forEach(watchFailedLookupLocationOfResolution);
|
|
125157
|
-
} else {
|
|
125158
|
-
resolutions.forEach((resolution) => watchAffectingLocationsOfResolution(
|
|
125159
|
-
resolution,
|
|
125160
|
-
/*addToResolutionsWithOnlyAffectingLocations*/
|
|
125161
|
-
true
|
|
125162
|
-
));
|
|
125163
|
-
}
|
|
125294
|
+
function watchFailedLookupLocationOfNonRelativeModuleResolutions() {
|
|
125295
|
+
nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfResolution);
|
|
125296
|
+
nonRelativeExternalModuleResolutions.clear();
|
|
125164
125297
|
}
|
|
125165
125298
|
function createDirectoryWatcherForPackageDir(dir, dirPath, packageDir, packageDirPath, nonRecursive) {
|
|
125166
125299
|
Debug.assert(!nonRecursive);
|
|
@@ -125180,11 +125313,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
125180
125313
|
);
|
|
125181
125314
|
} else if (packageDirWatcher.isSymlink !== isSymlink) {
|
|
125182
125315
|
packageDirWatcher.dirPathToWatcher.forEach((watcher) => {
|
|
125183
|
-
removeDirectoryWatcher(
|
|
125184
|
-
packageDirWatcher.isSymlink ? packageDirPath : dirPath,
|
|
125185
|
-
/*syncDirWatcherRemove*/
|
|
125186
|
-
false
|
|
125187
|
-
);
|
|
125316
|
+
removeDirectoryWatcher(packageDirWatcher.isSymlink ? packageDirPath : dirPath);
|
|
125188
125317
|
watcher.watcher = createDirPathToWatcher();
|
|
125189
125318
|
});
|
|
125190
125319
|
packageDirWatcher.isSymlink = isSymlink;
|
|
@@ -125224,7 +125353,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
125224
125353
|
}
|
|
125225
125354
|
return dirWatcher;
|
|
125226
125355
|
}
|
|
125227
|
-
function stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot
|
|
125356
|
+
function stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot) {
|
|
125228
125357
|
const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
|
|
125229
125358
|
const toWatch = getDirectoryToWatchFailedLookupLocation(
|
|
125230
125359
|
failedLookupLocation,
|
|
@@ -125244,7 +125373,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
125244
125373
|
const forDirPath = packageDirWatcher.dirPathToWatcher.get(dirPath);
|
|
125245
125374
|
forDirPath.refCount--;
|
|
125246
125375
|
if (forDirPath.refCount === 0) {
|
|
125247
|
-
removeDirectoryWatcher(packageDirWatcher.isSymlink ? packageDirPath : dirPath
|
|
125376
|
+
removeDirectoryWatcher(packageDirWatcher.isSymlink ? packageDirPath : dirPath);
|
|
125248
125377
|
packageDirWatcher.dirPathToWatcher.delete(dirPath);
|
|
125249
125378
|
if (packageDirWatcher.isSymlink) {
|
|
125250
125379
|
const refCount = dirPathToSymlinkPackageRefCount.get(dirPath) - 1;
|
|
@@ -125254,15 +125383,14 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
125254
125383
|
dirPathToSymlinkPackageRefCount.set(dirPath, refCount);
|
|
125255
125384
|
}
|
|
125256
125385
|
}
|
|
125257
|
-
if (syncDirWatcherRemove) closePackageDirWatcher(packageDirWatcher, packageDirPath);
|
|
125258
125386
|
}
|
|
125259
125387
|
} else {
|
|
125260
|
-
removeDirectoryWatcher(dirPath
|
|
125388
|
+
removeDirectoryWatcher(dirPath);
|
|
125261
125389
|
}
|
|
125262
125390
|
}
|
|
125263
125391
|
return removeAtRoot;
|
|
125264
125392
|
}
|
|
125265
|
-
function stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName
|
|
125393
|
+
function stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName) {
|
|
125266
125394
|
Debug.checkDefined(resolution.files).delete(filePath);
|
|
125267
125395
|
if (resolution.files.size) return;
|
|
125268
125396
|
resolution.files = void 0;
|
|
@@ -125277,11 +125405,11 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
125277
125405
|
let removeAtRoot = false;
|
|
125278
125406
|
if (failedLookupLocations) {
|
|
125279
125407
|
for (const failedLookupLocation of failedLookupLocations) {
|
|
125280
|
-
removeAtRoot = stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot
|
|
125408
|
+
removeAtRoot = stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot);
|
|
125281
125409
|
}
|
|
125282
125410
|
}
|
|
125283
|
-
if (alternateResult) removeAtRoot = stopWatchFailedLookupLocation(alternateResult, removeAtRoot
|
|
125284
|
-
if (removeAtRoot) removeDirectoryWatcher(rootPath
|
|
125411
|
+
if (alternateResult) removeAtRoot = stopWatchFailedLookupLocation(alternateResult, removeAtRoot);
|
|
125412
|
+
if (removeAtRoot) removeDirectoryWatcher(rootPath);
|
|
125285
125413
|
} else if (affectingLocations == null ? void 0 : affectingLocations.length) {
|
|
125286
125414
|
resolutionsWithOnlyAffectingLocations.delete(resolution);
|
|
125287
125415
|
}
|
|
@@ -125289,14 +125417,12 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
125289
125417
|
for (const affectingLocation of affectingLocations) {
|
|
125290
125418
|
const watcher = fileWatchesOfAffectingLocations.get(affectingLocation);
|
|
125291
125419
|
watcher.resolutions--;
|
|
125292
|
-
if (syncDirWatcherRemove) closeFileWatcherOfAffectingLocation(watcher, affectingLocation);
|
|
125293
125420
|
}
|
|
125294
125421
|
}
|
|
125295
125422
|
}
|
|
125296
|
-
function removeDirectoryWatcher(dirPath
|
|
125423
|
+
function removeDirectoryWatcher(dirPath) {
|
|
125297
125424
|
const dirWatcher = directoryWatchesOfFailedLookups.get(dirPath);
|
|
125298
125425
|
dirWatcher.refCount--;
|
|
125299
|
-
if (syncDirWatcherRemove) closeDirectoryWatchesOfFailedLookup(dirWatcher, dirPath);
|
|
125300
125426
|
}
|
|
125301
125427
|
function createDirectoryWatcher(directory, dirPath, nonRecursive) {
|
|
125302
125428
|
return resolutionHost.watchDirectoryOfFailedLookupLocation(directory, (fileOrDirectory) => {
|
|
@@ -125307,15 +125433,14 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
125307
125433
|
scheduleInvalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, dirPath === fileOrDirectoryPath);
|
|
125308
125434
|
}, nonRecursive ? 0 /* None */ : 1 /* Recursive */);
|
|
125309
125435
|
}
|
|
125310
|
-
function removeResolutionsOfFileFromCache(cache, filePath, getResolutionWithResolvedFileName
|
|
125436
|
+
function removeResolutionsOfFileFromCache(cache, filePath, getResolutionWithResolvedFileName) {
|
|
125311
125437
|
const resolutions = cache.get(filePath);
|
|
125312
125438
|
if (resolutions) {
|
|
125313
125439
|
resolutions.forEach(
|
|
125314
125440
|
(resolution) => stopWatchFailedLookupLocationOfResolution(
|
|
125315
125441
|
resolution,
|
|
125316
125442
|
filePath,
|
|
125317
|
-
getResolutionWithResolvedFileName
|
|
125318
|
-
syncDirWatcherRemove
|
|
125443
|
+
getResolutionWithResolvedFileName
|
|
125319
125444
|
)
|
|
125320
125445
|
);
|
|
125321
125446
|
cache.delete(filePath);
|
|
@@ -125329,9 +125454,9 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
125329
125454
|
if (!resolvedProjectReference) return;
|
|
125330
125455
|
resolvedProjectReference.commandLine.fileNames.forEach((f) => removeResolutionsOfFile(resolutionHost.toPath(f)));
|
|
125331
125456
|
}
|
|
125332
|
-
function removeResolutionsOfFile(filePath
|
|
125333
|
-
removeResolutionsOfFileFromCache(resolvedModuleNames, filePath, getResolvedModuleFromResolution
|
|
125334
|
-
removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, getResolvedTypeReferenceDirectiveFromResolution
|
|
125457
|
+
function removeResolutionsOfFile(filePath) {
|
|
125458
|
+
removeResolutionsOfFileFromCache(resolvedModuleNames, filePath, getResolvedModuleFromResolution);
|
|
125459
|
+
removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, getResolvedTypeReferenceDirectiveFromResolution);
|
|
125335
125460
|
}
|
|
125336
125461
|
function invalidateResolutions(resolutions, canInvalidate) {
|
|
125337
125462
|
if (!resolutions) return false;
|