@typescript-deploys/pr-build 5.2.0-pr-54546-4 → 5.2.0-pr-54581-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/lib.es2015.collection.d.ts +9 -9
- package/lib/lib.es2015.iterable.d.ts +4 -4
- package/lib/lib.es2015.symbol.wellknown.d.ts +2 -2
- package/lib/lib.es2021.weakref.d.ts +19 -16
- package/lib/lib.es2023.collection.d.ts +21 -0
- package/lib/lib.es2023.d.ts +1 -0
- package/lib/lib.es5.d.ts +9 -0
- package/lib/tsc.js +48 -95
- package/lib/tsserver.js +640 -683
- package/lib/tsserverlibrary.js +639 -680
- package/lib/typescript.js +613 -669
- package/lib/typingsInstaller.js +24 -2
- package/package.json +2 -2
package/lib/tsserverlibrary.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.2";
|
|
38
|
-
version = `${versionMajorMinor}.0-insiders.
|
|
38
|
+
version = `${versionMajorMinor}.0-insiders.20230609`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -1748,10 +1748,10 @@ var ts = (() => {
|
|
|
1748
1748
|
}
|
|
1749
1749
|
Debug2.log = log;
|
|
1750
1750
|
((_log) => {
|
|
1751
|
-
function
|
|
1751
|
+
function error2(s) {
|
|
1752
1752
|
logMessage(1 /* Error */, s);
|
|
1753
1753
|
}
|
|
1754
|
-
_log.error =
|
|
1754
|
+
_log.error = error2;
|
|
1755
1755
|
function warn(s) {
|
|
1756
1756
|
logMessage(2 /* Warning */, s);
|
|
1757
1757
|
}
|
|
@@ -2025,6 +2025,15 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
|
|
|
2025
2025
|
);
|
|
2026
2026
|
}
|
|
2027
2027
|
Debug2.formatSnippetKind = formatSnippetKind;
|
|
2028
|
+
function formatScriptKind(kind) {
|
|
2029
|
+
return formatEnum(
|
|
2030
|
+
kind,
|
|
2031
|
+
ScriptKind,
|
|
2032
|
+
/*isFlags*/
|
|
2033
|
+
false
|
|
2034
|
+
);
|
|
2035
|
+
}
|
|
2036
|
+
Debug2.formatScriptKind = formatScriptKind;
|
|
2028
2037
|
function formatNodeFlags(flags) {
|
|
2029
2038
|
return formatEnum(
|
|
2030
2039
|
flags,
|
|
@@ -4705,16 +4714,16 @@ ${lanes.join("\n")}
|
|
|
4705
4714
|
NewLineKind3[NewLineKind3["LineFeed"] = 1] = "LineFeed";
|
|
4706
4715
|
return NewLineKind3;
|
|
4707
4716
|
})(NewLineKind || {});
|
|
4708
|
-
ScriptKind = /* @__PURE__ */ ((
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
return
|
|
4717
|
+
ScriptKind = /* @__PURE__ */ ((ScriptKind7) => {
|
|
4718
|
+
ScriptKind7[ScriptKind7["Unknown"] = 0] = "Unknown";
|
|
4719
|
+
ScriptKind7[ScriptKind7["JS"] = 1] = "JS";
|
|
4720
|
+
ScriptKind7[ScriptKind7["JSX"] = 2] = "JSX";
|
|
4721
|
+
ScriptKind7[ScriptKind7["TS"] = 3] = "TS";
|
|
4722
|
+
ScriptKind7[ScriptKind7["TSX"] = 4] = "TSX";
|
|
4723
|
+
ScriptKind7[ScriptKind7["External"] = 5] = "External";
|
|
4724
|
+
ScriptKind7[ScriptKind7["JSON"] = 6] = "JSON";
|
|
4725
|
+
ScriptKind7[ScriptKind7["Deferred"] = 7] = "Deferred";
|
|
4726
|
+
return ScriptKind7;
|
|
4718
4727
|
})(ScriptKind || {});
|
|
4719
4728
|
ScriptTarget = /* @__PURE__ */ ((ScriptTarget11) => {
|
|
4720
4729
|
ScriptTarget11[ScriptTarget11["ES3"] = 0] = "ES3";
|
|
@@ -6254,8 +6263,8 @@ ${lanes.join("\n")}
|
|
|
6254
6263
|
try {
|
|
6255
6264
|
const modulePath = resolveJSModule(moduleName, baseDir, nodeSystem);
|
|
6256
6265
|
return { module: require(modulePath), modulePath, error: void 0 };
|
|
6257
|
-
} catch (
|
|
6258
|
-
return { module: void 0, modulePath: void 0, error };
|
|
6266
|
+
} catch (error2) {
|
|
6267
|
+
return { module: void 0, modulePath: void 0, error: error2 };
|
|
6259
6268
|
}
|
|
6260
6269
|
}
|
|
6261
6270
|
};
|
|
@@ -7452,7 +7461,6 @@ ${lanes.join("\n")}
|
|
|
7452
7461
|
The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate: diag(2210, 1 /* Error */, "The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_roo_2210", "The project root is ambiguous, but is required to resolve import map entry '{0}' in file '{1}'. Supply the `rootDir` compiler option to disambiguate."),
|
|
7453
7462
|
Add_extends_constraint: diag(2211, 3 /* Message */, "Add_extends_constraint_2211", "Add `extends` constraint."),
|
|
7454
7463
|
Add_extends_constraint_to_all_type_parameters: diag(2212, 3 /* Message */, "Add_extends_constraint_to_all_type_parameters_2212", "Add `extends` constraint to all type parameters"),
|
|
7455
|
-
The_project_root_is_ambiguous_but_is_required_to_determine_the_module_format_of_output_js_files_Supply_the_rootDir_compiler_option_to_disambiguate: diag(2213, 1 /* Error */, "The_project_root_is_ambiguous_but_is_required_to_determine_the_module_format_of_output_js_files_Supp_2213", "The project root is ambiguous, but is required to determine the module format of output '.js' files. Supply the `rootDir` compiler option to disambiguate."),
|
|
7456
7464
|
Duplicate_identifier_0: diag(2300, 1 /* Error */, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."),
|
|
7457
7465
|
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2301, 1 /* Error */, "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."),
|
|
7458
7466
|
Static_members_cannot_reference_class_type_parameters: diag(2302, 1 /* Error */, "Static_members_cannot_reference_class_type_parameters_2302", "Static members cannot reference class type parameters."),
|
|
@@ -9023,6 +9031,7 @@ ${lanes.join("\n")}
|
|
|
9023
9031
|
Use_import_type: diag(95180, 3 /* Message */, "Use_import_type_95180", "Use 'import type'"),
|
|
9024
9032
|
Use_type_0: diag(95181, 3 /* Message */, "Use_type_0_95181", "Use 'type {0}'"),
|
|
9025
9033
|
Fix_all_with_type_only_imports: diag(95182, 3 /* Message */, "Fix_all_with_type_only_imports_95182", "Fix all with type-only imports"),
|
|
9034
|
+
Cannot_move_statements_to_the_selected_file: diag(95183, 3 /* Message */, "Cannot_move_statements_to_the_selected_file_95183", "Cannot move statements to the selected file"),
|
|
9026
9035
|
No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, 1 /* Error */, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
|
|
9027
9036
|
Classes_may_not_have_a_field_named_constructor: diag(18006, 1 /* Error */, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
|
|
9028
9037
|
JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, 1 /* Error */, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
|
|
@@ -9341,9 +9350,9 @@ ${lanes.join("\n")}
|
|
|
9341
9350
|
}
|
|
9342
9351
|
return false;
|
|
9343
9352
|
}
|
|
9344
|
-
function scanConflictMarkerTrivia(text, pos,
|
|
9345
|
-
if (
|
|
9346
|
-
|
|
9353
|
+
function scanConflictMarkerTrivia(text, pos, error2) {
|
|
9354
|
+
if (error2) {
|
|
9355
|
+
error2(Diagnostics.Merge_conflict_marker_encountered, pos, mergeConflictMarkerLength);
|
|
9347
9356
|
}
|
|
9348
9357
|
const ch = text.charCodeAt(pos);
|
|
9349
9358
|
const len = text.length;
|
|
@@ -9639,7 +9648,7 @@ ${lanes.join("\n")}
|
|
|
9639
9648
|
});
|
|
9640
9649
|
}
|
|
9641
9650
|
return scanner2;
|
|
9642
|
-
function
|
|
9651
|
+
function error2(message, errPos = pos, length3, arg0) {
|
|
9643
9652
|
if (onError) {
|
|
9644
9653
|
const oldPos = pos;
|
|
9645
9654
|
pos = errPos;
|
|
@@ -9663,9 +9672,9 @@ ${lanes.join("\n")}
|
|
|
9663
9672
|
} else {
|
|
9664
9673
|
tokenFlags |= 16384 /* ContainsInvalidSeparator */;
|
|
9665
9674
|
if (isPreviousTokenSeparator) {
|
|
9666
|
-
|
|
9675
|
+
error2(Diagnostics.Multiple_consecutive_numeric_separators_are_not_permitted, pos, 1);
|
|
9667
9676
|
} else {
|
|
9668
|
-
|
|
9677
|
+
error2(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1);
|
|
9669
9678
|
}
|
|
9670
9679
|
}
|
|
9671
9680
|
pos++;
|
|
@@ -9682,7 +9691,7 @@ ${lanes.join("\n")}
|
|
|
9682
9691
|
}
|
|
9683
9692
|
if (text.charCodeAt(pos - 1) === 95 /* _ */) {
|
|
9684
9693
|
tokenFlags |= 16384 /* ContainsInvalidSeparator */;
|
|
9685
|
-
|
|
9694
|
+
error2(Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1);
|
|
9686
9695
|
}
|
|
9687
9696
|
return result + text.substring(start2, pos);
|
|
9688
9697
|
}
|
|
@@ -9693,7 +9702,7 @@ ${lanes.join("\n")}
|
|
|
9693
9702
|
pos++;
|
|
9694
9703
|
if (text.charCodeAt(pos) === 95 /* _ */) {
|
|
9695
9704
|
tokenFlags |= 512 /* ContainsSeparator */ | 16384 /* ContainsInvalidSeparator */;
|
|
9696
|
-
|
|
9705
|
+
error2(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1);
|
|
9697
9706
|
pos--;
|
|
9698
9707
|
mainFragment = scanNumberFragment();
|
|
9699
9708
|
} else if (!scanDigits()) {
|
|
@@ -9708,7 +9717,7 @@ ${lanes.join("\n")}
|
|
|
9708
9717
|
const literal = (withMinus ? "-" : "") + "0o" + (+tokenValue).toString(8);
|
|
9709
9718
|
if (withMinus)
|
|
9710
9719
|
start2--;
|
|
9711
|
-
|
|
9720
|
+
error2(Diagnostics.Octal_literals_are_not_allowed_Use_the_syntax_0, start2, pos - start2, literal);
|
|
9712
9721
|
return { type: 9 /* NumericLiteral */, value: tokenValue };
|
|
9713
9722
|
}
|
|
9714
9723
|
} else {
|
|
@@ -9729,7 +9738,7 @@ ${lanes.join("\n")}
|
|
|
9729
9738
|
const preNumericPart = pos;
|
|
9730
9739
|
const finalFragment = scanNumberFragment();
|
|
9731
9740
|
if (!finalFragment) {
|
|
9732
|
-
|
|
9741
|
+
error2(Diagnostics.Digit_expected);
|
|
9733
9742
|
} else {
|
|
9734
9743
|
scientificFragment = text.substring(end2, preNumericPart) + finalFragment;
|
|
9735
9744
|
end2 = pos;
|
|
@@ -9748,7 +9757,7 @@ ${lanes.join("\n")}
|
|
|
9748
9757
|
result = text.substring(start2, end2);
|
|
9749
9758
|
}
|
|
9750
9759
|
if (tokenFlags & 8192 /* ContainsLeadingZero */) {
|
|
9751
|
-
|
|
9760
|
+
error2(Diagnostics.Decimals_with_leading_zeros_are_not_allowed, start2, end2 - start2);
|
|
9752
9761
|
return { type: 9 /* NumericLiteral */, value: "" + +result };
|
|
9753
9762
|
}
|
|
9754
9763
|
if (decimalFragment !== void 0 || tokenFlags & 16 /* Scientific */) {
|
|
@@ -9773,12 +9782,12 @@ ${lanes.join("\n")}
|
|
|
9773
9782
|
const { length: length3 } = scanIdentifierParts();
|
|
9774
9783
|
if (length3 === 1 && text[identifierStart] === "n") {
|
|
9775
9784
|
if (isScientific) {
|
|
9776
|
-
|
|
9785
|
+
error2(Diagnostics.A_bigint_literal_cannot_use_exponential_notation, numericStart, identifierStart - numericStart + 1);
|
|
9777
9786
|
} else {
|
|
9778
|
-
|
|
9787
|
+
error2(Diagnostics.A_bigint_literal_must_be_an_integer, numericStart, identifierStart - numericStart + 1);
|
|
9779
9788
|
}
|
|
9780
9789
|
} else {
|
|
9781
|
-
|
|
9790
|
+
error2(Diagnostics.An_identifier_or_keyword_cannot_immediately_follow_a_numeric_literal, identifierStart, length3);
|
|
9782
9791
|
pos = identifierStart;
|
|
9783
9792
|
}
|
|
9784
9793
|
}
|
|
@@ -9825,9 +9834,9 @@ ${lanes.join("\n")}
|
|
|
9825
9834
|
allowSeparator = false;
|
|
9826
9835
|
isPreviousTokenSeparator = true;
|
|
9827
9836
|
} else if (isPreviousTokenSeparator) {
|
|
9828
|
-
|
|
9837
|
+
error2(Diagnostics.Multiple_consecutive_numeric_separators_are_not_permitted, pos, 1);
|
|
9829
9838
|
} else {
|
|
9830
|
-
|
|
9839
|
+
error2(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1);
|
|
9831
9840
|
}
|
|
9832
9841
|
pos++;
|
|
9833
9842
|
continue;
|
|
@@ -9846,7 +9855,7 @@ ${lanes.join("\n")}
|
|
|
9846
9855
|
valueChars = [];
|
|
9847
9856
|
}
|
|
9848
9857
|
if (text.charCodeAt(pos - 1) === 95 /* _ */) {
|
|
9849
|
-
|
|
9858
|
+
error2(Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1);
|
|
9850
9859
|
}
|
|
9851
9860
|
return String.fromCharCode(...valueChars);
|
|
9852
9861
|
}
|
|
@@ -9859,7 +9868,7 @@ ${lanes.join("\n")}
|
|
|
9859
9868
|
if (pos >= end) {
|
|
9860
9869
|
result += text.substring(start2, pos);
|
|
9861
9870
|
tokenFlags |= 4 /* Unterminated */;
|
|
9862
|
-
|
|
9871
|
+
error2(Diagnostics.Unterminated_string_literal);
|
|
9863
9872
|
break;
|
|
9864
9873
|
}
|
|
9865
9874
|
const ch = text.charCodeAt(pos);
|
|
@@ -9880,7 +9889,7 @@ ${lanes.join("\n")}
|
|
|
9880
9889
|
if (isLineBreak(ch) && !jsxAttributeString) {
|
|
9881
9890
|
result += text.substring(start2, pos);
|
|
9882
9891
|
tokenFlags |= 4 /* Unterminated */;
|
|
9883
|
-
|
|
9892
|
+
error2(Diagnostics.Unterminated_string_literal);
|
|
9884
9893
|
break;
|
|
9885
9894
|
}
|
|
9886
9895
|
pos++;
|
|
@@ -9897,7 +9906,7 @@ ${lanes.join("\n")}
|
|
|
9897
9906
|
if (pos >= end) {
|
|
9898
9907
|
contents += text.substring(start2, pos);
|
|
9899
9908
|
tokenFlags |= 4 /* Unterminated */;
|
|
9900
|
-
|
|
9909
|
+
error2(Diagnostics.Unterminated_template_literal);
|
|
9901
9910
|
resultingToken = startedWithBacktick ? 15 /* NoSubstitutionTemplateLiteral */ : 18 /* TemplateTail */;
|
|
9902
9911
|
break;
|
|
9903
9912
|
}
|
|
@@ -9940,7 +9949,7 @@ ${lanes.join("\n")}
|
|
|
9940
9949
|
const start2 = pos;
|
|
9941
9950
|
pos++;
|
|
9942
9951
|
if (pos >= end) {
|
|
9943
|
-
|
|
9952
|
+
error2(Diagnostics.Unexpected_end_of_text);
|
|
9944
9953
|
return "";
|
|
9945
9954
|
}
|
|
9946
9955
|
const ch = text.charCodeAt(pos);
|
|
@@ -9966,7 +9975,7 @@ ${lanes.join("\n")}
|
|
|
9966
9975
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
9967
9976
|
if (shouldEmitInvalidEscapeError) {
|
|
9968
9977
|
const code = parseInt(text.substring(start2 + 1, pos), 8);
|
|
9969
|
-
|
|
9978
|
+
error2(Diagnostics.Octal_escape_sequences_are_not_allowed_Use_the_syntax_0, start2, pos - start2, "\\x" + padLeft(code.toString(16), 2, "0"));
|
|
9970
9979
|
return String.fromCharCode(code);
|
|
9971
9980
|
}
|
|
9972
9981
|
return text.substring(start2, pos);
|
|
@@ -9974,7 +9983,7 @@ ${lanes.join("\n")}
|
|
|
9974
9983
|
case 57 /* _9 */:
|
|
9975
9984
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
9976
9985
|
if (shouldEmitInvalidEscapeError) {
|
|
9977
|
-
|
|
9986
|
+
error2(Diagnostics.Escape_sequence_0_is_not_allowed, start2, pos - start2, text.substring(start2, pos));
|
|
9978
9987
|
return String.fromCharCode(ch);
|
|
9979
9988
|
}
|
|
9980
9989
|
return text.substring(start2, pos);
|
|
@@ -10006,28 +10015,28 @@ ${lanes.join("\n")}
|
|
|
10006
10015
|
if (escapedValue < 0) {
|
|
10007
10016
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
10008
10017
|
if (shouldEmitInvalidEscapeError) {
|
|
10009
|
-
|
|
10018
|
+
error2(Diagnostics.Hexadecimal_digit_expected);
|
|
10010
10019
|
}
|
|
10011
10020
|
return text.substring(start2, pos);
|
|
10012
10021
|
}
|
|
10013
10022
|
if (!isCodePoint(escapedValue)) {
|
|
10014
10023
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
10015
10024
|
if (shouldEmitInvalidEscapeError) {
|
|
10016
|
-
|
|
10025
|
+
error2(Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive);
|
|
10017
10026
|
}
|
|
10018
10027
|
return text.substring(start2, pos);
|
|
10019
10028
|
}
|
|
10020
10029
|
if (pos >= end) {
|
|
10021
10030
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
10022
10031
|
if (shouldEmitInvalidEscapeError) {
|
|
10023
|
-
|
|
10032
|
+
error2(Diagnostics.Unexpected_end_of_text);
|
|
10024
10033
|
}
|
|
10025
10034
|
return text.substring(start2, pos);
|
|
10026
10035
|
}
|
|
10027
10036
|
if (text.charCodeAt(pos) !== 125 /* closeBrace */) {
|
|
10028
10037
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
10029
10038
|
if (shouldEmitInvalidEscapeError) {
|
|
10030
|
-
|
|
10039
|
+
error2(Diagnostics.Unterminated_Unicode_escape_sequence);
|
|
10031
10040
|
}
|
|
10032
10041
|
return text.substring(start2, pos);
|
|
10033
10042
|
}
|
|
@@ -10039,7 +10048,7 @@ ${lanes.join("\n")}
|
|
|
10039
10048
|
if (!(pos < end && isHexDigit(text.charCodeAt(pos)))) {
|
|
10040
10049
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
10041
10050
|
if (shouldEmitInvalidEscapeError) {
|
|
10042
|
-
|
|
10051
|
+
error2(Diagnostics.Hexadecimal_digit_expected);
|
|
10043
10052
|
}
|
|
10044
10053
|
return text.substring(start2, pos);
|
|
10045
10054
|
}
|
|
@@ -10051,7 +10060,7 @@ ${lanes.join("\n")}
|
|
|
10051
10060
|
if (!(pos < end && isHexDigit(text.charCodeAt(pos)))) {
|
|
10052
10061
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
10053
10062
|
if (shouldEmitInvalidEscapeError) {
|
|
10054
|
-
|
|
10063
|
+
error2(Diagnostics.Hexadecimal_digit_expected);
|
|
10055
10064
|
}
|
|
10056
10065
|
return text.substring(start2, pos);
|
|
10057
10066
|
}
|
|
@@ -10079,19 +10088,19 @@ ${lanes.join("\n")}
|
|
|
10079
10088
|
const escapedValue = escapedValueString ? parseInt(escapedValueString, 16) : -1;
|
|
10080
10089
|
let isInvalidExtendedEscape = false;
|
|
10081
10090
|
if (escapedValue < 0) {
|
|
10082
|
-
|
|
10091
|
+
error2(Diagnostics.Hexadecimal_digit_expected);
|
|
10083
10092
|
isInvalidExtendedEscape = true;
|
|
10084
10093
|
} else if (escapedValue > 1114111) {
|
|
10085
|
-
|
|
10094
|
+
error2(Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive);
|
|
10086
10095
|
isInvalidExtendedEscape = true;
|
|
10087
10096
|
}
|
|
10088
10097
|
if (pos >= end) {
|
|
10089
|
-
|
|
10098
|
+
error2(Diagnostics.Unexpected_end_of_text);
|
|
10090
10099
|
isInvalidExtendedEscape = true;
|
|
10091
10100
|
} else if (text.charCodeAt(pos) === 125 /* closeBrace */) {
|
|
10092
10101
|
pos++;
|
|
10093
10102
|
} else {
|
|
10094
|
-
|
|
10103
|
+
error2(Diagnostics.Unterminated_Unicode_escape_sequence);
|
|
10095
10104
|
isInvalidExtendedEscape = true;
|
|
10096
10105
|
}
|
|
10097
10106
|
if (isInvalidExtendedEscape) {
|
|
@@ -10185,9 +10194,9 @@ ${lanes.join("\n")}
|
|
|
10185
10194
|
separatorAllowed = false;
|
|
10186
10195
|
isPreviousTokenSeparator = true;
|
|
10187
10196
|
} else if (isPreviousTokenSeparator) {
|
|
10188
|
-
|
|
10197
|
+
error2(Diagnostics.Multiple_consecutive_numeric_separators_are_not_permitted, pos, 1);
|
|
10189
10198
|
} else {
|
|
10190
|
-
|
|
10199
|
+
error2(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1);
|
|
10191
10200
|
}
|
|
10192
10201
|
pos++;
|
|
10193
10202
|
continue;
|
|
@@ -10201,7 +10210,7 @@ ${lanes.join("\n")}
|
|
|
10201
10210
|
isPreviousTokenSeparator = false;
|
|
10202
10211
|
}
|
|
10203
10212
|
if (text.charCodeAt(pos - 1) === 95 /* _ */) {
|
|
10204
|
-
|
|
10213
|
+
error2(Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1);
|
|
10205
10214
|
}
|
|
10206
10215
|
return value;
|
|
10207
10216
|
}
|
|
@@ -10231,7 +10240,7 @@ ${lanes.join("\n")}
|
|
|
10231
10240
|
const ch = codePointAt(text, pos);
|
|
10232
10241
|
if (pos === 0) {
|
|
10233
10242
|
if (ch === 65533 /* replacementCharacter */) {
|
|
10234
|
-
|
|
10243
|
+
error2(Diagnostics.File_appears_to_be_binary);
|
|
10235
10244
|
pos = end;
|
|
10236
10245
|
return token = 8 /* NonTextFileMarkerTrivia */;
|
|
10237
10246
|
}
|
|
@@ -10422,7 +10431,7 @@ ${lanes.join("\n")}
|
|
|
10422
10431
|
}
|
|
10423
10432
|
commentDirectives = appendIfCommentDirective(commentDirectives, text.slice(lastLineStart, pos), commentDirectiveRegExMultiLine, lastLineStart);
|
|
10424
10433
|
if (!commentClosed) {
|
|
10425
|
-
|
|
10434
|
+
error2(Diagnostics.Asterisk_Slash_expected);
|
|
10426
10435
|
}
|
|
10427
10436
|
if (skipTrivia2) {
|
|
10428
10437
|
continue;
|
|
@@ -10447,7 +10456,7 @@ ${lanes.join("\n")}
|
|
|
10447
10456
|
true
|
|
10448
10457
|
);
|
|
10449
10458
|
if (!tokenValue) {
|
|
10450
|
-
|
|
10459
|
+
error2(Diagnostics.Hexadecimal_digit_expected);
|
|
10451
10460
|
tokenValue = "0";
|
|
10452
10461
|
}
|
|
10453
10462
|
tokenValue = "0x" + tokenValue;
|
|
@@ -10460,7 +10469,7 @@ ${lanes.join("\n")}
|
|
|
10460
10469
|
2
|
|
10461
10470
|
);
|
|
10462
10471
|
if (!tokenValue) {
|
|
10463
|
-
|
|
10472
|
+
error2(Diagnostics.Binary_digit_expected);
|
|
10464
10473
|
tokenValue = "0";
|
|
10465
10474
|
}
|
|
10466
10475
|
tokenValue = "0b" + tokenValue;
|
|
@@ -10473,7 +10482,7 @@ ${lanes.join("\n")}
|
|
|
10473
10482
|
8
|
|
10474
10483
|
);
|
|
10475
10484
|
if (!tokenValue) {
|
|
10476
|
-
|
|
10485
|
+
error2(Diagnostics.Octal_digit_expected);
|
|
10477
10486
|
tokenValue = "0";
|
|
10478
10487
|
}
|
|
10479
10488
|
tokenValue = "0o" + tokenValue;
|
|
@@ -10499,7 +10508,7 @@ ${lanes.join("\n")}
|
|
|
10499
10508
|
return token = 27 /* SemicolonToken */;
|
|
10500
10509
|
case 60 /* lessThan */:
|
|
10501
10510
|
if (isConflictMarkerTrivia(text, pos)) {
|
|
10502
|
-
pos = scanConflictMarkerTrivia(text, pos,
|
|
10511
|
+
pos = scanConflictMarkerTrivia(text, pos, error2);
|
|
10503
10512
|
if (skipTrivia2) {
|
|
10504
10513
|
continue;
|
|
10505
10514
|
} else {
|
|
@@ -10522,7 +10531,7 @@ ${lanes.join("\n")}
|
|
|
10522
10531
|
return token = 30 /* LessThanToken */;
|
|
10523
10532
|
case 61 /* equals */:
|
|
10524
10533
|
if (isConflictMarkerTrivia(text, pos)) {
|
|
10525
|
-
pos = scanConflictMarkerTrivia(text, pos,
|
|
10534
|
+
pos = scanConflictMarkerTrivia(text, pos, error2);
|
|
10526
10535
|
if (skipTrivia2) {
|
|
10527
10536
|
continue;
|
|
10528
10537
|
} else {
|
|
@@ -10542,7 +10551,7 @@ ${lanes.join("\n")}
|
|
|
10542
10551
|
return token = 64 /* EqualsToken */;
|
|
10543
10552
|
case 62 /* greaterThan */:
|
|
10544
10553
|
if (isConflictMarkerTrivia(text, pos)) {
|
|
10545
|
-
pos = scanConflictMarkerTrivia(text, pos,
|
|
10554
|
+
pos = scanConflictMarkerTrivia(text, pos, error2);
|
|
10546
10555
|
if (skipTrivia2) {
|
|
10547
10556
|
continue;
|
|
10548
10557
|
} else {
|
|
@@ -10580,7 +10589,7 @@ ${lanes.join("\n")}
|
|
|
10580
10589
|
return token = 19 /* OpenBraceToken */;
|
|
10581
10590
|
case 124 /* bar */:
|
|
10582
10591
|
if (isConflictMarkerTrivia(text, pos)) {
|
|
10583
|
-
pos = scanConflictMarkerTrivia(text, pos,
|
|
10592
|
+
pos = scanConflictMarkerTrivia(text, pos, error2);
|
|
10584
10593
|
if (skipTrivia2) {
|
|
10585
10594
|
continue;
|
|
10586
10595
|
} else {
|
|
@@ -10622,12 +10631,12 @@ ${lanes.join("\n")}
|
|
|
10622
10631
|
tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts();
|
|
10623
10632
|
return token = getIdentifierToken();
|
|
10624
10633
|
}
|
|
10625
|
-
|
|
10634
|
+
error2(Diagnostics.Invalid_character);
|
|
10626
10635
|
pos++;
|
|
10627
10636
|
return token = 0 /* Unknown */;
|
|
10628
10637
|
case 35 /* hash */:
|
|
10629
10638
|
if (pos !== 0 && text[pos + 1] === "!") {
|
|
10630
|
-
|
|
10639
|
+
error2(Diagnostics.can_only_be_used_at_the_start_of_a_file);
|
|
10631
10640
|
pos++;
|
|
10632
10641
|
return token = 0 /* Unknown */;
|
|
10633
10642
|
}
|
|
@@ -10655,7 +10664,7 @@ ${lanes.join("\n")}
|
|
|
10655
10664
|
scanIdentifier(charAfterHash, languageVersion);
|
|
10656
10665
|
} else {
|
|
10657
10666
|
tokenValue = "#";
|
|
10658
|
-
|
|
10667
|
+
error2(Diagnostics.Invalid_character, pos++, charSize(ch));
|
|
10659
10668
|
}
|
|
10660
10669
|
return token = 81 /* PrivateIdentifier */;
|
|
10661
10670
|
default:
|
|
@@ -10671,7 +10680,7 @@ ${lanes.join("\n")}
|
|
|
10671
10680
|
continue;
|
|
10672
10681
|
}
|
|
10673
10682
|
const size = charSize(ch);
|
|
10674
|
-
|
|
10683
|
+
error2(Diagnostics.Invalid_character, pos, size);
|
|
10675
10684
|
pos += size;
|
|
10676
10685
|
return token = 0 /* Unknown */;
|
|
10677
10686
|
}
|
|
@@ -10737,13 +10746,13 @@ ${lanes.join("\n")}
|
|
|
10737
10746
|
while (true) {
|
|
10738
10747
|
if (p >= end) {
|
|
10739
10748
|
tokenFlags |= 4 /* Unterminated */;
|
|
10740
|
-
|
|
10749
|
+
error2(Diagnostics.Unterminated_regular_expression_literal);
|
|
10741
10750
|
break;
|
|
10742
10751
|
}
|
|
10743
10752
|
const ch = text.charCodeAt(p);
|
|
10744
10753
|
if (isLineBreak(ch)) {
|
|
10745
10754
|
tokenFlags |= 4 /* Unterminated */;
|
|
10746
|
-
|
|
10755
|
+
error2(Diagnostics.Unterminated_regular_expression_literal);
|
|
10747
10756
|
break;
|
|
10748
10757
|
}
|
|
10749
10758
|
if (inEscape) {
|
|
@@ -10855,16 +10864,16 @@ ${lanes.join("\n")}
|
|
|
10855
10864
|
}
|
|
10856
10865
|
if (char === 60 /* lessThan */) {
|
|
10857
10866
|
if (isConflictMarkerTrivia(text, pos)) {
|
|
10858
|
-
pos = scanConflictMarkerTrivia(text, pos,
|
|
10867
|
+
pos = scanConflictMarkerTrivia(text, pos, error2);
|
|
10859
10868
|
return token = 7 /* ConflictMarkerTrivia */;
|
|
10860
10869
|
}
|
|
10861
10870
|
break;
|
|
10862
10871
|
}
|
|
10863
10872
|
if (char === 62 /* greaterThan */) {
|
|
10864
|
-
|
|
10873
|
+
error2(Diagnostics.Unexpected_token_Did_you_mean_or_gt, pos, 1);
|
|
10865
10874
|
}
|
|
10866
10875
|
if (char === 125 /* closeBrace */) {
|
|
10867
|
-
|
|
10876
|
+
error2(Diagnostics.Unexpected_token_Did_you_mean_or_rbrace, pos, 1);
|
|
10868
10877
|
}
|
|
10869
10878
|
if (isLineBreak(char) && firstNonWhitespace === 0) {
|
|
10870
10879
|
firstNonWhitespace = -1;
|
|
@@ -36464,8 +36473,8 @@ ${lanes.join("\n")}
|
|
|
36464
36473
|
const fileName = configFileName || "tsconfig.json";
|
|
36465
36474
|
const diagnosticMessage = Diagnostics.The_files_list_in_config_file_0_is_empty;
|
|
36466
36475
|
const nodeValue = forEachTsConfigPropArray(sourceFile, "files", (property) => property.initializer);
|
|
36467
|
-
const
|
|
36468
|
-
errors.push(
|
|
36476
|
+
const error2 = createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, nodeValue, diagnosticMessage, fileName);
|
|
36477
|
+
errors.push(error2);
|
|
36469
36478
|
} else {
|
|
36470
36479
|
createCompilerDiagnosticOnlyIfJson(Diagnostics.The_files_list_in_config_file_0_is_empty, configFileName || "tsconfig.json");
|
|
36471
36480
|
}
|
|
@@ -36572,8 +36581,8 @@ ${lanes.join("\n")}
|
|
|
36572
36581
|
}
|
|
36573
36582
|
}
|
|
36574
36583
|
}
|
|
36575
|
-
function isErrorNoInputFiles(
|
|
36576
|
-
return
|
|
36584
|
+
function isErrorNoInputFiles(error2) {
|
|
36585
|
+
return error2.code === Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2.code;
|
|
36577
36586
|
}
|
|
36578
36587
|
function getErrorForNoInputFiles({ includeSpecs, excludeSpecs }, configFileName) {
|
|
36579
36588
|
return createCompilerDiagnostic(
|
|
@@ -36594,7 +36603,7 @@ ${lanes.join("\n")}
|
|
|
36594
36603
|
if (shouldReportNoInputFiles(fileNames, canJsonReportNoInutFiles)) {
|
|
36595
36604
|
configParseDiagnostics.push(getErrorForNoInputFiles(configFileSpecs, configFileName));
|
|
36596
36605
|
} else {
|
|
36597
|
-
filterMutate(configParseDiagnostics, (
|
|
36606
|
+
filterMutate(configParseDiagnostics, (error2) => !isErrorNoInputFiles(error2));
|
|
36598
36607
|
}
|
|
36599
36608
|
return existingErrors !== configParseDiagnostics.length;
|
|
36600
36609
|
}
|
|
@@ -37298,7 +37307,9 @@ ${lanes.join("\n")}
|
|
|
37298
37307
|
["es2022.string", "lib.es2022.string.d.ts"],
|
|
37299
37308
|
["es2022.regexp", "lib.es2022.regexp.d.ts"],
|
|
37300
37309
|
["es2023.array", "lib.es2023.array.d.ts"],
|
|
37310
|
+
["es2023.collection", "lib.es2023.collection.d.ts"],
|
|
37301
37311
|
["esnext.array", "lib.es2023.array.d.ts"],
|
|
37312
|
+
["esnext.collection", "lib.es2023.collection.d.ts"],
|
|
37302
37313
|
["esnext.symbol", "lib.es2019.symbol.d.ts"],
|
|
37303
37314
|
["esnext.asynciterable", "lib.es2018.asynciterable.d.ts"],
|
|
37304
37315
|
["esnext.intl", "lib.esnext.intl.d.ts"],
|
|
@@ -39269,7 +39280,7 @@ ${lanes.join("\n")}
|
|
|
39269
39280
|
return str + "}";
|
|
39270
39281
|
}
|
|
39271
39282
|
function getKeyForCompilerOptions(options, affectingOptionDeclarations) {
|
|
39272
|
-
return affectingOptionDeclarations.map((option) => compilerOptionValueToString(getCompilerOptionValue(options, option))).join("|") +
|
|
39283
|
+
return affectingOptionDeclarations.map((option) => compilerOptionValueToString(getCompilerOptionValue(options, option))).join("|") + `|${options.pathsBasePath}`;
|
|
39273
39284
|
}
|
|
39274
39285
|
function createCacheWithRedirects(ownOptions) {
|
|
39275
39286
|
const redirectsMap = /* @__PURE__ */ new Map();
|
|
@@ -46109,14 +46120,14 @@ ${lanes.join("\n")}
|
|
|
46109
46120
|
}
|
|
46110
46121
|
}
|
|
46111
46122
|
function errorSkippedOn(key, location, message, ...args) {
|
|
46112
|
-
const diagnostic =
|
|
46123
|
+
const diagnostic = error2(location, message, ...args);
|
|
46113
46124
|
diagnostic.skippedOn = key;
|
|
46114
46125
|
return diagnostic;
|
|
46115
46126
|
}
|
|
46116
46127
|
function createError(location, message, ...args) {
|
|
46117
46128
|
return location ? createDiagnosticForNode(location, message, ...args) : createCompilerDiagnostic(message, ...args);
|
|
46118
46129
|
}
|
|
46119
|
-
function
|
|
46130
|
+
function error2(location, message, ...args) {
|
|
46120
46131
|
const diagnostic = createError(location, message, ...args);
|
|
46121
46132
|
diagnostics.add(diagnostic);
|
|
46122
46133
|
return diagnostic;
|
|
@@ -46140,7 +46151,7 @@ ${lanes.join("\n")}
|
|
|
46140
46151
|
addErrorOrSuggestion(isError, "message" in message ? createDiagnosticForNode(location, message, ...args) : createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(location), location, message));
|
|
46141
46152
|
}
|
|
46142
46153
|
function errorAndMaybeSuggestAwait(location, maybeMissingAwait, message, ...args) {
|
|
46143
|
-
const diagnostic =
|
|
46154
|
+
const diagnostic = error2(location, message, ...args);
|
|
46144
46155
|
if (maybeMissingAwait) {
|
|
46145
46156
|
const related = createDiagnosticForNode(location, Diagnostics.Did_you_forget_to_use_await);
|
|
46146
46157
|
addRelatedInfo(diagnostic, related);
|
|
@@ -46286,7 +46297,7 @@ ${lanes.join("\n")}
|
|
|
46286
46297
|
}
|
|
46287
46298
|
} else if (target.flags & 1024 /* NamespaceModule */) {
|
|
46288
46299
|
if (target !== globalThisSymbol) {
|
|
46289
|
-
|
|
46300
|
+
error2(
|
|
46290
46301
|
source.declarations && getNameOfDeclaration(source.declarations[0]),
|
|
46291
46302
|
Diagnostics.Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity,
|
|
46292
46303
|
symbolToString(target)
|
|
@@ -46416,7 +46427,7 @@ ${lanes.join("\n")}
|
|
|
46416
46427
|
mergeSymbol(mainModule, moduleAugmentation.symbol);
|
|
46417
46428
|
}
|
|
46418
46429
|
} else {
|
|
46419
|
-
|
|
46430
|
+
error2(moduleName, Diagnostics.Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity, moduleName.text);
|
|
46420
46431
|
}
|
|
46421
46432
|
}
|
|
46422
46433
|
}
|
|
@@ -46743,7 +46754,7 @@ ${lanes.join("\n")}
|
|
|
46743
46754
|
case 265 /* EnumDeclaration */:
|
|
46744
46755
|
if (result = lookup(((_c = getSymbolOfDeclaration(location)) == null ? void 0 : _c.exports) || emptySymbols, name, meaning & 8 /* EnumMember */)) {
|
|
46745
46756
|
if (nameNotFoundMessage && getIsolatedModules(compilerOptions) && !(location.flags & 16777216 /* Ambient */) && getSourceFileOfNode(location) !== getSourceFileOfNode(result.valueDeclaration)) {
|
|
46746
|
-
|
|
46757
|
+
error2(
|
|
46747
46758
|
errorLocation,
|
|
46748
46759
|
Diagnostics.Cannot_access_0_from_another_file_without_qualification_when_1_is_enabled_Use_2_instead,
|
|
46749
46760
|
unescapeLeadingUnderscores(name),
|
|
@@ -46775,7 +46786,7 @@ ${lanes.join("\n")}
|
|
|
46775
46786
|
}
|
|
46776
46787
|
if (lastLocation && isStatic(lastLocation)) {
|
|
46777
46788
|
if (nameNotFoundMessage) {
|
|
46778
|
-
|
|
46789
|
+
error2(errorLocation, Diagnostics.Static_members_cannot_reference_class_type_parameters);
|
|
46779
46790
|
}
|
|
46780
46791
|
return void 0;
|
|
46781
46792
|
}
|
|
@@ -46794,7 +46805,7 @@ ${lanes.join("\n")}
|
|
|
46794
46805
|
const container = location.parent.parent;
|
|
46795
46806
|
if (isClassLike(container) && (result = lookup(getSymbolOfDeclaration(container).members, name, meaning & 788968 /* Type */))) {
|
|
46796
46807
|
if (nameNotFoundMessage) {
|
|
46797
|
-
|
|
46808
|
+
error2(errorLocation, Diagnostics.Base_class_expressions_cannot_reference_class_type_parameters);
|
|
46798
46809
|
}
|
|
46799
46810
|
return void 0;
|
|
46800
46811
|
}
|
|
@@ -46805,7 +46816,7 @@ ${lanes.join("\n")}
|
|
|
46805
46816
|
if (isClassLike(grandparent) || grandparent.kind === 263 /* InterfaceDeclaration */) {
|
|
46806
46817
|
if (result = lookup(getSymbolOfDeclaration(grandparent).members, name, meaning & 788968 /* Type */)) {
|
|
46807
46818
|
if (nameNotFoundMessage) {
|
|
46808
|
-
|
|
46819
|
+
error2(errorLocation, Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);
|
|
46809
46820
|
}
|
|
46810
46821
|
return void 0;
|
|
46811
46822
|
}
|
|
@@ -46916,7 +46927,7 @@ ${lanes.join("\n")}
|
|
|
46916
46927
|
}
|
|
46917
46928
|
function checkAndReportErrorForInvalidInitializer() {
|
|
46918
46929
|
if (propertyWithInvalidInitializer && !(useDefineForClassFields && getEmitScriptTarget(compilerOptions) >= 9 /* ES2022 */)) {
|
|
46919
|
-
|
|
46930
|
+
error2(
|
|
46920
46931
|
errorLocation,
|
|
46921
46932
|
errorLocation && propertyWithInvalidInitializer.type && textRangeContainsPositionInclusive(propertyWithInvalidInitializer.type, errorLocation.pos) ? Diagnostics.Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor : Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor,
|
|
46922
46933
|
declarationNameToString(propertyWithInvalidInitializer.name),
|
|
@@ -46936,7 +46947,7 @@ ${lanes.join("\n")}
|
|
|
46936
46947
|
if (nameArg) {
|
|
46937
46948
|
suggestedLib = getSuggestedLibForNonExistentName(nameArg);
|
|
46938
46949
|
if (suggestedLib) {
|
|
46939
|
-
|
|
46950
|
+
error2(errorLocation, nameNotFoundMessage, diagnosticName(nameArg), suggestedLib);
|
|
46940
46951
|
}
|
|
46941
46952
|
}
|
|
46942
46953
|
if (!suggestedLib && getSpellingSuggestions && suggestionCount < maximumSuggestionCount) {
|
|
@@ -46965,7 +46976,7 @@ ${lanes.join("\n")}
|
|
|
46965
46976
|
}
|
|
46966
46977
|
}
|
|
46967
46978
|
if (!suggestion && !suggestedLib && nameArg) {
|
|
46968
|
-
|
|
46979
|
+
error2(errorLocation, nameNotFoundMessage, diagnosticName(nameArg));
|
|
46969
46980
|
}
|
|
46970
46981
|
suggestionCount++;
|
|
46971
46982
|
}
|
|
@@ -46993,9 +47004,9 @@ ${lanes.join("\n")}
|
|
|
46993
47004
|
const candidate = getMergedSymbol(getLateBoundSymbol(result));
|
|
46994
47005
|
const root = getRootDeclaration(associatedDeclarationForContainingInitializerOrBindingName);
|
|
46995
47006
|
if (candidate === getSymbolOfDeclaration(associatedDeclarationForContainingInitializerOrBindingName)) {
|
|
46996
|
-
|
|
47007
|
+
error2(errorLocation, Diagnostics.Parameter_0_cannot_reference_itself, declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name));
|
|
46997
47008
|
} else if (candidate.valueDeclaration && candidate.valueDeclaration.pos > associatedDeclarationForContainingInitializerOrBindingName.pos && root.parent.locals && lookup(root.parent.locals, candidate.escapedName, meaning) === candidate) {
|
|
46998
|
-
|
|
47009
|
+
error2(errorLocation, Diagnostics.Parameter_0_cannot_reference_identifier_1_declared_after_it, declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name), declarationNameToString(errorLocation));
|
|
46999
47010
|
}
|
|
47000
47011
|
}
|
|
47001
47012
|
if (result && errorLocation && meaning & 111551 /* Value */ && result.flags & 2097152 /* Alias */ && !(result.flags & 111551 /* Value */) && !isValidTypeOnlyAliasUseSite(errorLocation)) {
|
|
@@ -47004,7 +47015,7 @@ ${lanes.join("\n")}
|
|
|
47004
47015
|
const message = typeOnlyDeclaration.kind === 280 /* ExportSpecifier */ || typeOnlyDeclaration.kind === 277 /* ExportDeclaration */ || typeOnlyDeclaration.kind === 279 /* NamespaceExport */ ? Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type : Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type;
|
|
47005
47016
|
const unescapedName = unescapeLeadingUnderscores(name);
|
|
47006
47017
|
addTypeOnlyDeclarationRelatedInfo(
|
|
47007
|
-
|
|
47018
|
+
error2(errorLocation, message, unescapedName),
|
|
47008
47019
|
typeOnlyDeclaration,
|
|
47009
47020
|
unescapedName
|
|
47010
47021
|
);
|
|
@@ -47087,13 +47098,13 @@ ${lanes.join("\n")}
|
|
|
47087
47098
|
}
|
|
47088
47099
|
const constructorType = getTypeOfSymbol(classSymbol);
|
|
47089
47100
|
if (getPropertyOfType(constructorType, name)) {
|
|
47090
|
-
|
|
47101
|
+
error2(errorLocation, Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0, diagnosticName(nameArg), symbolToString(classSymbol));
|
|
47091
47102
|
return true;
|
|
47092
47103
|
}
|
|
47093
47104
|
if (location === container && !isStatic(location)) {
|
|
47094
47105
|
const instanceType = getDeclaredTypeOfSymbol(classSymbol).thisType;
|
|
47095
47106
|
if (getPropertyOfType(instanceType, name)) {
|
|
47096
|
-
|
|
47107
|
+
error2(errorLocation, Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0, diagnosticName(nameArg));
|
|
47097
47108
|
return true;
|
|
47098
47109
|
}
|
|
47099
47110
|
}
|
|
@@ -47110,7 +47121,7 @@ ${lanes.join("\n")}
|
|
|
47110
47121
|
/*ignoreErrors*/
|
|
47111
47122
|
true
|
|
47112
47123
|
)) {
|
|
47113
|
-
|
|
47124
|
+
error2(errorLocation, Diagnostics.Cannot_extend_an_interface_0_Did_you_mean_implements, getTextOfNode(expression));
|
|
47114
47125
|
return true;
|
|
47115
47126
|
}
|
|
47116
47127
|
return false;
|
|
@@ -47149,7 +47160,7 @@ ${lanes.join("\n")}
|
|
|
47149
47160
|
const propName = parent2.right.escapedText;
|
|
47150
47161
|
const propType = getPropertyOfType(getDeclaredTypeOfSymbol(symbol), propName);
|
|
47151
47162
|
if (propType) {
|
|
47152
|
-
|
|
47163
|
+
error2(
|
|
47153
47164
|
parent2,
|
|
47154
47165
|
Diagnostics.Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_property_1_in_0_with_0_1,
|
|
47155
47166
|
unescapeLeadingUnderscores(name),
|
|
@@ -47158,7 +47169,7 @@ ${lanes.join("\n")}
|
|
|
47158
47169
|
return true;
|
|
47159
47170
|
}
|
|
47160
47171
|
}
|
|
47161
|
-
|
|
47172
|
+
error2(errorLocation, Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here, unescapeLeadingUnderscores(name));
|
|
47162
47173
|
return true;
|
|
47163
47174
|
}
|
|
47164
47175
|
}
|
|
@@ -47178,7 +47189,7 @@ ${lanes.join("\n")}
|
|
|
47178
47189
|
false
|
|
47179
47190
|
));
|
|
47180
47191
|
if (symbol && !(symbol.flags & 1920 /* Namespace */)) {
|
|
47181
|
-
|
|
47192
|
+
error2(errorLocation, Diagnostics._0_refers_to_a_value_but_is_being_used_as_a_type_here_Did_you_mean_typeof_0, unescapeLeadingUnderscores(name));
|
|
47182
47193
|
return true;
|
|
47183
47194
|
}
|
|
47184
47195
|
}
|
|
@@ -47189,7 +47200,7 @@ ${lanes.join("\n")}
|
|
|
47189
47200
|
}
|
|
47190
47201
|
function checkAndReportErrorForExportingPrimitiveType(errorLocation, name) {
|
|
47191
47202
|
if (isPrimitiveTypeName(name) && errorLocation.parent.kind === 280 /* ExportSpecifier */) {
|
|
47192
|
-
|
|
47203
|
+
error2(errorLocation, Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, name);
|
|
47193
47204
|
return true;
|
|
47194
47205
|
}
|
|
47195
47206
|
return false;
|
|
@@ -47198,9 +47209,9 @@ ${lanes.join("\n")}
|
|
|
47198
47209
|
if (meaning & 111551 /* Value */) {
|
|
47199
47210
|
if (isPrimitiveTypeName(name)) {
|
|
47200
47211
|
if (isExtendedByInterface(errorLocation)) {
|
|
47201
|
-
|
|
47212
|
+
error2(errorLocation, Diagnostics.An_interface_cannot_extend_a_primitive_type_like_0_an_interface_can_only_extend_named_types_and_classes, unescapeLeadingUnderscores(name));
|
|
47202
47213
|
} else {
|
|
47203
|
-
|
|
47214
|
+
error2(errorLocation, Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, unescapeLeadingUnderscores(name));
|
|
47204
47215
|
}
|
|
47205
47216
|
return true;
|
|
47206
47217
|
}
|
|
@@ -47219,11 +47230,11 @@ ${lanes.join("\n")}
|
|
|
47219
47230
|
if (symbol && allFlags !== void 0 && !(allFlags & 111551 /* Value */)) {
|
|
47220
47231
|
const rawName = unescapeLeadingUnderscores(name);
|
|
47221
47232
|
if (isES2015OrLaterConstructorName(name)) {
|
|
47222
|
-
|
|
47233
|
+
error2(errorLocation, Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_es2015_or_later, rawName);
|
|
47223
47234
|
} else if (maybeMappedType(errorLocation, symbol)) {
|
|
47224
|
-
|
|
47235
|
+
error2(errorLocation, Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0, rawName, rawName === "K" ? "P" : "K");
|
|
47225
47236
|
} else {
|
|
47226
|
-
|
|
47237
|
+
error2(errorLocation, Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, rawName);
|
|
47227
47238
|
}
|
|
47228
47239
|
return true;
|
|
47229
47240
|
}
|
|
@@ -47279,7 +47290,7 @@ ${lanes.join("\n")}
|
|
|
47279
47290
|
false
|
|
47280
47291
|
));
|
|
47281
47292
|
if (symbol) {
|
|
47282
|
-
|
|
47293
|
+
error2(
|
|
47283
47294
|
errorLocation,
|
|
47284
47295
|
Diagnostics.Cannot_use_namespace_0_as_a_value,
|
|
47285
47296
|
unescapeLeadingUnderscores(name)
|
|
@@ -47299,7 +47310,7 @@ ${lanes.join("\n")}
|
|
|
47299
47310
|
false
|
|
47300
47311
|
));
|
|
47301
47312
|
if (symbol) {
|
|
47302
|
-
|
|
47313
|
+
error2(errorLocation, Diagnostics.Cannot_use_namespace_0_as_a_type, unescapeLeadingUnderscores(name));
|
|
47303
47314
|
return true;
|
|
47304
47315
|
}
|
|
47305
47316
|
}
|
|
@@ -47320,11 +47331,11 @@ ${lanes.join("\n")}
|
|
|
47320
47331
|
let diagnosticMessage;
|
|
47321
47332
|
const declarationName = declarationNameToString(getNameOfDeclaration(declaration));
|
|
47322
47333
|
if (result.flags & 2 /* BlockScopedVariable */) {
|
|
47323
|
-
diagnosticMessage =
|
|
47334
|
+
diagnosticMessage = error2(errorLocation, Diagnostics.Block_scoped_variable_0_used_before_its_declaration, declarationName);
|
|
47324
47335
|
} else if (result.flags & 32 /* Class */) {
|
|
47325
|
-
diagnosticMessage =
|
|
47336
|
+
diagnosticMessage = error2(errorLocation, Diagnostics.Class_0_used_before_its_declaration, declarationName);
|
|
47326
47337
|
} else if (result.flags & 256 /* RegularEnum */) {
|
|
47327
|
-
diagnosticMessage =
|
|
47338
|
+
diagnosticMessage = error2(errorLocation, Diagnostics.Enum_0_used_before_its_declaration, declarationName);
|
|
47328
47339
|
}
|
|
47329
47340
|
if (diagnosticMessage) {
|
|
47330
47341
|
addRelatedInfo(
|
|
@@ -47399,7 +47410,7 @@ ${lanes.join("\n")}
|
|
|
47399
47410
|
const message = isExport ? Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type : Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type;
|
|
47400
47411
|
const relatedMessage = isExport ? Diagnostics._0_was_exported_here : Diagnostics._0_was_imported_here;
|
|
47401
47412
|
const name = typeOnlyDeclaration.kind === 277 /* ExportDeclaration */ ? "*" : unescapeLeadingUnderscores(typeOnlyDeclaration.name.escapedText);
|
|
47402
|
-
addRelatedInfo(
|
|
47413
|
+
addRelatedInfo(error2(node.moduleReference, message), createDiagnosticForNode(typeOnlyDeclaration, relatedMessage, name));
|
|
47403
47414
|
}
|
|
47404
47415
|
}
|
|
47405
47416
|
function resolveExportByName(moduleSymbol, name, sourceNode, dontResolveAlias) {
|
|
@@ -47504,7 +47515,7 @@ ${lanes.join("\n")}
|
|
|
47504
47515
|
const compilerOptionName = moduleKind >= 5 /* ES2015 */ ? "allowSyntheticDefaultImports" : "esModuleInterop";
|
|
47505
47516
|
const exportEqualsSymbol = moduleSymbol.exports.get("export=" /* ExportEquals */);
|
|
47506
47517
|
const exportAssignment = exportEqualsSymbol.valueDeclaration;
|
|
47507
|
-
const err =
|
|
47518
|
+
const err = error2(node.name, Diagnostics.Module_0_can_only_be_default_imported_using_the_1_flag, symbolToString(moduleSymbol), compilerOptionName);
|
|
47508
47519
|
if (exportAssignment) {
|
|
47509
47520
|
addRelatedInfo(err, createDiagnosticForNode(
|
|
47510
47521
|
exportAssignment,
|
|
@@ -47557,14 +47568,14 @@ ${lanes.join("\n")}
|
|
|
47557
47568
|
function reportNonDefaultExport(moduleSymbol, node) {
|
|
47558
47569
|
var _a, _b, _c;
|
|
47559
47570
|
if ((_a = moduleSymbol.exports) == null ? void 0 : _a.has(node.symbol.escapedName)) {
|
|
47560
|
-
|
|
47571
|
+
error2(
|
|
47561
47572
|
node.name,
|
|
47562
47573
|
Diagnostics.Module_0_has_no_default_export_Did_you_mean_to_use_import_1_from_0_instead,
|
|
47563
47574
|
symbolToString(moduleSymbol),
|
|
47564
47575
|
symbolToString(node.symbol)
|
|
47565
47576
|
);
|
|
47566
47577
|
} else {
|
|
47567
|
-
const diagnostic =
|
|
47578
|
+
const diagnostic = error2(node.name, Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol));
|
|
47568
47579
|
const exportStar = (_b = moduleSymbol.exports) == null ? void 0 : _b.get("__export" /* ExportStar */);
|
|
47569
47580
|
if (exportStar) {
|
|
47570
47581
|
const defaultExport = (_c = exportStar.declarations) == null ? void 0 : _c.find((decl) => {
|
|
@@ -47715,7 +47726,7 @@ ${lanes.join("\n")}
|
|
|
47715
47726
|
const suggestion = getSuggestedSymbolForNonexistentModule(name, targetSymbol);
|
|
47716
47727
|
if (suggestion !== void 0) {
|
|
47717
47728
|
const suggestionName = symbolToString(suggestion);
|
|
47718
|
-
const diagnostic =
|
|
47729
|
+
const diagnostic = error2(name, Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, moduleName, declarationName, suggestionName);
|
|
47719
47730
|
if (suggestion.valueDeclaration) {
|
|
47720
47731
|
addRelatedInfo(
|
|
47721
47732
|
diagnostic,
|
|
@@ -47724,7 +47735,7 @@ ${lanes.join("\n")}
|
|
|
47724
47735
|
}
|
|
47725
47736
|
} else {
|
|
47726
47737
|
if ((_a = moduleSymbol.exports) == null ? void 0 : _a.has("default" /* Default */)) {
|
|
47727
|
-
|
|
47738
|
+
error2(
|
|
47728
47739
|
name,
|
|
47729
47740
|
Diagnostics.Module_0_has_no_exported_member_1_Did_you_mean_to_use_import_1_from_0_instead,
|
|
47730
47741
|
moduleName,
|
|
@@ -47742,10 +47753,10 @@ ${lanes.join("\n")}
|
|
|
47742
47753
|
if (localSymbol) {
|
|
47743
47754
|
const exportedEqualsSymbol = exports == null ? void 0 : exports.get("export=" /* ExportEquals */);
|
|
47744
47755
|
if (exportedEqualsSymbol) {
|
|
47745
|
-
getSymbolIfSameReference(exportedEqualsSymbol, localSymbol) ? reportInvalidImportEqualsExportMember(node, name, declarationName, moduleName) :
|
|
47756
|
+
getSymbolIfSameReference(exportedEqualsSymbol, localSymbol) ? reportInvalidImportEqualsExportMember(node, name, declarationName, moduleName) : error2(name, Diagnostics.Module_0_has_no_exported_member_1, moduleName, declarationName);
|
|
47746
47757
|
} else {
|
|
47747
47758
|
const exportedSymbol = exports ? find(symbolsToArray(exports), (symbol) => !!getSymbolIfSameReference(symbol, localSymbol)) : void 0;
|
|
47748
|
-
const diagnostic = exportedSymbol ?
|
|
47759
|
+
const diagnostic = exportedSymbol ? error2(name, Diagnostics.Module_0_declares_1_locally_but_it_is_exported_as_2, moduleName, declarationName, symbolToString(exportedSymbol)) : error2(name, Diagnostics.Module_0_declares_1_locally_but_it_is_not_exported, moduleName, declarationName);
|
|
47749
47760
|
if (localSymbol.declarations) {
|
|
47750
47761
|
addRelatedInfo(
|
|
47751
47762
|
diagnostic,
|
|
@@ -47754,20 +47765,20 @@ ${lanes.join("\n")}
|
|
|
47754
47765
|
}
|
|
47755
47766
|
}
|
|
47756
47767
|
} else {
|
|
47757
|
-
|
|
47768
|
+
error2(name, Diagnostics.Module_0_has_no_exported_member_1, moduleName, declarationName);
|
|
47758
47769
|
}
|
|
47759
47770
|
}
|
|
47760
47771
|
function reportInvalidImportEqualsExportMember(node, name, declarationName, moduleName) {
|
|
47761
47772
|
if (moduleKind >= 5 /* ES2015 */) {
|
|
47762
47773
|
const message = getESModuleInterop(compilerOptions) ? Diagnostics._0_can_only_be_imported_by_using_a_default_import : Diagnostics._0_can_only_be_imported_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import;
|
|
47763
|
-
|
|
47774
|
+
error2(name, message, declarationName);
|
|
47764
47775
|
} else {
|
|
47765
47776
|
if (isInJSFile(node)) {
|
|
47766
47777
|
const message = getESModuleInterop(compilerOptions) ? Diagnostics._0_can_only_be_imported_by_using_a_require_call_or_by_using_a_default_import : Diagnostics._0_can_only_be_imported_by_using_a_require_call_or_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import;
|
|
47767
|
-
|
|
47778
|
+
error2(name, message, declarationName);
|
|
47768
47779
|
} else {
|
|
47769
47780
|
const message = getESModuleInterop(compilerOptions) ? Diagnostics._0_can_only_be_imported_by_using_import_1_require_2_or_a_default_import : Diagnostics._0_can_only_be_imported_by_using_import_1_require_2_or_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import;
|
|
47770
|
-
|
|
47781
|
+
error2(name, message, declarationName, declarationName, moduleName);
|
|
47771
47782
|
}
|
|
47772
47783
|
}
|
|
47773
47784
|
}
|
|
@@ -47937,7 +47948,7 @@ ${lanes.join("\n")}
|
|
|
47937
47948
|
if (links.aliasTarget === resolvingSymbol) {
|
|
47938
47949
|
links.aliasTarget = target || unknownSymbol;
|
|
47939
47950
|
} else {
|
|
47940
|
-
|
|
47951
|
+
error2(node, Diagnostics.Circular_definition_of_import_alias_0, symbolToString(symbol));
|
|
47941
47952
|
}
|
|
47942
47953
|
} else if (links.aliasTarget === resolvingSymbol) {
|
|
47943
47954
|
links.aliasTarget = unknownSymbol;
|
|
@@ -48173,13 +48184,13 @@ ${lanes.join("\n")}
|
|
|
48173
48184
|
const declarationName = declarationNameToString(right);
|
|
48174
48185
|
const suggestionForNonexistentModule = getSuggestedSymbolForNonexistentModule(right, namespace);
|
|
48175
48186
|
if (suggestionForNonexistentModule) {
|
|
48176
|
-
|
|
48187
|
+
error2(right, Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, namespaceName, declarationName, symbolToString(suggestionForNonexistentModule));
|
|
48177
48188
|
return void 0;
|
|
48178
48189
|
}
|
|
48179
48190
|
const containingQualifiedName = isQualifiedName(name) && getContainingQualifiedNameNode(name);
|
|
48180
48191
|
const canSuggestTypeof = globalObjectType && meaning & 788968 /* Type */ && containingQualifiedName && !isTypeOfExpression(containingQualifiedName.parent) && tryGetQualifiedNameAsValue(containingQualifiedName);
|
|
48181
48192
|
if (canSuggestTypeof) {
|
|
48182
|
-
|
|
48193
|
+
error2(
|
|
48183
48194
|
containingQualifiedName,
|
|
48184
48195
|
Diagnostics._0_refers_to_a_value_but_is_being_used_as_a_type_here_Did_you_mean_typeof_0,
|
|
48185
48196
|
entityNameToString(containingQualifiedName)
|
|
@@ -48189,7 +48200,7 @@ ${lanes.join("\n")}
|
|
|
48189
48200
|
if (meaning & 1920 /* Namespace */ && isQualifiedName(name.parent)) {
|
|
48190
48201
|
const exportedTypeSymbol = getMergedSymbol(getSymbol2(getExportsOfSymbol(namespace), right.escapedText, 788968 /* Type */));
|
|
48191
48202
|
if (exportedTypeSymbol) {
|
|
48192
|
-
|
|
48203
|
+
error2(
|
|
48193
48204
|
name.parent.right,
|
|
48194
48205
|
Diagnostics.Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_property_1_in_0_with_0_1,
|
|
48195
48206
|
symbolToString(exportedTypeSymbol),
|
|
@@ -48198,7 +48209,7 @@ ${lanes.join("\n")}
|
|
|
48198
48209
|
return void 0;
|
|
48199
48210
|
}
|
|
48200
48211
|
}
|
|
48201
|
-
|
|
48212
|
+
error2(right, Diagnostics.Namespace_0_has_no_exported_member_1, namespaceName, declarationName);
|
|
48202
48213
|
}
|
|
48203
48214
|
return void 0;
|
|
48204
48215
|
}
|
|
@@ -48303,7 +48314,7 @@ ${lanes.join("\n")}
|
|
|
48303
48314
|
if (startsWith(moduleReference, "@types/")) {
|
|
48304
48315
|
const diag2 = Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
|
|
48305
48316
|
const withoutAtTypePrefix = removePrefix(moduleReference, "@types/");
|
|
48306
|
-
|
|
48317
|
+
error2(errorNode, diag2, withoutAtTypePrefix, moduleReference);
|
|
48307
48318
|
}
|
|
48308
48319
|
const ambientModule = tryFindAmbientModule(
|
|
48309
48320
|
moduleReference,
|
|
@@ -48322,12 +48333,12 @@ ${lanes.join("\n")}
|
|
|
48322
48333
|
const sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName);
|
|
48323
48334
|
if (sourceFile) {
|
|
48324
48335
|
if (resolutionDiagnostic) {
|
|
48325
|
-
|
|
48336
|
+
error2(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
|
|
48326
48337
|
}
|
|
48327
48338
|
if (resolvedModule.resolvedUsingTsExtension && isDeclarationFileName(moduleReference)) {
|
|
48328
48339
|
const importOrExport = ((_g = findAncestor(location, isImportDeclaration)) == null ? void 0 : _g.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
|
|
48329
48340
|
if (importOrExport && !importOrExport.isTypeOnly || findAncestor(location, isImportCall)) {
|
|
48330
|
-
|
|
48341
|
+
error2(
|
|
48331
48342
|
errorNode,
|
|
48332
48343
|
Diagnostics.A_declaration_file_cannot_be_imported_without_import_type_Did_you_mean_to_import_an_implementation_file_0_instead,
|
|
48333
48344
|
getSuggestedImportSource(Debug.checkDefined(tryExtractTSExtension(moduleReference)))
|
|
@@ -48335,7 +48346,7 @@ ${lanes.join("\n")}
|
|
|
48335
48346
|
}
|
|
48336
48347
|
} else if (resolvedModule.resolvedUsingTsExtension && !shouldAllowImportingTsExtension(compilerOptions, currentSourceFile.fileName)) {
|
|
48337
48348
|
const tsExtension = Debug.checkDefined(tryExtractTSExtension(moduleReference));
|
|
48338
|
-
|
|
48349
|
+
error2(errorNode, Diagnostics.An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled, tsExtension);
|
|
48339
48350
|
}
|
|
48340
48351
|
if (sourceFile.symbol) {
|
|
48341
48352
|
if (resolvedModule.isExternalLibraryImport && !resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
|
|
@@ -48355,7 +48366,7 @@ ${lanes.join("\n")}
|
|
|
48355
48366
|
const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (_h = overrideClauseHost.assertions) == null ? void 0 : _h.assertClause : overrideClauseHost == null ? void 0 : overrideClauseHost.assertClause;
|
|
48356
48367
|
if (isSyncImport && sourceFile.impliedNodeFormat === 99 /* ESNext */ && !getResolutionModeOverrideForClause(overrideClause)) {
|
|
48357
48368
|
if (findAncestor(location, isImportEqualsDeclaration)) {
|
|
48358
|
-
|
|
48369
|
+
error2(errorNode, Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_with_require_Use_an_ECMAScript_import_instead, moduleReference);
|
|
48359
48370
|
} else {
|
|
48360
48371
|
let diagnosticDetails;
|
|
48361
48372
|
const ext = tryGetExtensionFromPath2(currentSourceFile.fileName);
|
|
@@ -48407,7 +48418,7 @@ ${lanes.join("\n")}
|
|
|
48407
48418
|
return getMergedSymbol(sourceFile.symbol);
|
|
48408
48419
|
}
|
|
48409
48420
|
if (moduleNotFoundError) {
|
|
48410
|
-
|
|
48421
|
+
error2(errorNode, Diagnostics.File_0_is_not_a_module, sourceFile.fileName);
|
|
48411
48422
|
}
|
|
48412
48423
|
return void 0;
|
|
48413
48424
|
}
|
|
@@ -48424,7 +48435,7 @@ ${lanes.join("\n")}
|
|
|
48424
48435
|
if (resolvedModule && !resolutionExtensionIsTSOrJson(resolvedModule.extension) && resolutionDiagnostic === void 0 || resolutionDiagnostic === Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type) {
|
|
48425
48436
|
if (isForAugmentation) {
|
|
48426
48437
|
const diag2 = Diagnostics.Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented;
|
|
48427
|
-
|
|
48438
|
+
error2(errorNode, diag2, moduleReference, resolvedModule.resolvedFileName);
|
|
48428
48439
|
} else {
|
|
48429
48440
|
errorOnImplicitAnyModule(
|
|
48430
48441
|
/*isError*/
|
|
@@ -48442,31 +48453,31 @@ ${lanes.join("\n")}
|
|
|
48442
48453
|
if (resolvedModule) {
|
|
48443
48454
|
const redirect = host.getProjectReferenceRedirect(resolvedModule.resolvedFileName);
|
|
48444
48455
|
if (redirect) {
|
|
48445
|
-
|
|
48456
|
+
error2(errorNode, Diagnostics.Output_file_0_has_not_been_built_from_source_file_1, redirect, resolvedModule.resolvedFileName);
|
|
48446
48457
|
return void 0;
|
|
48447
48458
|
}
|
|
48448
48459
|
}
|
|
48449
48460
|
if (resolutionDiagnostic) {
|
|
48450
|
-
|
|
48461
|
+
error2(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
|
|
48451
48462
|
} else {
|
|
48452
48463
|
const isExtensionlessRelativePathImport = pathIsRelative(moduleReference) && !hasExtension(moduleReference);
|
|
48453
48464
|
const resolutionIsNode16OrNext = moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */;
|
|
48454
48465
|
if (!getResolveJsonModule(compilerOptions) && fileExtensionIs(moduleReference, ".json" /* Json */) && moduleResolutionKind !== 1 /* Classic */ && hasJsonModuleEmitEnabled(compilerOptions)) {
|
|
48455
|
-
|
|
48466
|
+
error2(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
48456
48467
|
} else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
|
|
48457
48468
|
const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
|
|
48458
48469
|
const suggestedExt = (_i = suggestedExtensions.find(([actualExt, _importExt]) => host.fileExists(absoluteRef + actualExt))) == null ? void 0 : _i[1];
|
|
48459
48470
|
if (suggestedExt) {
|
|
48460
|
-
|
|
48471
|
+
error2(
|
|
48461
48472
|
errorNode,
|
|
48462
48473
|
Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0,
|
|
48463
48474
|
moduleReference + suggestedExt
|
|
48464
48475
|
);
|
|
48465
48476
|
} else {
|
|
48466
|
-
|
|
48477
|
+
error2(errorNode, Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node16_or_nodenext_Consider_adding_an_extension_to_the_import_path);
|
|
48467
48478
|
}
|
|
48468
48479
|
} else {
|
|
48469
|
-
|
|
48480
|
+
error2(errorNode, moduleNotFoundError, moduleReference);
|
|
48470
48481
|
}
|
|
48471
48482
|
}
|
|
48472
48483
|
}
|
|
@@ -48532,7 +48543,7 @@ ${lanes.join("\n")}
|
|
|
48532
48543
|
if (!dontResolveAlias && symbol) {
|
|
48533
48544
|
if (!suppressInteropError && !(symbol.flags & (1536 /* Module */ | 3 /* Variable */)) && !getDeclarationOfKind(symbol, 311 /* SourceFile */)) {
|
|
48534
48545
|
const compilerOptionName = moduleKind >= 5 /* ES2015 */ ? "allowSyntheticDefaultImports" : "esModuleInterop";
|
|
48535
|
-
|
|
48546
|
+
error2(referencingLocation, Diagnostics.This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_referencing_its_default_export, compilerOptionName);
|
|
48536
48547
|
return symbol;
|
|
48537
48548
|
}
|
|
48538
48549
|
const referenceParent = referencingLocation.parent;
|
|
@@ -48916,7 +48927,7 @@ ${lanes.join("\n")}
|
|
|
48916
48927
|
function createIntrinsicType(kind, intrinsicName, objectFlags = 0 /* None */) {
|
|
48917
48928
|
const type = createType(kind);
|
|
48918
48929
|
type.intrinsicName = intrinsicName;
|
|
48919
|
-
type.objectFlags = objectFlags
|
|
48930
|
+
type.objectFlags = objectFlags | 524288 /* CouldContainTypeVariablesComputed */ | 2097152 /* IsGenericTypeComputed */ | 33554432 /* IsUnknownLikeUnionComputed */ | 16777216 /* IsNeverIntersectionComputed */;
|
|
48920
48931
|
return type;
|
|
48921
48932
|
}
|
|
48922
48933
|
function createObjectType(objectFlags, symbol) {
|
|
@@ -53359,7 +53370,7 @@ ${lanes.join("\n")}
|
|
|
53359
53370
|
if (declaration.dotDotDotToken) {
|
|
53360
53371
|
parentType = getReducedType(parentType);
|
|
53361
53372
|
if (parentType.flags & 2 /* Unknown */ || !isValidSpreadType(parentType)) {
|
|
53362
|
-
|
|
53373
|
+
error2(declaration, Diagnostics.Rest_types_may_only_be_created_from_object_types);
|
|
53363
53374
|
return errorType;
|
|
53364
53375
|
}
|
|
53365
53376
|
const literalMembers = [];
|
|
@@ -53592,7 +53603,7 @@ ${lanes.join("\n")}
|
|
|
53592
53603
|
reference.flowNode = staticBlock.returnFlowNode;
|
|
53593
53604
|
const flowType = getFlowTypeOfProperty(reference, symbol);
|
|
53594
53605
|
if (noImplicitAny && (flowType === autoType || flowType === autoArrayType)) {
|
|
53595
|
-
|
|
53606
|
+
error2(symbol.valueDeclaration, Diagnostics.Member_0_implicitly_has_an_1_type, symbolToString(symbol), typeToString(flowType));
|
|
53596
53607
|
}
|
|
53597
53608
|
if (everyType(flowType, isNullableType)) {
|
|
53598
53609
|
continue;
|
|
@@ -53608,7 +53619,7 @@ ${lanes.join("\n")}
|
|
|
53608
53619
|
reference.flowNode = constructor.returnFlowNode;
|
|
53609
53620
|
const flowType = getFlowTypeOfProperty(reference, symbol);
|
|
53610
53621
|
if (noImplicitAny && (flowType === autoType || flowType === autoArrayType)) {
|
|
53611
|
-
|
|
53622
|
+
error2(symbol.valueDeclaration, Diagnostics.Member_0_implicitly_has_an_1_type, symbolToString(symbol), typeToString(flowType));
|
|
53612
53623
|
}
|
|
53613
53624
|
return everyType(flowType, isNullableType) ? void 0 : convertAutoToAny(flowType);
|
|
53614
53625
|
}
|
|
@@ -53783,11 +53794,11 @@ ${lanes.join("\n")}
|
|
|
53783
53794
|
const unescapedName = unescapeLeadingUnderscores(s.escapedName);
|
|
53784
53795
|
const exportedMemberName = ((_a = tryCast(exportedMember.valueDeclaration, isNamedDeclaration)) == null ? void 0 : _a.name) || exportedMember.valueDeclaration;
|
|
53785
53796
|
addRelatedInfo(
|
|
53786
|
-
|
|
53797
|
+
error2(s.valueDeclaration, Diagnostics.Duplicate_identifier_0, unescapedName),
|
|
53787
53798
|
createDiagnosticForNode(exportedMemberName, Diagnostics._0_was_also_declared_here, unescapedName)
|
|
53788
53799
|
);
|
|
53789
53800
|
addRelatedInfo(
|
|
53790
|
-
|
|
53801
|
+
error2(exportedMemberName, Diagnostics.Duplicate_identifier_0, unescapedName),
|
|
53791
53802
|
createDiagnosticForNode(s.valueDeclaration, Diagnostics._0_was_also_declared_here, unescapedName)
|
|
53792
53803
|
);
|
|
53793
53804
|
}
|
|
@@ -54142,13 +54153,13 @@ ${lanes.join("\n")}
|
|
|
54142
54153
|
}
|
|
54143
54154
|
if (!popTypeResolution()) {
|
|
54144
54155
|
if (getAnnotatedAccessorTypeNode(getter)) {
|
|
54145
|
-
|
|
54156
|
+
error2(getter, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol));
|
|
54146
54157
|
} else if (getAnnotatedAccessorTypeNode(setter)) {
|
|
54147
|
-
|
|
54158
|
+
error2(setter, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol));
|
|
54148
54159
|
} else if (getAnnotatedAccessorTypeNode(accessor)) {
|
|
54149
|
-
|
|
54160
|
+
error2(setter, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol));
|
|
54150
54161
|
} else if (getter && noImplicitAny) {
|
|
54151
|
-
|
|
54162
|
+
error2(getter, Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol));
|
|
54152
54163
|
}
|
|
54153
54164
|
type = anyType;
|
|
54154
54165
|
}
|
|
@@ -54166,7 +54177,7 @@ ${lanes.join("\n")}
|
|
|
54166
54177
|
let writeType = getAnnotatedAccessorType(setter);
|
|
54167
54178
|
if (!popTypeResolution()) {
|
|
54168
54179
|
if (getAnnotatedAccessorTypeNode(setter)) {
|
|
54169
|
-
|
|
54180
|
+
error2(setter, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol));
|
|
54170
54181
|
}
|
|
54171
54182
|
writeType = anyType;
|
|
54172
54183
|
}
|
|
@@ -54259,7 +54270,7 @@ ${lanes.join("\n")}
|
|
|
54259
54270
|
function reportCircularityError(symbol) {
|
|
54260
54271
|
const declaration = symbol.valueDeclaration;
|
|
54261
54272
|
if (getEffectiveTypeAnnotationNode(declaration)) {
|
|
54262
|
-
|
|
54273
|
+
error2(
|
|
54263
54274
|
symbol.valueDeclaration,
|
|
54264
54275
|
Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation,
|
|
54265
54276
|
symbolToString(symbol)
|
|
@@ -54267,7 +54278,7 @@ ${lanes.join("\n")}
|
|
|
54267
54278
|
return errorType;
|
|
54268
54279
|
}
|
|
54269
54280
|
if (noImplicitAny && (declaration.kind !== 168 /* Parameter */ || declaration.initializer)) {
|
|
54270
|
-
|
|
54281
|
+
error2(
|
|
54271
54282
|
symbol.valueDeclaration,
|
|
54272
54283
|
Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer,
|
|
54273
54284
|
symbolToString(symbol)
|
|
@@ -54512,11 +54523,11 @@ ${lanes.join("\n")}
|
|
|
54512
54523
|
resolveStructuredTypeMembers(baseConstructorType);
|
|
54513
54524
|
}
|
|
54514
54525
|
if (!popTypeResolution()) {
|
|
54515
|
-
|
|
54526
|
+
error2(type.symbol.valueDeclaration, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_base_expression, symbolToString(type.symbol));
|
|
54516
54527
|
return type.resolvedBaseConstructorType = errorType;
|
|
54517
54528
|
}
|
|
54518
54529
|
if (!(baseConstructorType.flags & 1 /* Any */) && baseConstructorType !== nullWideningType && !isConstructorType(baseConstructorType)) {
|
|
54519
|
-
const err =
|
|
54530
|
+
const err = error2(baseTypeNode.expression, Diagnostics.Type_0_is_not_a_constructor_function_type, typeToString(baseConstructorType));
|
|
54520
54531
|
if (baseConstructorType.flags & 262144 /* TypeParameter */) {
|
|
54521
54532
|
const constraint = getConstraintFromTypeParameter(baseConstructorType);
|
|
54522
54533
|
let ctorReturn = unknownType;
|
|
@@ -54558,7 +54569,7 @@ ${lanes.join("\n")}
|
|
|
54558
54569
|
return resolvedImplementsTypes;
|
|
54559
54570
|
}
|
|
54560
54571
|
function reportCircularBaseType(node, type) {
|
|
54561
|
-
|
|
54572
|
+
error2(node, Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(
|
|
54562
54573
|
type,
|
|
54563
54574
|
/*enclosingDeclaration*/
|
|
54564
54575
|
void 0,
|
|
@@ -54612,7 +54623,7 @@ ${lanes.join("\n")}
|
|
|
54612
54623
|
} else {
|
|
54613
54624
|
const constructors = getInstantiatedConstructorsForTypeArguments(baseConstructorType, baseTypeNode.typeArguments, baseTypeNode);
|
|
54614
54625
|
if (!constructors.length) {
|
|
54615
|
-
|
|
54626
|
+
error2(baseTypeNode.expression, Diagnostics.No_base_constructor_has_the_specified_number_of_type_arguments);
|
|
54616
54627
|
return type.resolvedBaseTypes = emptyArray;
|
|
54617
54628
|
}
|
|
54618
54629
|
baseType = getReturnTypeOfSignature(constructors[0]);
|
|
@@ -54632,7 +54643,7 @@ ${lanes.join("\n")}
|
|
|
54632
54643
|
return type.resolvedBaseTypes = emptyArray;
|
|
54633
54644
|
}
|
|
54634
54645
|
if (type === reducedBaseType || hasBaseType(reducedBaseType, type)) {
|
|
54635
|
-
|
|
54646
|
+
error2(
|
|
54636
54647
|
type.symbol.valueDeclaration,
|
|
54637
54648
|
Diagnostics.Type_0_recursively_references_itself_as_a_base_type,
|
|
54638
54649
|
typeToString(
|
|
@@ -54686,7 +54697,7 @@ ${lanes.join("\n")}
|
|
|
54686
54697
|
reportCircularBaseType(declaration, type);
|
|
54687
54698
|
}
|
|
54688
54699
|
} else {
|
|
54689
|
-
|
|
54700
|
+
error2(node, Diagnostics.An_interface_can_only_extend_an_object_type_or_intersection_of_object_types_with_statically_known_members);
|
|
54690
54701
|
}
|
|
54691
54702
|
}
|
|
54692
54703
|
}
|
|
@@ -54772,9 +54783,9 @@ ${lanes.join("\n")}
|
|
|
54772
54783
|
} else {
|
|
54773
54784
|
type = errorType;
|
|
54774
54785
|
if (declaration.kind === 346 /* JSDocEnumTag */) {
|
|
54775
|
-
|
|
54786
|
+
error2(declaration.typeExpression.type, Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
|
|
54776
54787
|
} else {
|
|
54777
|
-
|
|
54788
|
+
error2(isNamedDeclaration(declaration) ? declaration.name || declaration : declaration, Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
|
|
54778
54789
|
}
|
|
54779
54790
|
}
|
|
54780
54791
|
links.declaredType = type;
|
|
@@ -55023,8 +55034,8 @@ ${lanes.join("\n")}
|
|
|
55023
55034
|
if (lateSymbol.flags & getExcludedSymbolFlags(symbolFlags) || earlySymbol) {
|
|
55024
55035
|
const declarations = earlySymbol ? concatenate(earlySymbol.declarations, lateSymbol.declarations) : lateSymbol.declarations;
|
|
55025
55036
|
const name = !(type.flags & 8192 /* UniqueESSymbol */) && unescapeLeadingUnderscores(memberName) || declarationNameToString(declName);
|
|
55026
|
-
forEach(declarations, (declaration) =>
|
|
55027
|
-
|
|
55037
|
+
forEach(declarations, (declaration) => error2(getNameOfDeclaration(declaration) || declaration, Diagnostics.Property_0_was_also_declared_here, name));
|
|
55038
|
+
error2(declName || decl, Diagnostics.Duplicate_property_0, name);
|
|
55028
55039
|
lateSymbol = createSymbol(0 /* None */, memberName, 4096 /* Late */);
|
|
55029
55040
|
}
|
|
55030
55041
|
lateSymbol.links.nameType = type;
|
|
@@ -55870,7 +55881,7 @@ ${lanes.join("\n")}
|
|
|
55870
55881
|
true
|
|
55871
55882
|
) : symbol.links.checkFlags & 524288 /* StripOptional */ ? removeMissingOrUndefinedType(propType) : propType;
|
|
55872
55883
|
if (!popTypeResolution()) {
|
|
55873
|
-
|
|
55884
|
+
error2(currentNode, Diagnostics.Type_of_property_0_circularly_references_itself_in_mapped_type_1, symbolToString(symbol), typeToString(mappedType));
|
|
55874
55885
|
type = errorType;
|
|
55875
55886
|
}
|
|
55876
55887
|
symbol.links.type = type;
|
|
@@ -56196,7 +56207,7 @@ ${lanes.join("\n")}
|
|
|
56196
56207
|
if (t.flags & 262144 /* TypeParameter */) {
|
|
56197
56208
|
const errorNode = getConstraintDeclaration(t);
|
|
56198
56209
|
if (errorNode) {
|
|
56199
|
-
const diagnostic =
|
|
56210
|
+
const diagnostic = error2(errorNode, Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(t));
|
|
56200
56211
|
if (currentNode && !isNodeDescendantOf(errorNode, currentNode) && !isNodeDescendantOf(currentNode, errorNode)) {
|
|
56201
56212
|
addRelatedInfo(diagnostic, createDiagnosticForNode(currentNode, Diagnostics.Circularity_originates_in_type_at_this_location));
|
|
56202
56213
|
}
|
|
@@ -57046,14 +57057,14 @@ ${lanes.join("\n")}
|
|
|
57046
57057
|
if (signature.declaration) {
|
|
57047
57058
|
const typeNode = getEffectiveReturnTypeNode(signature.declaration);
|
|
57048
57059
|
if (typeNode) {
|
|
57049
|
-
|
|
57060
|
+
error2(typeNode, Diagnostics.Return_type_annotation_circularly_references_itself);
|
|
57050
57061
|
} else if (noImplicitAny) {
|
|
57051
57062
|
const declaration = signature.declaration;
|
|
57052
57063
|
const name = getNameOfDeclaration(declaration);
|
|
57053
57064
|
if (name) {
|
|
57054
|
-
|
|
57065
|
+
error2(name, Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, declarationNameToString(name));
|
|
57055
57066
|
} else {
|
|
57056
|
-
|
|
57067
|
+
error2(declaration, Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions);
|
|
57057
57068
|
}
|
|
57058
57069
|
}
|
|
57059
57070
|
}
|
|
@@ -57397,7 +57408,7 @@ ${lanes.join("\n")}
|
|
|
57397
57408
|
type.resolvedTypeArguments = type.mapper ? instantiateTypes(typeArguments, type.mapper) : typeArguments;
|
|
57398
57409
|
} else {
|
|
57399
57410
|
type.resolvedTypeArguments = ((_b = type.target.localTypeParameters) == null ? void 0 : _b.map(() => errorType)) || emptyArray;
|
|
57400
|
-
|
|
57411
|
+
error2(
|
|
57401
57412
|
type.node || currentNode,
|
|
57402
57413
|
type.target.symbol ? Diagnostics.Type_arguments_for_0_circularly_reference_themselves : Diagnostics.Tuple_type_arguments_circularly_reference_themselves,
|
|
57403
57414
|
type.target.symbol && symbolToString(type.target.symbol)
|
|
@@ -57426,7 +57437,7 @@ ${lanes.join("\n")}
|
|
|
57426
57437
|
void 0,
|
|
57427
57438
|
2 /* WriteArrayAsGenericType */
|
|
57428
57439
|
);
|
|
57429
|
-
|
|
57440
|
+
error2(node, diag2, typeStr, minTypeArgumentCount, typeParameters.length);
|
|
57430
57441
|
if (!isJs) {
|
|
57431
57442
|
return errorType;
|
|
57432
57443
|
}
|
|
@@ -57482,7 +57493,7 @@ ${lanes.join("\n")}
|
|
|
57482
57493
|
const numTypeArguments = length(node.typeArguments);
|
|
57483
57494
|
const minTypeArgumentCount = getMinTypeArgumentCount(typeParameters);
|
|
57484
57495
|
if (numTypeArguments < minTypeArgumentCount || numTypeArguments > typeParameters.length) {
|
|
57485
|
-
|
|
57496
|
+
error2(
|
|
57486
57497
|
node,
|
|
57487
57498
|
minTypeArgumentCount === typeParameters.length ? Diagnostics.Generic_type_0_requires_1_type_argument_s : Diagnostics.Generic_type_0_requires_between_1_and_2_type_arguments,
|
|
57488
57499
|
symbolToString(symbol),
|
|
@@ -57658,7 +57669,7 @@ ${lanes.join("\n")}
|
|
|
57658
57669
|
}
|
|
57659
57670
|
function checkNoTypeArguments(node, symbol) {
|
|
57660
57671
|
if (node.typeArguments) {
|
|
57661
|
-
|
|
57672
|
+
error2(node, Diagnostics.Type_0_is_not_generic, symbol ? symbolToString(symbol) : node.typeName ? declarationNameToString(node.typeName) : anon);
|
|
57662
57673
|
return false;
|
|
57663
57674
|
}
|
|
57664
57675
|
return true;
|
|
@@ -57790,11 +57801,11 @@ ${lanes.join("\n")}
|
|
|
57790
57801
|
}
|
|
57791
57802
|
const type = getDeclaredTypeOfSymbol(symbol);
|
|
57792
57803
|
if (!(type.flags & 524288 /* Object */)) {
|
|
57793
|
-
|
|
57804
|
+
error2(getTypeDeclaration(symbol), Diagnostics.Global_type_0_must_be_a_class_or_interface_type, symbolName(symbol));
|
|
57794
57805
|
return arity ? emptyGenericType : emptyObjectType;
|
|
57795
57806
|
}
|
|
57796
57807
|
if (length(type.typeParameters) !== arity) {
|
|
57797
|
-
|
|
57808
|
+
error2(getTypeDeclaration(symbol), Diagnostics.Global_type_0_must_have_1_type_parameter_s, symbolName(symbol), arity);
|
|
57798
57809
|
return arity ? emptyGenericType : emptyObjectType;
|
|
57799
57810
|
}
|
|
57800
57811
|
return type;
|
|
@@ -57811,7 +57822,7 @@ ${lanes.join("\n")}
|
|
|
57811
57822
|
getDeclaredTypeOfSymbol(symbol);
|
|
57812
57823
|
if (length(getSymbolLinks(symbol).typeParameters) !== arity) {
|
|
57813
57824
|
const decl = symbol.declarations && find(symbol.declarations, isTypeAliasDeclaration);
|
|
57814
|
-
|
|
57825
|
+
error2(decl, Diagnostics.Global_type_0_must_have_1_type_parameter_s, symbolName(symbol), arity);
|
|
57815
57826
|
return void 0;
|
|
57816
57827
|
}
|
|
57817
57828
|
}
|
|
@@ -58356,7 +58367,7 @@ ${lanes.join("\n")}
|
|
|
58356
58367
|
} else if (isTupleType(type)) {
|
|
58357
58368
|
const elements = getElementTypes(type);
|
|
58358
58369
|
if (elements.length + expandedTypes.length >= 1e4) {
|
|
58359
|
-
|
|
58370
|
+
error2(currentNode, isPartOfTypeNode(currentNode) ? Diagnostics.Type_produces_a_tuple_type_that_is_too_large_to_represent : Diagnostics.Expression_produces_a_tuple_type_that_is_too_large_to_represent);
|
|
58360
58371
|
return errorType;
|
|
58361
58372
|
}
|
|
58362
58373
|
forEach(elements, (t, n) => {
|
|
@@ -58521,7 +58532,7 @@ ${lanes.join("\n")}
|
|
|
58521
58532
|
const estimatedCount = count / (len - i) * len;
|
|
58522
58533
|
if (estimatedCount > 1e6) {
|
|
58523
58534
|
(_a = tracing) == null ? void 0 : _a.instant(tracing.Phase.CheckTypes, "removeSubtypes_DepthLimit", { typeIds: types.map((t) => t.id) });
|
|
58524
|
-
|
|
58535
|
+
error2(currentNode, Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent);
|
|
58525
58536
|
return void 0;
|
|
58526
58537
|
}
|
|
58527
58538
|
}
|
|
@@ -58930,7 +58941,7 @@ ${lanes.join("\n")}
|
|
|
58930
58941
|
const size = getCrossProductUnionSize(types);
|
|
58931
58942
|
if (size >= 1e5) {
|
|
58932
58943
|
(_a = tracing) == null ? void 0 : _a.instant(tracing.Phase.CheckTypes, "checkCrossProductUnion_DepthLimit", { typeIds: types.map((t) => t.id), size });
|
|
58933
|
-
|
|
58944
|
+
error2(currentNode, Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent);
|
|
58934
58945
|
return false;
|
|
58935
58946
|
}
|
|
58936
58947
|
return true;
|
|
@@ -59302,7 +59313,7 @@ ${lanes.join("\n")}
|
|
|
59302
59313
|
if (accessExpression) {
|
|
59303
59314
|
markPropertyAsReferenced(prop, accessExpression, isSelfTypeAccess(accessExpression.expression, objectType.symbol));
|
|
59304
59315
|
if (isAssignmentToReadonlyEntity(accessExpression, prop, getAssignmentTargetKind(accessExpression))) {
|
|
59305
|
-
|
|
59316
|
+
error2(accessExpression.argumentExpression, Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, symbolToString(prop));
|
|
59306
59317
|
return void 0;
|
|
59307
59318
|
}
|
|
59308
59319
|
if (accessFlags & 8 /* CacheSymbol */) {
|
|
@@ -59321,10 +59332,10 @@ ${lanes.join("\n")}
|
|
|
59321
59332
|
const indexNode = getIndexNodeForAccessExpression(accessNode);
|
|
59322
59333
|
if (isTupleType(objectType)) {
|
|
59323
59334
|
if (index < 0) {
|
|
59324
|
-
|
|
59335
|
+
error2(indexNode, Diagnostics.A_tuple_type_cannot_be_indexed_with_a_negative_value);
|
|
59325
59336
|
return undefinedType;
|
|
59326
59337
|
}
|
|
59327
|
-
|
|
59338
|
+
error2(
|
|
59328
59339
|
indexNode,
|
|
59329
59340
|
Diagnostics.Tuple_type_0_of_length_1_has_no_element_at_index_2,
|
|
59330
59341
|
typeToString(objectType),
|
|
@@ -59332,7 +59343,7 @@ ${lanes.join("\n")}
|
|
|
59332
59343
|
unescapeLeadingUnderscores(propName)
|
|
59333
59344
|
);
|
|
59334
59345
|
} else {
|
|
59335
|
-
|
|
59346
|
+
error2(indexNode, Diagnostics.Property_0_does_not_exist_on_type_1, unescapeLeadingUnderscores(propName), typeToString(objectType));
|
|
59336
59347
|
}
|
|
59337
59348
|
}
|
|
59338
59349
|
if (index >= 0) {
|
|
@@ -59352,13 +59363,13 @@ ${lanes.join("\n")}
|
|
|
59352
59363
|
if (indexInfo) {
|
|
59353
59364
|
if (accessFlags & 2 /* NoIndexSignatures */ && indexInfo.keyType !== numberType) {
|
|
59354
59365
|
if (accessExpression) {
|
|
59355
|
-
|
|
59366
|
+
error2(accessExpression, Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(originalObjectType));
|
|
59356
59367
|
}
|
|
59357
59368
|
return void 0;
|
|
59358
59369
|
}
|
|
59359
59370
|
if (accessNode && indexInfo.keyType === stringType && !isTypeAssignableToKind(indexType, 4 /* String */ | 8 /* Number */)) {
|
|
59360
59371
|
const indexNode = getIndexNodeForAccessExpression(accessNode);
|
|
59361
|
-
|
|
59372
|
+
error2(indexNode, Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType));
|
|
59362
59373
|
return accessFlags & 1 /* IncludeUndefined */ ? getUnionType([indexInfo.type, missingType]) : indexInfo.type;
|
|
59363
59374
|
}
|
|
59364
59375
|
errorIfWritingToReadonlyIndex(indexInfo);
|
|
@@ -59386,23 +59397,23 @@ ${lanes.join("\n")}
|
|
|
59386
59397
|
}
|
|
59387
59398
|
}
|
|
59388
59399
|
if (objectType.symbol === globalThisSymbol && propName !== void 0 && globalThisSymbol.exports.has(propName) && globalThisSymbol.exports.get(propName).flags & 418 /* BlockScoped */) {
|
|
59389
|
-
|
|
59400
|
+
error2(accessExpression, Diagnostics.Property_0_does_not_exist_on_type_1, unescapeLeadingUnderscores(propName), typeToString(objectType));
|
|
59390
59401
|
} else if (noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors && !(accessFlags & 128 /* SuppressNoImplicitAnyError */)) {
|
|
59391
59402
|
if (propName !== void 0 && typeHasStaticProperty(propName, objectType)) {
|
|
59392
59403
|
const typeName = typeToString(objectType);
|
|
59393
|
-
|
|
59404
|
+
error2(accessExpression, Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_to_access_the_static_member_2_instead, propName, typeName, typeName + "[" + getTextOfNode(accessExpression.argumentExpression) + "]");
|
|
59394
59405
|
} else if (getIndexTypeOfType(objectType, numberType)) {
|
|
59395
|
-
|
|
59406
|
+
error2(accessExpression.argumentExpression, Diagnostics.Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number);
|
|
59396
59407
|
} else {
|
|
59397
59408
|
let suggestion;
|
|
59398
59409
|
if (propName !== void 0 && (suggestion = getSuggestionForNonexistentProperty(propName, objectType))) {
|
|
59399
59410
|
if (suggestion !== void 0) {
|
|
59400
|
-
|
|
59411
|
+
error2(accessExpression.argumentExpression, Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2, propName, typeToString(objectType), suggestion);
|
|
59401
59412
|
}
|
|
59402
59413
|
} else {
|
|
59403
59414
|
const suggestion2 = getSuggestionForNonexistentIndexSignature(objectType, accessExpression, indexType);
|
|
59404
59415
|
if (suggestion2 !== void 0) {
|
|
59405
|
-
|
|
59416
|
+
error2(accessExpression, Diagnostics.Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_Did_you_mean_to_call_1, typeToString(objectType), suggestion2);
|
|
59406
59417
|
} else {
|
|
59407
59418
|
let errorInfo;
|
|
59408
59419
|
if (indexType.flags & 1024 /* EnumLiteral */) {
|
|
@@ -59467,11 +59478,11 @@ ${lanes.join("\n")}
|
|
|
59467
59478
|
if (accessNode) {
|
|
59468
59479
|
const indexNode = getIndexNodeForAccessExpression(accessNode);
|
|
59469
59480
|
if (indexType.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */)) {
|
|
59470
|
-
|
|
59481
|
+
error2(indexNode, Diagnostics.Property_0_does_not_exist_on_type_1, "" + indexType.value, typeToString(objectType));
|
|
59471
59482
|
} else if (indexType.flags & (4 /* String */ | 8 /* Number */)) {
|
|
59472
|
-
|
|
59483
|
+
error2(indexNode, Diagnostics.Type_0_has_no_matching_index_signature_for_type_1, typeToString(objectType), typeToString(indexType));
|
|
59473
59484
|
} else {
|
|
59474
|
-
|
|
59485
|
+
error2(indexNode, Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType));
|
|
59475
59486
|
}
|
|
59476
59487
|
}
|
|
59477
59488
|
if (isTypeAny(indexType)) {
|
|
@@ -59480,7 +59491,7 @@ ${lanes.join("\n")}
|
|
|
59480
59491
|
return void 0;
|
|
59481
59492
|
function errorIfWritingToReadonlyIndex(indexInfo) {
|
|
59482
59493
|
if (indexInfo && indexInfo.isReadonly && accessExpression && (isAssignmentTarget(accessExpression) || isDeleteTarget(accessExpression))) {
|
|
59483
|
-
|
|
59494
|
+
error2(accessExpression, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
|
|
59484
59495
|
}
|
|
59485
59496
|
}
|
|
59486
59497
|
}
|
|
@@ -59705,7 +59716,7 @@ ${lanes.join("\n")}
|
|
|
59705
59716
|
let tailCount = 0;
|
|
59706
59717
|
while (true) {
|
|
59707
59718
|
if (tailCount === 1e3) {
|
|
59708
|
-
|
|
59719
|
+
error2(currentNode, Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
|
|
59709
59720
|
return errorType;
|
|
59710
59721
|
}
|
|
59711
59722
|
const checkType = instantiateType(getActualTypeVariable(root.checkType), mapper);
|
|
@@ -59883,7 +59894,7 @@ ${lanes.join("\n")}
|
|
|
59883
59894
|
const links = getNodeLinks(node);
|
|
59884
59895
|
if (!links.resolvedType) {
|
|
59885
59896
|
if (!isLiteralImportTypeNode(node)) {
|
|
59886
|
-
|
|
59897
|
+
error2(node.argument, Diagnostics.String_literal_expected);
|
|
59887
59898
|
links.resolvedSymbol = unknownSymbol;
|
|
59888
59899
|
return links.resolvedType = errorType;
|
|
59889
59900
|
}
|
|
@@ -59917,7 +59928,7 @@ ${lanes.join("\n")}
|
|
|
59917
59928
|
const symbolFromModule = node.isTypeOf ? void 0 : getSymbol2(getExportsOfSymbol(mergedResolvedSymbol), current.escapedText, meaning);
|
|
59918
59929
|
const next = symbolFromModule ?? symbolFromVariable;
|
|
59919
59930
|
if (!next) {
|
|
59920
|
-
|
|
59931
|
+
error2(current, Diagnostics.Namespace_0_has_no_exported_member_1, getFullyQualifiedName(currentNamespace), declarationNameToString(current));
|
|
59921
59932
|
return links.resolvedType = errorType;
|
|
59922
59933
|
}
|
|
59923
59934
|
getNodeLinks(current).resolvedSymbol = next;
|
|
@@ -59930,7 +59941,7 @@ ${lanes.join("\n")}
|
|
|
59930
59941
|
links.resolvedType = resolveImportSymbolType(node, links, moduleSymbol, targetMeaning);
|
|
59931
59942
|
} else {
|
|
59932
59943
|
const errorMessage = targetMeaning === 111551 /* Value */ ? Diagnostics.Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here : Diagnostics.Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0;
|
|
59933
|
-
|
|
59944
|
+
error2(node, errorMessage, node.argument.literal.text);
|
|
59934
59945
|
links.resolvedSymbol = unknownSymbol;
|
|
59935
59946
|
links.resolvedType = errorType;
|
|
59936
59947
|
}
|
|
@@ -60208,7 +60219,7 @@ ${lanes.join("\n")}
|
|
|
60208
60219
|
if (isJSConstructor(container) && isNodeDescendantOf(node, container.body)) {
|
|
60209
60220
|
return getDeclaredTypeOfClassOrInterface(getSymbolOfDeclaration(container)).thisType;
|
|
60210
60221
|
}
|
|
60211
|
-
|
|
60222
|
+
error2(node, Diagnostics.A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface);
|
|
60212
60223
|
return errorType;
|
|
60213
60224
|
}
|
|
60214
60225
|
function getTypeFromThisTypeNode(node) {
|
|
@@ -60537,13 +60548,18 @@ ${lanes.join("\n")}
|
|
|
60537
60548
|
if (!result) {
|
|
60538
60549
|
const newMapper = createTypeMapper(typeParameters, typeArguments);
|
|
60539
60550
|
result = target.objectFlags & 4 /* Reference */ ? createDeferredTypeReference(type.target, type.node, newMapper, newAliasSymbol, newAliasTypeArguments) : target.objectFlags & 32 /* Mapped */ ? instantiateMappedType(target, newMapper, newAliasSymbol, newAliasTypeArguments) : instantiateAnonymousType(target, newMapper, newAliasSymbol, newAliasTypeArguments);
|
|
60540
|
-
|
|
60551
|
+
target.instantiations.set(id, result);
|
|
60552
|
+
const resultObjectFlags = getObjectFlags(result);
|
|
60553
|
+
if (result.flags & 138117121 /* ObjectFlagsType */ && !(resultObjectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
|
|
60541
60554
|
const resultCouldContainTypeVariables = some(typeArguments, couldContainTypeVariables);
|
|
60542
|
-
if (!(result
|
|
60543
|
-
|
|
60555
|
+
if (!(getObjectFlags(result) & 524288 /* CouldContainTypeVariablesComputed */)) {
|
|
60556
|
+
if (resultObjectFlags & (32 /* Mapped */ | 16 /* Anonymous */ | 4 /* Reference */)) {
|
|
60557
|
+
result.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (resultCouldContainTypeVariables ? 1048576 /* CouldContainTypeVariables */ : 0);
|
|
60558
|
+
} else {
|
|
60559
|
+
result.objectFlags |= !resultCouldContainTypeVariables ? 524288 /* CouldContainTypeVariablesComputed */ : 0;
|
|
60560
|
+
}
|
|
60544
60561
|
}
|
|
60545
60562
|
}
|
|
60546
|
-
target.instantiations.set(id, result);
|
|
60547
60563
|
}
|
|
60548
60564
|
return result;
|
|
60549
60565
|
}
|
|
@@ -60728,7 +60744,7 @@ ${lanes.join("\n")}
|
|
|
60728
60744
|
}
|
|
60729
60745
|
if (instantiationDepth === 100 || instantiationCount >= 5e6) {
|
|
60730
60746
|
(_a = tracing) == null ? void 0 : _a.instant(tracing.Phase.CheckTypes, "instantiateType_DepthLimit", { typeId: type.id, instantiationDepth, instantiationCount });
|
|
60731
|
-
|
|
60747
|
+
error2(currentNode, Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
|
|
60732
60748
|
return errorType;
|
|
60733
60749
|
}
|
|
60734
60750
|
totalInstantiationCount++;
|
|
@@ -61348,7 +61364,7 @@ ${lanes.join("\n")}
|
|
|
61348
61364
|
result = elaborateIterableOrArrayLikeTargetElementwise(children, realSource, arrayLikeTargetParts, relation, containingMessageChain, errorOutputContainer) || result;
|
|
61349
61365
|
} else if (!isTypeRelatedTo(getIndexedAccessType(source, childrenNameType), childrenTargetType, relation)) {
|
|
61350
61366
|
result = true;
|
|
61351
|
-
const diag2 =
|
|
61367
|
+
const diag2 = error2(
|
|
61352
61368
|
containingElement.openingElement.tagName,
|
|
61353
61369
|
Diagnostics.This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided,
|
|
61354
61370
|
childrenPropName,
|
|
@@ -61376,7 +61392,7 @@ ${lanes.join("\n")}
|
|
|
61376
61392
|
}
|
|
61377
61393
|
} else if (!isTypeRelatedTo(getIndexedAccessType(source, childrenNameType), childrenTargetType, relation)) {
|
|
61378
61394
|
result = true;
|
|
61379
|
-
const diag2 =
|
|
61395
|
+
const diag2 = error2(
|
|
61380
61396
|
containingElement.openingElement.tagName,
|
|
61381
61397
|
Diagnostics.This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_provided,
|
|
61382
61398
|
childrenPropName,
|
|
@@ -61881,7 +61897,7 @@ ${lanes.join("\n")}
|
|
|
61881
61897
|
}
|
|
61882
61898
|
if (overflow) {
|
|
61883
61899
|
(_a = tracing) == null ? void 0 : _a.instant(tracing.Phase.CheckTypes, "checkTypeRelatedTo_DepthLimit", { sourceId: source.id, targetId: target.id, depth: sourceDepth, targetDepth });
|
|
61884
|
-
const diag2 =
|
|
61900
|
+
const diag2 = error2(errorNode || currentNode, Diagnostics.Excessive_stack_depth_comparing_types_0_and_1, typeToString(source), typeToString(target));
|
|
61885
61901
|
if (errorOutputContainer) {
|
|
61886
61902
|
(errorOutputContainer.errors || (errorOutputContainer.errors = [])).push(diag2);
|
|
61887
61903
|
}
|
|
@@ -64997,7 +65013,7 @@ ${lanes.join("\n")}
|
|
|
64997
65013
|
const t = getTypeOfSymbol(p);
|
|
64998
65014
|
if (getObjectFlags(t) & 65536 /* ContainsWideningType */) {
|
|
64999
65015
|
if (!reportWideningErrorsInType(t)) {
|
|
65000
|
-
|
|
65016
|
+
error2(p.valueDeclaration, Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, symbolToString(p), typeToString(getWidenedType(t)));
|
|
65001
65017
|
}
|
|
65002
65018
|
errorReported = true;
|
|
65003
65019
|
}
|
|
@@ -65047,11 +65063,11 @@ ${lanes.join("\n")}
|
|
|
65047
65063
|
}
|
|
65048
65064
|
break;
|
|
65049
65065
|
case 323 /* JSDocFunctionType */:
|
|
65050
|
-
|
|
65066
|
+
error2(declaration, Diagnostics.Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString);
|
|
65051
65067
|
return;
|
|
65052
65068
|
case 329 /* JSDocSignature */:
|
|
65053
65069
|
if (noImplicitAny && isJSDocOverloadTag(declaration.parent)) {
|
|
65054
|
-
|
|
65070
|
+
error2(declaration.parent.tagName, Diagnostics.This_overload_implicitly_returns_the_type_0_because_it_lacks_a_return_type_annotation, typeAsString);
|
|
65055
65071
|
}
|
|
65056
65072
|
return;
|
|
65057
65073
|
case 261 /* FunctionDeclaration */:
|
|
@@ -65063,9 +65079,9 @@ ${lanes.join("\n")}
|
|
|
65063
65079
|
case 218 /* ArrowFunction */:
|
|
65064
65080
|
if (noImplicitAny && !declaration.name) {
|
|
65065
65081
|
if (wideningKind === 3 /* GeneratorYield */) {
|
|
65066
|
-
|
|
65082
|
+
error2(declaration, Diagnostics.Generator_implicitly_has_yield_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type_annotation, typeAsString);
|
|
65067
65083
|
} else {
|
|
65068
|
-
|
|
65084
|
+
error2(declaration, Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString);
|
|
65069
65085
|
}
|
|
65070
65086
|
return;
|
|
65071
65087
|
}
|
|
@@ -65073,7 +65089,7 @@ ${lanes.join("\n")}
|
|
|
65073
65089
|
break;
|
|
65074
65090
|
case 199 /* MappedType */:
|
|
65075
65091
|
if (noImplicitAny) {
|
|
65076
|
-
|
|
65092
|
+
error2(declaration, Diagnostics.Mapped_object_type_implicitly_has_an_any_template_type);
|
|
65077
65093
|
}
|
|
65078
65094
|
return;
|
|
65079
65095
|
default:
|
|
@@ -68351,15 +68367,15 @@ ${lanes.join("\n")}
|
|
|
68351
68367
|
}
|
|
68352
68368
|
if (symbol === argumentsSymbol) {
|
|
68353
68369
|
if (isInPropertyInitializerOrClassStaticBlock(node)) {
|
|
68354
|
-
|
|
68370
|
+
error2(node, Diagnostics.arguments_cannot_be_referenced_in_property_initializers);
|
|
68355
68371
|
return errorType;
|
|
68356
68372
|
}
|
|
68357
68373
|
const container = getContainingFunction(node);
|
|
68358
68374
|
if (languageVersion < 2 /* ES2015 */) {
|
|
68359
68375
|
if (container.kind === 218 /* ArrowFunction */) {
|
|
68360
|
-
|
|
68376
|
+
error2(node, Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression);
|
|
68361
68377
|
} else if (hasSyntacticModifier(container, 512 /* Async */)) {
|
|
68362
|
-
|
|
68378
|
+
error2(node, Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method);
|
|
68363
68379
|
}
|
|
68364
68380
|
}
|
|
68365
68381
|
getNodeLinks(container).flags |= 512 /* CaptureArguments */;
|
|
@@ -68417,14 +68433,14 @@ ${lanes.join("\n")}
|
|
|
68417
68433
|
if (assignmentKind) {
|
|
68418
68434
|
if (!(localOrExportSymbol.flags & 3 /* Variable */) && !(isInJSFile(node) && localOrExportSymbol.flags & 512 /* ValueModule */)) {
|
|
68419
68435
|
const assignmentError = localOrExportSymbol.flags & 384 /* Enum */ ? Diagnostics.Cannot_assign_to_0_because_it_is_an_enum : localOrExportSymbol.flags & 32 /* Class */ ? Diagnostics.Cannot_assign_to_0_because_it_is_a_class : localOrExportSymbol.flags & 1536 /* Module */ ? Diagnostics.Cannot_assign_to_0_because_it_is_a_namespace : localOrExportSymbol.flags & 16 /* Function */ ? Diagnostics.Cannot_assign_to_0_because_it_is_a_function : localOrExportSymbol.flags & 2097152 /* Alias */ ? Diagnostics.Cannot_assign_to_0_because_it_is_an_import : Diagnostics.Cannot_assign_to_0_because_it_is_not_a_variable;
|
|
68420
|
-
|
|
68436
|
+
error2(node, assignmentError, symbolToString(symbol));
|
|
68421
68437
|
return errorType;
|
|
68422
68438
|
}
|
|
68423
68439
|
if (isReadonlySymbol(localOrExportSymbol)) {
|
|
68424
68440
|
if (localOrExportSymbol.flags & 3 /* Variable */) {
|
|
68425
|
-
|
|
68441
|
+
error2(node, Diagnostics.Cannot_assign_to_0_because_it_is_a_constant, symbolToString(symbol));
|
|
68426
68442
|
} else {
|
|
68427
|
-
|
|
68443
|
+
error2(node, Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, symbolToString(symbol));
|
|
68428
68444
|
}
|
|
68429
68445
|
return errorType;
|
|
68430
68446
|
}
|
|
@@ -68460,13 +68476,13 @@ ${lanes.join("\n")}
|
|
|
68460
68476
|
if (!isEvolvingArrayOperationTarget(node) && (type === autoType || type === autoArrayType)) {
|
|
68461
68477
|
if (flowType === autoType || flowType === autoArrayType) {
|
|
68462
68478
|
if (noImplicitAny) {
|
|
68463
|
-
|
|
68464
|
-
|
|
68479
|
+
error2(getNameOfDeclaration(declaration), Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined, symbolToString(symbol), typeToString(flowType));
|
|
68480
|
+
error2(node, Diagnostics.Variable_0_implicitly_has_an_1_type, symbolToString(symbol), typeToString(flowType));
|
|
68465
68481
|
}
|
|
68466
68482
|
return convertAutoToAny(flowType);
|
|
68467
68483
|
}
|
|
68468
68484
|
} else if (!assumeInitialized && !containsUndefinedType(type) && containsUndefinedType(flowType)) {
|
|
68469
|
-
|
|
68485
|
+
error2(node, Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol));
|
|
68470
68486
|
return type;
|
|
68471
68487
|
}
|
|
68472
68488
|
return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType;
|
|
@@ -68596,13 +68612,13 @@ ${lanes.join("\n")}
|
|
|
68596
68612
|
/*noCacheCheck*/
|
|
68597
68613
|
false
|
|
68598
68614
|
)) {
|
|
68599
|
-
|
|
68615
|
+
error2(node, diagnosticMessage);
|
|
68600
68616
|
}
|
|
68601
68617
|
}
|
|
68602
68618
|
}
|
|
68603
68619
|
function checkThisInStaticClassFieldInitializerInDecoratedClass(thisExpression, container) {
|
|
68604
68620
|
if (isPropertyDeclaration(container) && hasStaticModifier(container) && legacyDecorators && container.initializer && textRangeContainsPositionInclusive(container.initializer, thisExpression.pos) && hasDecorators(container.parent)) {
|
|
68605
|
-
|
|
68621
|
+
error2(thisExpression, Diagnostics.Cannot_use_this_in_a_static_property_initializer_of_a_decorated_class);
|
|
68606
68622
|
}
|
|
68607
68623
|
}
|
|
68608
68624
|
function checkThisExpression(node) {
|
|
@@ -68643,18 +68659,18 @@ ${lanes.join("\n")}
|
|
|
68643
68659
|
}
|
|
68644
68660
|
checkThisInStaticClassFieldInitializerInDecoratedClass(node, container);
|
|
68645
68661
|
if (thisInComputedPropertyName) {
|
|
68646
|
-
|
|
68662
|
+
error2(node, Diagnostics.this_cannot_be_referenced_in_a_computed_property_name);
|
|
68647
68663
|
} else {
|
|
68648
68664
|
switch (container.kind) {
|
|
68649
68665
|
case 266 /* ModuleDeclaration */:
|
|
68650
|
-
|
|
68666
|
+
error2(node, Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body);
|
|
68651
68667
|
break;
|
|
68652
68668
|
case 265 /* EnumDeclaration */:
|
|
68653
|
-
|
|
68669
|
+
error2(node, Diagnostics.this_cannot_be_referenced_in_current_location);
|
|
68654
68670
|
break;
|
|
68655
68671
|
case 175 /* Constructor */:
|
|
68656
68672
|
if (isInConstructorArgumentInitializer(node, container)) {
|
|
68657
|
-
|
|
68673
|
+
error2(node, Diagnostics.this_cannot_be_referenced_in_constructor_arguments);
|
|
68658
68674
|
}
|
|
68659
68675
|
break;
|
|
68660
68676
|
}
|
|
@@ -68671,9 +68687,9 @@ ${lanes.join("\n")}
|
|
|
68671
68687
|
if (noImplicitThis) {
|
|
68672
68688
|
const globalThisType2 = getTypeOfSymbol(globalThisSymbol);
|
|
68673
68689
|
if (type === globalThisType2 && capturedByArrowFunction) {
|
|
68674
|
-
|
|
68690
|
+
error2(node, Diagnostics.The_containing_arrow_function_captures_the_global_value_of_this);
|
|
68675
68691
|
} else if (!type) {
|
|
68676
|
-
const diag2 =
|
|
68692
|
+
const diag2 = error2(node, Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation);
|
|
68677
68693
|
if (!isSourceFile(container)) {
|
|
68678
68694
|
const outsideThis = tryGetThisTypeAt(container);
|
|
68679
68695
|
if (outsideThis && outsideThis !== globalThisType2) {
|
|
@@ -68802,13 +68818,13 @@ ${lanes.join("\n")}
|
|
|
68802
68818
|
if (!container || !isLegalUsageOfSuperExpression(container)) {
|
|
68803
68819
|
const current = findAncestor(node, (n) => n === container ? "quit" : n.kind === 166 /* ComputedPropertyName */);
|
|
68804
68820
|
if (current && current.kind === 166 /* ComputedPropertyName */) {
|
|
68805
|
-
|
|
68821
|
+
error2(node, Diagnostics.super_cannot_be_referenced_in_a_computed_property_name);
|
|
68806
68822
|
} else if (isCallExpression2) {
|
|
68807
|
-
|
|
68823
|
+
error2(node, Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors);
|
|
68808
68824
|
} else if (!container || !container.parent || !(isClassLike(container.parent) || container.parent.kind === 209 /* ObjectLiteralExpression */)) {
|
|
68809
|
-
|
|
68825
|
+
error2(node, Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions);
|
|
68810
68826
|
} else {
|
|
68811
|
-
|
|
68827
|
+
error2(node, Diagnostics.super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class);
|
|
68812
68828
|
}
|
|
68813
68829
|
return errorType;
|
|
68814
68830
|
}
|
|
@@ -68840,7 +68856,7 @@ ${lanes.join("\n")}
|
|
|
68840
68856
|
}
|
|
68841
68857
|
if (container.parent.kind === 209 /* ObjectLiteralExpression */) {
|
|
68842
68858
|
if (languageVersion < 2 /* ES2015 */) {
|
|
68843
|
-
|
|
68859
|
+
error2(node, Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher);
|
|
68844
68860
|
return errorType;
|
|
68845
68861
|
} else {
|
|
68846
68862
|
return anyType;
|
|
@@ -68848,7 +68864,7 @@ ${lanes.join("\n")}
|
|
|
68848
68864
|
}
|
|
68849
68865
|
const classLikeDeclaration = container.parent;
|
|
68850
68866
|
if (!getClassExtendsHeritageElement(classLikeDeclaration)) {
|
|
68851
|
-
|
|
68867
|
+
error2(node, Diagnostics.super_can_only_be_referenced_in_a_derived_class);
|
|
68852
68868
|
return errorType;
|
|
68853
68869
|
}
|
|
68854
68870
|
const classType = getDeclaredTypeOfSymbol(getSymbolOfDeclaration(classLikeDeclaration));
|
|
@@ -68857,7 +68873,7 @@ ${lanes.join("\n")}
|
|
|
68857
68873
|
return errorType;
|
|
68858
68874
|
}
|
|
68859
68875
|
if (container.kind === 175 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) {
|
|
68860
|
-
|
|
68876
|
+
error2(node, Diagnostics.super_cannot_be_referenced_in_constructor_arguments);
|
|
68861
68877
|
return errorType;
|
|
68862
68878
|
}
|
|
68863
68879
|
return nodeCheckFlag === 32 /* SuperStatic */ ? getBaseConstructorTypeOfClass(classType) : getTypeWithThisArgument(baseClassType, classType.thisType);
|
|
@@ -69813,7 +69829,7 @@ ${lanes.join("\n")}
|
|
|
69813
69829
|
let attributesType = forcedLookupLocation === void 0 ? getTypeOfFirstParameterOfSignatureWithFallback(sig, unknownType) : forcedLookupLocation === "" ? getReturnTypeOfSignature(sig) : getJsxPropsTypeForSignatureFromMember(sig, forcedLookupLocation);
|
|
69814
69830
|
if (!attributesType) {
|
|
69815
69831
|
if (!!forcedLookupLocation && !!length(context.attributes.properties)) {
|
|
69816
|
-
|
|
69832
|
+
error2(context, Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, unescapeLeadingUnderscores(forcedLookupLocation));
|
|
69817
69833
|
}
|
|
69818
69834
|
return unknownType;
|
|
69819
69835
|
}
|
|
@@ -70121,7 +70137,7 @@ ${lanes.join("\n")}
|
|
|
70121
70137
|
}
|
|
70122
70138
|
}
|
|
70123
70139
|
if (links.resolvedType.flags & 98304 /* Nullable */ || !isTypeAssignableToKind(links.resolvedType, 402653316 /* StringLike */ | 296 /* NumberLike */ | 12288 /* ESSymbolLike */) && !isTypeAssignableTo(links.resolvedType, stringNumberSymbolType)) {
|
|
70124
|
-
|
|
70140
|
+
error2(node, Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any);
|
|
70125
70141
|
}
|
|
70126
70142
|
}
|
|
70127
70143
|
return links.resolvedType;
|
|
@@ -70230,7 +70246,7 @@ ${lanes.join("\n")}
|
|
|
70230
70246
|
if (impliedProp) {
|
|
70231
70247
|
prop.flags |= impliedProp.flags & 16777216 /* Optional */;
|
|
70232
70248
|
} else if (!compilerOptions.suppressExcessPropertyErrors && !getIndexInfoOfType(contextualType, stringType)) {
|
|
70233
|
-
|
|
70249
|
+
error2(
|
|
70234
70250
|
memberDecl.name,
|
|
70235
70251
|
Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1,
|
|
70236
70252
|
symbolToString(member),
|
|
@@ -70277,7 +70293,7 @@ ${lanes.join("\n")}
|
|
|
70277
70293
|
}
|
|
70278
70294
|
spread = getSpreadType(spread, mergedType, node.symbol, objectFlags, inConstContext);
|
|
70279
70295
|
} else {
|
|
70280
|
-
|
|
70296
|
+
error2(memberDecl, Diagnostics.Spread_types_may_only_be_created_from_object_types);
|
|
70281
70297
|
spread = errorType;
|
|
70282
70298
|
}
|
|
70283
70299
|
continue;
|
|
@@ -70317,7 +70333,7 @@ ${lanes.join("\n")}
|
|
|
70317
70333
|
for (const prop of getPropertiesOfType(contextualType)) {
|
|
70318
70334
|
if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) {
|
|
70319
70335
|
if (!(prop.flags & 16777216 /* Optional */)) {
|
|
70320
|
-
|
|
70336
|
+
error2(
|
|
70321
70337
|
prop.valueDeclaration || ((_a = tryCast(prop, isTransientSymbol)) == null ? void 0 : _a.links.bindingElement),
|
|
70322
70338
|
Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value
|
|
70323
70339
|
);
|
|
@@ -70392,7 +70408,7 @@ ${lanes.join("\n")}
|
|
|
70392
70408
|
checkJsxOpeningLikeElementOrOpeningFragment(node.openingFragment);
|
|
70393
70409
|
const nodeSourceFile = getSourceFileOfNode(node);
|
|
70394
70410
|
if (getJSXTransformEnabled(compilerOptions) && (compilerOptions.jsxFactory || nodeSourceFile.pragmas.has("jsx")) && !compilerOptions.jsxFragmentFactory && !nodeSourceFile.pragmas.has("jsxfrag")) {
|
|
70395
|
-
|
|
70411
|
+
error2(node, compilerOptions.jsxFactory ? Diagnostics.The_jsxFragmentFactory_compiler_option_must_be_provided_to_use_JSX_fragments_with_the_jsxFactory_compiler_option : Diagnostics.An_jsxFrag_pragma_is_required_when_using_an_jsx_pragma_with_JSX_fragments);
|
|
70396
70412
|
}
|
|
70397
70413
|
checkJsxChildren(node);
|
|
70398
70414
|
return getJsxElementTypeAt(node) || anyType;
|
|
@@ -70479,7 +70495,7 @@ ${lanes.join("\n")}
|
|
|
70479
70495
|
checkSpreadPropOverrides(exprType, allAttributesTable, attributeDecl);
|
|
70480
70496
|
}
|
|
70481
70497
|
} else {
|
|
70482
|
-
|
|
70498
|
+
error2(attributeDecl.expression, Diagnostics.Spread_types_may_only_be_created_from_object_types);
|
|
70483
70499
|
typeToIntersect = typeToIntersect ? getIntersectionType([typeToIntersect, exprType]) : exprType;
|
|
70484
70500
|
}
|
|
70485
70501
|
}
|
|
@@ -70501,7 +70517,7 @@ ${lanes.join("\n")}
|
|
|
70501
70517
|
const childrenTypes = checkJsxChildren(parent2, checkMode);
|
|
70502
70518
|
if (!hasSpreadAnyType && jsxChildrenPropertyName && jsxChildrenPropertyName !== "") {
|
|
70503
70519
|
if (explicitlySpecifyChildrenAttribute) {
|
|
70504
|
-
|
|
70520
|
+
error2(attributes, Diagnostics._0_are_specified_twice_The_attribute_named_0_will_be_overwritten, unescapeLeadingUnderscores(jsxChildrenPropertyName));
|
|
70505
70521
|
}
|
|
70506
70522
|
const contextualType2 = getApparentTypeOfContextualType(
|
|
70507
70523
|
openingLikeElement.attributes,
|
|
@@ -70568,7 +70584,7 @@ ${lanes.join("\n")}
|
|
|
70568
70584
|
if (!(right.flags & 16777216 /* Optional */)) {
|
|
70569
70585
|
const left = props.get(right.escapedName);
|
|
70570
70586
|
if (left) {
|
|
70571
|
-
const diagnostic =
|
|
70587
|
+
const diagnostic = error2(left.valueDeclaration, Diagnostics._0_is_specified_more_than_once_so_this_usage_will_be_overwritten, unescapeLeadingUnderscores(left.escapedName));
|
|
70572
70588
|
addRelatedInfo(diagnostic, createDiagnosticForNode(spread, Diagnostics.This_spread_always_overwrites_this_property));
|
|
70573
70589
|
}
|
|
70574
70590
|
}
|
|
@@ -70600,11 +70616,11 @@ ${lanes.join("\n")}
|
|
|
70600
70616
|
links.jsxFlags |= 2 /* IntrinsicIndexedElement */;
|
|
70601
70617
|
return links.resolvedSymbol = intrinsicElementsType.symbol;
|
|
70602
70618
|
}
|
|
70603
|
-
|
|
70619
|
+
error2(node, Diagnostics.Property_0_does_not_exist_on_type_1, intrinsicTagNameToString(node.tagName), "JSX." + JsxNames.IntrinsicElements);
|
|
70604
70620
|
return links.resolvedSymbol = unknownSymbol;
|
|
70605
70621
|
} else {
|
|
70606
70622
|
if (noImplicitAny) {
|
|
70607
|
-
|
|
70623
|
+
error2(node, Diagnostics.JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists, unescapeLeadingUnderscores(JsxNames.IntrinsicElements));
|
|
70608
70624
|
}
|
|
70609
70625
|
return links.resolvedSymbol = unknownSymbol;
|
|
70610
70626
|
}
|
|
@@ -70687,7 +70703,7 @@ ${lanes.join("\n")}
|
|
|
70687
70703
|
} else if (propertiesOfJsxElementAttribPropInterface.length === 1) {
|
|
70688
70704
|
return propertiesOfJsxElementAttribPropInterface[0].escapedName;
|
|
70689
70705
|
} else if (propertiesOfJsxElementAttribPropInterface.length > 1 && jsxElementAttribPropInterfaceSym.declarations) {
|
|
70690
|
-
|
|
70706
|
+
error2(jsxElementAttribPropInterfaceSym.declarations[0], Diagnostics.The_global_type_JSX_0_may_not_have_more_than_one_property, unescapeLeadingUnderscores(nameOfAttribPropContainer));
|
|
70691
70707
|
}
|
|
70692
70708
|
}
|
|
70693
70709
|
return void 0;
|
|
@@ -70710,7 +70726,7 @@ ${lanes.join("\n")}
|
|
|
70710
70726
|
} else if (elementType.flags & 128 /* StringLiteral */) {
|
|
70711
70727
|
const intrinsicType = getIntrinsicAttributesTypeFromStringLiteralType(elementType, caller);
|
|
70712
70728
|
if (!intrinsicType) {
|
|
70713
|
-
|
|
70729
|
+
error2(caller, Diagnostics.Property_0_does_not_exist_on_type_1, elementType.value, "JSX." + JsxNames.IntrinsicElements);
|
|
70714
70730
|
return emptyArray;
|
|
70715
70731
|
} else {
|
|
70716
70732
|
const fakeSignature = createSignatureForJSXIntrinsic(caller, intrinsicType);
|
|
@@ -70836,11 +70852,11 @@ ${lanes.join("\n")}
|
|
|
70836
70852
|
}
|
|
70837
70853
|
function checkJsxPreconditions(errorNode) {
|
|
70838
70854
|
if ((compilerOptions.jsx || 0 /* None */) === 0 /* None */) {
|
|
70839
|
-
|
|
70855
|
+
error2(errorNode, Diagnostics.Cannot_use_JSX_unless_the_jsx_flag_is_provided);
|
|
70840
70856
|
}
|
|
70841
70857
|
if (getJsxElementTypeAt(errorNode) === void 0) {
|
|
70842
70858
|
if (noImplicitAny) {
|
|
70843
|
-
|
|
70859
|
+
error2(errorNode, Diagnostics.JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist);
|
|
70844
70860
|
}
|
|
70845
70861
|
}
|
|
70846
70862
|
}
|
|
@@ -70932,7 +70948,7 @@ ${lanes.join("\n")}
|
|
|
70932
70948
|
if (node.expression) {
|
|
70933
70949
|
const type = checkExpression(node.expression, checkMode);
|
|
70934
70950
|
if (node.dotDotDotToken && type !== anyType && !isArrayType(type)) {
|
|
70935
|
-
|
|
70951
|
+
error2(node, Diagnostics.JSX_spread_child_must_be_an_array_type);
|
|
70936
70952
|
}
|
|
70937
70953
|
return type;
|
|
70938
70954
|
} else {
|
|
@@ -70961,14 +70977,14 @@ ${lanes.join("\n")}
|
|
|
70961
70977
|
if (languageVersion < 2 /* ES2015 */) {
|
|
70962
70978
|
if (symbolHasNonMethodDeclaration(prop)) {
|
|
70963
70979
|
if (errorNode) {
|
|
70964
|
-
|
|
70980
|
+
error2(errorNode, Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword);
|
|
70965
70981
|
}
|
|
70966
70982
|
return false;
|
|
70967
70983
|
}
|
|
70968
70984
|
}
|
|
70969
70985
|
if (flags & 256 /* Abstract */) {
|
|
70970
70986
|
if (errorNode) {
|
|
70971
|
-
|
|
70987
|
+
error2(
|
|
70972
70988
|
errorNode,
|
|
70973
70989
|
Diagnostics.Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression,
|
|
70974
70990
|
symbolToString(prop),
|
|
@@ -70982,7 +70998,7 @@ ${lanes.join("\n")}
|
|
|
70982
70998
|
const declaringClassDeclaration = getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop));
|
|
70983
70999
|
if (declaringClassDeclaration && isNodeUsedDuringClassInitialization(location)) {
|
|
70984
71000
|
if (errorNode) {
|
|
70985
|
-
|
|
71001
|
+
error2(
|
|
70986
71002
|
errorNode,
|
|
70987
71003
|
Diagnostics.Abstract_property_0_in_class_1_cannot_be_accessed_in_the_constructor,
|
|
70988
71004
|
symbolToString(prop),
|
|
@@ -70999,7 +71015,7 @@ ${lanes.join("\n")}
|
|
|
70999
71015
|
const declaringClassDeclaration = getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop));
|
|
71000
71016
|
if (!isNodeWithinClass(location, declaringClassDeclaration)) {
|
|
71001
71017
|
if (errorNode) {
|
|
71002
|
-
|
|
71018
|
+
error2(
|
|
71003
71019
|
errorNode,
|
|
71004
71020
|
Diagnostics.Property_0_is_private_and_only_accessible_within_class_1,
|
|
71005
71021
|
symbolToString(prop),
|
|
@@ -71022,7 +71038,7 @@ ${lanes.join("\n")}
|
|
|
71022
71038
|
enclosingClass = enclosingClass && isClassDerivedFromDeclaringClasses(enclosingClass, prop, writing);
|
|
71023
71039
|
if (flags & 32 /* Static */ || !enclosingClass) {
|
|
71024
71040
|
if (errorNode) {
|
|
71025
|
-
|
|
71041
|
+
error2(
|
|
71026
71042
|
errorNode,
|
|
71027
71043
|
Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses,
|
|
71028
71044
|
symbolToString(prop),
|
|
@@ -71040,7 +71056,7 @@ ${lanes.join("\n")}
|
|
|
71040
71056
|
}
|
|
71041
71057
|
if (!containingType || !hasBaseType(containingType, enclosingClass)) {
|
|
71042
71058
|
if (errorNode) {
|
|
71043
|
-
|
|
71059
|
+
error2(
|
|
71044
71060
|
errorNode,
|
|
71045
71061
|
Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1_This_is_an_instance_of_class_2,
|
|
71046
71062
|
symbolToString(prop),
|
|
@@ -71088,28 +71104,28 @@ ${lanes.join("\n")}
|
|
|
71088
71104
|
function reportObjectPossiblyNullOrUndefinedError(node, facts) {
|
|
71089
71105
|
const nodeText2 = isEntityNameExpression(node) ? entityNameToString(node) : void 0;
|
|
71090
71106
|
if (node.kind === 106 /* NullKeyword */) {
|
|
71091
|
-
|
|
71107
|
+
error2(node, Diagnostics.The_value_0_cannot_be_used_here, "null");
|
|
71092
71108
|
return;
|
|
71093
71109
|
}
|
|
71094
71110
|
if (nodeText2 !== void 0 && nodeText2.length < 100) {
|
|
71095
71111
|
if (isIdentifier(node) && nodeText2 === "undefined") {
|
|
71096
|
-
|
|
71112
|
+
error2(node, Diagnostics.The_value_0_cannot_be_used_here, "undefined");
|
|
71097
71113
|
return;
|
|
71098
71114
|
}
|
|
71099
|
-
|
|
71115
|
+
error2(
|
|
71100
71116
|
node,
|
|
71101
71117
|
facts & 16777216 /* IsUndefined */ ? facts & 33554432 /* IsNull */ ? Diagnostics._0_is_possibly_null_or_undefined : Diagnostics._0_is_possibly_undefined : Diagnostics._0_is_possibly_null,
|
|
71102
71118
|
nodeText2
|
|
71103
71119
|
);
|
|
71104
71120
|
} else {
|
|
71105
|
-
|
|
71121
|
+
error2(
|
|
71106
71122
|
node,
|
|
71107
71123
|
facts & 16777216 /* IsUndefined */ ? facts & 33554432 /* IsNull */ ? Diagnostics.Object_is_possibly_null_or_undefined : Diagnostics.Object_is_possibly_undefined : Diagnostics.Object_is_possibly_null
|
|
71108
71124
|
);
|
|
71109
71125
|
}
|
|
71110
71126
|
}
|
|
71111
71127
|
function reportCannotInvokePossiblyNullOrUndefinedError(node, facts) {
|
|
71112
|
-
|
|
71128
|
+
error2(
|
|
71113
71129
|
node,
|
|
71114
71130
|
facts & 16777216 /* IsUndefined */ ? facts & 33554432 /* IsNull */ ? Diagnostics.Cannot_invoke_an_object_which_is_possibly_null_or_undefined : Diagnostics.Cannot_invoke_an_object_which_is_possibly_undefined : Diagnostics.Cannot_invoke_an_object_which_is_possibly_null
|
|
71115
71131
|
);
|
|
@@ -71119,11 +71135,11 @@ ${lanes.join("\n")}
|
|
|
71119
71135
|
if (isEntityNameExpression(node)) {
|
|
71120
71136
|
const nodeText2 = entityNameToString(node);
|
|
71121
71137
|
if (nodeText2.length < 100) {
|
|
71122
|
-
|
|
71138
|
+
error2(node, Diagnostics._0_is_of_type_unknown, nodeText2);
|
|
71123
71139
|
return errorType;
|
|
71124
71140
|
}
|
|
71125
71141
|
}
|
|
71126
|
-
|
|
71142
|
+
error2(node, Diagnostics.Object_is_of_type_unknown);
|
|
71127
71143
|
return errorType;
|
|
71128
71144
|
}
|
|
71129
71145
|
const facts = getTypeFacts(type);
|
|
@@ -71143,15 +71159,15 @@ ${lanes.join("\n")}
|
|
|
71143
71159
|
if (isEntityNameExpression(node)) {
|
|
71144
71160
|
const nodeText2 = entityNameToString(node);
|
|
71145
71161
|
if (isIdentifier(node) && nodeText2 === "undefined") {
|
|
71146
|
-
|
|
71162
|
+
error2(node, Diagnostics.The_value_0_cannot_be_used_here, nodeText2);
|
|
71147
71163
|
return nonNullType;
|
|
71148
71164
|
}
|
|
71149
71165
|
if (nodeText2.length < 100) {
|
|
71150
|
-
|
|
71166
|
+
error2(node, Diagnostics._0_is_possibly_undefined, nodeText2);
|
|
71151
71167
|
return nonNullType;
|
|
71152
71168
|
}
|
|
71153
71169
|
}
|
|
71154
|
-
|
|
71170
|
+
error2(node, Diagnostics.Object_is_possibly_undefined);
|
|
71155
71171
|
}
|
|
71156
71172
|
return nonNullType;
|
|
71157
71173
|
}
|
|
@@ -71246,7 +71262,7 @@ ${lanes.join("\n")}
|
|
|
71246
71262
|
const lexicalClass = getContainingClass(lexicalValueDecl);
|
|
71247
71263
|
Debug.assert(!!lexicalClass);
|
|
71248
71264
|
if (findAncestor(lexicalClass, (n) => typeClass === n)) {
|
|
71249
|
-
const diagnostic =
|
|
71265
|
+
const diagnostic = error2(
|
|
71250
71266
|
right,
|
|
71251
71267
|
Diagnostics.The_property_0_cannot_be_accessed_on_type_1_within_this_class_because_it_is_shadowed_by_another_private_identifier_with_the_same_spelling,
|
|
71252
71268
|
diagName,
|
|
@@ -71268,7 +71284,7 @@ ${lanes.join("\n")}
|
|
|
71268
71284
|
return true;
|
|
71269
71285
|
}
|
|
71270
71286
|
}
|
|
71271
|
-
|
|
71287
|
+
error2(
|
|
71272
71288
|
right,
|
|
71273
71289
|
Diagnostics.Property_0_is_not_accessible_outside_class_1_because_it_has_a_private_identifier,
|
|
71274
71290
|
diagName,
|
|
@@ -71321,7 +71337,7 @@ ${lanes.join("\n")}
|
|
|
71321
71337
|
} else {
|
|
71322
71338
|
const isSetonlyAccessor = prop && prop.flags & 65536 /* SetAccessor */ && !(prop.flags & 32768 /* GetAccessor */);
|
|
71323
71339
|
if (isSetonlyAccessor && assignmentKind !== 1 /* Definite */) {
|
|
71324
|
-
|
|
71340
|
+
error2(node, Diagnostics.Private_accessor_was_defined_without_a_getter);
|
|
71325
71341
|
}
|
|
71326
71342
|
}
|
|
71327
71343
|
} else {
|
|
@@ -71358,9 +71374,9 @@ ${lanes.join("\n")}
|
|
|
71358
71374
|
}
|
|
71359
71375
|
if (leftType.symbol === globalThisSymbol) {
|
|
71360
71376
|
if (globalThisSymbol.exports.has(right.escapedText) && globalThisSymbol.exports.get(right.escapedText).flags & 418 /* BlockScoped */) {
|
|
71361
|
-
|
|
71377
|
+
error2(right, Diagnostics.Property_0_does_not_exist_on_type_1, unescapeLeadingUnderscores(right.escapedText), typeToString(leftType));
|
|
71362
71378
|
} else if (noImplicitAny) {
|
|
71363
|
-
|
|
71379
|
+
error2(right, Diagnostics.Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature, typeToString(leftType));
|
|
71364
71380
|
}
|
|
71365
71381
|
return anyType;
|
|
71366
71382
|
}
|
|
@@ -71370,11 +71386,11 @@ ${lanes.join("\n")}
|
|
|
71370
71386
|
return errorType;
|
|
71371
71387
|
}
|
|
71372
71388
|
if (indexInfo.isReadonly && (isAssignmentTarget(node) || isDeleteTarget(node))) {
|
|
71373
|
-
|
|
71389
|
+
error2(node, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(apparentType));
|
|
71374
71390
|
}
|
|
71375
71391
|
propType = compilerOptions.noUncheckedIndexedAccess && !isAssignmentTarget(node) ? getUnionType([indexInfo.type, missingType]) : indexInfo.type;
|
|
71376
71392
|
if (compilerOptions.noPropertyAccessFromIndexSignature && isPropertyAccessExpression(node)) {
|
|
71377
|
-
|
|
71393
|
+
error2(right, Diagnostics.Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0, unescapeLeadingUnderscores(right.escapedText));
|
|
71378
71394
|
}
|
|
71379
71395
|
if (indexInfo.declaration && getCombinedNodeFlags(indexInfo.declaration) & 268435456 /* Deprecated */) {
|
|
71380
71396
|
addDeprecatedSuggestion(right, [indexInfo.declaration], right.escapedText);
|
|
@@ -71389,7 +71405,7 @@ ${lanes.join("\n")}
|
|
|
71389
71405
|
getNodeLinks(node).resolvedSymbol = prop;
|
|
71390
71406
|
checkPropertyAccessibility(node, left.kind === 108 /* SuperKeyword */, isWriteAccess(node), apparentType, prop);
|
|
71391
71407
|
if (isAssignmentToReadonlyEntity(node, prop, assignmentKind)) {
|
|
71392
|
-
|
|
71408
|
+
error2(right, Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, idText(right));
|
|
71393
71409
|
return errorType;
|
|
71394
71410
|
}
|
|
71395
71411
|
propType = isThisPropertyAccessInConstructor(node, prop) ? autoType : writeOnly || isWriteOnlyAccess(node) ? getWriteTypeOfSymbol(prop) : getTypeOfSymbol(prop);
|
|
@@ -71434,7 +71450,7 @@ ${lanes.join("\n")}
|
|
|
71434
71450
|
}
|
|
71435
71451
|
const flowType = getFlowTypeOfReference(node, propType, assumeUninitialized ? getOptionalType(propType) : propType);
|
|
71436
71452
|
if (assumeUninitialized && !containsUndefinedType(propType) && containsUndefinedType(flowType)) {
|
|
71437
|
-
|
|
71453
|
+
error2(errorNode, Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(prop));
|
|
71438
71454
|
return propType;
|
|
71439
71455
|
}
|
|
71440
71456
|
return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType;
|
|
@@ -71447,9 +71463,9 @@ ${lanes.join("\n")}
|
|
|
71447
71463
|
let diagnosticMessage;
|
|
71448
71464
|
const declarationName = idText(right);
|
|
71449
71465
|
if (isInPropertyInitializerOrClassStaticBlock(node) && !isOptionalPropertyDeclaration(valueDeclaration) && !(isAccessExpression(node) && isAccessExpression(node.expression)) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right) && !(isMethodDeclaration(valueDeclaration) && getCombinedModifierFlags(valueDeclaration) & 32 /* Static */) && (compilerOptions.useDefineForClassFields || !isPropertyDeclaredInAncestorClass(prop))) {
|
|
71450
|
-
diagnosticMessage =
|
|
71466
|
+
diagnosticMessage = error2(right, Diagnostics.Property_0_is_used_before_its_initialization, declarationName);
|
|
71451
71467
|
} else if (valueDeclaration.kind === 262 /* ClassDeclaration */ && node.parent.kind !== 182 /* TypeReference */ && !(valueDeclaration.flags & 16777216 /* Ambient */) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) {
|
|
71452
|
-
diagnosticMessage =
|
|
71468
|
+
diagnosticMessage = error2(right, Diagnostics.Class_0_used_before_its_declaration, declarationName);
|
|
71453
71469
|
}
|
|
71454
71470
|
if (diagnosticMessage) {
|
|
71455
71471
|
addRelatedInfo(
|
|
@@ -71827,7 +71843,7 @@ ${lanes.join("\n")}
|
|
|
71827
71843
|
return objectType;
|
|
71828
71844
|
}
|
|
71829
71845
|
if (isConstEnumObjectType(objectType) && !isStringLiteralLike(indexExpression)) {
|
|
71830
|
-
|
|
71846
|
+
error2(indexExpression, Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal);
|
|
71831
71847
|
return errorType;
|
|
71832
71848
|
}
|
|
71833
71849
|
const effectiveIndexType = isForInVariableForNumericPropertyNames(indexExpression) ? numberType : indexType;
|
|
@@ -72534,7 +72550,7 @@ ${lanes.join("\n")}
|
|
|
72534
72550
|
if (isVoidPromiseError && isInJSFile(node)) {
|
|
72535
72551
|
return getDiagnosticForCallNode(node, Diagnostics.Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_without_arguments);
|
|
72536
72552
|
}
|
|
72537
|
-
const
|
|
72553
|
+
const error3 = isDecorator(node) ? hasRestParameter2 ? Diagnostics.The_runtime_will_invoke_the_decorator_with_1_arguments_but_the_decorator_expects_at_least_0 : Diagnostics.The_runtime_will_invoke_the_decorator_with_1_arguments_but_the_decorator_expects_0 : hasRestParameter2 ? Diagnostics.Expected_at_least_0_arguments_but_got_1 : isVoidPromiseError ? Diagnostics.Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise : Diagnostics.Expected_0_arguments_but_got_1;
|
|
72538
72554
|
if (min2 < args.length && args.length < max) {
|
|
72539
72555
|
if (headMessage) {
|
|
72540
72556
|
let chain = chainDiagnosticMessages(
|
|
@@ -72555,14 +72571,14 @@ ${lanes.join("\n")}
|
|
|
72555
72571
|
let chain = chainDiagnosticMessages(
|
|
72556
72572
|
/*details*/
|
|
72557
72573
|
void 0,
|
|
72558
|
-
|
|
72574
|
+
error3,
|
|
72559
72575
|
parameterRange,
|
|
72560
72576
|
args.length
|
|
72561
72577
|
);
|
|
72562
72578
|
chain = chainDiagnosticMessages(chain, headMessage);
|
|
72563
72579
|
diagnostic = getDiagnosticForCallNode(node, chain);
|
|
72564
72580
|
} else {
|
|
72565
|
-
diagnostic = getDiagnosticForCallNode(node,
|
|
72581
|
+
diagnostic = getDiagnosticForCallNode(node, error3, parameterRange, args.length);
|
|
72566
72582
|
}
|
|
72567
72583
|
const parameter = (_a = closestSignature == null ? void 0 : closestSignature.declaration) == null ? void 0 : _a.parameters[closestSignature.thisParameter ? args.length + 1 : args.length];
|
|
72568
72584
|
if (parameter) {
|
|
@@ -72583,14 +72599,14 @@ ${lanes.join("\n")}
|
|
|
72583
72599
|
let chain = chainDiagnosticMessages(
|
|
72584
72600
|
/*details*/
|
|
72585
72601
|
void 0,
|
|
72586
|
-
|
|
72602
|
+
error3,
|
|
72587
72603
|
parameterRange,
|
|
72588
72604
|
args.length
|
|
72589
72605
|
);
|
|
72590
72606
|
chain = chainDiagnosticMessages(chain, headMessage);
|
|
72591
72607
|
return createDiagnosticForNodeArrayFromMessageChain(getSourceFileOfNode(node), errorSpan, chain);
|
|
72592
72608
|
}
|
|
72593
|
-
return createDiagnosticForNodeArray(getSourceFileOfNode(node), errorSpan,
|
|
72609
|
+
return createDiagnosticForNodeArray(getSourceFileOfNode(node), errorSpan, error3, parameterRange, args.length);
|
|
72594
72610
|
}
|
|
72595
72611
|
}
|
|
72596
72612
|
function getTypeArgumentArityError(node, signatures, typeArguments, headMessage) {
|
|
@@ -73072,13 +73088,13 @@ ${lanes.join("\n")}
|
|
|
73072
73088
|
const numConstructSignatures = getSignaturesOfType(apparentType, 1 /* Construct */).length;
|
|
73073
73089
|
if (isUntypedFunctionCall(funcType, apparentType, callSignatures.length, numConstructSignatures)) {
|
|
73074
73090
|
if (!isErrorType(funcType) && node.typeArguments) {
|
|
73075
|
-
|
|
73091
|
+
error2(node, Diagnostics.Untyped_function_calls_may_not_accept_type_arguments);
|
|
73076
73092
|
}
|
|
73077
73093
|
return resolveUntypedCall(node);
|
|
73078
73094
|
}
|
|
73079
73095
|
if (!callSignatures.length) {
|
|
73080
73096
|
if (numConstructSignatures) {
|
|
73081
|
-
|
|
73097
|
+
error2(node, Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new, typeToString(funcType));
|
|
73082
73098
|
} else {
|
|
73083
73099
|
let relatedInformation;
|
|
73084
73100
|
if (node.arguments.length === 1) {
|
|
@@ -73101,7 +73117,7 @@ ${lanes.join("\n")}
|
|
|
73101
73117
|
return resolvingSignature;
|
|
73102
73118
|
}
|
|
73103
73119
|
if (callSignatures.some((sig) => isInJSFile(sig.declaration) && !!getJSDocClassTag(sig.declaration))) {
|
|
73104
|
-
|
|
73120
|
+
error2(node, Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new, typeToString(funcType));
|
|
73105
73121
|
return resolveErrorCall(node);
|
|
73106
73122
|
}
|
|
73107
73123
|
return resolveCall(node, callSignatures, candidatesOutArray, checkMode, callChainFlags);
|
|
@@ -73116,7 +73132,7 @@ ${lanes.join("\n")}
|
|
|
73116
73132
|
if (node.arguments && languageVersion < 1 /* ES5 */) {
|
|
73117
73133
|
const spreadIndex = getSpreadArgumentIndex(node.arguments);
|
|
73118
73134
|
if (spreadIndex >= 0) {
|
|
73119
|
-
|
|
73135
|
+
error2(node.arguments[spreadIndex], Diagnostics.Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher);
|
|
73120
73136
|
}
|
|
73121
73137
|
}
|
|
73122
73138
|
let expressionType = checkNonNullExpression(node.expression);
|
|
@@ -73129,7 +73145,7 @@ ${lanes.join("\n")}
|
|
|
73129
73145
|
}
|
|
73130
73146
|
if (isTypeAny(expressionType)) {
|
|
73131
73147
|
if (node.typeArguments) {
|
|
73132
|
-
|
|
73148
|
+
error2(node, Diagnostics.Untyped_function_calls_may_not_accept_type_arguments);
|
|
73133
73149
|
}
|
|
73134
73150
|
return resolveUntypedCall(node);
|
|
73135
73151
|
}
|
|
@@ -73139,12 +73155,12 @@ ${lanes.join("\n")}
|
|
|
73139
73155
|
return resolveErrorCall(node);
|
|
73140
73156
|
}
|
|
73141
73157
|
if (someSignature(constructSignatures, (signature) => !!(signature.flags & 4 /* Abstract */))) {
|
|
73142
|
-
|
|
73158
|
+
error2(node, Diagnostics.Cannot_create_an_instance_of_an_abstract_class);
|
|
73143
73159
|
return resolveErrorCall(node);
|
|
73144
73160
|
}
|
|
73145
73161
|
const valueDecl = expressionType.symbol && getClassLikeDeclarationOfSymbol(expressionType.symbol);
|
|
73146
73162
|
if (valueDecl && hasSyntacticModifier(valueDecl, 256 /* Abstract */)) {
|
|
73147
|
-
|
|
73163
|
+
error2(node, Diagnostics.Cannot_create_an_instance_of_an_abstract_class);
|
|
73148
73164
|
return resolveErrorCall(node);
|
|
73149
73165
|
}
|
|
73150
73166
|
return resolveCall(node, constructSignatures, candidatesOutArray, checkMode, 0 /* None */);
|
|
@@ -73154,10 +73170,10 @@ ${lanes.join("\n")}
|
|
|
73154
73170
|
const signature = resolveCall(node, callSignatures, candidatesOutArray, checkMode, 0 /* None */);
|
|
73155
73171
|
if (!noImplicitAny) {
|
|
73156
73172
|
if (signature.declaration && !isJSConstructor(signature.declaration) && getReturnTypeOfSignature(signature) !== voidType) {
|
|
73157
|
-
|
|
73173
|
+
error2(node, Diagnostics.Only_a_void_function_can_be_called_with_the_new_keyword);
|
|
73158
73174
|
}
|
|
73159
73175
|
if (getThisTypeOfSignature(signature) === voidType) {
|
|
73160
|
-
|
|
73176
|
+
error2(node, Diagnostics.A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void);
|
|
73161
73177
|
}
|
|
73162
73178
|
}
|
|
73163
73179
|
return signature;
|
|
@@ -73221,10 +73237,10 @@ ${lanes.join("\n")}
|
|
|
73221
73237
|
}
|
|
73222
73238
|
}
|
|
73223
73239
|
if (modifiers & 8 /* Private */) {
|
|
73224
|
-
|
|
73240
|
+
error2(node, Diagnostics.Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration, typeToString(declaringClass));
|
|
73225
73241
|
}
|
|
73226
73242
|
if (modifiers & 16 /* Protected */) {
|
|
73227
|
-
|
|
73243
|
+
error2(node, Diagnostics.Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration, typeToString(declaringClass));
|
|
73228
73244
|
}
|
|
73229
73245
|
return false;
|
|
73230
73246
|
}
|
|
@@ -73386,7 +73402,7 @@ ${lanes.join("\n")}
|
|
|
73386
73402
|
/*includeTrivia*/
|
|
73387
73403
|
false
|
|
73388
73404
|
);
|
|
73389
|
-
|
|
73405
|
+
error2(node, Diagnostics._0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write_0, nodeStr);
|
|
73390
73406
|
return resolveErrorCall(node);
|
|
73391
73407
|
}
|
|
73392
73408
|
const headMessage = getDiagnosticHeadMessageForDecoratorResolution(node);
|
|
@@ -73476,7 +73492,7 @@ ${lanes.join("\n")}
|
|
|
73476
73492
|
return resolveUntypedCall(node);
|
|
73477
73493
|
}
|
|
73478
73494
|
if (signatures.length === 0) {
|
|
73479
|
-
|
|
73495
|
+
error2(node.tagName, Diagnostics.JSX_element_type_0_does_not_have_any_construct_or_call_signatures, getTextOfNode(node.tagName));
|
|
73480
73496
|
return resolveErrorCall(node);
|
|
73481
73497
|
}
|
|
73482
73498
|
return resolveCall(node, signatures, candidatesOutArray, checkMode, 0 /* None */);
|
|
@@ -73636,7 +73652,7 @@ ${lanes.join("\n")}
|
|
|
73636
73652
|
const declaration = signature.declaration;
|
|
73637
73653
|
if (declaration && declaration.kind !== 175 /* Constructor */ && declaration.kind !== 179 /* ConstructSignature */ && declaration.kind !== 184 /* ConstructorType */ && !(isJSDocSignature(declaration) && ((_b = (_a = getJSDocRoot(declaration)) == null ? void 0 : _a.parent) == null ? void 0 : _b.kind) === 175 /* Constructor */) && !isJSDocConstructSignature(declaration) && !isJSConstructor(declaration)) {
|
|
73638
73654
|
if (noImplicitAny) {
|
|
73639
|
-
|
|
73655
|
+
error2(node, Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type);
|
|
73640
73656
|
}
|
|
73641
73657
|
return anyType;
|
|
73642
73658
|
}
|
|
@@ -73650,9 +73666,9 @@ ${lanes.join("\n")}
|
|
|
73650
73666
|
}
|
|
73651
73667
|
if (node.kind === 212 /* CallExpression */ && !node.questionDotToken && node.parent.kind === 243 /* ExpressionStatement */ && returnType.flags & 16384 /* Void */ && getTypePredicateOfSignature(signature)) {
|
|
73652
73668
|
if (!isDottedName(node.expression)) {
|
|
73653
|
-
|
|
73669
|
+
error2(node.expression, Diagnostics.Assertions_require_the_call_target_to_be_an_identifier_or_qualified_name);
|
|
73654
73670
|
} else if (!getEffectsSignature(node)) {
|
|
73655
|
-
const diagnostic =
|
|
73671
|
+
const diagnostic = error2(node.expression, Diagnostics.Assertions_require_every_name_in_the_call_target_to_be_declared_with_an_explicit_type_annotation);
|
|
73656
73672
|
getTypeOfDottedName(node.expression, diagnostic);
|
|
73657
73673
|
}
|
|
73658
73674
|
}
|
|
@@ -73741,7 +73757,7 @@ ${lanes.join("\n")}
|
|
|
73741
73757
|
checkExpressionCached(node.arguments[i]);
|
|
73742
73758
|
}
|
|
73743
73759
|
if (specifierType.flags & 32768 /* Undefined */ || specifierType.flags & 65536 /* Null */ || !isTypeAssignableTo(specifierType, stringType)) {
|
|
73744
|
-
|
|
73760
|
+
error2(specifier, Diagnostics.Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0, typeToString(specifierType));
|
|
73745
73761
|
}
|
|
73746
73762
|
if (optionsType) {
|
|
73747
73763
|
const importCallOptionsType = getGlobalImportCallOptionsType(
|
|
@@ -73915,7 +73931,7 @@ ${lanes.join("\n")}
|
|
|
73915
73931
|
const exprType = checkExpression(expression, checkMode);
|
|
73916
73932
|
if (isConstTypeReference(type)) {
|
|
73917
73933
|
if (!isValidConstAssertionArgument(expression)) {
|
|
73918
|
-
|
|
73934
|
+
error2(expression, Diagnostics.A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array_or_object_literals);
|
|
73919
73935
|
}
|
|
73920
73936
|
return getRegularTypeOfLiteralType(exprType);
|
|
73921
73937
|
}
|
|
@@ -73976,7 +73992,7 @@ ${lanes.join("\n")}
|
|
|
73976
73992
|
if (node.kind === 232 /* ExpressionWithTypeArguments */) {
|
|
73977
73993
|
const parent2 = walkUpParenthesizedExpressions(node.parent);
|
|
73978
73994
|
if (parent2.kind === 225 /* BinaryExpression */ && parent2.operatorToken.kind === 104 /* InstanceOfKeyword */ && isNodeDescendantOf(node, parent2.right)) {
|
|
73979
|
-
|
|
73995
|
+
error2(node, Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_not_be_an_instantiation_expression);
|
|
73980
73996
|
}
|
|
73981
73997
|
}
|
|
73982
73998
|
const exprType = node.kind === 232 /* ExpressionWithTypeArguments */ ? checkExpression(node.expression) : isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName);
|
|
@@ -74091,7 +74107,7 @@ ${lanes.join("\n")}
|
|
|
74091
74107
|
function checkNewTargetMetaProperty(node) {
|
|
74092
74108
|
const container = getNewTargetContainer(node);
|
|
74093
74109
|
if (!container) {
|
|
74094
|
-
|
|
74110
|
+
error2(node, Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target");
|
|
74095
74111
|
return errorType;
|
|
74096
74112
|
} else if (container.kind === 175 /* Constructor */) {
|
|
74097
74113
|
const symbol = getSymbolOfDeclaration(container.parent);
|
|
@@ -74104,10 +74120,10 @@ ${lanes.join("\n")}
|
|
|
74104
74120
|
function checkImportMetaProperty(node) {
|
|
74105
74121
|
if (moduleKind === 100 /* Node16 */ || moduleKind === 199 /* NodeNext */) {
|
|
74106
74122
|
if (getSourceFileOfNode(node).impliedNodeFormat !== 99 /* ESNext */) {
|
|
74107
|
-
|
|
74123
|
+
error2(node, Diagnostics.The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output);
|
|
74108
74124
|
}
|
|
74109
74125
|
} else if (moduleKind < 6 /* ES2020 */ && moduleKind !== 4 /* System */) {
|
|
74110
|
-
|
|
74126
|
+
error2(node, Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_or_nodenext);
|
|
74111
74127
|
}
|
|
74112
74128
|
const file = getSourceFileOfNode(node);
|
|
74113
74129
|
Debug.assert(!!(file.flags & 4194304 /* PossiblyContainsImportMeta */), "Containing file is missing import meta node flag.");
|
|
@@ -74664,13 +74680,13 @@ ${lanes.join("\n")}
|
|
|
74664
74680
|
function createPromiseReturnType(func, promisedType) {
|
|
74665
74681
|
const promiseType = createPromiseType(promisedType);
|
|
74666
74682
|
if (promiseType === unknownType) {
|
|
74667
|
-
|
|
74683
|
+
error2(func, isImportCall(func) ? Diagnostics.A_dynamic_import_call_returns_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option : Diagnostics.An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option);
|
|
74668
74684
|
return errorType;
|
|
74669
74685
|
} else if (!getGlobalPromiseConstructorSymbol(
|
|
74670
74686
|
/*reportErrors*/
|
|
74671
74687
|
true
|
|
74672
74688
|
)) {
|
|
74673
|
-
|
|
74689
|
+
error2(func, isImportCall(func) ? Diagnostics.A_dynamic_import_call_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option : Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option);
|
|
74674
74690
|
}
|
|
74675
74691
|
return promiseType;
|
|
74676
74692
|
}
|
|
@@ -74966,11 +74982,11 @@ ${lanes.join("\n")}
|
|
|
74966
74982
|
const hasExplicitReturn = func.flags & 512 /* HasExplicitReturn */;
|
|
74967
74983
|
const errorNode = getEffectiveReturnTypeNode(func) || func;
|
|
74968
74984
|
if (type && type.flags & 131072 /* Never */) {
|
|
74969
|
-
|
|
74985
|
+
error2(errorNode, Diagnostics.A_function_returning_never_cannot_have_a_reachable_end_point);
|
|
74970
74986
|
} else if (type && !hasExplicitReturn) {
|
|
74971
|
-
|
|
74987
|
+
error2(errorNode, Diagnostics.A_function_whose_declared_type_is_neither_undefined_void_nor_any_must_return_a_value);
|
|
74972
74988
|
} else if (type && strictNullChecks && !isTypeAssignableTo(undefinedType, type)) {
|
|
74973
|
-
|
|
74989
|
+
error2(errorNode, Diagnostics.Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined);
|
|
74974
74990
|
} else if (compilerOptions.noImplicitReturns) {
|
|
74975
74991
|
if (!type) {
|
|
74976
74992
|
if (!hasExplicitReturn) {
|
|
@@ -74981,7 +74997,7 @@ ${lanes.join("\n")}
|
|
|
74981
74997
|
return;
|
|
74982
74998
|
}
|
|
74983
74999
|
}
|
|
74984
|
-
|
|
75000
|
+
error2(errorNode, Diagnostics.Not_all_code_paths_return_a_value);
|
|
74985
75001
|
}
|
|
74986
75002
|
}
|
|
74987
75003
|
}
|
|
@@ -75181,11 +75197,11 @@ ${lanes.join("\n")}
|
|
|
75181
75197
|
function checkReferenceExpression(expr, invalidReferenceMessage, invalidOptionalChainMessage) {
|
|
75182
75198
|
const node = skipOuterExpressions(expr, 6 /* Assertions */ | 1 /* Parentheses */);
|
|
75183
75199
|
if (node.kind !== 80 /* Identifier */ && !isAccessExpression(node)) {
|
|
75184
|
-
|
|
75200
|
+
error2(expr, invalidReferenceMessage);
|
|
75185
75201
|
return false;
|
|
75186
75202
|
}
|
|
75187
75203
|
if (node.flags & 32 /* OptionalChain */) {
|
|
75188
|
-
|
|
75204
|
+
error2(expr, invalidOptionalChainMessage);
|
|
75189
75205
|
return false;
|
|
75190
75206
|
}
|
|
75191
75207
|
return true;
|
|
@@ -75194,17 +75210,17 @@ ${lanes.join("\n")}
|
|
|
75194
75210
|
checkExpression(node.expression);
|
|
75195
75211
|
const expr = skipParentheses(node.expression);
|
|
75196
75212
|
if (!isAccessExpression(expr)) {
|
|
75197
|
-
|
|
75213
|
+
error2(expr, Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference);
|
|
75198
75214
|
return booleanType;
|
|
75199
75215
|
}
|
|
75200
75216
|
if (isPropertyAccessExpression(expr) && isPrivateIdentifier(expr.name)) {
|
|
75201
|
-
|
|
75217
|
+
error2(expr, Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_private_identifier);
|
|
75202
75218
|
}
|
|
75203
75219
|
const links = getNodeLinks(expr);
|
|
75204
75220
|
const symbol = getExportSymbolOfValueSymbolIfExported(links.resolvedSymbol);
|
|
75205
75221
|
if (symbol) {
|
|
75206
75222
|
if (isReadonlySymbol(symbol)) {
|
|
75207
|
-
|
|
75223
|
+
error2(expr, Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_read_only_property);
|
|
75208
75224
|
}
|
|
75209
75225
|
checkDeleteExpressionMustBeOptional(expr, symbol);
|
|
75210
75226
|
}
|
|
@@ -75213,7 +75229,7 @@ ${lanes.join("\n")}
|
|
|
75213
75229
|
function checkDeleteExpressionMustBeOptional(expr, symbol) {
|
|
75214
75230
|
const type = getTypeOfSymbol(symbol);
|
|
75215
75231
|
if (strictNullChecks && !(type.flags & (3 /* AnyOrUnknown */ | 131072 /* Never */)) && !(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ : getTypeFacts(type) & 16777216 /* IsUndefined */)) {
|
|
75216
|
-
|
|
75232
|
+
error2(expr, Diagnostics.The_operand_of_a_delete_operator_must_be_optional);
|
|
75217
75233
|
}
|
|
75218
75234
|
}
|
|
75219
75235
|
function checkTypeOfExpression(node) {
|
|
@@ -75227,7 +75243,7 @@ ${lanes.join("\n")}
|
|
|
75227
75243
|
function checkAwaitExpressionGrammar(node) {
|
|
75228
75244
|
const container = getContainingFunctionOrClassStaticBlock(node);
|
|
75229
75245
|
if (container && isClassStaticBlockDeclaration(container)) {
|
|
75230
|
-
|
|
75246
|
+
error2(node, Diagnostics.Await_expression_cannot_be_used_inside_a_class_static_block);
|
|
75231
75247
|
} else if (!(node.flags & 32768 /* AwaitContext */)) {
|
|
75232
75248
|
if (isInTopLevelContext(node)) {
|
|
75233
75249
|
const sourceFile = getSourceFileOfNode(node);
|
|
@@ -75286,7 +75302,7 @@ ${lanes.join("\n")}
|
|
|
75286
75302
|
}
|
|
75287
75303
|
}
|
|
75288
75304
|
if (isInParameterInitializerBeforeContainingFunction(node)) {
|
|
75289
|
-
|
|
75305
|
+
error2(node, Diagnostics.await_expressions_cannot_be_used_in_a_parameter_initializer);
|
|
75290
75306
|
}
|
|
75291
75307
|
}
|
|
75292
75308
|
function checkAwaitExpression(node) {
|
|
@@ -75336,11 +75352,11 @@ ${lanes.join("\n")}
|
|
|
75336
75352
|
case 55 /* TildeToken */:
|
|
75337
75353
|
checkNonNullType(operandType, node.operand);
|
|
75338
75354
|
if (maybeTypeOfKindConsideringBaseConstraint(operandType, 12288 /* ESSymbolLike */)) {
|
|
75339
|
-
|
|
75355
|
+
error2(node.operand, Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, tokenToString(node.operator));
|
|
75340
75356
|
}
|
|
75341
75357
|
if (node.operator === 40 /* PlusToken */) {
|
|
75342
75358
|
if (maybeTypeOfKindConsideringBaseConstraint(operandType, 2112 /* BigIntLike */)) {
|
|
75343
|
-
|
|
75359
|
+
error2(node.operand, Diagnostics.Operator_0_cannot_be_applied_to_type_1, tokenToString(node.operator), typeToString(getBaseTypeOfLiteralType(operandType)));
|
|
75344
75360
|
}
|
|
75345
75361
|
return numberType;
|
|
75346
75362
|
}
|
|
@@ -75436,10 +75452,10 @@ ${lanes.join("\n")}
|
|
|
75436
75452
|
return silentNeverType;
|
|
75437
75453
|
}
|
|
75438
75454
|
if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 402784252 /* Primitive */)) {
|
|
75439
|
-
|
|
75455
|
+
error2(left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
|
|
75440
75456
|
}
|
|
75441
75457
|
if (!(isTypeAny(rightType) || typeHasCallOrConstructSignatures(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
|
|
75442
|
-
|
|
75458
|
+
error2(right, Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type);
|
|
75443
75459
|
}
|
|
75444
75460
|
return booleanType;
|
|
75445
75461
|
}
|
|
@@ -75468,7 +75484,7 @@ ${lanes.join("\n")}
|
|
|
75468
75484
|
}
|
|
75469
75485
|
if (checkTypeAssignableTo(checkNonNullType(rightType, right), nonPrimitiveType, right)) {
|
|
75470
75486
|
if (hasEmptyObjectIntersection(rightType)) {
|
|
75471
|
-
|
|
75487
|
+
error2(right, Diagnostics.Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator, typeToString(rightType));
|
|
75472
75488
|
}
|
|
75473
75489
|
}
|
|
75474
75490
|
return booleanType;
|
|
@@ -75510,7 +75526,7 @@ ${lanes.join("\n")}
|
|
|
75510
75526
|
return checkDestructuringAssignment(property.kind === 303 /* ShorthandPropertyAssignment */ ? property : property.initializer, type);
|
|
75511
75527
|
} else if (property.kind === 304 /* SpreadAssignment */) {
|
|
75512
75528
|
if (propertyIndex < properties.length - 1) {
|
|
75513
|
-
|
|
75529
|
+
error2(property, Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern);
|
|
75514
75530
|
} else {
|
|
75515
75531
|
if (languageVersion < 99 /* ESNext */) {
|
|
75516
75532
|
checkExternalEmitHelpers(property, 4 /* Rest */);
|
|
@@ -75528,7 +75544,7 @@ ${lanes.join("\n")}
|
|
|
75528
75544
|
return checkDestructuringAssignment(property.expression, type);
|
|
75529
75545
|
}
|
|
75530
75546
|
} else {
|
|
75531
|
-
|
|
75547
|
+
error2(property, Diagnostics.Property_assignment_expected);
|
|
75532
75548
|
}
|
|
75533
75549
|
}
|
|
75534
75550
|
function checkArrayLiteralAssignment(node, sourceType, checkMode) {
|
|
@@ -75563,11 +75579,11 @@ ${lanes.join("\n")}
|
|
|
75563
75579
|
return checkDestructuringAssignment(element, elementType, checkMode);
|
|
75564
75580
|
}
|
|
75565
75581
|
if (elementIndex < elements.length - 1) {
|
|
75566
|
-
|
|
75582
|
+
error2(element, Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern);
|
|
75567
75583
|
} else {
|
|
75568
75584
|
const restExpression = element.expression;
|
|
75569
75585
|
if (restExpression.kind === 225 /* BinaryExpression */ && restExpression.operatorToken.kind === 64 /* EqualsToken */) {
|
|
75570
|
-
|
|
75586
|
+
error2(restExpression.operatorToken, Diagnostics.A_rest_element_cannot_have_an_initializer);
|
|
75571
75587
|
} else {
|
|
75572
75588
|
checkGrammarForDisallowedTrailingComma(node.elements, Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma);
|
|
75573
75589
|
const type = everyType(sourceType, isTupleType) ? mapType(sourceType, (t) => sliceTupleType(t, elementIndex)) : createArrayType(elementType);
|
|
@@ -75608,9 +75624,9 @@ ${lanes.join("\n")}
|
|
|
75608
75624
|
}
|
|
75609
75625
|
function checkReferenceAssignment(target, sourceType, checkMode) {
|
|
75610
75626
|
const targetType = checkExpression(target, checkMode);
|
|
75611
|
-
const
|
|
75627
|
+
const error3 = target.parent.kind === 304 /* SpreadAssignment */ ? Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access;
|
|
75612
75628
|
const optionalError = target.parent.kind === 304 /* SpreadAssignment */ ? Diagnostics.The_target_of_an_object_rest_assignment_may_not_be_an_optional_property_access : Diagnostics.The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access;
|
|
75613
|
-
if (checkReferenceExpression(target,
|
|
75629
|
+
if (checkReferenceExpression(target, error3, optionalError)) {
|
|
75614
75630
|
checkTypeAssignableToAndOptionallyElaborate(sourceType, targetType, target, target);
|
|
75615
75631
|
}
|
|
75616
75632
|
if (isPrivateIdentifierPropertyAccessExpression(target)) {
|
|
@@ -75851,7 +75867,7 @@ ${lanes.join("\n")}
|
|
|
75851
75867
|
rightType = checkNonNullType(rightType, right);
|
|
75852
75868
|
let suggestedOperator;
|
|
75853
75869
|
if (leftType.flags & 528 /* BooleanLike */ && rightType.flags & 528 /* BooleanLike */ && (suggestedOperator = getSuggestedBooleanOperator(operatorToken.kind)) !== void 0) {
|
|
75854
|
-
|
|
75870
|
+
error2(errorNode || operatorToken, Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, tokenToString(operatorToken.kind), tokenToString(suggestedOperator));
|
|
75855
75871
|
return numberType;
|
|
75856
75872
|
} else {
|
|
75857
75873
|
const leftOk = checkArithmeticOperandType(
|
|
@@ -75881,7 +75897,7 @@ ${lanes.join("\n")}
|
|
|
75881
75897
|
case 43 /* AsteriskAsteriskToken */:
|
|
75882
75898
|
case 68 /* AsteriskAsteriskEqualsToken */:
|
|
75883
75899
|
if (languageVersion < 3 /* ES2016 */) {
|
|
75884
|
-
|
|
75900
|
+
error2(errorNode, Diagnostics.Exponentiation_cannot_be_performed_on_bigint_values_unless_the_target_option_is_set_to_es2016_or_later);
|
|
75885
75901
|
}
|
|
75886
75902
|
}
|
|
75887
75903
|
resultType2 = bigintType;
|
|
@@ -75979,7 +75995,7 @@ ${lanes.join("\n")}
|
|
|
75979
75995
|
if (!(checkMode && checkMode & 256 /* TypeOnly */)) {
|
|
75980
75996
|
if (isLiteralExpressionOfObject(left) || isLiteralExpressionOfObject(right)) {
|
|
75981
75997
|
const eqType = operator === 35 /* EqualsEqualsToken */ || operator === 37 /* EqualsEqualsEqualsToken */;
|
|
75982
|
-
|
|
75998
|
+
error2(errorNode, Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true");
|
|
75983
75999
|
}
|
|
75984
76000
|
checkNaNEquality(errorNode, operator, left, right);
|
|
75985
76001
|
reportOperatorErrorUnless((left2, right2) => isTypeEqualityComparableTo(left2, right2) || isTypeEqualityComparableTo(right2, left2));
|
|
@@ -76036,7 +76052,7 @@ ${lanes.join("\n")}
|
|
|
76036
76052
|
return textSpanContainsPosition(diag2, start);
|
|
76037
76053
|
});
|
|
76038
76054
|
if (!isInDiag2657)
|
|
76039
|
-
|
|
76055
|
+
error2(left, Diagnostics.Left_side_of_comma_operator_is_unused_and_has_no_side_effects);
|
|
76040
76056
|
}
|
|
76041
76057
|
return rightType;
|
|
76042
76058
|
default:
|
|
@@ -76076,7 +76092,7 @@ ${lanes.join("\n")}
|
|
|
76076
76092
|
function checkForDisallowedESSymbolOperand(operator2) {
|
|
76077
76093
|
const offendingSymbolOperand = maybeTypeOfKindConsideringBaseConstraint(leftType, 12288 /* ESSymbolLike */) ? left : maybeTypeOfKindConsideringBaseConstraint(rightType, 12288 /* ESSymbolLike */) ? right : void 0;
|
|
76078
76094
|
if (offendingSymbolOperand) {
|
|
76079
|
-
|
|
76095
|
+
error2(offendingSymbolOperand, Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, tokenToString(operator2));
|
|
76080
76096
|
return false;
|
|
76081
76097
|
}
|
|
76082
76098
|
return true;
|
|
@@ -76197,7 +76213,7 @@ ${lanes.join("\n")}
|
|
|
76197
76213
|
const isLeftNaN = isGlobalNaN(skipParentheses(left2));
|
|
76198
76214
|
const isRightNaN = isGlobalNaN(skipParentheses(right2));
|
|
76199
76215
|
if (isLeftNaN || isRightNaN) {
|
|
76200
|
-
const err =
|
|
76216
|
+
const err = error2(
|
|
76201
76217
|
errorNode2,
|
|
76202
76218
|
Diagnostics.This_condition_will_always_return_0,
|
|
76203
76219
|
tokenToString(operator2 === 37 /* EqualsEqualsEqualsToken */ || operator2 === 35 /* EqualsEqualsToken */ ? 97 /* FalseKeyword */ : 112 /* TrueKeyword */)
|
|
@@ -76278,7 +76294,7 @@ ${lanes.join("\n")}
|
|
|
76278
76294
|
void 0
|
|
76279
76295
|
);
|
|
76280
76296
|
if (!contextualType || isTypeAny(contextualType)) {
|
|
76281
|
-
|
|
76297
|
+
error2(node, Diagnostics.yield_expression_implicitly_results_in_an_any_type_because_its_containing_generator_lacks_a_return_type_annotation);
|
|
76282
76298
|
}
|
|
76283
76299
|
}
|
|
76284
76300
|
});
|
|
@@ -76289,7 +76305,7 @@ ${lanes.join("\n")}
|
|
|
76289
76305
|
grammarErrorOnFirstToken(node, Diagnostics.A_yield_expression_is_only_allowed_in_a_generator_body);
|
|
76290
76306
|
}
|
|
76291
76307
|
if (isInParameterInitializerBeforeContainingFunction(node)) {
|
|
76292
|
-
|
|
76308
|
+
error2(node, Diagnostics.yield_expressions_cannot_be_used_in_a_parameter_initializer);
|
|
76293
76309
|
}
|
|
76294
76310
|
}
|
|
76295
76311
|
}
|
|
@@ -76310,7 +76326,7 @@ ${lanes.join("\n")}
|
|
|
76310
76326
|
for (const span of node.templateSpans) {
|
|
76311
76327
|
const type = checkExpression(span.expression);
|
|
76312
76328
|
if (maybeTypeOfKindConsideringBaseConstraint(type, 12288 /* ESSymbolLike */)) {
|
|
76313
|
-
|
|
76329
|
+
error2(span.expression, Diagnostics.Implicit_conversion_of_a_symbol_to_a_string_will_fail_at_runtime_Consider_wrapping_this_expression_in_String);
|
|
76314
76330
|
}
|
|
76315
76331
|
texts.push(span.literal.text);
|
|
76316
76332
|
types.push(isTypeAssignableTo(type, templateConstraintType) ? type : stringType);
|
|
@@ -76706,13 +76722,13 @@ ${lanes.join("\n")}
|
|
|
76706
76722
|
function checkConstEnumAccess(node, type) {
|
|
76707
76723
|
const ok = node.parent.kind === 210 /* PropertyAccessExpression */ && node.parent.expression === node || node.parent.kind === 211 /* ElementAccessExpression */ && node.parent.expression === node || ((node.kind === 80 /* Identifier */ || node.kind === 165 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) || node.parent.kind === 185 /* TypeQuery */ && node.parent.exprName === node) || node.parent.kind === 280 /* ExportSpecifier */;
|
|
76708
76724
|
if (!ok) {
|
|
76709
|
-
|
|
76725
|
+
error2(node, Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query);
|
|
76710
76726
|
}
|
|
76711
76727
|
if (getIsolatedModules(compilerOptions)) {
|
|
76712
76728
|
Debug.assert(!!(type.symbol.flags & 128 /* ConstEnum */));
|
|
76713
76729
|
const constEnumDeclaration = type.symbol.valueDeclaration;
|
|
76714
76730
|
if (constEnumDeclaration.flags & 16777216 /* Ambient */ && !isValidTypeOnlyAliasUseSite(node)) {
|
|
76715
|
-
|
|
76731
|
+
error2(node, Diagnostics.Cannot_access_ambient_const_enums_when_0_is_enabled, isolatedModulesLikeFlagName);
|
|
76716
76732
|
}
|
|
76717
76733
|
}
|
|
76718
76734
|
}
|
|
@@ -76853,7 +76869,7 @@ ${lanes.join("\n")}
|
|
|
76853
76869
|
const typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfDeclaration(node));
|
|
76854
76870
|
getBaseConstraintOfType(typeParameter);
|
|
76855
76871
|
if (!hasNonCircularTypeParameterDefault(typeParameter)) {
|
|
76856
|
-
|
|
76872
|
+
error2(node.default, Diagnostics.Type_parameter_0_has_a_circular_default, typeToString(typeParameter));
|
|
76857
76873
|
}
|
|
76858
76874
|
const constraintType = getConstraintOfTypeParameter(typeParameter);
|
|
76859
76875
|
const defaultType = getDefaultFromTypeParameter(typeParameter);
|
|
@@ -76871,7 +76887,7 @@ ${lanes.join("\n")}
|
|
|
76871
76887
|
if (modifiers) {
|
|
76872
76888
|
const symbol = getSymbolOfDeclaration(node.parent);
|
|
76873
76889
|
if (isTypeAliasDeclaration(node.parent) && !(getObjectFlags(getDeclaredTypeOfSymbol(symbol)) & (16 /* Anonymous */ | 32 /* Mapped */))) {
|
|
76874
|
-
|
|
76890
|
+
error2(node, Diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types);
|
|
76875
76891
|
} else if (modifiers === 32768 /* In */ || modifiers === 65536 /* Out */) {
|
|
76876
76892
|
(_a = tracing) == null ? void 0 : _a.push(tracing.Phase.CheckTypes, "checkTypeParameterDeferred", { parent: getTypeId(getDeclaredTypeOfSymbol(symbol)), id: getTypeId(typeParameter) });
|
|
76877
76893
|
const source = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSubTypeForCheck : markerSuperTypeForCheck);
|
|
@@ -76891,37 +76907,37 @@ ${lanes.join("\n")}
|
|
|
76891
76907
|
const func = getContainingFunction(node);
|
|
76892
76908
|
if (hasSyntacticModifier(node, 16476 /* ParameterPropertyModifier */)) {
|
|
76893
76909
|
if (!(func.kind === 175 /* Constructor */ && nodeIsPresent(func.body))) {
|
|
76894
|
-
|
|
76910
|
+
error2(node, Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation);
|
|
76895
76911
|
}
|
|
76896
76912
|
if (func.kind === 175 /* Constructor */ && isIdentifier(node.name) && node.name.escapedText === "constructor") {
|
|
76897
|
-
|
|
76913
|
+
error2(node.name, Diagnostics.constructor_cannot_be_used_as_a_parameter_property_name);
|
|
76898
76914
|
}
|
|
76899
76915
|
}
|
|
76900
76916
|
if (!node.initializer && isOptionalDeclaration(node) && isBindingPattern(node.name) && func.body) {
|
|
76901
|
-
|
|
76917
|
+
error2(node, Diagnostics.A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature);
|
|
76902
76918
|
}
|
|
76903
76919
|
if (node.name && isIdentifier(node.name) && (node.name.escapedText === "this" || node.name.escapedText === "new")) {
|
|
76904
76920
|
if (func.parameters.indexOf(node) !== 0) {
|
|
76905
|
-
|
|
76921
|
+
error2(node, Diagnostics.A_0_parameter_must_be_the_first_parameter, node.name.escapedText);
|
|
76906
76922
|
}
|
|
76907
76923
|
if (func.kind === 175 /* Constructor */ || func.kind === 179 /* ConstructSignature */ || func.kind === 184 /* ConstructorType */) {
|
|
76908
|
-
|
|
76924
|
+
error2(node, Diagnostics.A_constructor_cannot_have_a_this_parameter);
|
|
76909
76925
|
}
|
|
76910
76926
|
if (func.kind === 218 /* ArrowFunction */) {
|
|
76911
|
-
|
|
76927
|
+
error2(node, Diagnostics.An_arrow_function_cannot_have_a_this_parameter);
|
|
76912
76928
|
}
|
|
76913
76929
|
if (func.kind === 176 /* GetAccessor */ || func.kind === 177 /* SetAccessor */) {
|
|
76914
|
-
|
|
76930
|
+
error2(node, Diagnostics.get_and_set_accessors_cannot_declare_this_parameters);
|
|
76915
76931
|
}
|
|
76916
76932
|
}
|
|
76917
76933
|
if (node.dotDotDotToken && !isBindingPattern(node.name) && !isTypeAssignableTo(getReducedType(getTypeOfSymbol(node.symbol)), anyReadonlyArrayType)) {
|
|
76918
|
-
|
|
76934
|
+
error2(node, Diagnostics.A_rest_parameter_must_be_of_an_array_type);
|
|
76919
76935
|
}
|
|
76920
76936
|
}
|
|
76921
76937
|
function checkTypePredicate(node) {
|
|
76922
76938
|
const parent2 = getTypePredicateParent(node);
|
|
76923
76939
|
if (!parent2) {
|
|
76924
|
-
|
|
76940
|
+
error2(node, Diagnostics.A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods);
|
|
76925
76941
|
return;
|
|
76926
76942
|
}
|
|
76927
76943
|
const signature = getSignatureFromDeclaration(parent2);
|
|
@@ -76936,7 +76952,7 @@ ${lanes.join("\n")}
|
|
|
76936
76952
|
} else {
|
|
76937
76953
|
if (typePredicate.parameterIndex >= 0) {
|
|
76938
76954
|
if (signatureHasRestParameter(signature) && typePredicate.parameterIndex === signature.parameters.length - 1) {
|
|
76939
|
-
|
|
76955
|
+
error2(parameterName, Diagnostics.A_type_predicate_cannot_reference_a_rest_parameter);
|
|
76940
76956
|
} else {
|
|
76941
76957
|
if (typePredicate.type) {
|
|
76942
76958
|
const leadingError = () => chainDiagnosticMessages(
|
|
@@ -76963,7 +76979,7 @@ ${lanes.join("\n")}
|
|
|
76963
76979
|
}
|
|
76964
76980
|
}
|
|
76965
76981
|
if (!hasReportedError) {
|
|
76966
|
-
|
|
76982
|
+
error2(node.parameterName, Diagnostics.Cannot_find_parameter_0, typePredicate.parameterName);
|
|
76967
76983
|
}
|
|
76968
76984
|
}
|
|
76969
76985
|
}
|
|
@@ -76990,7 +77006,7 @@ ${lanes.join("\n")}
|
|
|
76990
77006
|
}
|
|
76991
77007
|
const name = element.name;
|
|
76992
77008
|
if (name.kind === 80 /* Identifier */ && name.escapedText === predicateVariableName) {
|
|
76993
|
-
|
|
77009
|
+
error2(
|
|
76994
77010
|
predicateVariableNode,
|
|
76995
77011
|
Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern,
|
|
76996
77012
|
predicateVariableName
|
|
@@ -77038,10 +77054,10 @@ ${lanes.join("\n")}
|
|
|
77038
77054
|
if (noImplicitAny && !returnTypeNode) {
|
|
77039
77055
|
switch (node.kind) {
|
|
77040
77056
|
case 179 /* ConstructSignature */:
|
|
77041
|
-
|
|
77057
|
+
error2(node, Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type);
|
|
77042
77058
|
break;
|
|
77043
77059
|
case 178 /* CallSignature */:
|
|
77044
|
-
|
|
77060
|
+
error2(node, Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type);
|
|
77045
77061
|
break;
|
|
77046
77062
|
}
|
|
77047
77063
|
}
|
|
@@ -77050,7 +77066,7 @@ ${lanes.join("\n")}
|
|
|
77050
77066
|
if ((functionFlags2 & (4 /* Invalid */ | 1 /* Generator */)) === 1 /* Generator */) {
|
|
77051
77067
|
const returnType = getTypeFromTypeNode(returnTypeNode);
|
|
77052
77068
|
if (returnType === voidType) {
|
|
77053
|
-
|
|
77069
|
+
error2(returnTypeNode, Diagnostics.A_generator_cannot_have_a_void_type_annotation);
|
|
77054
77070
|
} else {
|
|
77055
77071
|
const generatorYieldType = getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || anyType;
|
|
77056
77072
|
const generatorReturnType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || generatorYieldType;
|
|
@@ -77110,16 +77126,16 @@ ${lanes.join("\n")}
|
|
|
77110
77126
|
const prev = names.get(name);
|
|
77111
77127
|
if (prev) {
|
|
77112
77128
|
if ((prev & 16 /* PrivateStatic */) !== (meaning & 16 /* PrivateStatic */)) {
|
|
77113
|
-
|
|
77129
|
+
error2(location, Diagnostics.Duplicate_identifier_0_Static_and_instance_elements_cannot_share_the_same_private_name, getTextOfNode(location));
|
|
77114
77130
|
} else {
|
|
77115
77131
|
const prevIsMethod = !!(prev & 8 /* Method */);
|
|
77116
77132
|
const isMethod = !!(meaning & 8 /* Method */);
|
|
77117
77133
|
if (prevIsMethod || isMethod) {
|
|
77118
77134
|
if (prevIsMethod !== isMethod) {
|
|
77119
|
-
|
|
77135
|
+
error2(location, Diagnostics.Duplicate_identifier_0, getTextOfNode(location));
|
|
77120
77136
|
}
|
|
77121
77137
|
} else if (prev & meaning & ~16 /* PrivateStatic */) {
|
|
77122
|
-
|
|
77138
|
+
error2(location, Diagnostics.Duplicate_identifier_0, getTextOfNode(location));
|
|
77123
77139
|
} else {
|
|
77124
77140
|
names.set(name, prev | meaning);
|
|
77125
77141
|
}
|
|
@@ -77146,7 +77162,7 @@ ${lanes.join("\n")}
|
|
|
77146
77162
|
case "prototype":
|
|
77147
77163
|
const message = Diagnostics.Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1;
|
|
77148
77164
|
const className = getNameOfSymbolAsWritten(getSymbolOfDeclaration(node));
|
|
77149
|
-
|
|
77165
|
+
error2(memberNameNode, message, memberName, className);
|
|
77150
77166
|
break;
|
|
77151
77167
|
}
|
|
77152
77168
|
}
|
|
@@ -77170,8 +77186,8 @@ ${lanes.join("\n")}
|
|
|
77170
77186
|
continue;
|
|
77171
77187
|
}
|
|
77172
77188
|
if (names.get(memberName)) {
|
|
77173
|
-
|
|
77174
|
-
|
|
77189
|
+
error2(getNameOfDeclaration(member.symbol.valueDeclaration), Diagnostics.Duplicate_identifier_0, memberName);
|
|
77190
|
+
error2(member.name, Diagnostics.Duplicate_identifier_0, memberName);
|
|
77175
77191
|
} else {
|
|
77176
77192
|
names.set(memberName, true);
|
|
77177
77193
|
}
|
|
@@ -77203,7 +77219,7 @@ ${lanes.join("\n")}
|
|
|
77203
77219
|
indexSignatureMap.forEach((entry) => {
|
|
77204
77220
|
if (entry.declarations.length > 1) {
|
|
77205
77221
|
for (const declaration of entry.declarations) {
|
|
77206
|
-
|
|
77222
|
+
error2(declaration, Diagnostics.Duplicate_index_signature_for_type_0, typeToString(entry.type));
|
|
77207
77223
|
}
|
|
77208
77224
|
}
|
|
77209
77225
|
});
|
|
@@ -77215,12 +77231,12 @@ ${lanes.join("\n")}
|
|
|
77215
77231
|
checkVariableLikeDeclaration(node);
|
|
77216
77232
|
setNodeLinksForPrivateIdentifierScope(node);
|
|
77217
77233
|
if (hasSyntacticModifier(node, 256 /* Abstract */) && node.kind === 171 /* PropertyDeclaration */ && node.initializer) {
|
|
77218
|
-
|
|
77234
|
+
error2(node, Diagnostics.Property_0_cannot_have_an_initializer_because_it_is_marked_abstract, declarationNameToString(node.name));
|
|
77219
77235
|
}
|
|
77220
77236
|
}
|
|
77221
77237
|
function checkPropertySignature(node) {
|
|
77222
77238
|
if (isPrivateIdentifier(node.name)) {
|
|
77223
|
-
|
|
77239
|
+
error2(node, Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);
|
|
77224
77240
|
}
|
|
77225
77241
|
return checkPropertyDeclaration(node);
|
|
77226
77242
|
}
|
|
@@ -77228,14 +77244,14 @@ ${lanes.join("\n")}
|
|
|
77228
77244
|
if (!checkGrammarMethod(node))
|
|
77229
77245
|
checkGrammarComputedPropertyName(node.name);
|
|
77230
77246
|
if (isMethodDeclaration(node) && node.asteriskToken && isIdentifier(node.name) && idText(node.name) === "constructor") {
|
|
77231
|
-
|
|
77247
|
+
error2(node.name, Diagnostics.Class_constructor_may_not_be_a_generator);
|
|
77232
77248
|
}
|
|
77233
77249
|
checkFunctionOrMethodDeclaration(node);
|
|
77234
77250
|
if (hasSyntacticModifier(node, 256 /* Abstract */) && node.kind === 173 /* MethodDeclaration */ && node.body) {
|
|
77235
|
-
|
|
77251
|
+
error2(node, Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, declarationNameToString(node.name));
|
|
77236
77252
|
}
|
|
77237
77253
|
if (isPrivateIdentifier(node.name) && !getContainingClass(node)) {
|
|
77238
|
-
|
|
77254
|
+
error2(node, Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);
|
|
77239
77255
|
}
|
|
77240
77256
|
setNodeLinksForPrivateIdentifierScope(node);
|
|
77241
77257
|
}
|
|
@@ -77286,12 +77302,12 @@ ${lanes.join("\n")}
|
|
|
77286
77302
|
const superCall = findFirstSuperCall(node.body);
|
|
77287
77303
|
if (superCall) {
|
|
77288
77304
|
if (classExtendsNull) {
|
|
77289
|
-
|
|
77305
|
+
error2(superCall, Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null);
|
|
77290
77306
|
}
|
|
77291
77307
|
const superCallShouldBeRootLevel = (getEmitScriptTarget(compilerOptions) !== 99 /* ESNext */ || !useDefineForClassFields) && (some(node.parent.members, isInstancePropertyWithInitializerOrPrivateIdentifierProperty) || some(node.parameters, (p) => hasSyntacticModifier(p, 16476 /* ParameterPropertyModifier */)));
|
|
77292
77308
|
if (superCallShouldBeRootLevel) {
|
|
77293
77309
|
if (!superCallIsRootLevelInConstructor(superCall, node.body)) {
|
|
77294
|
-
|
|
77310
|
+
error2(superCall, Diagnostics.A_super_call_must_be_a_root_level_statement_within_a_constructor_of_a_derived_class_that_contains_initialized_properties_parameter_properties_or_private_identifiers);
|
|
77295
77311
|
} else {
|
|
77296
77312
|
let superCallStatement;
|
|
77297
77313
|
for (const statement of node.body.statements) {
|
|
@@ -77304,12 +77320,12 @@ ${lanes.join("\n")}
|
|
|
77304
77320
|
}
|
|
77305
77321
|
}
|
|
77306
77322
|
if (superCallStatement === void 0) {
|
|
77307
|
-
|
|
77323
|
+
error2(node, Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_to_refer_to_super_or_this_when_a_derived_class_contains_initialized_properties_parameter_properties_or_private_identifiers);
|
|
77308
77324
|
}
|
|
77309
77325
|
}
|
|
77310
77326
|
}
|
|
77311
77327
|
} else if (!classExtendsNull) {
|
|
77312
|
-
|
|
77328
|
+
error2(node, Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call);
|
|
77313
77329
|
}
|
|
77314
77330
|
}
|
|
77315
77331
|
}
|
|
@@ -77329,7 +77345,7 @@ ${lanes.join("\n")}
|
|
|
77329
77345
|
}
|
|
77330
77346
|
function checkAccessorDeclaration(node) {
|
|
77331
77347
|
if (isIdentifier(node.name) && idText(node.name) === "constructor" && isClassLike(node.parent)) {
|
|
77332
|
-
|
|
77348
|
+
error2(node.name, Diagnostics.Class_constructor_may_not_be_an_accessor);
|
|
77333
77349
|
}
|
|
77334
77350
|
addLazyDiagnostic(checkAccessorDeclarationDiagnostics);
|
|
77335
77351
|
checkSourceElement(node.body);
|
|
@@ -77342,7 +77358,7 @@ ${lanes.join("\n")}
|
|
|
77342
77358
|
if (node.kind === 176 /* GetAccessor */) {
|
|
77343
77359
|
if (!(node.flags & 16777216 /* Ambient */) && nodeIsPresent(node.body) && node.flags & 256 /* HasImplicitReturn */) {
|
|
77344
77360
|
if (!(node.flags & 512 /* HasExplicitReturn */)) {
|
|
77345
|
-
|
|
77361
|
+
error2(node.name, Diagnostics.A_get_accessor_must_return_a_value);
|
|
77346
77362
|
}
|
|
77347
77363
|
}
|
|
77348
77364
|
}
|
|
@@ -77358,12 +77374,12 @@ ${lanes.join("\n")}
|
|
|
77358
77374
|
const getterFlags = getEffectiveModifierFlags(getter);
|
|
77359
77375
|
const setterFlags = getEffectiveModifierFlags(setter);
|
|
77360
77376
|
if ((getterFlags & 256 /* Abstract */) !== (setterFlags & 256 /* Abstract */)) {
|
|
77361
|
-
|
|
77362
|
-
|
|
77377
|
+
error2(getter.name, Diagnostics.Accessors_must_both_be_abstract_or_non_abstract);
|
|
77378
|
+
error2(setter.name, Diagnostics.Accessors_must_both_be_abstract_or_non_abstract);
|
|
77363
77379
|
}
|
|
77364
77380
|
if (getterFlags & 16 /* Protected */ && !(setterFlags & (16 /* Protected */ | 8 /* Private */)) || getterFlags & 8 /* Private */ && !(setterFlags & 8 /* Private */)) {
|
|
77365
|
-
|
|
77366
|
-
|
|
77381
|
+
error2(getter.name, Diagnostics.A_get_accessor_must_be_at_least_as_accessible_as_the_setter);
|
|
77382
|
+
error2(setter.name, Diagnostics.A_get_accessor_must_be_at_least_as_accessible_as_the_setter);
|
|
77367
77383
|
}
|
|
77368
77384
|
}
|
|
77369
77385
|
}
|
|
@@ -77501,7 +77517,7 @@ ${lanes.join("\n")}
|
|
|
77501
77517
|
if (flags & 8 /* Variadic */) {
|
|
77502
77518
|
const type = getTypeFromTypeNode(e.type);
|
|
77503
77519
|
if (!isArrayLikeType(type)) {
|
|
77504
|
-
|
|
77520
|
+
error2(e, Diagnostics.A_rest_element_type_must_be_an_array_type);
|
|
77505
77521
|
break;
|
|
77506
77522
|
}
|
|
77507
77523
|
if (isArrayType(type) || isTupleType(type) && type.target.combinedFlags & 4 /* Rest */) {
|
|
@@ -77539,7 +77555,7 @@ ${lanes.join("\n")}
|
|
|
77539
77555
|
const indexType = type.indexType;
|
|
77540
77556
|
if (isTypeAssignableTo(indexType, getIndexType(objectType, 0 /* None */))) {
|
|
77541
77557
|
if (accessNode.kind === 211 /* ElementAccessExpression */ && isAssignmentTarget(accessNode) && getObjectFlags(objectType) & 32 /* Mapped */ && getMappedTypeModifiers(objectType) & 1 /* IncludeReadonly */) {
|
|
77542
|
-
|
|
77558
|
+
error2(accessNode, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
|
|
77543
77559
|
}
|
|
77544
77560
|
return type;
|
|
77545
77561
|
}
|
|
@@ -77552,12 +77568,12 @@ ${lanes.join("\n")}
|
|
|
77552
77568
|
if (propertyName) {
|
|
77553
77569
|
const propertySymbol = forEachType(apparentObjectType, (t) => getPropertyOfType(t, propertyName));
|
|
77554
77570
|
if (propertySymbol && getDeclarationModifierFlagsFromSymbol(propertySymbol) & 24 /* NonPublicAccessibilityModifier */) {
|
|
77555
|
-
|
|
77571
|
+
error2(accessNode, Diagnostics.Private_or_protected_member_0_cannot_be_accessed_on_a_type_parameter, unescapeLeadingUnderscores(propertyName));
|
|
77556
77572
|
return errorType;
|
|
77557
77573
|
}
|
|
77558
77574
|
}
|
|
77559
77575
|
}
|
|
77560
|
-
|
|
77576
|
+
error2(accessNode, Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType));
|
|
77561
77577
|
return errorType;
|
|
77562
77578
|
}
|
|
77563
77579
|
function checkIndexedAccessType(node) {
|
|
@@ -77613,7 +77629,7 @@ ${lanes.join("\n")}
|
|
|
77613
77629
|
if (!areTypeParametersIdentical(declarations, [typeParameter], (decl) => [decl])) {
|
|
77614
77630
|
const name = symbolToString(symbol);
|
|
77615
77631
|
for (const declaration of declarations) {
|
|
77616
|
-
|
|
77632
|
+
error2(declaration.name, Diagnostics.All_declarations_of_0_must_have_identical_constraints, name);
|
|
77617
77633
|
}
|
|
77618
77634
|
}
|
|
77619
77635
|
}
|
|
@@ -77684,13 +77700,13 @@ ${lanes.join("\n")}
|
|
|
77684
77700
|
forEach(overloads, (o) => {
|
|
77685
77701
|
const deviation = getEffectiveDeclarationFlags(o, flagsToCheck2) ^ canonicalFlags;
|
|
77686
77702
|
if (deviation & 1 /* Export */) {
|
|
77687
|
-
|
|
77703
|
+
error2(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_exported_or_non_exported);
|
|
77688
77704
|
} else if (deviation & 2 /* Ambient */) {
|
|
77689
|
-
|
|
77705
|
+
error2(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_ambient_or_non_ambient);
|
|
77690
77706
|
} else if (deviation & (8 /* Private */ | 16 /* Protected */)) {
|
|
77691
|
-
|
|
77707
|
+
error2(getNameOfDeclaration(o) || o, Diagnostics.Overload_signatures_must_all_be_public_private_or_protected);
|
|
77692
77708
|
} else if (deviation & 256 /* Abstract */) {
|
|
77693
|
-
|
|
77709
|
+
error2(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_abstract_or_non_abstract);
|
|
77694
77710
|
}
|
|
77695
77711
|
});
|
|
77696
77712
|
}
|
|
@@ -77701,7 +77717,7 @@ ${lanes.join("\n")}
|
|
|
77701
77717
|
forEach(overloads, (o) => {
|
|
77702
77718
|
const deviation = hasQuestionToken(o) !== canonicalHasQuestionToken;
|
|
77703
77719
|
if (deviation) {
|
|
77704
|
-
|
|
77720
|
+
error2(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_optional_or_required);
|
|
77705
77721
|
}
|
|
77706
77722
|
});
|
|
77707
77723
|
}
|
|
@@ -77740,24 +77756,24 @@ ${lanes.join("\n")}
|
|
|
77740
77756
|
const reportError = (node.kind === 173 /* MethodDeclaration */ || node.kind === 172 /* MethodSignature */) && isStatic(node) !== isStatic(subsequentNode);
|
|
77741
77757
|
if (reportError) {
|
|
77742
77758
|
const diagnostic = isStatic(node) ? Diagnostics.Function_overload_must_be_static : Diagnostics.Function_overload_must_not_be_static;
|
|
77743
|
-
|
|
77759
|
+
error2(errorNode2, diagnostic);
|
|
77744
77760
|
}
|
|
77745
77761
|
return;
|
|
77746
77762
|
}
|
|
77747
77763
|
if (nodeIsPresent(subsequentNode.body)) {
|
|
77748
|
-
|
|
77764
|
+
error2(errorNode2, Diagnostics.Function_implementation_name_must_be_0, declarationNameToString(node.name));
|
|
77749
77765
|
return;
|
|
77750
77766
|
}
|
|
77751
77767
|
}
|
|
77752
77768
|
}
|
|
77753
77769
|
const errorNode = node.name || node;
|
|
77754
77770
|
if (isConstructor) {
|
|
77755
|
-
|
|
77771
|
+
error2(errorNode, Diagnostics.Constructor_implementation_is_missing);
|
|
77756
77772
|
} else {
|
|
77757
77773
|
if (hasSyntacticModifier(node, 256 /* Abstract */)) {
|
|
77758
|
-
|
|
77774
|
+
error2(errorNode, Diagnostics.All_declarations_of_an_abstract_method_must_be_consecutive);
|
|
77759
77775
|
} else {
|
|
77760
|
-
|
|
77776
|
+
error2(errorNode, Diagnostics.Function_implementation_is_missing_or_not_immediately_following_the_declaration);
|
|
77761
77777
|
}
|
|
77762
77778
|
}
|
|
77763
77779
|
}
|
|
@@ -77820,12 +77836,12 @@ ${lanes.join("\n")}
|
|
|
77820
77836
|
}
|
|
77821
77837
|
if (multipleConstructorImplementation) {
|
|
77822
77838
|
forEach(functionDeclarations, (declaration) => {
|
|
77823
|
-
|
|
77839
|
+
error2(declaration, Diagnostics.Multiple_constructor_implementations_are_not_allowed);
|
|
77824
77840
|
});
|
|
77825
77841
|
}
|
|
77826
77842
|
if (duplicateFunctionDeclaration) {
|
|
77827
77843
|
forEach(functionDeclarations, (declaration) => {
|
|
77828
|
-
|
|
77844
|
+
error2(getNameOfDeclaration(declaration) || declaration, Diagnostics.Duplicate_function_implementation);
|
|
77829
77845
|
});
|
|
77830
77846
|
}
|
|
77831
77847
|
if (hasNonAmbientClass && !isConstructor && symbol.flags & 16 /* Function */ && declarations) {
|
|
@@ -77834,7 +77850,7 @@ ${lanes.join("\n")}
|
|
|
77834
77850
|
const diagnostic = declaration.kind === 262 /* ClassDeclaration */ ? Diagnostics.Class_declaration_cannot_implement_overload_list_for_0 : declaration.kind === 261 /* FunctionDeclaration */ ? Diagnostics.Function_with_bodies_can_only_merge_with_classes_that_are_ambient : void 0;
|
|
77835
77851
|
if (diagnostic) {
|
|
77836
77852
|
addRelatedInfo(
|
|
77837
|
-
|
|
77853
|
+
error2(getNameOfDeclaration(declaration) || declaration, diagnostic, symbolName(symbol)),
|
|
77838
77854
|
...relatedDiagnostics
|
|
77839
77855
|
);
|
|
77840
77856
|
}
|
|
@@ -77855,7 +77871,7 @@ ${lanes.join("\n")}
|
|
|
77855
77871
|
if (!isImplementationCompatibleWithOverload(bodySignature, signature)) {
|
|
77856
77872
|
const errorNode = signature.declaration && isJSDocSignature(signature.declaration) ? signature.declaration.parent.tagName : signature.declaration;
|
|
77857
77873
|
addRelatedInfo(
|
|
77858
|
-
|
|
77874
|
+
error2(errorNode, Diagnostics.This_overload_signature_is_not_compatible_with_its_implementation_signature),
|
|
77859
77875
|
createDiagnosticForNode(bodyDeclaration, Diagnostics.The_implementation_signature_is_declared_here)
|
|
77860
77876
|
);
|
|
77861
77877
|
break;
|
|
@@ -77902,9 +77918,9 @@ ${lanes.join("\n")}
|
|
|
77902
77918
|
const declarationSpaces = getDeclarationSpaces(d);
|
|
77903
77919
|
const name = getNameOfDeclaration(d);
|
|
77904
77920
|
if (declarationSpaces & commonDeclarationSpacesForDefaultAndNonDefault) {
|
|
77905
|
-
|
|
77921
|
+
error2(name, Diagnostics.Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead, declarationNameToString(name));
|
|
77906
77922
|
} else if (declarationSpaces & commonDeclarationSpacesForExportsAndLocals) {
|
|
77907
|
-
|
|
77923
|
+
error2(name, Diagnostics.Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local, declarationNameToString(name));
|
|
77908
77924
|
}
|
|
77909
77925
|
}
|
|
77910
77926
|
}
|
|
@@ -77984,7 +78000,7 @@ ${lanes.join("\n")}
|
|
|
77984
78000
|
const thenSignatures = thenFunction ? getSignaturesOfType(thenFunction, 0 /* Call */) : emptyArray;
|
|
77985
78001
|
if (thenSignatures.length === 0) {
|
|
77986
78002
|
if (errorNode) {
|
|
77987
|
-
|
|
78003
|
+
error2(errorNode, Diagnostics.A_promise_must_have_a_then_method);
|
|
77988
78004
|
}
|
|
77989
78005
|
return void 0;
|
|
77990
78006
|
}
|
|
@@ -78004,7 +78020,7 @@ ${lanes.join("\n")}
|
|
|
78004
78020
|
thisTypeForErrorOut.value = thisTypeForError;
|
|
78005
78021
|
}
|
|
78006
78022
|
if (errorNode) {
|
|
78007
|
-
|
|
78023
|
+
error2(errorNode, Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1, typeToString(type), typeToString(thisTypeForError));
|
|
78008
78024
|
}
|
|
78009
78025
|
return void 0;
|
|
78010
78026
|
}
|
|
@@ -78015,7 +78031,7 @@ ${lanes.join("\n")}
|
|
|
78015
78031
|
const onfulfilledParameterSignatures = getSignaturesOfType(onfulfilledParameterType, 0 /* Call */);
|
|
78016
78032
|
if (onfulfilledParameterSignatures.length === 0) {
|
|
78017
78033
|
if (errorNode) {
|
|
78018
|
-
|
|
78034
|
+
error2(errorNode, Diagnostics.The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback);
|
|
78019
78035
|
}
|
|
78020
78036
|
return void 0;
|
|
78021
78037
|
}
|
|
@@ -78096,7 +78112,7 @@ ${lanes.join("\n")}
|
|
|
78096
78112
|
if (type.flags & 1048576 /* Union */) {
|
|
78097
78113
|
if (awaitedTypeStack.lastIndexOf(type.id) >= 0) {
|
|
78098
78114
|
if (errorNode) {
|
|
78099
|
-
|
|
78115
|
+
error2(errorNode, Diagnostics.Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method);
|
|
78100
78116
|
}
|
|
78101
78117
|
return void 0;
|
|
78102
78118
|
}
|
|
@@ -78119,7 +78135,7 @@ ${lanes.join("\n")}
|
|
|
78119
78135
|
if (promisedType) {
|
|
78120
78136
|
if (type.id === promisedType.id || awaitedTypeStack.lastIndexOf(promisedType.id) >= 0) {
|
|
78121
78137
|
if (errorNode) {
|
|
78122
|
-
|
|
78138
|
+
error2(errorNode, Diagnostics.Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method);
|
|
78123
78139
|
}
|
|
78124
78140
|
return void 0;
|
|
78125
78141
|
}
|
|
@@ -78156,7 +78172,7 @@ ${lanes.join("\n")}
|
|
|
78156
78172
|
true
|
|
78157
78173
|
);
|
|
78158
78174
|
if (globalPromiseType !== emptyGenericType && !isReferenceToType2(returnType, globalPromiseType)) {
|
|
78159
|
-
|
|
78175
|
+
error2(returnTypeNode, Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_write_Promise_0, typeToString(getAwaitedTypeNoAlias(returnType) || voidType));
|
|
78160
78176
|
return;
|
|
78161
78177
|
}
|
|
78162
78178
|
} else {
|
|
@@ -78166,7 +78182,7 @@ ${lanes.join("\n")}
|
|
|
78166
78182
|
}
|
|
78167
78183
|
const promiseConstructorName = getEntityNameFromTypeNode(returnTypeNode);
|
|
78168
78184
|
if (promiseConstructorName === void 0) {
|
|
78169
|
-
|
|
78185
|
+
error2(returnTypeNode, Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, typeToString(returnType));
|
|
78170
78186
|
return;
|
|
78171
78187
|
}
|
|
78172
78188
|
const promiseConstructorSymbol = resolveEntityName(
|
|
@@ -78181,9 +78197,9 @@ ${lanes.join("\n")}
|
|
|
78181
78197
|
/*reportErrors*/
|
|
78182
78198
|
false
|
|
78183
78199
|
)) {
|
|
78184
|
-
|
|
78200
|
+
error2(returnTypeNode, Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option);
|
|
78185
78201
|
} else {
|
|
78186
|
-
|
|
78202
|
+
error2(returnTypeNode, Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, entityNameToString(promiseConstructorName));
|
|
78187
78203
|
}
|
|
78188
78204
|
return;
|
|
78189
78205
|
}
|
|
@@ -78192,7 +78208,7 @@ ${lanes.join("\n")}
|
|
|
78192
78208
|
true
|
|
78193
78209
|
);
|
|
78194
78210
|
if (globalPromiseConstructorLikeType === emptyObjectType) {
|
|
78195
|
-
|
|
78211
|
+
error2(returnTypeNode, Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, entityNameToString(promiseConstructorName));
|
|
78196
78212
|
return;
|
|
78197
78213
|
}
|
|
78198
78214
|
if (!checkTypeAssignableTo(
|
|
@@ -78206,7 +78222,7 @@ ${lanes.join("\n")}
|
|
|
78206
78222
|
const rootName = promiseConstructorName && getFirstIdentifier(promiseConstructorName);
|
|
78207
78223
|
const collidingSymbol = getSymbol2(node.locals, rootName.escapedText, 111551 /* Value */);
|
|
78208
78224
|
if (collidingSymbol) {
|
|
78209
|
-
|
|
78225
|
+
error2(
|
|
78210
78226
|
collidingSymbol.valueDeclaration,
|
|
78211
78227
|
Diagnostics.Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions,
|
|
78212
78228
|
idText(rootName),
|
|
@@ -78319,7 +78335,7 @@ ${lanes.join("\n")}
|
|
|
78319
78335
|
if (canCollectSymbolAliasAccessabilityData && symbolIsValue(rootSymbol) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol)) && !getTypeOnlyAliasDeclaration(rootSymbol)) {
|
|
78320
78336
|
markAliasSymbolAsReferenced(rootSymbol);
|
|
78321
78337
|
} else if (forDecoratorMetadata && getIsolatedModules(compilerOptions) && getEmitModuleKind(compilerOptions) >= 5 /* ES2015 */ && !symbolIsValue(rootSymbol) && !some(rootSymbol.declarations, isTypeOnlyImportOrExportDeclaration)) {
|
|
78322
|
-
const diag2 =
|
|
78338
|
+
const diag2 = error2(typeName, Diagnostics.A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled);
|
|
78323
78339
|
const aliasDeclaration = find(rootSymbol.declarations || emptyArray, isAliasSymbolDeclaration2);
|
|
78324
78340
|
if (aliasDeclaration) {
|
|
78325
78341
|
addRelatedInfo(diag2, createDiagnosticForNode(aliasDeclaration, Diagnostics._0_was_imported_here, idText(rootName)));
|
|
@@ -78467,7 +78483,7 @@ ${lanes.join("\n")}
|
|
|
78467
78483
|
}
|
|
78468
78484
|
function checkJSDocTypeAliasTag(node) {
|
|
78469
78485
|
if (!node.typeExpression) {
|
|
78470
|
-
|
|
78486
|
+
error2(node.name, Diagnostics.JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags);
|
|
78471
78487
|
}
|
|
78472
78488
|
if (node.name) {
|
|
78473
78489
|
checkTypeNameIsReserved(node.name, Diagnostics.Type_alias_name_cannot_be_0);
|
|
@@ -78492,7 +78508,7 @@ ${lanes.join("\n")}
|
|
|
78492
78508
|
if (length(tags) > 1) {
|
|
78493
78509
|
for (let i = 1; i < length(tags); i++) {
|
|
78494
78510
|
const tagName = tags[i].tagName;
|
|
78495
|
-
|
|
78511
|
+
error2(tagName, Diagnostics._0_tag_already_specified, idText(tagName));
|
|
78496
78512
|
}
|
|
78497
78513
|
}
|
|
78498
78514
|
}
|
|
@@ -78524,33 +78540,33 @@ ${lanes.join("\n")}
|
|
|
78524
78540
|
function checkJSDocImplementsTag(node) {
|
|
78525
78541
|
const classLike = getEffectiveJSDocHost(node);
|
|
78526
78542
|
if (!classLike || !isClassDeclaration(classLike) && !isClassExpression(classLike)) {
|
|
78527
|
-
|
|
78543
|
+
error2(classLike, Diagnostics.JSDoc_0_is_not_attached_to_a_class, idText(node.tagName));
|
|
78528
78544
|
}
|
|
78529
78545
|
}
|
|
78530
78546
|
function checkJSDocAugmentsTag(node) {
|
|
78531
78547
|
const classLike = getEffectiveJSDocHost(node);
|
|
78532
78548
|
if (!classLike || !isClassDeclaration(classLike) && !isClassExpression(classLike)) {
|
|
78533
|
-
|
|
78549
|
+
error2(classLike, Diagnostics.JSDoc_0_is_not_attached_to_a_class, idText(node.tagName));
|
|
78534
78550
|
return;
|
|
78535
78551
|
}
|
|
78536
78552
|
const augmentsTags = getJSDocTags(classLike).filter(isJSDocAugmentsTag);
|
|
78537
78553
|
Debug.assert(augmentsTags.length > 0);
|
|
78538
78554
|
if (augmentsTags.length > 1) {
|
|
78539
|
-
|
|
78555
|
+
error2(augmentsTags[1], Diagnostics.Class_declarations_cannot_have_more_than_one_augments_or_extends_tag);
|
|
78540
78556
|
}
|
|
78541
78557
|
const name = getIdentifierFromEntityNameExpression(node.class.expression);
|
|
78542
78558
|
const extend2 = getClassExtendsHeritageElement(classLike);
|
|
78543
78559
|
if (extend2) {
|
|
78544
78560
|
const className = getIdentifierFromEntityNameExpression(extend2.expression);
|
|
78545
78561
|
if (className && name.escapedText !== className.escapedText) {
|
|
78546
|
-
|
|
78562
|
+
error2(name, Diagnostics.JSDoc_0_1_does_not_match_the_extends_2_clause, idText(node.tagName), idText(name), idText(className));
|
|
78547
78563
|
}
|
|
78548
78564
|
}
|
|
78549
78565
|
}
|
|
78550
78566
|
function checkJSDocAccessibilityModifiers(node) {
|
|
78551
78567
|
const host2 = getJSDocHost(node);
|
|
78552
78568
|
if (host2 && isPrivateIdentifierClassElementDeclaration(host2)) {
|
|
78553
|
-
|
|
78569
|
+
error2(node, Diagnostics.An_accessibility_modifier_cannot_be_used_with_a_private_identifier);
|
|
78554
78570
|
}
|
|
78555
78571
|
}
|
|
78556
78572
|
function getIdentifierFromEntityNameExpression(node) {
|
|
@@ -78592,7 +78608,7 @@ ${lanes.join("\n")}
|
|
|
78592
78608
|
if (isInJSFile(node)) {
|
|
78593
78609
|
const typeTag = getJSDocTypeTag(node);
|
|
78594
78610
|
if (typeTag && typeTag.typeExpression && !getContextualCallSignature(getTypeFromTypeNode(typeTag.typeExpression), node)) {
|
|
78595
|
-
|
|
78611
|
+
error2(typeTag.typeExpression.type, Diagnostics.The_type_of_a_function_declaration_must_match_the_function_s_signature);
|
|
78596
78612
|
}
|
|
78597
78613
|
}
|
|
78598
78614
|
function checkFunctionOrMethodDeclarationDiagnostics() {
|
|
@@ -78916,9 +78932,9 @@ ${lanes.join("\n")}
|
|
|
78916
78932
|
if (getNodeCheckFlags(current) & 4 /* CaptureThis */) {
|
|
78917
78933
|
const isDeclaration2 = node.kind !== 80 /* Identifier */;
|
|
78918
78934
|
if (isDeclaration2) {
|
|
78919
|
-
|
|
78935
|
+
error2(getNameOfDeclaration(node), Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference);
|
|
78920
78936
|
} else {
|
|
78921
|
-
|
|
78937
|
+
error2(node, Diagnostics.Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference);
|
|
78922
78938
|
}
|
|
78923
78939
|
return true;
|
|
78924
78940
|
}
|
|
@@ -78930,9 +78946,9 @@ ${lanes.join("\n")}
|
|
|
78930
78946
|
if (getNodeCheckFlags(current) & 8 /* CaptureNewTarget */) {
|
|
78931
78947
|
const isDeclaration2 = node.kind !== 80 /* Identifier */;
|
|
78932
78948
|
if (isDeclaration2) {
|
|
78933
|
-
|
|
78949
|
+
error2(getNameOfDeclaration(node), Diagnostics.Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference);
|
|
78934
78950
|
} else {
|
|
78935
|
-
|
|
78951
|
+
error2(node, Diagnostics.Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference);
|
|
78936
78952
|
}
|
|
78937
78953
|
return true;
|
|
78938
78954
|
}
|
|
@@ -79070,7 +79086,7 @@ ${lanes.join("\n")}
|
|
|
79070
79086
|
const namesShareScope = container && (container.kind === 240 /* Block */ && isFunctionLike(container.parent) || container.kind === 267 /* ModuleBlock */ || container.kind === 266 /* ModuleDeclaration */ || container.kind === 311 /* SourceFile */);
|
|
79071
79087
|
if (!namesShareScope) {
|
|
79072
79088
|
const name = symbolToString(localDeclarationSymbol);
|
|
79073
|
-
|
|
79089
|
+
error2(node, Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name);
|
|
79074
79090
|
}
|
|
79075
79091
|
}
|
|
79076
79092
|
}
|
|
@@ -79141,7 +79157,7 @@ ${lanes.join("\n")}
|
|
|
79141
79157
|
forEach(node.name.elements, checkSourceElement);
|
|
79142
79158
|
}
|
|
79143
79159
|
if (isParameter(node) && node.initializer && nodeIsMissing(getContainingFunction(node).body)) {
|
|
79144
|
-
|
|
79160
|
+
error2(node, Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation);
|
|
79145
79161
|
return;
|
|
79146
79162
|
}
|
|
79147
79163
|
if (isBindingPattern(node.name)) {
|
|
@@ -79193,7 +79209,7 @@ ${lanes.join("\n")}
|
|
|
79193
79209
|
}
|
|
79194
79210
|
if (symbol.declarations && symbol.declarations.length > 1) {
|
|
79195
79211
|
if (some(symbol.declarations, (d) => d !== node && isVariableLike(d) && !areDeclarationFlagsIdentical(d, node))) {
|
|
79196
|
-
|
|
79212
|
+
error2(node.name, Diagnostics.All_declarations_of_0_must_have_identical_modifiers, declarationNameToString(node.name));
|
|
79197
79213
|
}
|
|
79198
79214
|
}
|
|
79199
79215
|
} else {
|
|
@@ -79212,7 +79228,7 @@ ${lanes.join("\n")}
|
|
|
79212
79228
|
);
|
|
79213
79229
|
}
|
|
79214
79230
|
if (symbol.valueDeclaration && !areDeclarationFlagsIdentical(node, symbol.valueDeclaration)) {
|
|
79215
|
-
|
|
79231
|
+
error2(node.name, Diagnostics.All_declarations_of_0_must_have_identical_modifiers, declarationNameToString(node.name));
|
|
79216
79232
|
}
|
|
79217
79233
|
}
|
|
79218
79234
|
if (node.kind !== 171 /* PropertyDeclaration */ && node.kind !== 170 /* PropertySignature */) {
|
|
@@ -79227,7 +79243,7 @@ ${lanes.join("\n")}
|
|
|
79227
79243
|
const nextDeclarationName = getNameOfDeclaration(nextDeclaration);
|
|
79228
79244
|
const message = nextDeclaration.kind === 171 /* PropertyDeclaration */ || nextDeclaration.kind === 170 /* PropertySignature */ ? Diagnostics.Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_type_2 : Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2;
|
|
79229
79245
|
const declName = declarationNameToString(nextDeclarationName);
|
|
79230
|
-
const err =
|
|
79246
|
+
const err = error2(
|
|
79231
79247
|
nextDeclarationName,
|
|
79232
79248
|
message,
|
|
79233
79249
|
declName,
|
|
@@ -79277,7 +79293,7 @@ ${lanes.join("\n")}
|
|
|
79277
79293
|
checkTestingKnownTruthyCallableOrAwaitableType(node.expression, type, node.thenStatement);
|
|
79278
79294
|
checkSourceElement(node.thenStatement);
|
|
79279
79295
|
if (node.thenStatement.kind === 241 /* EmptyStatement */) {
|
|
79280
|
-
|
|
79296
|
+
error2(node.thenStatement, Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement);
|
|
79281
79297
|
}
|
|
79282
79298
|
checkSourceElement(node.elseStatement);
|
|
79283
79299
|
}
|
|
@@ -79327,7 +79343,7 @@ ${lanes.join("\n")}
|
|
|
79327
79343
|
getTypeNameForErrorDisplay(type)
|
|
79328
79344
|
);
|
|
79329
79345
|
} else {
|
|
79330
|
-
|
|
79346
|
+
error2(location, Diagnostics.This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_instead);
|
|
79331
79347
|
}
|
|
79332
79348
|
}
|
|
79333
79349
|
}
|
|
@@ -79393,7 +79409,7 @@ ${lanes.join("\n")}
|
|
|
79393
79409
|
}
|
|
79394
79410
|
function checkTruthinessOfType(type, node) {
|
|
79395
79411
|
if (type.flags & 16384 /* Void */) {
|
|
79396
|
-
|
|
79412
|
+
error2(node, Diagnostics.An_expression_of_type_void_cannot_be_tested_for_truthiness);
|
|
79397
79413
|
}
|
|
79398
79414
|
return type;
|
|
79399
79415
|
}
|
|
@@ -79467,16 +79483,16 @@ ${lanes.join("\n")}
|
|
|
79467
79483
|
if (node.initializer.kind === 260 /* VariableDeclarationList */) {
|
|
79468
79484
|
const variable = node.initializer.declarations[0];
|
|
79469
79485
|
if (variable && isBindingPattern(variable.name)) {
|
|
79470
|
-
|
|
79486
|
+
error2(variable.name, Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern);
|
|
79471
79487
|
}
|
|
79472
79488
|
checkForInOrForOfVariableDeclaration(node);
|
|
79473
79489
|
} else {
|
|
79474
79490
|
const varExpr = node.initializer;
|
|
79475
79491
|
const leftType = checkExpression(varExpr);
|
|
79476
79492
|
if (varExpr.kind === 208 /* ArrayLiteralExpression */ || varExpr.kind === 209 /* ObjectLiteralExpression */) {
|
|
79477
|
-
|
|
79493
|
+
error2(varExpr, Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern);
|
|
79478
79494
|
} else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) {
|
|
79479
|
-
|
|
79495
|
+
error2(varExpr, Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any);
|
|
79480
79496
|
} else {
|
|
79481
79497
|
checkReferenceExpression(
|
|
79482
79498
|
varExpr,
|
|
@@ -79486,7 +79502,7 @@ ${lanes.join("\n")}
|
|
|
79486
79502
|
}
|
|
79487
79503
|
}
|
|
79488
79504
|
if (rightType === neverType || !isTypeAssignableToKind(rightType, 67108864 /* NonPrimitive */ | 58982400 /* InstantiableNonPrimitive */)) {
|
|
79489
|
-
|
|
79505
|
+
error2(node.expression, Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_here_has_type_0, typeToString(rightType));
|
|
79490
79506
|
}
|
|
79491
79507
|
checkSourceElement(node.statement);
|
|
79492
79508
|
if (node.locals) {
|
|
@@ -79557,7 +79573,7 @@ ${lanes.join("\n")}
|
|
|
79557
79573
|
if (hasStringConstituent) {
|
|
79558
79574
|
if (languageVersion < 1 /* ES5 */) {
|
|
79559
79575
|
if (errorNode) {
|
|
79560
|
-
|
|
79576
|
+
error2(errorNode, Diagnostics.Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher);
|
|
79561
79577
|
reportedError = true;
|
|
79562
79578
|
}
|
|
79563
79579
|
}
|
|
@@ -80017,7 +80033,7 @@ ${lanes.join("\n")}
|
|
|
80017
80033
|
errorOutputContainer.errors ?? (errorOutputContainer.errors = []);
|
|
80018
80034
|
errorOutputContainer.errors.push(createDiagnosticForNode(errorNode, diagnostic, methodName));
|
|
80019
80035
|
} else {
|
|
80020
|
-
|
|
80036
|
+
error2(errorNode, diagnostic, methodName);
|
|
80021
80037
|
}
|
|
80022
80038
|
}
|
|
80023
80039
|
return methodName === "next" ? noIterationTypes : void 0;
|
|
@@ -80072,7 +80088,7 @@ ${lanes.join("\n")}
|
|
|
80072
80088
|
errorOutputContainer.errors ?? (errorOutputContainer.errors = []);
|
|
80073
80089
|
errorOutputContainer.errors.push(createDiagnosticForNode(errorNode, resolver.mustHaveAValueDiagnostic, methodName));
|
|
80074
80090
|
} else {
|
|
80075
|
-
|
|
80091
|
+
error2(errorNode, resolver.mustHaveAValueDiagnostic, methodName);
|
|
80076
80092
|
}
|
|
80077
80093
|
}
|
|
80078
80094
|
yieldType = anyType;
|
|
@@ -80158,11 +80174,11 @@ ${lanes.join("\n")}
|
|
|
80158
80174
|
const exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType;
|
|
80159
80175
|
if (container.kind === 177 /* SetAccessor */) {
|
|
80160
80176
|
if (node.expression) {
|
|
80161
|
-
|
|
80177
|
+
error2(node, Diagnostics.Setters_cannot_return_a_value);
|
|
80162
80178
|
}
|
|
80163
80179
|
} else if (container.kind === 175 /* Constructor */) {
|
|
80164
80180
|
if (node.expression && !checkTypeAssignableToAndOptionallyElaborate(exprType, returnType, node, node.expression)) {
|
|
80165
|
-
|
|
80181
|
+
error2(node, Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class);
|
|
80166
80182
|
}
|
|
80167
80183
|
} else if (getReturnTypeFromAnnotation(container)) {
|
|
80168
80184
|
const unwrappedReturnType = unwrapReturnType(returnType, functionFlags) ?? returnType;
|
|
@@ -80178,7 +80194,7 @@ ${lanes.join("\n")}
|
|
|
80178
80194
|
}
|
|
80179
80195
|
}
|
|
80180
80196
|
} else if (container.kind !== 175 /* Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeUndefinedVoidOrAny(container, returnType)) {
|
|
80181
|
-
|
|
80197
|
+
error2(node, Diagnostics.Not_all_code_paths_return_a_value);
|
|
80182
80198
|
}
|
|
80183
80199
|
}
|
|
80184
80200
|
function checkWithStatement(node) {
|
|
@@ -80214,7 +80230,7 @@ ${lanes.join("\n")}
|
|
|
80214
80230
|
}
|
|
80215
80231
|
forEach(clause.statements, checkSourceElement);
|
|
80216
80232
|
if (compilerOptions.noFallthroughCasesInSwitch && clause.fallthroughFlowNode && isReachableFlowNode(clause.fallthroughFlowNode)) {
|
|
80217
|
-
|
|
80233
|
+
error2(clause, Diagnostics.Fallthrough_case_in_switch);
|
|
80218
80234
|
}
|
|
80219
80235
|
function createLazyCaseClauseDiagnostics(clause2) {
|
|
80220
80236
|
return () => {
|
|
@@ -80364,7 +80380,7 @@ ${lanes.join("\n")}
|
|
|
80364
80380
|
const localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfDeclaration(info.declaration)) === type.symbol ? info.declaration : void 0;
|
|
80365
80381
|
const errorNode = localCheckDeclaration || localIndexDeclaration || (interfaceDeclaration && !some(getBaseTypes(type), (base) => !!getIndexInfoOfType(base, checkInfo.keyType) && !!getIndexTypeOfType(base, info.keyType)) ? interfaceDeclaration : void 0);
|
|
80366
80382
|
if (errorNode && !isTypeAssignableTo(checkInfo.type, info.type)) {
|
|
80367
|
-
|
|
80383
|
+
error2(
|
|
80368
80384
|
errorNode,
|
|
80369
80385
|
Diagnostics._0_index_type_1_is_not_assignable_to_2_index_type_3,
|
|
80370
80386
|
typeToString(checkInfo.keyType),
|
|
@@ -80387,12 +80403,12 @@ ${lanes.join("\n")}
|
|
|
80387
80403
|
case "symbol":
|
|
80388
80404
|
case "void":
|
|
80389
80405
|
case "object":
|
|
80390
|
-
|
|
80406
|
+
error2(name, message, name.escapedText);
|
|
80391
80407
|
}
|
|
80392
80408
|
}
|
|
80393
80409
|
function checkClassNameCollisionWithObject(name) {
|
|
80394
80410
|
if (languageVersion >= 1 /* ES5 */ && name.escapedText === "Object" && (moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(name).impliedNodeFormat === 1 /* CommonJS */)) {
|
|
80395
|
-
|
|
80411
|
+
error2(name, Diagnostics.Class_name_cannot_be_Object_when_targeting_ES5_with_module_0, ModuleKind[moduleKind]);
|
|
80396
80412
|
}
|
|
80397
80413
|
}
|
|
80398
80414
|
function checkUnmatchedJSDocParameters(node) {
|
|
@@ -80415,7 +80431,7 @@ ${lanes.join("\n")}
|
|
|
80415
80431
|
const lastJSDocParamIndex = jsdocParameters.length - 1;
|
|
80416
80432
|
const lastJSDocParam = jsdocParameters[lastJSDocParamIndex];
|
|
80417
80433
|
if (isJs && lastJSDocParam && isIdentifier(lastJSDocParam.name) && lastJSDocParam.typeExpression && lastJSDocParam.typeExpression.type && !parameters.has(lastJSDocParam.name.escapedText) && !excludedParameters.has(lastJSDocParamIndex) && !isArrayType(getTypeFromTypeNode(lastJSDocParam.typeExpression.type))) {
|
|
80418
|
-
|
|
80434
|
+
error2(lastJSDocParam.name, Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_had_an_array_type, idText(lastJSDocParam.name));
|
|
80419
80435
|
}
|
|
80420
80436
|
} else {
|
|
80421
80437
|
forEach(jsdocParameters, ({ name, isNameFirst }, index) => {
|
|
@@ -80424,7 +80440,7 @@ ${lanes.join("\n")}
|
|
|
80424
80440
|
}
|
|
80425
80441
|
if (isQualifiedName(name)) {
|
|
80426
80442
|
if (isJs) {
|
|
80427
|
-
|
|
80443
|
+
error2(name, Diagnostics.Qualified_name_0_is_not_allowed_without_a_leading_param_object_1, entityNameToString(name), entityNameToString(name.left));
|
|
80428
80444
|
}
|
|
80429
80445
|
} else {
|
|
80430
80446
|
if (!isNameFirst) {
|
|
@@ -80449,11 +80465,11 @@ ${lanes.join("\n")}
|
|
|
80449
80465
|
seenDefault = true;
|
|
80450
80466
|
checkTypeParametersNotReferenced(node.default, typeParameterDeclarations, i);
|
|
80451
80467
|
} else if (seenDefault) {
|
|
80452
|
-
|
|
80468
|
+
error2(node, Diagnostics.Required_type_parameters_may_not_follow_optional_type_parameters);
|
|
80453
80469
|
}
|
|
80454
80470
|
for (let j = 0; j < i; j++) {
|
|
80455
80471
|
if (typeParameterDeclarations[j].symbol === node.symbol) {
|
|
80456
|
-
|
|
80472
|
+
error2(node.name, Diagnostics.Duplicate_identifier_0, declarationNameToString(node.name));
|
|
80457
80473
|
}
|
|
80458
80474
|
}
|
|
80459
80475
|
};
|
|
@@ -80467,7 +80483,7 @@ ${lanes.join("\n")}
|
|
|
80467
80483
|
if (type.flags & 262144 /* TypeParameter */) {
|
|
80468
80484
|
for (let i = index; i < typeParameters.length; i++) {
|
|
80469
80485
|
if (type.symbol === getSymbolOfDeclaration(typeParameters[i])) {
|
|
80470
|
-
|
|
80486
|
+
error2(node, Diagnostics.Type_parameter_defaults_can_only_reference_previously_declared_type_parameters);
|
|
80471
80487
|
}
|
|
80472
80488
|
}
|
|
80473
80489
|
}
|
|
@@ -80490,7 +80506,7 @@ ${lanes.join("\n")}
|
|
|
80490
80506
|
if (!areTypeParametersIdentical(declarations, type.localTypeParameters, getEffectiveTypeParameterDeclarations)) {
|
|
80491
80507
|
const name = symbolToString(symbol);
|
|
80492
80508
|
for (const declaration of declarations) {
|
|
80493
|
-
|
|
80509
|
+
error2(declaration.name, Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, name);
|
|
80494
80510
|
}
|
|
80495
80511
|
}
|
|
80496
80512
|
}
|
|
@@ -80661,18 +80677,18 @@ ${lanes.join("\n")}
|
|
|
80661
80677
|
}
|
|
80662
80678
|
if (baseConstructorType.flags & 8650752 /* TypeVariable */) {
|
|
80663
80679
|
if (!isMixinConstructorType(staticType)) {
|
|
80664
|
-
|
|
80680
|
+
error2(node.name || node, Diagnostics.A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any);
|
|
80665
80681
|
} else {
|
|
80666
80682
|
const constructSignatures = getSignaturesOfType(baseConstructorType, 1 /* Construct */);
|
|
80667
80683
|
if (constructSignatures.some((signature) => signature.flags & 4 /* Abstract */) && !hasSyntacticModifier(node, 256 /* Abstract */)) {
|
|
80668
|
-
|
|
80684
|
+
error2(node.name || node, Diagnostics.A_mixin_class_that_extends_from_a_type_variable_containing_an_abstract_construct_signature_must_also_be_declared_abstract);
|
|
80669
80685
|
}
|
|
80670
80686
|
}
|
|
80671
80687
|
}
|
|
80672
80688
|
if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32 /* Class */) && !(baseConstructorType.flags & 8650752 /* TypeVariable */)) {
|
|
80673
80689
|
const constructors = getInstantiatedConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments, baseTypeNode);
|
|
80674
80690
|
if (forEach(constructors, (sig) => !isJSConstructor(sig.declaration) && !isTypeIdenticalTo(getReturnTypeOfSignature(sig), baseType))) {
|
|
80675
|
-
|
|
80691
|
+
error2(baseTypeNode.expression, Diagnostics.Base_constructors_must_all_have_the_same_return_type);
|
|
80676
80692
|
}
|
|
80677
80693
|
}
|
|
80678
80694
|
checkKindsOfPropertyMemberOverrides(type, baseType);
|
|
@@ -80684,7 +80700,7 @@ ${lanes.join("\n")}
|
|
|
80684
80700
|
if (implementedTypeNodes) {
|
|
80685
80701
|
for (const typeRefNode of implementedTypeNodes) {
|
|
80686
80702
|
if (!isEntityNameExpression(typeRefNode.expression) || isOptionalChain(typeRefNode.expression)) {
|
|
80687
|
-
|
|
80703
|
+
error2(typeRefNode.expression, Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments);
|
|
80688
80704
|
}
|
|
80689
80705
|
checkTypeReferenceNode(typeRefNode);
|
|
80690
80706
|
addLazyDiagnostic(createImplementsDiagnostics(typeRefNode));
|
|
@@ -80717,7 +80733,7 @@ ${lanes.join("\n")}
|
|
|
80717
80733
|
issueMemberSpecificError(node, typeWithThis, baseWithThis, genericDiag);
|
|
80718
80734
|
}
|
|
80719
80735
|
} else {
|
|
80720
|
-
|
|
80736
|
+
error2(typeRefNode, Diagnostics.A_class_can_only_implement_an_object_type_or_intersection_of_object_types_with_statically_known_members);
|
|
80721
80737
|
}
|
|
80722
80738
|
}
|
|
80723
80739
|
};
|
|
@@ -80795,12 +80811,12 @@ ${lanes.join("\n")}
|
|
|
80795
80811
|
if (prop && !baseProp && memberHasOverrideModifier) {
|
|
80796
80812
|
if (errorNode) {
|
|
80797
80813
|
const suggestion = getSuggestedSymbolForNonexistentClassMember(memberName, baseType);
|
|
80798
|
-
suggestion ?
|
|
80814
|
+
suggestion ? error2(
|
|
80799
80815
|
errorNode,
|
|
80800
80816
|
isJs ? Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1 : Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1,
|
|
80801
80817
|
baseClassName,
|
|
80802
80818
|
symbolToString(suggestion)
|
|
80803
|
-
) :
|
|
80819
|
+
) : error2(
|
|
80804
80820
|
errorNode,
|
|
80805
80821
|
isJs ? Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0 : Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0,
|
|
80806
80822
|
baseClassName
|
|
@@ -80815,12 +80831,12 @@ ${lanes.join("\n")}
|
|
|
80815
80831
|
if (!baseHasAbstract) {
|
|
80816
80832
|
if (errorNode) {
|
|
80817
80833
|
const diag2 = memberIsParameterProperty ? isJs ? Diagnostics.This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0 : Diagnostics.This_parameter_property_must_have_an_override_modifier_because_it_overrides_a_member_in_base_class_0 : isJs ? Diagnostics.This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0 : Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0;
|
|
80818
|
-
|
|
80834
|
+
error2(errorNode, diag2, baseClassName);
|
|
80819
80835
|
}
|
|
80820
80836
|
return 1 /* NeedsOverride */;
|
|
80821
80837
|
} else if (memberHasAbstractModifier && baseHasAbstract) {
|
|
80822
80838
|
if (errorNode) {
|
|
80823
|
-
|
|
80839
|
+
error2(errorNode, Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared_in_the_base_class_0, baseClassName);
|
|
80824
80840
|
}
|
|
80825
80841
|
return 1 /* NeedsOverride */;
|
|
80826
80842
|
}
|
|
@@ -80828,7 +80844,7 @@ ${lanes.join("\n")}
|
|
|
80828
80844
|
} else if (memberHasOverrideModifier) {
|
|
80829
80845
|
if (errorNode) {
|
|
80830
80846
|
const className = typeToString(type);
|
|
80831
|
-
|
|
80847
|
+
error2(
|
|
80832
80848
|
errorNode,
|
|
80833
80849
|
isJs ? Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_extend_another_class : Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class,
|
|
80834
80850
|
className
|
|
@@ -80881,7 +80897,7 @@ ${lanes.join("\n")}
|
|
|
80881
80897
|
if (declaration && hasEffectiveModifier(declaration, 8 /* Private */)) {
|
|
80882
80898
|
const typeClassDeclaration = getClassLikeDeclarationOfSymbol(type.symbol);
|
|
80883
80899
|
if (!isNodeWithinClass(node, typeClassDeclaration)) {
|
|
80884
|
-
|
|
80900
|
+
error2(node, Diagnostics.Cannot_extend_a_class_0_Class_constructor_is_marked_as_private, getFullyQualifiedName(type.symbol));
|
|
80885
80901
|
}
|
|
80886
80902
|
}
|
|
80887
80903
|
}
|
|
@@ -80950,7 +80966,7 @@ ${lanes.join("\n")}
|
|
|
80950
80966
|
}
|
|
80951
80967
|
}
|
|
80952
80968
|
if (!inheritedAbstractMemberNotImplementedError) {
|
|
80953
|
-
inheritedAbstractMemberNotImplementedError =
|
|
80969
|
+
inheritedAbstractMemberNotImplementedError = error2(
|
|
80954
80970
|
derivedClassDecl,
|
|
80955
80971
|
Diagnostics.Non_abstract_class_0_does_not_implement_all_abstract_members_of_1,
|
|
80956
80972
|
typeToString(type),
|
|
@@ -80996,7 +81012,7 @@ ${lanes.join("\n")}
|
|
|
80996
81012
|
const overriddenInstanceAccessor = basePropertyFlags === 4 /* Property */ && derivedPropertyFlags !== 4 /* Property */;
|
|
80997
81013
|
if (overriddenInstanceProperty || overriddenInstanceAccessor) {
|
|
80998
81014
|
const errorMessage2 = overriddenInstanceProperty ? Diagnostics._0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property : Diagnostics._0_is_defined_as_a_property_in_class_1_but_is_overridden_here_in_2_as_an_accessor;
|
|
80999
|
-
|
|
81015
|
+
error2(getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage2, symbolToString(base), typeToString(baseType), typeToString(type));
|
|
81000
81016
|
} else if (useDefineForClassFields) {
|
|
81001
81017
|
const uninitialized = (_c = derived.declarations) == null ? void 0 : _c.find((d) => d.kind === 171 /* PropertyDeclaration */ && !d.initializer);
|
|
81002
81018
|
if (uninitialized && !(derived.flags & 33554432 /* Transient */) && !(baseDeclarationFlags & 256 /* Abstract */) && !(derivedDeclarationFlags & 256 /* Abstract */) && !((_d = derived.declarations) == null ? void 0 : _d.some((d) => !!(d.flags & 16777216 /* Ambient */)))) {
|
|
@@ -81004,7 +81020,7 @@ ${lanes.join("\n")}
|
|
|
81004
81020
|
const propName = uninitialized.name;
|
|
81005
81021
|
if (uninitialized.exclamationToken || !constructor || !isIdentifier(propName) || !strictNullChecks || !isPropertyInitializedInConstructor(propName, type, constructor)) {
|
|
81006
81022
|
const errorMessage2 = Diagnostics.Property_0_will_overwrite_the_base_property_in_1_If_this_is_intentional_add_an_initializer_Otherwise_add_a_declare_modifier_or_remove_the_redundant_declaration;
|
|
81007
|
-
|
|
81023
|
+
error2(getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage2, symbolToString(base), typeToString(baseType));
|
|
81008
81024
|
}
|
|
81009
81025
|
}
|
|
81010
81026
|
}
|
|
@@ -81021,7 +81037,7 @@ ${lanes.join("\n")}
|
|
|
81021
81037
|
} else {
|
|
81022
81038
|
errorMessage = Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function;
|
|
81023
81039
|
}
|
|
81024
|
-
|
|
81040
|
+
error2(getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type));
|
|
81025
81041
|
}
|
|
81026
81042
|
}
|
|
81027
81043
|
}
|
|
@@ -81100,7 +81116,7 @@ ${lanes.join("\n")}
|
|
|
81100
81116
|
const type = getTypeOfSymbol(getSymbolOfDeclaration(member));
|
|
81101
81117
|
if (!(type.flags & 3 /* AnyOrUnknown */ || containsUndefinedType(type))) {
|
|
81102
81118
|
if (!constructor || !isPropertyInitializedInConstructor(propName, type, constructor)) {
|
|
81103
|
-
|
|
81119
|
+
error2(member.name, Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor, declarationNameToString(propName));
|
|
81104
81120
|
}
|
|
81105
81121
|
}
|
|
81106
81122
|
}
|
|
@@ -81157,7 +81173,7 @@ ${lanes.join("\n")}
|
|
|
81157
81173
|
});
|
|
81158
81174
|
forEach(getInterfaceBaseTypeNodes(node), (heritageElement) => {
|
|
81159
81175
|
if (!isEntityNameExpression(heritageElement.expression) || isOptionalChain(heritageElement.expression)) {
|
|
81160
|
-
|
|
81176
|
+
error2(heritageElement.expression, Diagnostics.An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments);
|
|
81161
81177
|
}
|
|
81162
81178
|
checkTypeReferenceNode(heritageElement);
|
|
81163
81179
|
});
|
|
@@ -81174,7 +81190,7 @@ ${lanes.join("\n")}
|
|
|
81174
81190
|
checkTypeParameters(node.typeParameters);
|
|
81175
81191
|
if (node.type.kind === 141 /* IntrinsicKeyword */) {
|
|
81176
81192
|
if (!intrinsicTypeKinds.has(node.name.escapedText) || length(node.typeParameters) !== 1) {
|
|
81177
|
-
|
|
81193
|
+
error2(node.type, Diagnostics.The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types);
|
|
81178
81194
|
}
|
|
81179
81195
|
} else {
|
|
81180
81196
|
checkSourceElement(node.type);
|
|
@@ -81195,11 +81211,11 @@ ${lanes.join("\n")}
|
|
|
81195
81211
|
}
|
|
81196
81212
|
function computeMemberValue(member, autoValue) {
|
|
81197
81213
|
if (isComputedNonLiteralName(member.name)) {
|
|
81198
|
-
|
|
81214
|
+
error2(member.name, Diagnostics.Computed_property_names_are_not_allowed_in_enums);
|
|
81199
81215
|
} else {
|
|
81200
81216
|
const text = getTextOfPropertyName(member.name);
|
|
81201
81217
|
if (isNumericLiteralName(text) && !isInfinityOrNaNString(text)) {
|
|
81202
|
-
|
|
81218
|
+
error2(member.name, Diagnostics.An_enum_member_cannot_have_a_numeric_name);
|
|
81203
81219
|
}
|
|
81204
81220
|
}
|
|
81205
81221
|
if (member.initializer) {
|
|
@@ -81211,7 +81227,7 @@ ${lanes.join("\n")}
|
|
|
81211
81227
|
if (autoValue !== void 0) {
|
|
81212
81228
|
return autoValue;
|
|
81213
81229
|
}
|
|
81214
|
-
|
|
81230
|
+
error2(member.name, Diagnostics.Enum_member_must_have_initializer);
|
|
81215
81231
|
return void 0;
|
|
81216
81232
|
}
|
|
81217
81233
|
function computeConstantValue(member) {
|
|
@@ -81220,12 +81236,12 @@ ${lanes.join("\n")}
|
|
|
81220
81236
|
const value = evaluate(initializer, member);
|
|
81221
81237
|
if (value !== void 0) {
|
|
81222
81238
|
if (isConstEnum && typeof value === "number" && !isFinite(value)) {
|
|
81223
|
-
|
|
81239
|
+
error2(initializer, isNaN(value) ? Diagnostics.const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN : Diagnostics.const_enum_member_initializer_was_evaluated_to_a_non_finite_value);
|
|
81224
81240
|
}
|
|
81225
81241
|
} else if (isConstEnum) {
|
|
81226
|
-
|
|
81242
|
+
error2(initializer, Diagnostics.const_enum_member_initializers_must_be_constant_expressions);
|
|
81227
81243
|
} else if (member.parent.flags & 16777216 /* Ambient */) {
|
|
81228
|
-
|
|
81244
|
+
error2(initializer, Diagnostics.In_ambient_enum_declarations_member_initializer_must_be_constant_expression);
|
|
81229
81245
|
} else {
|
|
81230
81246
|
checkTypeAssignableTo(checkExpression(initializer), numberType, initializer, Diagnostics.Type_0_is_not_assignable_to_type_1_as_required_for_computed_enum_member_values);
|
|
81231
81247
|
}
|
|
@@ -81339,11 +81355,11 @@ ${lanes.join("\n")}
|
|
|
81339
81355
|
function evaluateEnumMember(expr, symbol, location) {
|
|
81340
81356
|
const declaration = symbol.valueDeclaration;
|
|
81341
81357
|
if (!declaration || declaration === location) {
|
|
81342
|
-
|
|
81358
|
+
error2(expr, Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(symbol));
|
|
81343
81359
|
return void 0;
|
|
81344
81360
|
}
|
|
81345
81361
|
if (!isBlockScopedNameDeclaredBeforeUse(declaration, location)) {
|
|
81346
|
-
|
|
81362
|
+
error2(expr, Diagnostics.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums);
|
|
81347
81363
|
return 0;
|
|
81348
81364
|
}
|
|
81349
81365
|
return getEnumMemberValue(declaration);
|
|
@@ -81376,7 +81392,7 @@ ${lanes.join("\n")}
|
|
|
81376
81392
|
const enumIsConst = isEnumConst(node);
|
|
81377
81393
|
forEach(enumSymbol.declarations, (decl) => {
|
|
81378
81394
|
if (isEnumDeclaration(decl) && isEnumConst(decl) !== enumIsConst) {
|
|
81379
|
-
|
|
81395
|
+
error2(getNameOfDeclaration(decl), Diagnostics.Enum_declarations_must_all_be_const_or_non_const);
|
|
81380
81396
|
}
|
|
81381
81397
|
});
|
|
81382
81398
|
}
|
|
@@ -81392,7 +81408,7 @@ ${lanes.join("\n")}
|
|
|
81392
81408
|
const firstEnumMember = enumDeclaration.members[0];
|
|
81393
81409
|
if (!firstEnumMember.initializer) {
|
|
81394
81410
|
if (seenEnumMissingInitialInitializer) {
|
|
81395
|
-
|
|
81411
|
+
error2(firstEnumMember.name, Diagnostics.In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element);
|
|
81396
81412
|
} else {
|
|
81397
81413
|
seenEnumMissingInitialInitializer = true;
|
|
81398
81414
|
}
|
|
@@ -81402,7 +81418,7 @@ ${lanes.join("\n")}
|
|
|
81402
81418
|
}
|
|
81403
81419
|
function checkEnumMember(node) {
|
|
81404
81420
|
if (isPrivateIdentifier(node.name)) {
|
|
81405
|
-
|
|
81421
|
+
error2(node, Diagnostics.An_enum_member_cannot_be_named_with_a_private_identifier);
|
|
81406
81422
|
}
|
|
81407
81423
|
if (node.initializer) {
|
|
81408
81424
|
checkExpression(node.initializer);
|
|
@@ -81443,7 +81459,7 @@ ${lanes.join("\n")}
|
|
|
81443
81459
|
const isGlobalAugmentation = isGlobalScopeAugmentation(node);
|
|
81444
81460
|
const inAmbientContext = node.flags & 16777216 /* Ambient */;
|
|
81445
81461
|
if (isGlobalAugmentation && !inAmbientContext) {
|
|
81446
|
-
|
|
81462
|
+
error2(node.name, Diagnostics.Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context);
|
|
81447
81463
|
}
|
|
81448
81464
|
const isAmbientExternalModule = isAmbientModule(node);
|
|
81449
81465
|
const contextErrorMessage = isAmbientExternalModule ? Diagnostics.An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file : Diagnostics.A_namespace_declaration_is_only_allowed_at_the_top_level_of_a_namespace_or_module;
|
|
@@ -81462,15 +81478,15 @@ ${lanes.join("\n")}
|
|
|
81462
81478
|
const symbol = getSymbolOfDeclaration(node);
|
|
81463
81479
|
if (symbol.flags & 512 /* ValueModule */ && !inAmbientContext && isInstantiatedModule(node, shouldPreserveConstEnums(compilerOptions))) {
|
|
81464
81480
|
if (getIsolatedModules(compilerOptions) && !getSourceFileOfNode(node).externalModuleIndicator) {
|
|
81465
|
-
|
|
81481
|
+
error2(node.name, Diagnostics.Namespaces_are_not_allowed_in_global_script_files_when_0_is_enabled_If_this_file_is_not_intended_to_be_a_global_script_set_moduleDetection_to_force_or_add_an_empty_export_statement, isolatedModulesLikeFlagName);
|
|
81466
81482
|
}
|
|
81467
81483
|
if (((_a = symbol.declarations) == null ? void 0 : _a.length) > 1) {
|
|
81468
81484
|
const firstNonAmbientClassOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol);
|
|
81469
81485
|
if (firstNonAmbientClassOrFunc) {
|
|
81470
81486
|
if (getSourceFileOfNode(node) !== getSourceFileOfNode(firstNonAmbientClassOrFunc)) {
|
|
81471
|
-
|
|
81487
|
+
error2(node.name, Diagnostics.A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged);
|
|
81472
81488
|
} else if (node.pos < firstNonAmbientClassOrFunc.pos) {
|
|
81473
|
-
|
|
81489
|
+
error2(node.name, Diagnostics.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged);
|
|
81474
81490
|
}
|
|
81475
81491
|
}
|
|
81476
81492
|
const mergedClass = getDeclarationOfKind(symbol, 262 /* ClassDeclaration */);
|
|
@@ -81481,7 +81497,7 @@ ${lanes.join("\n")}
|
|
|
81481
81497
|
if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 311 /* SourceFile */ && (moduleKind === 1 /* CommonJS */ || node.parent.impliedNodeFormat === 1 /* CommonJS */)) {
|
|
81482
81498
|
const exportModifier = (_b = node.modifiers) == null ? void 0 : _b.find((m) => m.kind === 95 /* ExportKeyword */);
|
|
81483
81499
|
if (exportModifier) {
|
|
81484
|
-
|
|
81500
|
+
error2(exportModifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
|
81485
81501
|
}
|
|
81486
81502
|
}
|
|
81487
81503
|
}
|
|
@@ -81495,15 +81511,15 @@ ${lanes.join("\n")}
|
|
|
81495
81511
|
}
|
|
81496
81512
|
} else if (isGlobalSourceFile(node.parent)) {
|
|
81497
81513
|
if (isGlobalAugmentation) {
|
|
81498
|
-
|
|
81514
|
+
error2(node.name, Diagnostics.Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations);
|
|
81499
81515
|
} else if (isExternalModuleNameRelative(getTextOfIdentifierOrLiteral(node.name))) {
|
|
81500
|
-
|
|
81516
|
+
error2(node.name, Diagnostics.Ambient_module_declaration_cannot_specify_relative_module_name);
|
|
81501
81517
|
}
|
|
81502
81518
|
} else {
|
|
81503
81519
|
if (isGlobalAugmentation) {
|
|
81504
|
-
|
|
81520
|
+
error2(node.name, Diagnostics.Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations);
|
|
81505
81521
|
} else {
|
|
81506
|
-
|
|
81522
|
+
error2(node.name, Diagnostics.Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces);
|
|
81507
81523
|
}
|
|
81508
81524
|
}
|
|
81509
81525
|
}
|
|
@@ -81570,17 +81586,17 @@ ${lanes.join("\n")}
|
|
|
81570
81586
|
return false;
|
|
81571
81587
|
}
|
|
81572
81588
|
if (!isStringLiteral(moduleName)) {
|
|
81573
|
-
|
|
81589
|
+
error2(moduleName, Diagnostics.String_literal_expected);
|
|
81574
81590
|
return false;
|
|
81575
81591
|
}
|
|
81576
81592
|
const inAmbientExternalModule = node.parent.kind === 267 /* ModuleBlock */ && isAmbientModule(node.parent.parent);
|
|
81577
81593
|
if (node.parent.kind !== 311 /* SourceFile */ && !inAmbientExternalModule) {
|
|
81578
|
-
|
|
81594
|
+
error2(moduleName, node.kind === 277 /* ExportDeclaration */ ? Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module);
|
|
81579
81595
|
return false;
|
|
81580
81596
|
}
|
|
81581
81597
|
if (inAmbientExternalModule && isExternalModuleNameRelative(moduleName.text)) {
|
|
81582
81598
|
if (!isTopLevelInExternalModuleAugmentation(node)) {
|
|
81583
|
-
|
|
81599
|
+
error2(node, Diagnostics.Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name);
|
|
81584
81600
|
return false;
|
|
81585
81601
|
}
|
|
81586
81602
|
}
|
|
@@ -81589,7 +81605,7 @@ ${lanes.join("\n")}
|
|
|
81589
81605
|
for (const clause of node.assertClause.elements) {
|
|
81590
81606
|
if (!isStringLiteral(clause.value)) {
|
|
81591
81607
|
hasError = true;
|
|
81592
|
-
|
|
81608
|
+
error2(clause.value, Diagnostics.Import_assertion_values_must_be_string_literal_expressions);
|
|
81593
81609
|
}
|
|
81594
81610
|
}
|
|
81595
81611
|
return !hasError;
|
|
@@ -81606,7 +81622,7 @@ ${lanes.join("\n")}
|
|
|
81606
81622
|
const errorNode = isImportOrExportSpecifier(node) ? node.propertyName || node.name : isNamedDeclaration(node) ? node.name : node;
|
|
81607
81623
|
Debug.assert(node.kind !== 279 /* NamespaceExport */);
|
|
81608
81624
|
if (node.kind === 280 /* ExportSpecifier */) {
|
|
81609
|
-
const diag2 =
|
|
81625
|
+
const diag2 = error2(errorNode, Diagnostics.Types_cannot_appear_in_export_declarations_in_JavaScript_files);
|
|
81610
81626
|
const alreadyExportedSymbol = (_b = (_a = getSourceFileOfNode(node).symbol) == null ? void 0 : _a.exports) == null ? void 0 : _b.get((node.propertyName || node.name).escapedText);
|
|
81611
81627
|
if (alreadyExportedSymbol === target) {
|
|
81612
81628
|
const exportingDeclaration = (_c = alreadyExportedSymbol.declarations) == null ? void 0 : _c.find(isJSDocNode);
|
|
@@ -81623,7 +81639,7 @@ ${lanes.join("\n")}
|
|
|
81623
81639
|
const importDeclaration = findAncestor(node, or(isImportDeclaration, isImportEqualsDeclaration));
|
|
81624
81640
|
const moduleSpecifier = (importDeclaration && ((_d = tryGetModuleSpecifierFromDeclaration(importDeclaration)) == null ? void 0 : _d.text)) ?? "...";
|
|
81625
81641
|
const importedIdentifier = unescapeLeadingUnderscores(isIdentifier(errorNode) ? errorNode.escapedText : symbol.escapedName);
|
|
81626
|
-
|
|
81642
|
+
error2(
|
|
81627
81643
|
errorNode,
|
|
81628
81644
|
Diagnostics._0_is_a_type_and_cannot_be_imported_in_JavaScript_files_Use_1_in_a_JSDoc_type_annotation,
|
|
81629
81645
|
importedIdentifier,
|
|
@@ -81636,7 +81652,7 @@ ${lanes.join("\n")}
|
|
|
81636
81652
|
const excludedMeanings = (symbol.flags & (111551 /* Value */ | 1048576 /* ExportValue */) ? 111551 /* Value */ : 0) | (symbol.flags & 788968 /* Type */ ? 788968 /* Type */ : 0) | (symbol.flags & 1920 /* Namespace */ ? 1920 /* Namespace */ : 0);
|
|
81637
81653
|
if (targetFlags & excludedMeanings) {
|
|
81638
81654
|
const message = node.kind === 280 /* ExportSpecifier */ ? Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0;
|
|
81639
|
-
|
|
81655
|
+
error2(node, message, symbolToString(symbol));
|
|
81640
81656
|
}
|
|
81641
81657
|
if (getIsolatedModules(compilerOptions) && !isTypeOnlyImportOrExportDeclaration(node) && !(node.flags & 16777216 /* Ambient */)) {
|
|
81642
81658
|
const typeOnlyAlias = getTypeOnlyAliasDeclaration(symbol);
|
|
@@ -81651,20 +81667,20 @@ ${lanes.join("\n")}
|
|
|
81651
81667
|
const message = compilerOptions.verbatimModuleSyntax && isInternalModuleImportEqualsDeclaration(node) ? Diagnostics.An_import_alias_cannot_resolve_to_a_type_or_type_only_declaration_when_verbatimModuleSyntax_is_enabled : isType ? compilerOptions.verbatimModuleSyntax ? Diagnostics._0_is_a_type_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled : Diagnostics._0_is_a_type_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled : compilerOptions.verbatimModuleSyntax ? Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled : Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled;
|
|
81652
81668
|
const name = idText(node.kind === 275 /* ImportSpecifier */ ? node.propertyName || node.name : node.name);
|
|
81653
81669
|
addTypeOnlyDeclarationRelatedInfo(
|
|
81654
|
-
|
|
81670
|
+
error2(node, message, name),
|
|
81655
81671
|
isType ? void 0 : typeOnlyAlias,
|
|
81656
81672
|
name
|
|
81657
81673
|
);
|
|
81658
81674
|
}
|
|
81659
81675
|
if (isType && node.kind === 270 /* ImportEqualsDeclaration */ && hasEffectiveModifier(node, 1 /* Export */)) {
|
|
81660
|
-
|
|
81676
|
+
error2(node, Diagnostics.Cannot_use_export_import_on_a_type_or_type_only_namespace_when_0_is_enabled, isolatedModulesLikeFlagName);
|
|
81661
81677
|
}
|
|
81662
81678
|
break;
|
|
81663
81679
|
}
|
|
81664
81680
|
case 280 /* ExportSpecifier */: {
|
|
81665
81681
|
if (compilerOptions.verbatimModuleSyntax || getSourceFileOfNode(typeOnlyAlias) !== getSourceFileOfNode(node)) {
|
|
81666
81682
|
const name = idText(node.propertyName || node.name);
|
|
81667
|
-
const diagnostic = isType ?
|
|
81683
|
+
const diagnostic = isType ? error2(node, Diagnostics.Re_exporting_a_type_when_0_is_enabled_requires_using_export_type, isolatedModulesLikeFlagName) : error2(node, Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_re_exported_using_a_type_only_re_export_when_1_is_enabled, name, isolatedModulesLikeFlagName);
|
|
81668
81684
|
addTypeOnlyDeclarationRelatedInfo(diagnostic, isType ? void 0 : typeOnlyAlias, name);
|
|
81669
81685
|
break;
|
|
81670
81686
|
}
|
|
@@ -81672,7 +81688,7 @@ ${lanes.join("\n")}
|
|
|
81672
81688
|
}
|
|
81673
81689
|
}
|
|
81674
81690
|
if (compilerOptions.verbatimModuleSyntax && node.kind !== 270 /* ImportEqualsDeclaration */ && !isInJSFile(node) && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) {
|
|
81675
|
-
|
|
81691
|
+
error2(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
|
81676
81692
|
}
|
|
81677
81693
|
}
|
|
81678
81694
|
if (isImportSpecifier(node)) {
|
|
@@ -81794,7 +81810,7 @@ ${lanes.join("\n")}
|
|
|
81794
81810
|
if (targetFlags & 111551 /* Value */) {
|
|
81795
81811
|
const moduleName = getFirstIdentifier(node.moduleReference);
|
|
81796
81812
|
if (!(resolveEntityName(moduleName, 111551 /* Value */ | 1920 /* Namespace */).flags & 1920 /* Namespace */)) {
|
|
81797
|
-
|
|
81813
|
+
error2(moduleName, Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name, declarationNameToString(moduleName));
|
|
81798
81814
|
}
|
|
81799
81815
|
}
|
|
81800
81816
|
if (targetFlags & 788968 /* Type */) {
|
|
@@ -81828,12 +81844,12 @@ ${lanes.join("\n")}
|
|
|
81828
81844
|
const inAmbientExternalModule = node.parent.kind === 267 /* ModuleBlock */ && isAmbientModule(node.parent.parent);
|
|
81829
81845
|
const inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 267 /* ModuleBlock */ && !node.moduleSpecifier && node.flags & 16777216 /* Ambient */;
|
|
81830
81846
|
if (node.parent.kind !== 311 /* SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) {
|
|
81831
|
-
|
|
81847
|
+
error2(node, Diagnostics.Export_declarations_are_not_permitted_in_a_namespace);
|
|
81832
81848
|
}
|
|
81833
81849
|
} else {
|
|
81834
81850
|
const moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier);
|
|
81835
81851
|
if (moduleSymbol && hasExportAssignmentSymbol(moduleSymbol)) {
|
|
81836
|
-
|
|
81852
|
+
error2(node.moduleSpecifier, Diagnostics.Module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol));
|
|
81837
81853
|
} else if (node.exportClause) {
|
|
81838
81854
|
checkAliasSymbol(node.exportClause);
|
|
81839
81855
|
}
|
|
@@ -81894,7 +81910,7 @@ ${lanes.join("\n")}
|
|
|
81894
81910
|
}
|
|
81895
81911
|
for (const statement of sourceFile.statements) {
|
|
81896
81912
|
if (canConvertImportDeclarationToTypeOnly(statement) || canConvertImportEqualsDeclarationToTypeOnly(statement)) {
|
|
81897
|
-
|
|
81913
|
+
error2(
|
|
81898
81914
|
statement,
|
|
81899
81915
|
Diagnostics.This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error
|
|
81900
81916
|
);
|
|
@@ -81924,7 +81940,7 @@ ${lanes.join("\n")}
|
|
|
81924
81940
|
true
|
|
81925
81941
|
);
|
|
81926
81942
|
if (symbol && (symbol === undefinedSymbol || symbol === globalThisSymbol || symbol.declarations && isGlobalSourceFile(getDeclarationContainer(symbol.declarations[0])))) {
|
|
81927
|
-
|
|
81943
|
+
error2(exportedName, Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, idText(exportedName));
|
|
81928
81944
|
} else {
|
|
81929
81945
|
if (!node.isTypeOnly && !node.parent.parent.isTypeOnly) {
|
|
81930
81946
|
markExportAsReferenced(node);
|
|
@@ -81948,9 +81964,9 @@ ${lanes.join("\n")}
|
|
|
81948
81964
|
const container = node.parent.kind === 311 /* SourceFile */ ? node.parent : node.parent.parent;
|
|
81949
81965
|
if (container.kind === 266 /* ModuleDeclaration */ && !isAmbientModule(container)) {
|
|
81950
81966
|
if (node.isExportEquals) {
|
|
81951
|
-
|
|
81967
|
+
error2(node, Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace);
|
|
81952
81968
|
} else {
|
|
81953
|
-
|
|
81969
|
+
error2(node, Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module);
|
|
81954
81970
|
}
|
|
81955
81971
|
return;
|
|
81956
81972
|
}
|
|
@@ -81978,14 +81994,14 @@ ${lanes.join("\n")}
|
|
|
81978
81994
|
if (getAllSymbolFlags(sym) & 111551 /* Value */) {
|
|
81979
81995
|
checkExpressionCached(id);
|
|
81980
81996
|
if (!isIllegalExportDefaultInCJS && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax && getTypeOnlyAliasDeclaration(sym, 111551 /* Value */)) {
|
|
81981
|
-
|
|
81997
|
+
error2(
|
|
81982
81998
|
id,
|
|
81983
81999
|
node.isExportEquals ? Diagnostics.An_export_declaration_must_reference_a_real_value_when_verbatimModuleSyntax_is_enabled_but_0_resolves_to_a_type_only_declaration : Diagnostics.An_export_default_must_reference_a_real_value_when_verbatimModuleSyntax_is_enabled_but_0_resolves_to_a_type_only_declaration,
|
|
81984
82000
|
idText(id)
|
|
81985
82001
|
);
|
|
81986
82002
|
}
|
|
81987
82003
|
} else if (!isIllegalExportDefaultInCJS && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax) {
|
|
81988
|
-
|
|
82004
|
+
error2(
|
|
81989
82005
|
id,
|
|
81990
82006
|
node.isExportEquals ? Diagnostics.An_export_declaration_must_reference_a_value_when_verbatimModuleSyntax_is_enabled_but_0_only_refers_to_a_type : Diagnostics.An_export_default_must_reference_a_value_when_verbatimModuleSyntax_is_enabled_but_0_only_refers_to_a_type,
|
|
81991
82007
|
idText(id)
|
|
@@ -82005,7 +82021,7 @@ ${lanes.join("\n")}
|
|
|
82005
82021
|
checkExpressionCached(node.expression);
|
|
82006
82022
|
}
|
|
82007
82023
|
if (isIllegalExportDefaultInCJS) {
|
|
82008
|
-
|
|
82024
|
+
error2(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
|
82009
82025
|
}
|
|
82010
82026
|
checkExternalModuleExports(container);
|
|
82011
82027
|
if (node.flags & 16777216 /* Ambient */ && !isEntityNameExpression(node.expression)) {
|
|
@@ -82030,7 +82046,7 @@ ${lanes.join("\n")}
|
|
|
82030
82046
|
if (exportEqualsSymbol && hasExportedMembers(moduleSymbol)) {
|
|
82031
82047
|
const declaration = getDeclarationOfAliasSymbol(exportEqualsSymbol) || exportEqualsSymbol.valueDeclaration;
|
|
82032
82048
|
if (declaration && !isTopLevelInExternalModuleAugmentation(declaration) && !isInJSFile(declaration)) {
|
|
82033
|
-
|
|
82049
|
+
error2(declaration, Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements);
|
|
82034
82050
|
}
|
|
82035
82051
|
}
|
|
82036
82052
|
const exports = getExportsOfModule(moduleSymbol);
|
|
@@ -82296,16 +82312,16 @@ ${lanes.join("\n")}
|
|
|
82296
82312
|
const { parent: parent2 } = node;
|
|
82297
82313
|
if (isParameter(parent2) && isJSDocFunctionType(parent2.parent)) {
|
|
82298
82314
|
if (last(parent2.parent.parameters) !== parent2) {
|
|
82299
|
-
|
|
82315
|
+
error2(node, Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list);
|
|
82300
82316
|
}
|
|
82301
82317
|
return;
|
|
82302
82318
|
}
|
|
82303
82319
|
if (!isJSDocTypeExpression(parent2)) {
|
|
82304
|
-
|
|
82320
|
+
error2(node, Diagnostics.JSDoc_may_only_appear_in_the_last_parameter_of_a_signature);
|
|
82305
82321
|
}
|
|
82306
82322
|
const paramTag = node.parent.parent;
|
|
82307
82323
|
if (!isJSDocParameterTag(paramTag)) {
|
|
82308
|
-
|
|
82324
|
+
error2(node, Diagnostics.JSDoc_may_only_appear_in_the_last_parameter_of_a_signature);
|
|
82309
82325
|
return;
|
|
82310
82326
|
}
|
|
82311
82327
|
const param = getParameterSymbolFromJSDoc(paramTag);
|
|
@@ -82314,7 +82330,7 @@ ${lanes.join("\n")}
|
|
|
82314
82330
|
}
|
|
82315
82331
|
const host2 = getHostSignatureFromJSDoc(paramTag);
|
|
82316
82332
|
if (!host2 || last(host2.parameters).symbol !== param) {
|
|
82317
|
-
|
|
82333
|
+
error2(node, Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list);
|
|
82318
82334
|
}
|
|
82319
82335
|
}
|
|
82320
82336
|
function getTypeFromJSDocVariadicType(node) {
|
|
@@ -84151,18 +84167,18 @@ ${lanes.join("\n")}
|
|
|
84151
84167
|
requestedExternalEmitHelperNames.add(name);
|
|
84152
84168
|
const symbol = resolveSymbol(getSymbol2(getExportsOfModule(helpersModule), escapeLeadingUnderscores(name), 111551 /* Value */));
|
|
84153
84169
|
if (!symbol) {
|
|
84154
|
-
|
|
84170
|
+
error2(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name);
|
|
84155
84171
|
} else if (helper & 524288 /* ClassPrivateFieldGet */) {
|
|
84156
84172
|
if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 3)) {
|
|
84157
|
-
|
|
84173
|
+
error2(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name, 4);
|
|
84158
84174
|
}
|
|
84159
84175
|
} else if (helper & 1048576 /* ClassPrivateFieldSet */) {
|
|
84160
84176
|
if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 4)) {
|
|
84161
|
-
|
|
84177
|
+
error2(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name, 5);
|
|
84162
84178
|
}
|
|
84163
84179
|
} else if (helper & 1024 /* SpreadArray */) {
|
|
84164
84180
|
if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 2)) {
|
|
84165
|
-
|
|
84181
|
+
error2(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name, 3);
|
|
84166
84182
|
}
|
|
84167
84183
|
}
|
|
84168
84184
|
}
|
|
@@ -84269,7 +84285,7 @@ ${lanes.join("\n")}
|
|
|
84269
84285
|
const sourceFile = getSourceFileOfNode(modifier);
|
|
84270
84286
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
84271
84287
|
addRelatedInfo(
|
|
84272
|
-
|
|
84288
|
+
error2(modifier, Diagnostics.Decorators_may_not_appear_after_export_or_export_default_if_they_also_appear_before_export),
|
|
84273
84289
|
createDiagnosticForNode(firstDecorator, Diagnostics.Decorator_used_before_export_here)
|
|
84274
84290
|
);
|
|
84275
84291
|
return true;
|
|
@@ -84662,12 +84678,12 @@ ${lanes.join("\n")}
|
|
|
84662
84678
|
if (length(nonSimpleParameters)) {
|
|
84663
84679
|
forEach(nonSimpleParameters, (parameter) => {
|
|
84664
84680
|
addRelatedInfo(
|
|
84665
|
-
|
|
84681
|
+
error2(parameter, Diagnostics.This_parameter_is_not_allowed_with_use_strict_directive),
|
|
84666
84682
|
createDiagnosticForNode(useStrictDirective, Diagnostics.use_strict_directive_used_here)
|
|
84667
84683
|
);
|
|
84668
84684
|
});
|
|
84669
84685
|
const diagnostics2 = nonSimpleParameters.map((parameter, index) => index === 0 ? createDiagnosticForNode(parameter, Diagnostics.Non_simple_parameter_declared_here) : createDiagnosticForNode(parameter, Diagnostics.and_here));
|
|
84670
|
-
addRelatedInfo(
|
|
84686
|
+
addRelatedInfo(error2(useStrictDirective, Diagnostics.use_strict_directive_cannot_be_used_with_non_simple_parameter_list), ...diagnostics2);
|
|
84671
84687
|
return true;
|
|
84672
84688
|
}
|
|
84673
84689
|
}
|
|
@@ -87574,13 +87590,13 @@ ${lanes.join("\n")}
|
|
|
87574
87590
|
let sourceLine = 0;
|
|
87575
87591
|
let sourceCharacter = 0;
|
|
87576
87592
|
let nameIndex = 0;
|
|
87577
|
-
let
|
|
87593
|
+
let error2;
|
|
87578
87594
|
return {
|
|
87579
87595
|
get pos() {
|
|
87580
87596
|
return pos;
|
|
87581
87597
|
},
|
|
87582
87598
|
get error() {
|
|
87583
|
-
return
|
|
87599
|
+
return error2;
|
|
87584
87600
|
},
|
|
87585
87601
|
get state() {
|
|
87586
87602
|
return captureMapping(
|
|
@@ -87665,8 +87681,8 @@ ${lanes.join("\n")}
|
|
|
87665
87681
|
return { value: void 0, done: true };
|
|
87666
87682
|
}
|
|
87667
87683
|
function setError(message) {
|
|
87668
|
-
if (
|
|
87669
|
-
|
|
87684
|
+
if (error2 === void 0) {
|
|
87685
|
+
error2 = message;
|
|
87670
87686
|
}
|
|
87671
87687
|
}
|
|
87672
87688
|
function setErrorAndStopIterating(message) {
|
|
@@ -87674,7 +87690,7 @@ ${lanes.join("\n")}
|
|
|
87674
87690
|
return stopIterating();
|
|
87675
87691
|
}
|
|
87676
87692
|
function hasReportedError() {
|
|
87677
|
-
return
|
|
87693
|
+
return error2 !== void 0;
|
|
87678
87694
|
}
|
|
87679
87695
|
function isSourceMappingSegmentEnd() {
|
|
87680
87696
|
return pos === mappings.length || mappings.charCodeAt(pos) === 44 /* comma */ || mappings.charCodeAt(pos) === 59 /* semicolon */;
|
|
@@ -110087,15 +110103,6 @@ ${lanes.join("\n")}
|
|
|
110087
110103
|
getDeclarationEmitExtensionForPath(inputFileName)
|
|
110088
110104
|
);
|
|
110089
110105
|
}
|
|
110090
|
-
function getOutputDeclarationFileNameWithoutConfigFile(inputFileName, options, ignoreCase, currentDirectory, getCommonSourceDirectory2) {
|
|
110091
|
-
const directory = options.declarationDir || options.outDir ? getNormalizedAbsolutePath(options.declarationDir || options.outDir, currentDirectory) : void 0;
|
|
110092
|
-
const outputPathWithoutChangedExtension = directory ? resolvePath(directory, getRelativePathFromDirectory(getCommonSourceDirectory2(), inputFileName, ignoreCase)) : inputFileName;
|
|
110093
|
-
const outputFileName = changeExtension(
|
|
110094
|
-
outputPathWithoutChangedExtension,
|
|
110095
|
-
getDeclarationEmitExtensionForPath(inputFileName)
|
|
110096
|
-
);
|
|
110097
|
-
return outputFileName;
|
|
110098
|
-
}
|
|
110099
110106
|
function getOutputJSFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory2) {
|
|
110100
110107
|
if (configFile.options.emitDeclarationOnly)
|
|
110101
110108
|
return void 0;
|
|
@@ -110106,18 +110113,6 @@ ${lanes.join("\n")}
|
|
|
110106
110113
|
);
|
|
110107
110114
|
return !isJsonFile || comparePaths(inputFileName, outputFileName, Debug.checkDefined(configFile.options.configFilePath), ignoreCase) !== 0 /* EqualTo */ ? outputFileName : void 0;
|
|
110108
110115
|
}
|
|
110109
|
-
function getOutputJSFileNameWithoutConfigFile(inputFileName, options, ignoreCase, currentDirectory, getCommonSourceDirectory2) {
|
|
110110
|
-
if (options.emitDeclarationOnly)
|
|
110111
|
-
return void 0;
|
|
110112
|
-
const isJsonFile = fileExtensionIs(inputFileName, ".json" /* Json */);
|
|
110113
|
-
const outDir = options.outDir ? getNormalizedAbsolutePath(options.outDir, currentDirectory) : void 0;
|
|
110114
|
-
const outputPathWithoutChangedExtension = outDir ? resolvePath(outDir, getRelativePathFromDirectory(getCommonSourceDirectory2(), inputFileName, ignoreCase)) : inputFileName;
|
|
110115
|
-
const outputFileName = changeExtension(
|
|
110116
|
-
outputPathWithoutChangedExtension,
|
|
110117
|
-
getOutputExtension(inputFileName, options)
|
|
110118
|
-
);
|
|
110119
|
-
return !isJsonFile || !options.configFilePath || comparePaths(inputFileName, outputFileName, options.configFilePath, ignoreCase) !== 0 /* EqualTo */ ? outputFileName : void 0;
|
|
110120
|
-
}
|
|
110121
110116
|
function createAddOutput() {
|
|
110122
110117
|
let outputs;
|
|
110123
110118
|
return { addOutput, getOutputs };
|
|
@@ -116648,15 +116643,6 @@ ${lanes.join("\n")}
|
|
|
116648
116643
|
return { impliedNodeFormat, packageJsonLocations, packageJsonScope };
|
|
116649
116644
|
}
|
|
116650
116645
|
}
|
|
116651
|
-
function moduleFormatNeedsPackageJsonLookup(fileName, options) {
|
|
116652
|
-
switch (getEmitModuleResolutionKind(options)) {
|
|
116653
|
-
case 3 /* Node16 */:
|
|
116654
|
-
case 99 /* NodeNext */:
|
|
116655
|
-
return fileExtensionIsOneOf(fileName, [".d.ts" /* Dts */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".js" /* Js */, ".jsx" /* Jsx */]);
|
|
116656
|
-
default:
|
|
116657
|
-
return false;
|
|
116658
|
-
}
|
|
116659
|
-
}
|
|
116660
116646
|
function shouldProgramCreateNewSourceFiles(program, newOptions) {
|
|
116661
116647
|
if (!program)
|
|
116662
116648
|
return false;
|
|
@@ -116683,7 +116669,6 @@ ${lanes.join("\n")}
|
|
|
116683
116669
|
let files;
|
|
116684
116670
|
let symlinks;
|
|
116685
116671
|
let commonSourceDirectory;
|
|
116686
|
-
let assumedCommonSourceDirectory;
|
|
116687
116672
|
let typeChecker;
|
|
116688
116673
|
let classifiableNames;
|
|
116689
116674
|
const ambientModuleNameToUnmodifiedFileName = /* @__PURE__ */ new Map();
|
|
@@ -117175,9 +117160,6 @@ ${lanes.join("\n")}
|
|
|
117175
117160
|
}
|
|
117176
117161
|
return commonSourceDirectory;
|
|
117177
117162
|
}
|
|
117178
|
-
function getAssumedCommonSourceDirectory() {
|
|
117179
|
-
return commonSourceDirectory ?? (assumedCommonSourceDirectory ?? (assumedCommonSourceDirectory = getCommonSourceDirectory(options, () => rootNames, host.getCurrentDirectory(), getCanonicalFileName)));
|
|
117180
|
-
}
|
|
117181
117163
|
function getClassifiableNames() {
|
|
117182
117164
|
var _a2;
|
|
117183
117165
|
if (!classifiableNames) {
|
|
@@ -117401,20 +117383,20 @@ ${lanes.join("\n")}
|
|
|
117401
117383
|
})(SeenPackageName || (SeenPackageName = {}));
|
|
117402
117384
|
const seenPackageNames = /* @__PURE__ */ new Map();
|
|
117403
117385
|
for (const oldSourceFile of oldSourceFiles) {
|
|
117404
|
-
const sourceFileOptions = getCreateSourceFileOptions(oldSourceFile.fileName);
|
|
117386
|
+
const sourceFileOptions = getCreateSourceFileOptions(oldSourceFile.fileName, moduleResolutionCache, host, options);
|
|
117405
117387
|
let newSourceFile = host.getSourceFileByPath ? host.getSourceFileByPath(
|
|
117406
117388
|
oldSourceFile.fileName,
|
|
117407
117389
|
oldSourceFile.resolvedPath,
|
|
117408
117390
|
sourceFileOptions,
|
|
117409
117391
|
/*onError*/
|
|
117410
117392
|
void 0,
|
|
117411
|
-
shouldCreateNewSourceFile
|
|
117393
|
+
shouldCreateNewSourceFile
|
|
117412
117394
|
) : host.getSourceFile(
|
|
117413
117395
|
oldSourceFile.fileName,
|
|
117414
117396
|
sourceFileOptions,
|
|
117415
117397
|
/*onError*/
|
|
117416
117398
|
void 0,
|
|
117417
|
-
shouldCreateNewSourceFile
|
|
117399
|
+
shouldCreateNewSourceFile
|
|
117418
117400
|
);
|
|
117419
117401
|
if (!newSourceFile) {
|
|
117420
117402
|
return 0 /* Not */;
|
|
@@ -118363,52 +118345,14 @@ ${lanes.join("\n")}
|
|
|
118363
118345
|
(_b2 = tracing) == null ? void 0 : _b2.pop();
|
|
118364
118346
|
return result;
|
|
118365
118347
|
}
|
|
118366
|
-
function
|
|
118367
|
-
|
|
118368
|
-
|
|
118369
|
-
|
|
118370
|
-
if (projectReference) {
|
|
118371
|
-
Debug.assert(useSourceOfProjectReferenceRedirect);
|
|
118372
|
-
fileNameForModuleFormatDetection = getOutputDeclarationFileName(
|
|
118373
|
-
fileNameForModuleFormatDetection,
|
|
118374
|
-
projectReference.commandLine,
|
|
118375
|
-
!host.useCaseSensitiveFileNames()
|
|
118376
|
-
) || getOutputJSFileName(
|
|
118377
|
-
fileNameForModuleFormatDetection,
|
|
118378
|
-
projectReference.commandLine,
|
|
118379
|
-
!host.useCaseSensitiveFileNames()
|
|
118380
|
-
) || fileNameForModuleFormatDetection;
|
|
118381
|
-
} else {
|
|
118382
|
-
fileNameForModuleFormatDetection = getOutputDeclarationFileNameWithoutConfigFile(
|
|
118383
|
-
fileNameForModuleFormatDetection,
|
|
118384
|
-
options,
|
|
118385
|
-
!host.useCaseSensitiveFileNames(),
|
|
118386
|
-
currentDirectory,
|
|
118387
|
-
getAssumedCommonSourceDirectory
|
|
118388
|
-
) || getOutputJSFileNameWithoutConfigFile(
|
|
118389
|
-
fileNameForModuleFormatDetection,
|
|
118390
|
-
options,
|
|
118391
|
-
!host.useCaseSensitiveFileNames(),
|
|
118392
|
-
currentDirectory,
|
|
118393
|
-
getAssumedCommonSourceDirectory
|
|
118394
|
-
) || fileNameForModuleFormatDetection;
|
|
118395
|
-
}
|
|
118396
|
-
}
|
|
118397
|
-
return getImpliedNodeFormatForFileWorker(
|
|
118398
|
-
fileNameForModuleFormatDetection,
|
|
118399
|
-
moduleResolutionCache == null ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(),
|
|
118400
|
-
host,
|
|
118401
|
-
options
|
|
118402
|
-
);
|
|
118403
|
-
}
|
|
118404
|
-
function getCreateSourceFileOptions(fileName) {
|
|
118405
|
-
const result = getImpliedNodeFormatForFile2(fileName);
|
|
118406
|
-
const languageVersion = getEmitScriptTarget(options);
|
|
118407
|
-
const setExternalModuleIndicator2 = getSetExternalModuleIndicator(options);
|
|
118348
|
+
function getCreateSourceFileOptions(fileName, moduleResolutionCache2, host2, options2) {
|
|
118349
|
+
const result = getImpliedNodeFormatForFileWorker(getNormalizedAbsolutePath(fileName, currentDirectory), moduleResolutionCache2 == null ? void 0 : moduleResolutionCache2.getPackageJsonInfoCache(), host2, options2);
|
|
118350
|
+
const languageVersion = getEmitScriptTarget(options2);
|
|
118351
|
+
const setExternalModuleIndicator2 = getSetExternalModuleIndicator(options2);
|
|
118408
118352
|
return typeof result === "object" ? { ...result, languageVersion, setExternalModuleIndicator: setExternalModuleIndicator2 } : { languageVersion, impliedNodeFormat: result, setExternalModuleIndicator: setExternalModuleIndicator2 };
|
|
118409
118353
|
}
|
|
118410
118354
|
function findSourceFileWorker(fileName, isDefaultLib, ignoreNoDefaultLib, reason, packageId) {
|
|
118411
|
-
var _a2
|
|
118355
|
+
var _a2;
|
|
118412
118356
|
const path = toPath3(fileName);
|
|
118413
118357
|
if (useSourceOfProjectReferenceRedirect) {
|
|
118414
118358
|
let source = getSourceOfProjectReferenceRedirect(path);
|
|
@@ -118476,7 +118420,7 @@ ${lanes.join("\n")}
|
|
|
118476
118420
|
redirectedPath = toPath3(redirect);
|
|
118477
118421
|
}
|
|
118478
118422
|
}
|
|
118479
|
-
const sourceFileOptions = getCreateSourceFileOptions(fileName);
|
|
118423
|
+
const sourceFileOptions = getCreateSourceFileOptions(fileName, moduleResolutionCache, host, options);
|
|
118480
118424
|
const file = host.getSourceFile(
|
|
118481
118425
|
fileName,
|
|
118482
118426
|
sourceFileOptions,
|
|
@@ -118487,7 +118431,7 @@ ${lanes.join("\n")}
|
|
|
118487
118431
|
Diagnostics.Cannot_read_file_0_Colon_1,
|
|
118488
118432
|
[fileName, hostErrorMessage]
|
|
118489
118433
|
),
|
|
118490
|
-
shouldCreateNewSourceFile
|
|
118434
|
+
shouldCreateNewSourceFile
|
|
118491
118435
|
);
|
|
118492
118436
|
if (packageId) {
|
|
118493
118437
|
const packageIdKey = packageIdToString(packageId);
|
|
@@ -118512,7 +118456,7 @@ ${lanes.join("\n")}
|
|
|
118512
118456
|
file.path = path;
|
|
118513
118457
|
file.resolvedPath = toPath3(fileName);
|
|
118514
118458
|
file.originalFileName = originalFileName;
|
|
118515
|
-
file.packageJsonLocations = ((
|
|
118459
|
+
file.packageJsonLocations = ((_a2 = sourceFileOptions.packageJsonLocations) == null ? void 0 : _a2.length) ? sourceFileOptions.packageJsonLocations : void 0;
|
|
118516
118460
|
file.packageJsonScope = sourceFileOptions.packageJsonScope;
|
|
118517
118461
|
addFileIncludeReason(file, reason);
|
|
118518
118462
|
if (host.useCaseSensitiveFileNames()) {
|
|
@@ -119099,9 +119043,6 @@ ${lanes.join("\n")}
|
|
|
119099
119043
|
createDiagnosticForOptionName(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files, "outDir");
|
|
119100
119044
|
}
|
|
119101
119045
|
}
|
|
119102
|
-
if (assumedCommonSourceDirectory && assumedCommonSourceDirectory !== getCommonSourceDirectory2()) {
|
|
119103
|
-
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.The_project_root_is_ambiguous_but_is_required_to_determine_the_module_format_of_output_js_files_Supply_the_rootDir_compiler_option_to_disambiguate));
|
|
119104
|
-
}
|
|
119105
119046
|
if (options.useDefineForClassFields && languageVersion === 0 /* ES3 */) {
|
|
119106
119047
|
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_when_option_target_is_ES3, "useDefineForClassFields");
|
|
119107
119048
|
}
|
|
@@ -122922,17 +122863,17 @@ ${lanes.join("\n")}
|
|
|
122922
122863
|
function getWatchErrorSummaryDiagnosticMessage(errorCount) {
|
|
122923
122864
|
return errorCount === 1 ? Diagnostics.Found_1_error_Watching_for_file_changes : Diagnostics.Found_0_errors_Watching_for_file_changes;
|
|
122924
122865
|
}
|
|
122925
|
-
function prettyPathForFileError(
|
|
122926
|
-
const line = formatColorAndReset(":" +
|
|
122927
|
-
if (pathIsAbsolute(
|
|
122866
|
+
function prettyPathForFileError(error2, cwd) {
|
|
122867
|
+
const line = formatColorAndReset(":" + error2.line, "\x1B[90m" /* Grey */);
|
|
122868
|
+
if (pathIsAbsolute(error2.fileName) && pathIsAbsolute(cwd)) {
|
|
122928
122869
|
return getRelativePathFromDirectory(
|
|
122929
122870
|
cwd,
|
|
122930
|
-
|
|
122871
|
+
error2.fileName,
|
|
122931
122872
|
/*ignoreCase*/
|
|
122932
122873
|
false
|
|
122933
122874
|
) + line;
|
|
122934
122875
|
}
|
|
122935
|
-
return
|
|
122876
|
+
return error2.fileName + line;
|
|
122936
122877
|
}
|
|
122937
122878
|
function getErrorSummaryText(errorCount, filesInError, newLine, host) {
|
|
122938
122879
|
if (errorCount === 0)
|
|
@@ -123813,7 +123754,8 @@ ${lanes.join("\n")}
|
|
|
123813
123754
|
if (isFileMissingOnHost(hostSourceFile)) {
|
|
123814
123755
|
return void 0;
|
|
123815
123756
|
}
|
|
123816
|
-
|
|
123757
|
+
const impliedNodeFormat = typeof languageVersionOrOptions === "object" ? languageVersionOrOptions.impliedNodeFormat : void 0;
|
|
123758
|
+
if (hostSourceFile === void 0 || shouldCreateNewSourceFile || isFilePresenceUnknownOnHost(hostSourceFile) || hostSourceFile.sourceFile.impliedNodeFormat !== impliedNodeFormat) {
|
|
123817
123759
|
const sourceFile = getNewSourceFile(fileName, languageVersionOrOptions, onError);
|
|
123818
123760
|
if (hostSourceFile) {
|
|
123819
123761
|
if (sourceFile) {
|
|
@@ -131773,13 +131715,6 @@ ${lanes.join("\n")}
|
|
|
131773
131715
|
}
|
|
131774
131716
|
}
|
|
131775
131717
|
}
|
|
131776
|
-
function getLanguageServiceRefCounts(path, scriptKind) {
|
|
131777
|
-
return arrayFrom(buckets.entries(), ([key, bucket]) => {
|
|
131778
|
-
const bucketEntry = bucket.get(path);
|
|
131779
|
-
const entry = bucketEntry && getDocumentRegistryEntry(bucketEntry, scriptKind);
|
|
131780
|
-
return [key, entry && entry.languageServiceRefCount];
|
|
131781
|
-
});
|
|
131782
|
-
}
|
|
131783
131718
|
return {
|
|
131784
131719
|
acquireDocument,
|
|
131785
131720
|
acquireDocumentWithKey,
|
|
@@ -131787,9 +131722,10 @@ ${lanes.join("\n")}
|
|
|
131787
131722
|
updateDocumentWithKey,
|
|
131788
131723
|
releaseDocument,
|
|
131789
131724
|
releaseDocumentWithKey,
|
|
131790
|
-
|
|
131725
|
+
getKeyForCompilationSettings,
|
|
131726
|
+
getDocumentRegistryBucketKeyWithMode,
|
|
131791
131727
|
reportStats,
|
|
131792
|
-
|
|
131728
|
+
getBuckets: () => buckets
|
|
131793
131729
|
};
|
|
131794
131730
|
}
|
|
131795
131731
|
function getKeyForCompilationSettings(settings) {
|
|
@@ -135028,6 +134964,9 @@ ${lanes.join("\n")}
|
|
|
135028
134964
|
});
|
|
135029
134965
|
|
|
135030
134966
|
// src/services/refactors/moveToFile.ts
|
|
134967
|
+
function error(notApplicableReason) {
|
|
134968
|
+
return { edits: [], renameFilename: void 0, renameLocation: void 0, notApplicableReason };
|
|
134969
|
+
}
|
|
135031
134970
|
function doChange4(context, oldFile, targetFile, program, toMove, changes, host, preferences) {
|
|
135032
134971
|
const checker = program.getTypeChecker();
|
|
135033
134972
|
const usage = getUsageInfo(oldFile, toMove.all, checker);
|
|
@@ -135910,13 +135849,17 @@ ${lanes.join("\n")}
|
|
|
135910
135849
|
getEditsForAction: function getRefactorEditsToMoveToFile(context, actionName2, interactiveRefactorArguments) {
|
|
135911
135850
|
Debug.assert(actionName2 === refactorNameForMoveToFile, "Wrong refactor invoked");
|
|
135912
135851
|
const statements = Debug.checkDefined(getStatementsToMove(context));
|
|
135852
|
+
const { host, program } = context;
|
|
135913
135853
|
Debug.assert(interactiveRefactorArguments, "No interactive refactor arguments available");
|
|
135914
135854
|
const targetFile = interactiveRefactorArguments.targetFile;
|
|
135915
135855
|
if (hasJSFileExtension(targetFile) || hasTSFileExtension(targetFile)) {
|
|
135916
|
-
|
|
135856
|
+
if (host.fileExists(targetFile) && program.getSourceFile(targetFile) === void 0) {
|
|
135857
|
+
return error(getLocaleSpecificMessage(Diagnostics.Cannot_move_statements_to_the_selected_file));
|
|
135858
|
+
}
|
|
135859
|
+
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange4(context, context.file, interactiveRefactorArguments.targetFile, program, statements, t, context.host, context.preferences));
|
|
135917
135860
|
return { edits, renameFilename: void 0, renameLocation: void 0 };
|
|
135918
135861
|
}
|
|
135919
|
-
return
|
|
135862
|
+
return error(getLocaleSpecificMessage(Diagnostics.Cannot_move_to_file_selected_file_is_invalid));
|
|
135920
135863
|
}
|
|
135921
135864
|
});
|
|
135922
135865
|
}
|
|
@@ -136297,25 +136240,25 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
136297
136240
|
const possibleActions = [];
|
|
136298
136241
|
const errors = [];
|
|
136299
136242
|
if (refactorKindBeginsWith(toNamedFunctionAction.kind, kind)) {
|
|
136300
|
-
const
|
|
136301
|
-
if (
|
|
136302
|
-
errors.push({ ...toNamedFunctionAction, notApplicableReason:
|
|
136243
|
+
const error2 = selectedVariableDeclaration || isArrowFunction(func) && isVariableDeclaration(func.parent) ? void 0 : getLocaleSpecificMessage(Diagnostics.Could_not_convert_to_named_function);
|
|
136244
|
+
if (error2) {
|
|
136245
|
+
errors.push({ ...toNamedFunctionAction, notApplicableReason: error2 });
|
|
136303
136246
|
} else {
|
|
136304
136247
|
possibleActions.push(toNamedFunctionAction);
|
|
136305
136248
|
}
|
|
136306
136249
|
}
|
|
136307
136250
|
if (refactorKindBeginsWith(toAnonymousFunctionAction.kind, kind)) {
|
|
136308
|
-
const
|
|
136309
|
-
if (
|
|
136310
|
-
errors.push({ ...toAnonymousFunctionAction, notApplicableReason:
|
|
136251
|
+
const error2 = !selectedVariableDeclaration && isArrowFunction(func) ? void 0 : getLocaleSpecificMessage(Diagnostics.Could_not_convert_to_anonymous_function);
|
|
136252
|
+
if (error2) {
|
|
136253
|
+
errors.push({ ...toAnonymousFunctionAction, notApplicableReason: error2 });
|
|
136311
136254
|
} else {
|
|
136312
136255
|
possibleActions.push(toAnonymousFunctionAction);
|
|
136313
136256
|
}
|
|
136314
136257
|
}
|
|
136315
136258
|
if (refactorKindBeginsWith(toArrowFunctionAction.kind, kind)) {
|
|
136316
|
-
const
|
|
136317
|
-
if (
|
|
136318
|
-
errors.push({ ...toArrowFunctionAction, notApplicableReason:
|
|
136259
|
+
const error2 = isFunctionExpression(func) ? void 0 : getLocaleSpecificMessage(Diagnostics.Could_not_convert_to_arrow_function);
|
|
136260
|
+
if (error2) {
|
|
136261
|
+
errors.push({ ...toArrowFunctionAction, notApplicableReason: error2 });
|
|
136319
136262
|
} else {
|
|
136320
136263
|
possibleActions.push(toArrowFunctionAction);
|
|
136321
136264
|
}
|
|
@@ -137658,11 +137601,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
137658
137601
|
}
|
|
137659
137602
|
return infos.length ? infos : emptyArray;
|
|
137660
137603
|
function getStringError(errors) {
|
|
137661
|
-
let
|
|
137662
|
-
if (typeof
|
|
137663
|
-
|
|
137604
|
+
let error2 = errors[0].messageText;
|
|
137605
|
+
if (typeof error2 !== "string") {
|
|
137606
|
+
error2 = error2.messageText;
|
|
137664
137607
|
}
|
|
137665
|
-
return
|
|
137608
|
+
return error2;
|
|
137666
137609
|
}
|
|
137667
137610
|
}
|
|
137668
137611
|
function getRefactorEditsToExtractSymbol(context, actionName2) {
|
|
@@ -139906,9 +139849,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
139906
139849
|
function getValidSourceFile(fileName) {
|
|
139907
139850
|
const sourceFile = program.getSourceFile(fileName);
|
|
139908
139851
|
if (!sourceFile) {
|
|
139909
|
-
const
|
|
139910
|
-
|
|
139911
|
-
throw
|
|
139852
|
+
const error2 = new Error(`Could not find source file: '${fileName}'.`);
|
|
139853
|
+
error2.ProgramFiles = program.getSourceFiles().map((f) => f.fileName);
|
|
139854
|
+
throw error2;
|
|
139912
139855
|
}
|
|
139913
139856
|
return sourceFile;
|
|
139914
139857
|
}
|
|
@@ -140141,14 +140084,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
140141
140084
|
}
|
|
140142
140085
|
}
|
|
140143
140086
|
function cleanupSemanticCache() {
|
|
140144
|
-
program = void 0;
|
|
140145
|
-
}
|
|
140146
|
-
function dispose() {
|
|
140147
140087
|
if (program) {
|
|
140148
140088
|
const key = documentRegistry.getKeyForCompilationSettings(program.getCompilerOptions());
|
|
140149
140089
|
forEach(program.getSourceFiles(), (f) => documentRegistry.releaseDocumentWithKey(f.resolvedPath, key, f.scriptKind, f.impliedNodeFormat));
|
|
140150
140090
|
program = void 0;
|
|
140151
140091
|
}
|
|
140092
|
+
}
|
|
140093
|
+
function dispose() {
|
|
140094
|
+
cleanupSemanticCache();
|
|
140152
140095
|
host = void 0;
|
|
140153
140096
|
}
|
|
140154
140097
|
function getSyntacticDiagnostics(fileName) {
|
|
@@ -143804,9 +143747,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
143804
143747
|
return { fixName: fixName8, description: description3, changes, fixId: fixId52, fixAllDescription, commands: command ? [command] : void 0 };
|
|
143805
143748
|
}
|
|
143806
143749
|
function registerCodeFix(reg) {
|
|
143807
|
-
for (const
|
|
143750
|
+
for (const error2 of reg.errorCodes) {
|
|
143808
143751
|
errorCodeToFixesArray = void 0;
|
|
143809
|
-
errorCodeToFixes.add(String(
|
|
143752
|
+
errorCodeToFixes.add(String(error2), reg);
|
|
143810
143753
|
}
|
|
143811
143754
|
if (reg.fixIds) {
|
|
143812
143755
|
for (const fixId52 of reg.fixIds) {
|
|
@@ -154043,8 +153986,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154043
153986
|
return [createCodeFixAction(fixId48, changes, Diagnostics.Split_into_two_separate_import_declarations, fixId48, Diagnostics.Split_all_invalid_type_only_imports)];
|
|
154044
153987
|
}
|
|
154045
153988
|
},
|
|
154046
|
-
getAllCodeActions: (context) => codeFixAll(context, errorCodes60, (changes,
|
|
154047
|
-
splitTypeOnlyImport(changes, getImportDeclaration2(context.sourceFile,
|
|
153989
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes60, (changes, error2) => {
|
|
153990
|
+
splitTypeOnlyImport(changes, getImportDeclaration2(context.sourceFile, error2), context);
|
|
154048
153991
|
})
|
|
154049
153992
|
});
|
|
154050
153993
|
}
|
|
@@ -160704,7 +160647,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
160704
160647
|
}
|
|
160705
160648
|
Core2.someSignatureUsage = someSignatureUsage;
|
|
160706
160649
|
function getPossibleSymbolReferenceNodes(sourceFile, symbolName2, container = sourceFile) {
|
|
160707
|
-
return getPossibleSymbolReferencePositions(sourceFile, symbolName2, container)
|
|
160650
|
+
return mapDefined(getPossibleSymbolReferencePositions(sourceFile, symbolName2, container), (pos) => {
|
|
160651
|
+
const referenceLocation = getTouchingPropertyName(sourceFile, pos);
|
|
160652
|
+
return referenceLocation === sourceFile ? void 0 : referenceLocation;
|
|
160653
|
+
});
|
|
160708
160654
|
}
|
|
160709
160655
|
function getPossibleSymbolReferencePositions(sourceFile, symbolName2, container = sourceFile) {
|
|
160710
160656
|
const positions = [];
|
|
@@ -162841,7 +162787,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
162841
162787
|
if (length(oldImportDecls) === 0) {
|
|
162842
162788
|
return;
|
|
162843
162789
|
}
|
|
162844
|
-
|
|
162790
|
+
setEmitFlags(oldImportDecls[0], 1024 /* NoLeadingComments */);
|
|
162845
162791
|
const oldImportGroups = shouldCombine ? group(oldImportDecls, (importDecl) => getExternalModuleName2(importDecl.moduleSpecifier)) : [oldImportDecls];
|
|
162846
162792
|
const sortedImportGroups = shouldSort ? stableSort(oldImportGroups, (group1, group2) => compareModuleSpecifiersWorker(group1[0].moduleSpecifier, group2[0].moduleSpecifier, comparer)) : oldImportGroups;
|
|
162847
162793
|
const newImportDecls = flatMap(sortedImportGroups, (importGroup) => getExternalModuleName2(importGroup[0].moduleSpecifier) || importGroup[0].moduleSpecifier === void 0 ? coalesce(importGroup) : importGroup);
|
|
@@ -168053,11 +167999,11 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
168053
167999
|
if (index >= sorted.length) {
|
|
168054
168000
|
return false;
|
|
168055
168001
|
}
|
|
168056
|
-
const
|
|
168057
|
-
if (r.end <=
|
|
168002
|
+
const error2 = sorted[index];
|
|
168003
|
+
if (r.end <= error2.start) {
|
|
168058
168004
|
return false;
|
|
168059
168005
|
}
|
|
168060
|
-
if (startEndOverlapsWithStartEnd(r.pos, r.end,
|
|
168006
|
+
if (startEndOverlapsWithStartEnd(r.pos, r.end, error2.start, error2.start + error2.length)) {
|
|
168061
168007
|
return true;
|
|
168062
168008
|
}
|
|
168063
168009
|
index++;
|
|
@@ -169578,11 +169524,11 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
169578
169524
|
function getTypeScriptVersion() {
|
|
169579
169525
|
return typeScriptVersion2 ?? (typeScriptVersion2 = new Version(version));
|
|
169580
169526
|
}
|
|
169581
|
-
function formatDeprecationMessage(name,
|
|
169582
|
-
let deprecationMessage =
|
|
169527
|
+
function formatDeprecationMessage(name, error2, errorAfter, since, message) {
|
|
169528
|
+
let deprecationMessage = error2 ? "DeprecationError: " : "DeprecationWarning: ";
|
|
169583
169529
|
deprecationMessage += `'${name}' `;
|
|
169584
169530
|
deprecationMessage += since ? `has been deprecated since v${since}` : "is deprecated";
|
|
169585
|
-
deprecationMessage +=
|
|
169531
|
+
deprecationMessage += error2 ? " and can no longer be used." : errorAfter ? ` and will no longer be usable after v${errorAfter}.` : ".";
|
|
169586
169532
|
deprecationMessage += message ? ` ${formatStringFromArgs(message, [name], 0)}` : "";
|
|
169587
169533
|
return deprecationMessage;
|
|
169588
169534
|
}
|
|
@@ -169620,9 +169566,9 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
169620
169566
|
const errorAfter = typeof options.errorAfter === "string" ? new Version(options.errorAfter) : options.errorAfter;
|
|
169621
169567
|
const warnAfter = typeof options.warnAfter === "string" ? new Version(options.warnAfter) : options.warnAfter;
|
|
169622
169568
|
const since = typeof options.since === "string" ? new Version(options.since) : options.since ?? warnAfter;
|
|
169623
|
-
const
|
|
169569
|
+
const error2 = options.error || errorAfter && version2.compareTo(errorAfter) >= 0;
|
|
169624
169570
|
const warn = !warnAfter || version2.compareTo(warnAfter) >= 0;
|
|
169625
|
-
return
|
|
169571
|
+
return error2 ? createErrorDeprecation(name, errorAfter, since, options.message) : warn ? createWarningDeprecation(name, errorAfter, since, options.message) : noop;
|
|
169626
169572
|
}
|
|
169627
169573
|
function wrapFunction(deprecation, func) {
|
|
169628
169574
|
return function() {
|
|
@@ -171811,6 +171757,16 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
171811
171757
|
true
|
|
171812
171758
|
);
|
|
171813
171759
|
}
|
|
171760
|
+
/** @internal */
|
|
171761
|
+
cleanupProgram() {
|
|
171762
|
+
if (this.program) {
|
|
171763
|
+
for (const f of this.program.getSourceFiles()) {
|
|
171764
|
+
this.detachScriptInfoIfNotRoot(f.fileName);
|
|
171765
|
+
}
|
|
171766
|
+
this.program.forEachResolvedProjectReference((ref) => this.detachScriptInfoFromProject(ref.sourceFile.fileName));
|
|
171767
|
+
this.program = void 0;
|
|
171768
|
+
}
|
|
171769
|
+
}
|
|
171814
171770
|
disableLanguageService(lastFileExceededProgramSize) {
|
|
171815
171771
|
if (!this.languageServiceEnabled) {
|
|
171816
171772
|
return;
|
|
@@ -171818,6 +171774,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
171818
171774
|
Debug.assert(this.projectService.serverMode !== 2 /* Syntactic */);
|
|
171819
171775
|
this.languageService.cleanupSemanticCache();
|
|
171820
171776
|
this.languageServiceEnabled = false;
|
|
171777
|
+
this.cleanupProgram();
|
|
171821
171778
|
this.lastFileExceededProgramSize = lastFileExceededProgramSize;
|
|
171822
171779
|
this.builderState = void 0;
|
|
171823
171780
|
if (this.autoImportProviderHost) {
|
|
@@ -171826,6 +171783,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
171826
171783
|
this.autoImportProviderHost = void 0;
|
|
171827
171784
|
this.resolutionCache.closeTypeRootsWatch();
|
|
171828
171785
|
this.clearGeneratedFileWatch();
|
|
171786
|
+
this.projectService.verifyDocumentRegistry();
|
|
171829
171787
|
this.projectService.onUpdateLanguageServiceStateForProject(
|
|
171830
171788
|
this,
|
|
171831
171789
|
/*languageServiceEnabled*/
|
|
@@ -171869,12 +171827,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
171869
171827
|
close() {
|
|
171870
171828
|
this.projectService.typingsCache.onProjectClosed(this);
|
|
171871
171829
|
this.closeWatchingTypingLocations();
|
|
171872
|
-
|
|
171873
|
-
for (const f of this.program.getSourceFiles()) {
|
|
171874
|
-
this.detachScriptInfoIfNotRoot(f.fileName);
|
|
171875
|
-
}
|
|
171876
|
-
this.program.forEachResolvedProjectReference((ref) => this.detachScriptInfoFromProject(ref.sourceFile.fileName));
|
|
171877
|
-
}
|
|
171830
|
+
this.cleanupProgram();
|
|
171878
171831
|
forEach(this.externalFiles, (externalFile) => this.detachScriptInfoIfNotRoot(externalFile));
|
|
171879
171832
|
for (const root of this.rootFiles) {
|
|
171880
171833
|
root.detachFromProject(this);
|
|
@@ -172252,6 +172205,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
172252
172205
|
updateGraphWorker() {
|
|
172253
172206
|
var _a, _b;
|
|
172254
172207
|
const oldProgram = this.languageService.getCurrentProgram();
|
|
172208
|
+
Debug.assert(oldProgram === this.program);
|
|
172255
172209
|
Debug.assert(!this.isClosed(), "Called update graph worker of closed project");
|
|
172256
172210
|
this.writeLog(`Starting updateGraphWorker: Project: ${this.getProjectName()}`);
|
|
172257
172211
|
const start = timestamp();
|
|
@@ -172382,6 +172336,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
172382
172336
|
} else if (this.program !== oldProgram) {
|
|
172383
172337
|
this.writeLog(`Different program with same set of files`);
|
|
172384
172338
|
}
|
|
172339
|
+
this.projectService.verifyDocumentRegistry();
|
|
172385
172340
|
return hasNewProgram;
|
|
172386
172341
|
}
|
|
172387
172342
|
/** @internal */
|
|
@@ -173004,7 +172959,6 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
173004
172959
|
isOrphan() {
|
|
173005
172960
|
return true;
|
|
173006
172961
|
}
|
|
173007
|
-
/** @internal */
|
|
173008
172962
|
scheduleInvalidateResolutionsOfFailedLookupLocations() {
|
|
173009
172963
|
return;
|
|
173010
172964
|
}
|
|
@@ -173910,6 +173864,9 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
173910
173864
|
this.sharedExtendedConfigFileWatchers = /* @__PURE__ */ new Map();
|
|
173911
173865
|
/** @internal */
|
|
173912
173866
|
this.extendedConfigCache = /* @__PURE__ */ new Map();
|
|
173867
|
+
/** @internal */
|
|
173868
|
+
this.verifyDocumentRegistry = noop;
|
|
173869
|
+
var _a;
|
|
173913
173870
|
this.host = opts.host;
|
|
173914
173871
|
this.logger = opts.logger;
|
|
173915
173872
|
this.cancellationToken = opts.cancellationToken;
|
|
@@ -173957,6 +173914,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
173957
173914
|
watchFile: returnNoopFileWatcher,
|
|
173958
173915
|
watchDirectory: returnNoopFileWatcher
|
|
173959
173916
|
} : getWatchFactory(this.host, watchLogLevel, log, getDetailWatchInfo);
|
|
173917
|
+
(_a = opts.incrementalVerifier) == null ? void 0 : _a.call(opts, this);
|
|
173960
173918
|
}
|
|
173961
173919
|
toPath(fileName) {
|
|
173962
173920
|
return toPath(fileName, this.currentDirectory, this.toCanonicalFileName);
|
|
@@ -175285,6 +175243,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
175285
175243
|
/*ensureSynchronized*/
|
|
175286
175244
|
false
|
|
175287
175245
|
).cleanupSemanticCache();
|
|
175246
|
+
project.cleanupProgram();
|
|
175288
175247
|
project.markAsDirty();
|
|
175289
175248
|
}
|
|
175290
175249
|
sendConfigFileDiagEvent(project, triggerFile) {
|
|
@@ -178223,7 +178182,8 @@ ${json}${newLine}`;
|
|
|
178223
178182
|
allowLocalPluginLoads: opts.allowLocalPluginLoads,
|
|
178224
178183
|
typesMapLocation: opts.typesMapLocation,
|
|
178225
178184
|
serverMode: opts.serverMode,
|
|
178226
|
-
session: this
|
|
178185
|
+
session: this,
|
|
178186
|
+
incrementalVerifier: opts.incrementalVerifier
|
|
178227
178187
|
};
|
|
178228
178188
|
this.projectService = new ProjectService3(settings);
|
|
178229
178189
|
this.projectService.setPerformanceEventHandler(this.performanceEventHandler.bind(this));
|
|
@@ -178543,6 +178503,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
178543
178503
|
/*ensureSynchronized*/
|
|
178544
178504
|
false
|
|
178545
178505
|
).cleanupSemanticCache();
|
|
178506
|
+
p.cleanupProgram();
|
|
178546
178507
|
}
|
|
178547
178508
|
}
|
|
178548
178509
|
cleanup() {
|
|
@@ -181016,6 +180977,7 @@ ${e.message}`;
|
|
|
181016
180977
|
ActionWatchTypingLocations: () => ActionWatchTypingLocations,
|
|
181017
180978
|
Arguments: () => Arguments,
|
|
181018
180979
|
AutoImportProviderProject: () => AutoImportProviderProject,
|
|
180980
|
+
AuxiliaryProject: () => AuxiliaryProject,
|
|
181019
180981
|
CharRangeSection: () => CharRangeSection,
|
|
181020
180982
|
CommandNames: () => CommandNames,
|
|
181021
180983
|
ConfigFileDiagEvent: () => ConfigFileDiagEvent,
|
|
@@ -182006,11 +181968,8 @@ ${e.message}`;
|
|
|
182006
181968
|
getOriginalNodeId: () => getOriginalNodeId,
|
|
182007
181969
|
getOriginalSourceFile: () => getOriginalSourceFile,
|
|
182008
181970
|
getOutputDeclarationFileName: () => getOutputDeclarationFileName,
|
|
182009
|
-
getOutputDeclarationFileNameWithoutConfigFile: () => getOutputDeclarationFileNameWithoutConfigFile,
|
|
182010
181971
|
getOutputExtension: () => getOutputExtension,
|
|
182011
181972
|
getOutputFileNames: () => getOutputFileNames,
|
|
182012
|
-
getOutputJSFileName: () => getOutputJSFileName,
|
|
182013
|
-
getOutputJSFileNameWithoutConfigFile: () => getOutputJSFileNameWithoutConfigFile,
|
|
182014
181973
|
getOutputPathsFor: () => getOutputPathsFor,
|
|
182015
181974
|
getOutputPathsForBundle: () => getOutputPathsForBundle,
|
|
182016
181975
|
getOwnEmitOutputFilePath: () => getOwnEmitOutputFilePath,
|
|
@@ -182375,6 +182334,7 @@ ${e.message}`;
|
|
|
182375
182334
|
isDiagnosticWithLocation: () => isDiagnosticWithLocation,
|
|
182376
182335
|
isDiskPathRoot: () => isDiskPathRoot,
|
|
182377
182336
|
isDoStatement: () => isDoStatement,
|
|
182337
|
+
isDocumentRegistryEntry: () => isDocumentRegistryEntry,
|
|
182378
182338
|
isDotDotDotToken: () => isDotDotDotToken,
|
|
182379
182339
|
isDottedName: () => isDottedName,
|
|
182380
182340
|
isDynamicName: () => isDynamicName,
|
|
@@ -183410,6 +183370,7 @@ ${e.message}`;
|
|
|
183410
183370
|
ActionWatchTypingLocations: () => ActionWatchTypingLocations,
|
|
183411
183371
|
Arguments: () => Arguments,
|
|
183412
183372
|
AutoImportProviderProject: () => AutoImportProviderProject,
|
|
183373
|
+
AuxiliaryProject: () => AuxiliaryProject,
|
|
183413
183374
|
CharRangeSection: () => CharRangeSection,
|
|
183414
183375
|
CommandNames: () => CommandNames,
|
|
183415
183376
|
ConfigFileDiagEvent: () => ConfigFileDiagEvent,
|
|
@@ -184388,11 +184349,8 @@ ${e.message}`;
|
|
|
184388
184349
|
getOriginalNodeId: () => getOriginalNodeId,
|
|
184389
184350
|
getOriginalSourceFile: () => getOriginalSourceFile,
|
|
184390
184351
|
getOutputDeclarationFileName: () => getOutputDeclarationFileName,
|
|
184391
|
-
getOutputDeclarationFileNameWithoutConfigFile: () => getOutputDeclarationFileNameWithoutConfigFile,
|
|
184392
184352
|
getOutputExtension: () => getOutputExtension,
|
|
184393
184353
|
getOutputFileNames: () => getOutputFileNames,
|
|
184394
|
-
getOutputJSFileName: () => getOutputJSFileName,
|
|
184395
|
-
getOutputJSFileNameWithoutConfigFile: () => getOutputJSFileNameWithoutConfigFile,
|
|
184396
184354
|
getOutputPathsFor: () => getOutputPathsFor,
|
|
184397
184355
|
getOutputPathsForBundle: () => getOutputPathsForBundle,
|
|
184398
184356
|
getOwnEmitOutputFilePath: () => getOwnEmitOutputFilePath,
|
|
@@ -184757,6 +184715,7 @@ ${e.message}`;
|
|
|
184757
184715
|
isDiagnosticWithLocation: () => isDiagnosticWithLocation,
|
|
184758
184716
|
isDiskPathRoot: () => isDiskPathRoot,
|
|
184759
184717
|
isDoStatement: () => isDoStatement,
|
|
184718
|
+
isDocumentRegistryEntry: () => isDocumentRegistryEntry,
|
|
184760
184719
|
isDotDotDotToken: () => isDotDotDotToken,
|
|
184761
184720
|
isDottedName: () => isDottedName,
|
|
184762
184721
|
isDynamicName: () => isDynamicName,
|