typescript 5.2.0-dev.20230605 → 5.2.0-dev.20230607
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tsc.js +72 -35
- package/lib/tsserver.js +679 -616
- package/lib/tsserverlibrary.js +678 -616
- package/lib/typescript.js +652 -608
- package/lib/typingsInstaller.js +27 -5
- 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-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20230607`;
|
|
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
|
};
|
|
@@ -9022,6 +9031,7 @@ ${lanes.join("\n")}
|
|
|
9022
9031
|
Use_import_type: diag(95180, 3 /* Message */, "Use_import_type_95180", "Use 'import type'"),
|
|
9023
9032
|
Use_type_0: diag(95181, 3 /* Message */, "Use_type_0_95181", "Use 'type {0}'"),
|
|
9024
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"),
|
|
9025
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."),
|
|
9026
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'."),
|
|
9027
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?"),
|
|
@@ -9340,9 +9350,9 @@ ${lanes.join("\n")}
|
|
|
9340
9350
|
}
|
|
9341
9351
|
return false;
|
|
9342
9352
|
}
|
|
9343
|
-
function scanConflictMarkerTrivia(text, pos,
|
|
9344
|
-
if (
|
|
9345
|
-
|
|
9353
|
+
function scanConflictMarkerTrivia(text, pos, error2) {
|
|
9354
|
+
if (error2) {
|
|
9355
|
+
error2(Diagnostics.Merge_conflict_marker_encountered, pos, mergeConflictMarkerLength);
|
|
9346
9356
|
}
|
|
9347
9357
|
const ch = text.charCodeAt(pos);
|
|
9348
9358
|
const len = text.length;
|
|
@@ -9638,7 +9648,7 @@ ${lanes.join("\n")}
|
|
|
9638
9648
|
});
|
|
9639
9649
|
}
|
|
9640
9650
|
return scanner2;
|
|
9641
|
-
function
|
|
9651
|
+
function error2(message, errPos = pos, length3, arg0) {
|
|
9642
9652
|
if (onError) {
|
|
9643
9653
|
const oldPos = pos;
|
|
9644
9654
|
pos = errPos;
|
|
@@ -9662,9 +9672,9 @@ ${lanes.join("\n")}
|
|
|
9662
9672
|
} else {
|
|
9663
9673
|
tokenFlags |= 16384 /* ContainsInvalidSeparator */;
|
|
9664
9674
|
if (isPreviousTokenSeparator) {
|
|
9665
|
-
|
|
9675
|
+
error2(Diagnostics.Multiple_consecutive_numeric_separators_are_not_permitted, pos, 1);
|
|
9666
9676
|
} else {
|
|
9667
|
-
|
|
9677
|
+
error2(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1);
|
|
9668
9678
|
}
|
|
9669
9679
|
}
|
|
9670
9680
|
pos++;
|
|
@@ -9681,7 +9691,7 @@ ${lanes.join("\n")}
|
|
|
9681
9691
|
}
|
|
9682
9692
|
if (text.charCodeAt(pos - 1) === 95 /* _ */) {
|
|
9683
9693
|
tokenFlags |= 16384 /* ContainsInvalidSeparator */;
|
|
9684
|
-
|
|
9694
|
+
error2(Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1);
|
|
9685
9695
|
}
|
|
9686
9696
|
return result + text.substring(start2, pos);
|
|
9687
9697
|
}
|
|
@@ -9692,7 +9702,7 @@ ${lanes.join("\n")}
|
|
|
9692
9702
|
pos++;
|
|
9693
9703
|
if (text.charCodeAt(pos) === 95 /* _ */) {
|
|
9694
9704
|
tokenFlags |= 512 /* ContainsSeparator */ | 16384 /* ContainsInvalidSeparator */;
|
|
9695
|
-
|
|
9705
|
+
error2(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1);
|
|
9696
9706
|
pos--;
|
|
9697
9707
|
mainFragment = scanNumberFragment();
|
|
9698
9708
|
} else if (!scanDigits()) {
|
|
@@ -9707,7 +9717,7 @@ ${lanes.join("\n")}
|
|
|
9707
9717
|
const literal = (withMinus ? "-" : "") + "0o" + (+tokenValue).toString(8);
|
|
9708
9718
|
if (withMinus)
|
|
9709
9719
|
start2--;
|
|
9710
|
-
|
|
9720
|
+
error2(Diagnostics.Octal_literals_are_not_allowed_Use_the_syntax_0, start2, pos - start2, literal);
|
|
9711
9721
|
return { type: 9 /* NumericLiteral */, value: tokenValue };
|
|
9712
9722
|
}
|
|
9713
9723
|
} else {
|
|
@@ -9728,7 +9738,7 @@ ${lanes.join("\n")}
|
|
|
9728
9738
|
const preNumericPart = pos;
|
|
9729
9739
|
const finalFragment = scanNumberFragment();
|
|
9730
9740
|
if (!finalFragment) {
|
|
9731
|
-
|
|
9741
|
+
error2(Diagnostics.Digit_expected);
|
|
9732
9742
|
} else {
|
|
9733
9743
|
scientificFragment = text.substring(end2, preNumericPart) + finalFragment;
|
|
9734
9744
|
end2 = pos;
|
|
@@ -9747,7 +9757,7 @@ ${lanes.join("\n")}
|
|
|
9747
9757
|
result = text.substring(start2, end2);
|
|
9748
9758
|
}
|
|
9749
9759
|
if (tokenFlags & 8192 /* ContainsLeadingZero */) {
|
|
9750
|
-
|
|
9760
|
+
error2(Diagnostics.Decimals_with_leading_zeros_are_not_allowed, start2, end2 - start2);
|
|
9751
9761
|
return { type: 9 /* NumericLiteral */, value: "" + +result };
|
|
9752
9762
|
}
|
|
9753
9763
|
if (decimalFragment !== void 0 || tokenFlags & 16 /* Scientific */) {
|
|
@@ -9772,12 +9782,12 @@ ${lanes.join("\n")}
|
|
|
9772
9782
|
const { length: length3 } = scanIdentifierParts();
|
|
9773
9783
|
if (length3 === 1 && text[identifierStart] === "n") {
|
|
9774
9784
|
if (isScientific) {
|
|
9775
|
-
|
|
9785
|
+
error2(Diagnostics.A_bigint_literal_cannot_use_exponential_notation, numericStart, identifierStart - numericStart + 1);
|
|
9776
9786
|
} else {
|
|
9777
|
-
|
|
9787
|
+
error2(Diagnostics.A_bigint_literal_must_be_an_integer, numericStart, identifierStart - numericStart + 1);
|
|
9778
9788
|
}
|
|
9779
9789
|
} else {
|
|
9780
|
-
|
|
9790
|
+
error2(Diagnostics.An_identifier_or_keyword_cannot_immediately_follow_a_numeric_literal, identifierStart, length3);
|
|
9781
9791
|
pos = identifierStart;
|
|
9782
9792
|
}
|
|
9783
9793
|
}
|
|
@@ -9824,9 +9834,9 @@ ${lanes.join("\n")}
|
|
|
9824
9834
|
allowSeparator = false;
|
|
9825
9835
|
isPreviousTokenSeparator = true;
|
|
9826
9836
|
} else if (isPreviousTokenSeparator) {
|
|
9827
|
-
|
|
9837
|
+
error2(Diagnostics.Multiple_consecutive_numeric_separators_are_not_permitted, pos, 1);
|
|
9828
9838
|
} else {
|
|
9829
|
-
|
|
9839
|
+
error2(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1);
|
|
9830
9840
|
}
|
|
9831
9841
|
pos++;
|
|
9832
9842
|
continue;
|
|
@@ -9845,7 +9855,7 @@ ${lanes.join("\n")}
|
|
|
9845
9855
|
valueChars = [];
|
|
9846
9856
|
}
|
|
9847
9857
|
if (text.charCodeAt(pos - 1) === 95 /* _ */) {
|
|
9848
|
-
|
|
9858
|
+
error2(Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1);
|
|
9849
9859
|
}
|
|
9850
9860
|
return String.fromCharCode(...valueChars);
|
|
9851
9861
|
}
|
|
@@ -9858,7 +9868,7 @@ ${lanes.join("\n")}
|
|
|
9858
9868
|
if (pos >= end) {
|
|
9859
9869
|
result += text.substring(start2, pos);
|
|
9860
9870
|
tokenFlags |= 4 /* Unterminated */;
|
|
9861
|
-
|
|
9871
|
+
error2(Diagnostics.Unterminated_string_literal);
|
|
9862
9872
|
break;
|
|
9863
9873
|
}
|
|
9864
9874
|
const ch = text.charCodeAt(pos);
|
|
@@ -9879,7 +9889,7 @@ ${lanes.join("\n")}
|
|
|
9879
9889
|
if (isLineBreak(ch) && !jsxAttributeString) {
|
|
9880
9890
|
result += text.substring(start2, pos);
|
|
9881
9891
|
tokenFlags |= 4 /* Unterminated */;
|
|
9882
|
-
|
|
9892
|
+
error2(Diagnostics.Unterminated_string_literal);
|
|
9883
9893
|
break;
|
|
9884
9894
|
}
|
|
9885
9895
|
pos++;
|
|
@@ -9896,7 +9906,7 @@ ${lanes.join("\n")}
|
|
|
9896
9906
|
if (pos >= end) {
|
|
9897
9907
|
contents += text.substring(start2, pos);
|
|
9898
9908
|
tokenFlags |= 4 /* Unterminated */;
|
|
9899
|
-
|
|
9909
|
+
error2(Diagnostics.Unterminated_template_literal);
|
|
9900
9910
|
resultingToken = startedWithBacktick ? 15 /* NoSubstitutionTemplateLiteral */ : 18 /* TemplateTail */;
|
|
9901
9911
|
break;
|
|
9902
9912
|
}
|
|
@@ -9939,7 +9949,7 @@ ${lanes.join("\n")}
|
|
|
9939
9949
|
const start2 = pos;
|
|
9940
9950
|
pos++;
|
|
9941
9951
|
if (pos >= end) {
|
|
9942
|
-
|
|
9952
|
+
error2(Diagnostics.Unexpected_end_of_text);
|
|
9943
9953
|
return "";
|
|
9944
9954
|
}
|
|
9945
9955
|
const ch = text.charCodeAt(pos);
|
|
@@ -9965,7 +9975,7 @@ ${lanes.join("\n")}
|
|
|
9965
9975
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
9966
9976
|
if (shouldEmitInvalidEscapeError) {
|
|
9967
9977
|
const code = parseInt(text.substring(start2 + 1, pos), 8);
|
|
9968
|
-
|
|
9978
|
+
error2(Diagnostics.Octal_escape_sequences_are_not_allowed_Use_the_syntax_0, start2, pos - start2, "\\x" + padLeft(code.toString(16), 2, "0"));
|
|
9969
9979
|
return String.fromCharCode(code);
|
|
9970
9980
|
}
|
|
9971
9981
|
return text.substring(start2, pos);
|
|
@@ -9973,7 +9983,7 @@ ${lanes.join("\n")}
|
|
|
9973
9983
|
case 57 /* _9 */:
|
|
9974
9984
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
9975
9985
|
if (shouldEmitInvalidEscapeError) {
|
|
9976
|
-
|
|
9986
|
+
error2(Diagnostics.Escape_sequence_0_is_not_allowed, start2, pos - start2, text.substring(start2, pos));
|
|
9977
9987
|
return String.fromCharCode(ch);
|
|
9978
9988
|
}
|
|
9979
9989
|
return text.substring(start2, pos);
|
|
@@ -10005,28 +10015,28 @@ ${lanes.join("\n")}
|
|
|
10005
10015
|
if (escapedValue < 0) {
|
|
10006
10016
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
10007
10017
|
if (shouldEmitInvalidEscapeError) {
|
|
10008
|
-
|
|
10018
|
+
error2(Diagnostics.Hexadecimal_digit_expected);
|
|
10009
10019
|
}
|
|
10010
10020
|
return text.substring(start2, pos);
|
|
10011
10021
|
}
|
|
10012
10022
|
if (!isCodePoint(escapedValue)) {
|
|
10013
10023
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
10014
10024
|
if (shouldEmitInvalidEscapeError) {
|
|
10015
|
-
|
|
10025
|
+
error2(Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive);
|
|
10016
10026
|
}
|
|
10017
10027
|
return text.substring(start2, pos);
|
|
10018
10028
|
}
|
|
10019
10029
|
if (pos >= end) {
|
|
10020
10030
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
10021
10031
|
if (shouldEmitInvalidEscapeError) {
|
|
10022
|
-
|
|
10032
|
+
error2(Diagnostics.Unexpected_end_of_text);
|
|
10023
10033
|
}
|
|
10024
10034
|
return text.substring(start2, pos);
|
|
10025
10035
|
}
|
|
10026
10036
|
if (text.charCodeAt(pos) !== 125 /* closeBrace */) {
|
|
10027
10037
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
10028
10038
|
if (shouldEmitInvalidEscapeError) {
|
|
10029
|
-
|
|
10039
|
+
error2(Diagnostics.Unterminated_Unicode_escape_sequence);
|
|
10030
10040
|
}
|
|
10031
10041
|
return text.substring(start2, pos);
|
|
10032
10042
|
}
|
|
@@ -10038,7 +10048,7 @@ ${lanes.join("\n")}
|
|
|
10038
10048
|
if (!(pos < end && isHexDigit(text.charCodeAt(pos)))) {
|
|
10039
10049
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
10040
10050
|
if (shouldEmitInvalidEscapeError) {
|
|
10041
|
-
|
|
10051
|
+
error2(Diagnostics.Hexadecimal_digit_expected);
|
|
10042
10052
|
}
|
|
10043
10053
|
return text.substring(start2, pos);
|
|
10044
10054
|
}
|
|
@@ -10050,7 +10060,7 @@ ${lanes.join("\n")}
|
|
|
10050
10060
|
if (!(pos < end && isHexDigit(text.charCodeAt(pos)))) {
|
|
10051
10061
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
10052
10062
|
if (shouldEmitInvalidEscapeError) {
|
|
10053
|
-
|
|
10063
|
+
error2(Diagnostics.Hexadecimal_digit_expected);
|
|
10054
10064
|
}
|
|
10055
10065
|
return text.substring(start2, pos);
|
|
10056
10066
|
}
|
|
@@ -10078,19 +10088,19 @@ ${lanes.join("\n")}
|
|
|
10078
10088
|
const escapedValue = escapedValueString ? parseInt(escapedValueString, 16) : -1;
|
|
10079
10089
|
let isInvalidExtendedEscape = false;
|
|
10080
10090
|
if (escapedValue < 0) {
|
|
10081
|
-
|
|
10091
|
+
error2(Diagnostics.Hexadecimal_digit_expected);
|
|
10082
10092
|
isInvalidExtendedEscape = true;
|
|
10083
10093
|
} else if (escapedValue > 1114111) {
|
|
10084
|
-
|
|
10094
|
+
error2(Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive);
|
|
10085
10095
|
isInvalidExtendedEscape = true;
|
|
10086
10096
|
}
|
|
10087
10097
|
if (pos >= end) {
|
|
10088
|
-
|
|
10098
|
+
error2(Diagnostics.Unexpected_end_of_text);
|
|
10089
10099
|
isInvalidExtendedEscape = true;
|
|
10090
10100
|
} else if (text.charCodeAt(pos) === 125 /* closeBrace */) {
|
|
10091
10101
|
pos++;
|
|
10092
10102
|
} else {
|
|
10093
|
-
|
|
10103
|
+
error2(Diagnostics.Unterminated_Unicode_escape_sequence);
|
|
10094
10104
|
isInvalidExtendedEscape = true;
|
|
10095
10105
|
}
|
|
10096
10106
|
if (isInvalidExtendedEscape) {
|
|
@@ -10184,9 +10194,9 @@ ${lanes.join("\n")}
|
|
|
10184
10194
|
separatorAllowed = false;
|
|
10185
10195
|
isPreviousTokenSeparator = true;
|
|
10186
10196
|
} else if (isPreviousTokenSeparator) {
|
|
10187
|
-
|
|
10197
|
+
error2(Diagnostics.Multiple_consecutive_numeric_separators_are_not_permitted, pos, 1);
|
|
10188
10198
|
} else {
|
|
10189
|
-
|
|
10199
|
+
error2(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1);
|
|
10190
10200
|
}
|
|
10191
10201
|
pos++;
|
|
10192
10202
|
continue;
|
|
@@ -10200,7 +10210,7 @@ ${lanes.join("\n")}
|
|
|
10200
10210
|
isPreviousTokenSeparator = false;
|
|
10201
10211
|
}
|
|
10202
10212
|
if (text.charCodeAt(pos - 1) === 95 /* _ */) {
|
|
10203
|
-
|
|
10213
|
+
error2(Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1);
|
|
10204
10214
|
}
|
|
10205
10215
|
return value;
|
|
10206
10216
|
}
|
|
@@ -10230,7 +10240,7 @@ ${lanes.join("\n")}
|
|
|
10230
10240
|
const ch = codePointAt(text, pos);
|
|
10231
10241
|
if (pos === 0) {
|
|
10232
10242
|
if (ch === 65533 /* replacementCharacter */) {
|
|
10233
|
-
|
|
10243
|
+
error2(Diagnostics.File_appears_to_be_binary);
|
|
10234
10244
|
pos = end;
|
|
10235
10245
|
return token = 8 /* NonTextFileMarkerTrivia */;
|
|
10236
10246
|
}
|
|
@@ -10421,7 +10431,7 @@ ${lanes.join("\n")}
|
|
|
10421
10431
|
}
|
|
10422
10432
|
commentDirectives = appendIfCommentDirective(commentDirectives, text.slice(lastLineStart, pos), commentDirectiveRegExMultiLine, lastLineStart);
|
|
10423
10433
|
if (!commentClosed) {
|
|
10424
|
-
|
|
10434
|
+
error2(Diagnostics.Asterisk_Slash_expected);
|
|
10425
10435
|
}
|
|
10426
10436
|
if (skipTrivia2) {
|
|
10427
10437
|
continue;
|
|
@@ -10446,7 +10456,7 @@ ${lanes.join("\n")}
|
|
|
10446
10456
|
true
|
|
10447
10457
|
);
|
|
10448
10458
|
if (!tokenValue) {
|
|
10449
|
-
|
|
10459
|
+
error2(Diagnostics.Hexadecimal_digit_expected);
|
|
10450
10460
|
tokenValue = "0";
|
|
10451
10461
|
}
|
|
10452
10462
|
tokenValue = "0x" + tokenValue;
|
|
@@ -10459,7 +10469,7 @@ ${lanes.join("\n")}
|
|
|
10459
10469
|
2
|
|
10460
10470
|
);
|
|
10461
10471
|
if (!tokenValue) {
|
|
10462
|
-
|
|
10472
|
+
error2(Diagnostics.Binary_digit_expected);
|
|
10463
10473
|
tokenValue = "0";
|
|
10464
10474
|
}
|
|
10465
10475
|
tokenValue = "0b" + tokenValue;
|
|
@@ -10472,7 +10482,7 @@ ${lanes.join("\n")}
|
|
|
10472
10482
|
8
|
|
10473
10483
|
);
|
|
10474
10484
|
if (!tokenValue) {
|
|
10475
|
-
|
|
10485
|
+
error2(Diagnostics.Octal_digit_expected);
|
|
10476
10486
|
tokenValue = "0";
|
|
10477
10487
|
}
|
|
10478
10488
|
tokenValue = "0o" + tokenValue;
|
|
@@ -10498,7 +10508,7 @@ ${lanes.join("\n")}
|
|
|
10498
10508
|
return token = 27 /* SemicolonToken */;
|
|
10499
10509
|
case 60 /* lessThan */:
|
|
10500
10510
|
if (isConflictMarkerTrivia(text, pos)) {
|
|
10501
|
-
pos = scanConflictMarkerTrivia(text, pos,
|
|
10511
|
+
pos = scanConflictMarkerTrivia(text, pos, error2);
|
|
10502
10512
|
if (skipTrivia2) {
|
|
10503
10513
|
continue;
|
|
10504
10514
|
} else {
|
|
@@ -10521,7 +10531,7 @@ ${lanes.join("\n")}
|
|
|
10521
10531
|
return token = 30 /* LessThanToken */;
|
|
10522
10532
|
case 61 /* equals */:
|
|
10523
10533
|
if (isConflictMarkerTrivia(text, pos)) {
|
|
10524
|
-
pos = scanConflictMarkerTrivia(text, pos,
|
|
10534
|
+
pos = scanConflictMarkerTrivia(text, pos, error2);
|
|
10525
10535
|
if (skipTrivia2) {
|
|
10526
10536
|
continue;
|
|
10527
10537
|
} else {
|
|
@@ -10541,7 +10551,7 @@ ${lanes.join("\n")}
|
|
|
10541
10551
|
return token = 64 /* EqualsToken */;
|
|
10542
10552
|
case 62 /* greaterThan */:
|
|
10543
10553
|
if (isConflictMarkerTrivia(text, pos)) {
|
|
10544
|
-
pos = scanConflictMarkerTrivia(text, pos,
|
|
10554
|
+
pos = scanConflictMarkerTrivia(text, pos, error2);
|
|
10545
10555
|
if (skipTrivia2) {
|
|
10546
10556
|
continue;
|
|
10547
10557
|
} else {
|
|
@@ -10579,7 +10589,7 @@ ${lanes.join("\n")}
|
|
|
10579
10589
|
return token = 19 /* OpenBraceToken */;
|
|
10580
10590
|
case 124 /* bar */:
|
|
10581
10591
|
if (isConflictMarkerTrivia(text, pos)) {
|
|
10582
|
-
pos = scanConflictMarkerTrivia(text, pos,
|
|
10592
|
+
pos = scanConflictMarkerTrivia(text, pos, error2);
|
|
10583
10593
|
if (skipTrivia2) {
|
|
10584
10594
|
continue;
|
|
10585
10595
|
} else {
|
|
@@ -10621,12 +10631,12 @@ ${lanes.join("\n")}
|
|
|
10621
10631
|
tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts();
|
|
10622
10632
|
return token = getIdentifierToken();
|
|
10623
10633
|
}
|
|
10624
|
-
|
|
10634
|
+
error2(Diagnostics.Invalid_character);
|
|
10625
10635
|
pos++;
|
|
10626
10636
|
return token = 0 /* Unknown */;
|
|
10627
10637
|
case 35 /* hash */:
|
|
10628
10638
|
if (pos !== 0 && text[pos + 1] === "!") {
|
|
10629
|
-
|
|
10639
|
+
error2(Diagnostics.can_only_be_used_at_the_start_of_a_file);
|
|
10630
10640
|
pos++;
|
|
10631
10641
|
return token = 0 /* Unknown */;
|
|
10632
10642
|
}
|
|
@@ -10654,7 +10664,7 @@ ${lanes.join("\n")}
|
|
|
10654
10664
|
scanIdentifier(charAfterHash, languageVersion);
|
|
10655
10665
|
} else {
|
|
10656
10666
|
tokenValue = "#";
|
|
10657
|
-
|
|
10667
|
+
error2(Diagnostics.Invalid_character, pos++, charSize(ch));
|
|
10658
10668
|
}
|
|
10659
10669
|
return token = 81 /* PrivateIdentifier */;
|
|
10660
10670
|
default:
|
|
@@ -10670,7 +10680,7 @@ ${lanes.join("\n")}
|
|
|
10670
10680
|
continue;
|
|
10671
10681
|
}
|
|
10672
10682
|
const size = charSize(ch);
|
|
10673
|
-
|
|
10683
|
+
error2(Diagnostics.Invalid_character, pos, size);
|
|
10674
10684
|
pos += size;
|
|
10675
10685
|
return token = 0 /* Unknown */;
|
|
10676
10686
|
}
|
|
@@ -10736,13 +10746,13 @@ ${lanes.join("\n")}
|
|
|
10736
10746
|
while (true) {
|
|
10737
10747
|
if (p >= end) {
|
|
10738
10748
|
tokenFlags |= 4 /* Unterminated */;
|
|
10739
|
-
|
|
10749
|
+
error2(Diagnostics.Unterminated_regular_expression_literal);
|
|
10740
10750
|
break;
|
|
10741
10751
|
}
|
|
10742
10752
|
const ch = text.charCodeAt(p);
|
|
10743
10753
|
if (isLineBreak(ch)) {
|
|
10744
10754
|
tokenFlags |= 4 /* Unterminated */;
|
|
10745
|
-
|
|
10755
|
+
error2(Diagnostics.Unterminated_regular_expression_literal);
|
|
10746
10756
|
break;
|
|
10747
10757
|
}
|
|
10748
10758
|
if (inEscape) {
|
|
@@ -10854,16 +10864,16 @@ ${lanes.join("\n")}
|
|
|
10854
10864
|
}
|
|
10855
10865
|
if (char === 60 /* lessThan */) {
|
|
10856
10866
|
if (isConflictMarkerTrivia(text, pos)) {
|
|
10857
|
-
pos = scanConflictMarkerTrivia(text, pos,
|
|
10867
|
+
pos = scanConflictMarkerTrivia(text, pos, error2);
|
|
10858
10868
|
return token = 7 /* ConflictMarkerTrivia */;
|
|
10859
10869
|
}
|
|
10860
10870
|
break;
|
|
10861
10871
|
}
|
|
10862
10872
|
if (char === 62 /* greaterThan */) {
|
|
10863
|
-
|
|
10873
|
+
error2(Diagnostics.Unexpected_token_Did_you_mean_or_gt, pos, 1);
|
|
10864
10874
|
}
|
|
10865
10875
|
if (char === 125 /* closeBrace */) {
|
|
10866
|
-
|
|
10876
|
+
error2(Diagnostics.Unexpected_token_Did_you_mean_or_rbrace, pos, 1);
|
|
10867
10877
|
}
|
|
10868
10878
|
if (isLineBreak(char) && firstNonWhitespace === 0) {
|
|
10869
10879
|
firstNonWhitespace = -1;
|
|
@@ -36463,8 +36473,8 @@ ${lanes.join("\n")}
|
|
|
36463
36473
|
const fileName = configFileName || "tsconfig.json";
|
|
36464
36474
|
const diagnosticMessage = Diagnostics.The_files_list_in_config_file_0_is_empty;
|
|
36465
36475
|
const nodeValue = forEachTsConfigPropArray(sourceFile, "files", (property) => property.initializer);
|
|
36466
|
-
const
|
|
36467
|
-
errors.push(
|
|
36476
|
+
const error2 = createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, nodeValue, diagnosticMessage, fileName);
|
|
36477
|
+
errors.push(error2);
|
|
36468
36478
|
} else {
|
|
36469
36479
|
createCompilerDiagnosticOnlyIfJson(Diagnostics.The_files_list_in_config_file_0_is_empty, configFileName || "tsconfig.json");
|
|
36470
36480
|
}
|
|
@@ -36571,8 +36581,8 @@ ${lanes.join("\n")}
|
|
|
36571
36581
|
}
|
|
36572
36582
|
}
|
|
36573
36583
|
}
|
|
36574
|
-
function isErrorNoInputFiles(
|
|
36575
|
-
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;
|
|
36576
36586
|
}
|
|
36577
36587
|
function getErrorForNoInputFiles({ includeSpecs, excludeSpecs }, configFileName) {
|
|
36578
36588
|
return createCompilerDiagnostic(
|
|
@@ -36593,7 +36603,7 @@ ${lanes.join("\n")}
|
|
|
36593
36603
|
if (shouldReportNoInputFiles(fileNames, canJsonReportNoInutFiles)) {
|
|
36594
36604
|
configParseDiagnostics.push(getErrorForNoInputFiles(configFileSpecs, configFileName));
|
|
36595
36605
|
} else {
|
|
36596
|
-
filterMutate(configParseDiagnostics, (
|
|
36606
|
+
filterMutate(configParseDiagnostics, (error2) => !isErrorNoInputFiles(error2));
|
|
36597
36607
|
}
|
|
36598
36608
|
return existingErrors !== configParseDiagnostics.length;
|
|
36599
36609
|
}
|
|
@@ -39268,7 +39278,7 @@ ${lanes.join("\n")}
|
|
|
39268
39278
|
return str + "}";
|
|
39269
39279
|
}
|
|
39270
39280
|
function getKeyForCompilerOptions(options, affectingOptionDeclarations) {
|
|
39271
|
-
return affectingOptionDeclarations.map((option) => compilerOptionValueToString(getCompilerOptionValue(options, option))).join("|") +
|
|
39281
|
+
return affectingOptionDeclarations.map((option) => compilerOptionValueToString(getCompilerOptionValue(options, option))).join("|") + `|${options.pathsBasePath}`;
|
|
39272
39282
|
}
|
|
39273
39283
|
function createCacheWithRedirects(ownOptions) {
|
|
39274
39284
|
const redirectsMap = /* @__PURE__ */ new Map();
|
|
@@ -45382,9 +45392,9 @@ ${lanes.join("\n")}
|
|
|
45382
45392
|
candidatesOutArray,
|
|
45383
45393
|
/*argumentCount*/
|
|
45384
45394
|
void 0,
|
|
45385
|
-
|
|
45395
|
+
64 /* IsForStringLiteralArgumentCompletions */
|
|
45386
45396
|
)),
|
|
45387
|
-
getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount,
|
|
45397
|
+
getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 32 /* IsForSignatureHelp */)),
|
|
45388
45398
|
getExpandedParameters,
|
|
45389
45399
|
hasEffectiveRestParameter,
|
|
45390
45400
|
containsArgumentsReference,
|
|
@@ -46108,14 +46118,14 @@ ${lanes.join("\n")}
|
|
|
46108
46118
|
}
|
|
46109
46119
|
}
|
|
46110
46120
|
function errorSkippedOn(key, location, message, ...args) {
|
|
46111
|
-
const diagnostic =
|
|
46121
|
+
const diagnostic = error2(location, message, ...args);
|
|
46112
46122
|
diagnostic.skippedOn = key;
|
|
46113
46123
|
return diagnostic;
|
|
46114
46124
|
}
|
|
46115
46125
|
function createError(location, message, ...args) {
|
|
46116
46126
|
return location ? createDiagnosticForNode(location, message, ...args) : createCompilerDiagnostic(message, ...args);
|
|
46117
46127
|
}
|
|
46118
|
-
function
|
|
46128
|
+
function error2(location, message, ...args) {
|
|
46119
46129
|
const diagnostic = createError(location, message, ...args);
|
|
46120
46130
|
diagnostics.add(diagnostic);
|
|
46121
46131
|
return diagnostic;
|
|
@@ -46139,7 +46149,7 @@ ${lanes.join("\n")}
|
|
|
46139
46149
|
addErrorOrSuggestion(isError, "message" in message ? createDiagnosticForNode(location, message, ...args) : createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(location), location, message));
|
|
46140
46150
|
}
|
|
46141
46151
|
function errorAndMaybeSuggestAwait(location, maybeMissingAwait, message, ...args) {
|
|
46142
|
-
const diagnostic =
|
|
46152
|
+
const diagnostic = error2(location, message, ...args);
|
|
46143
46153
|
if (maybeMissingAwait) {
|
|
46144
46154
|
const related = createDiagnosticForNode(location, Diagnostics.Did_you_forget_to_use_await);
|
|
46145
46155
|
addRelatedInfo(diagnostic, related);
|
|
@@ -46285,7 +46295,7 @@ ${lanes.join("\n")}
|
|
|
46285
46295
|
}
|
|
46286
46296
|
} else if (target.flags & 1024 /* NamespaceModule */) {
|
|
46287
46297
|
if (target !== globalThisSymbol) {
|
|
46288
|
-
|
|
46298
|
+
error2(
|
|
46289
46299
|
source.declarations && getNameOfDeclaration(source.declarations[0]),
|
|
46290
46300
|
Diagnostics.Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity,
|
|
46291
46301
|
symbolToString(target)
|
|
@@ -46415,7 +46425,7 @@ ${lanes.join("\n")}
|
|
|
46415
46425
|
mergeSymbol(mainModule, moduleAugmentation.symbol);
|
|
46416
46426
|
}
|
|
46417
46427
|
} else {
|
|
46418
|
-
|
|
46428
|
+
error2(moduleName, Diagnostics.Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity, moduleName.text);
|
|
46419
46429
|
}
|
|
46420
46430
|
}
|
|
46421
46431
|
}
|
|
@@ -46742,7 +46752,7 @@ ${lanes.join("\n")}
|
|
|
46742
46752
|
case 265 /* EnumDeclaration */:
|
|
46743
46753
|
if (result = lookup(((_c = getSymbolOfDeclaration(location)) == null ? void 0 : _c.exports) || emptySymbols, name, meaning & 8 /* EnumMember */)) {
|
|
46744
46754
|
if (nameNotFoundMessage && getIsolatedModules(compilerOptions) && !(location.flags & 16777216 /* Ambient */) && getSourceFileOfNode(location) !== getSourceFileOfNode(result.valueDeclaration)) {
|
|
46745
|
-
|
|
46755
|
+
error2(
|
|
46746
46756
|
errorLocation,
|
|
46747
46757
|
Diagnostics.Cannot_access_0_from_another_file_without_qualification_when_1_is_enabled_Use_2_instead,
|
|
46748
46758
|
unescapeLeadingUnderscores(name),
|
|
@@ -46774,7 +46784,7 @@ ${lanes.join("\n")}
|
|
|
46774
46784
|
}
|
|
46775
46785
|
if (lastLocation && isStatic(lastLocation)) {
|
|
46776
46786
|
if (nameNotFoundMessage) {
|
|
46777
|
-
|
|
46787
|
+
error2(errorLocation, Diagnostics.Static_members_cannot_reference_class_type_parameters);
|
|
46778
46788
|
}
|
|
46779
46789
|
return void 0;
|
|
46780
46790
|
}
|
|
@@ -46793,7 +46803,7 @@ ${lanes.join("\n")}
|
|
|
46793
46803
|
const container = location.parent.parent;
|
|
46794
46804
|
if (isClassLike(container) && (result = lookup(getSymbolOfDeclaration(container).members, name, meaning & 788968 /* Type */))) {
|
|
46795
46805
|
if (nameNotFoundMessage) {
|
|
46796
|
-
|
|
46806
|
+
error2(errorLocation, Diagnostics.Base_class_expressions_cannot_reference_class_type_parameters);
|
|
46797
46807
|
}
|
|
46798
46808
|
return void 0;
|
|
46799
46809
|
}
|
|
@@ -46804,7 +46814,7 @@ ${lanes.join("\n")}
|
|
|
46804
46814
|
if (isClassLike(grandparent) || grandparent.kind === 263 /* InterfaceDeclaration */) {
|
|
46805
46815
|
if (result = lookup(getSymbolOfDeclaration(grandparent).members, name, meaning & 788968 /* Type */)) {
|
|
46806
46816
|
if (nameNotFoundMessage) {
|
|
46807
|
-
|
|
46817
|
+
error2(errorLocation, Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);
|
|
46808
46818
|
}
|
|
46809
46819
|
return void 0;
|
|
46810
46820
|
}
|
|
@@ -46915,7 +46925,7 @@ ${lanes.join("\n")}
|
|
|
46915
46925
|
}
|
|
46916
46926
|
function checkAndReportErrorForInvalidInitializer() {
|
|
46917
46927
|
if (propertyWithInvalidInitializer && !(useDefineForClassFields && getEmitScriptTarget(compilerOptions) >= 9 /* ES2022 */)) {
|
|
46918
|
-
|
|
46928
|
+
error2(
|
|
46919
46929
|
errorLocation,
|
|
46920
46930
|
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,
|
|
46921
46931
|
declarationNameToString(propertyWithInvalidInitializer.name),
|
|
@@ -46935,7 +46945,7 @@ ${lanes.join("\n")}
|
|
|
46935
46945
|
if (nameArg) {
|
|
46936
46946
|
suggestedLib = getSuggestedLibForNonExistentName(nameArg);
|
|
46937
46947
|
if (suggestedLib) {
|
|
46938
|
-
|
|
46948
|
+
error2(errorLocation, nameNotFoundMessage, diagnosticName(nameArg), suggestedLib);
|
|
46939
46949
|
}
|
|
46940
46950
|
}
|
|
46941
46951
|
if (!suggestedLib && getSpellingSuggestions && suggestionCount < maximumSuggestionCount) {
|
|
@@ -46964,7 +46974,7 @@ ${lanes.join("\n")}
|
|
|
46964
46974
|
}
|
|
46965
46975
|
}
|
|
46966
46976
|
if (!suggestion && !suggestedLib && nameArg) {
|
|
46967
|
-
|
|
46977
|
+
error2(errorLocation, nameNotFoundMessage, diagnosticName(nameArg));
|
|
46968
46978
|
}
|
|
46969
46979
|
suggestionCount++;
|
|
46970
46980
|
}
|
|
@@ -46992,9 +47002,9 @@ ${lanes.join("\n")}
|
|
|
46992
47002
|
const candidate = getMergedSymbol(getLateBoundSymbol(result));
|
|
46993
47003
|
const root = getRootDeclaration(associatedDeclarationForContainingInitializerOrBindingName);
|
|
46994
47004
|
if (candidate === getSymbolOfDeclaration(associatedDeclarationForContainingInitializerOrBindingName)) {
|
|
46995
|
-
|
|
47005
|
+
error2(errorLocation, Diagnostics.Parameter_0_cannot_reference_itself, declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name));
|
|
46996
47006
|
} else if (candidate.valueDeclaration && candidate.valueDeclaration.pos > associatedDeclarationForContainingInitializerOrBindingName.pos && root.parent.locals && lookup(root.parent.locals, candidate.escapedName, meaning) === candidate) {
|
|
46997
|
-
|
|
47007
|
+
error2(errorLocation, Diagnostics.Parameter_0_cannot_reference_identifier_1_declared_after_it, declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name), declarationNameToString(errorLocation));
|
|
46998
47008
|
}
|
|
46999
47009
|
}
|
|
47000
47010
|
if (result && errorLocation && meaning & 111551 /* Value */ && result.flags & 2097152 /* Alias */ && !(result.flags & 111551 /* Value */) && !isValidTypeOnlyAliasUseSite(errorLocation)) {
|
|
@@ -47003,7 +47013,7 @@ ${lanes.join("\n")}
|
|
|
47003
47013
|
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;
|
|
47004
47014
|
const unescapedName = unescapeLeadingUnderscores(name);
|
|
47005
47015
|
addTypeOnlyDeclarationRelatedInfo(
|
|
47006
|
-
|
|
47016
|
+
error2(errorLocation, message, unescapedName),
|
|
47007
47017
|
typeOnlyDeclaration,
|
|
47008
47018
|
unescapedName
|
|
47009
47019
|
);
|
|
@@ -47086,13 +47096,13 @@ ${lanes.join("\n")}
|
|
|
47086
47096
|
}
|
|
47087
47097
|
const constructorType = getTypeOfSymbol(classSymbol);
|
|
47088
47098
|
if (getPropertyOfType(constructorType, name)) {
|
|
47089
|
-
|
|
47099
|
+
error2(errorLocation, Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0, diagnosticName(nameArg), symbolToString(classSymbol));
|
|
47090
47100
|
return true;
|
|
47091
47101
|
}
|
|
47092
47102
|
if (location === container && !isStatic(location)) {
|
|
47093
47103
|
const instanceType = getDeclaredTypeOfSymbol(classSymbol).thisType;
|
|
47094
47104
|
if (getPropertyOfType(instanceType, name)) {
|
|
47095
|
-
|
|
47105
|
+
error2(errorLocation, Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0, diagnosticName(nameArg));
|
|
47096
47106
|
return true;
|
|
47097
47107
|
}
|
|
47098
47108
|
}
|
|
@@ -47109,7 +47119,7 @@ ${lanes.join("\n")}
|
|
|
47109
47119
|
/*ignoreErrors*/
|
|
47110
47120
|
true
|
|
47111
47121
|
)) {
|
|
47112
|
-
|
|
47122
|
+
error2(errorLocation, Diagnostics.Cannot_extend_an_interface_0_Did_you_mean_implements, getTextOfNode(expression));
|
|
47113
47123
|
return true;
|
|
47114
47124
|
}
|
|
47115
47125
|
return false;
|
|
@@ -47148,7 +47158,7 @@ ${lanes.join("\n")}
|
|
|
47148
47158
|
const propName = parent2.right.escapedText;
|
|
47149
47159
|
const propType = getPropertyOfType(getDeclaredTypeOfSymbol(symbol), propName);
|
|
47150
47160
|
if (propType) {
|
|
47151
|
-
|
|
47161
|
+
error2(
|
|
47152
47162
|
parent2,
|
|
47153
47163
|
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,
|
|
47154
47164
|
unescapeLeadingUnderscores(name),
|
|
@@ -47157,7 +47167,7 @@ ${lanes.join("\n")}
|
|
|
47157
47167
|
return true;
|
|
47158
47168
|
}
|
|
47159
47169
|
}
|
|
47160
|
-
|
|
47170
|
+
error2(errorLocation, Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here, unescapeLeadingUnderscores(name));
|
|
47161
47171
|
return true;
|
|
47162
47172
|
}
|
|
47163
47173
|
}
|
|
@@ -47177,7 +47187,7 @@ ${lanes.join("\n")}
|
|
|
47177
47187
|
false
|
|
47178
47188
|
));
|
|
47179
47189
|
if (symbol && !(symbol.flags & 1920 /* Namespace */)) {
|
|
47180
|
-
|
|
47190
|
+
error2(errorLocation, Diagnostics._0_refers_to_a_value_but_is_being_used_as_a_type_here_Did_you_mean_typeof_0, unescapeLeadingUnderscores(name));
|
|
47181
47191
|
return true;
|
|
47182
47192
|
}
|
|
47183
47193
|
}
|
|
@@ -47188,7 +47198,7 @@ ${lanes.join("\n")}
|
|
|
47188
47198
|
}
|
|
47189
47199
|
function checkAndReportErrorForExportingPrimitiveType(errorLocation, name) {
|
|
47190
47200
|
if (isPrimitiveTypeName(name) && errorLocation.parent.kind === 280 /* ExportSpecifier */) {
|
|
47191
|
-
|
|
47201
|
+
error2(errorLocation, Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, name);
|
|
47192
47202
|
return true;
|
|
47193
47203
|
}
|
|
47194
47204
|
return false;
|
|
@@ -47197,9 +47207,9 @@ ${lanes.join("\n")}
|
|
|
47197
47207
|
if (meaning & 111551 /* Value */) {
|
|
47198
47208
|
if (isPrimitiveTypeName(name)) {
|
|
47199
47209
|
if (isExtendedByInterface(errorLocation)) {
|
|
47200
|
-
|
|
47210
|
+
error2(errorLocation, Diagnostics.An_interface_cannot_extend_a_primitive_type_like_0_an_interface_can_only_extend_named_types_and_classes, unescapeLeadingUnderscores(name));
|
|
47201
47211
|
} else {
|
|
47202
|
-
|
|
47212
|
+
error2(errorLocation, Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, unescapeLeadingUnderscores(name));
|
|
47203
47213
|
}
|
|
47204
47214
|
return true;
|
|
47205
47215
|
}
|
|
@@ -47218,11 +47228,11 @@ ${lanes.join("\n")}
|
|
|
47218
47228
|
if (symbol && allFlags !== void 0 && !(allFlags & 111551 /* Value */)) {
|
|
47219
47229
|
const rawName = unescapeLeadingUnderscores(name);
|
|
47220
47230
|
if (isES2015OrLaterConstructorName(name)) {
|
|
47221
|
-
|
|
47231
|
+
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);
|
|
47222
47232
|
} else if (maybeMappedType(errorLocation, symbol)) {
|
|
47223
|
-
|
|
47233
|
+
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");
|
|
47224
47234
|
} else {
|
|
47225
|
-
|
|
47235
|
+
error2(errorLocation, Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, rawName);
|
|
47226
47236
|
}
|
|
47227
47237
|
return true;
|
|
47228
47238
|
}
|
|
@@ -47278,7 +47288,7 @@ ${lanes.join("\n")}
|
|
|
47278
47288
|
false
|
|
47279
47289
|
));
|
|
47280
47290
|
if (symbol) {
|
|
47281
|
-
|
|
47291
|
+
error2(
|
|
47282
47292
|
errorLocation,
|
|
47283
47293
|
Diagnostics.Cannot_use_namespace_0_as_a_value,
|
|
47284
47294
|
unescapeLeadingUnderscores(name)
|
|
@@ -47298,7 +47308,7 @@ ${lanes.join("\n")}
|
|
|
47298
47308
|
false
|
|
47299
47309
|
));
|
|
47300
47310
|
if (symbol) {
|
|
47301
|
-
|
|
47311
|
+
error2(errorLocation, Diagnostics.Cannot_use_namespace_0_as_a_type, unescapeLeadingUnderscores(name));
|
|
47302
47312
|
return true;
|
|
47303
47313
|
}
|
|
47304
47314
|
}
|
|
@@ -47319,11 +47329,11 @@ ${lanes.join("\n")}
|
|
|
47319
47329
|
let diagnosticMessage;
|
|
47320
47330
|
const declarationName = declarationNameToString(getNameOfDeclaration(declaration));
|
|
47321
47331
|
if (result.flags & 2 /* BlockScopedVariable */) {
|
|
47322
|
-
diagnosticMessage =
|
|
47332
|
+
diagnosticMessage = error2(errorLocation, Diagnostics.Block_scoped_variable_0_used_before_its_declaration, declarationName);
|
|
47323
47333
|
} else if (result.flags & 32 /* Class */) {
|
|
47324
|
-
diagnosticMessage =
|
|
47334
|
+
diagnosticMessage = error2(errorLocation, Diagnostics.Class_0_used_before_its_declaration, declarationName);
|
|
47325
47335
|
} else if (result.flags & 256 /* RegularEnum */) {
|
|
47326
|
-
diagnosticMessage =
|
|
47336
|
+
diagnosticMessage = error2(errorLocation, Diagnostics.Enum_0_used_before_its_declaration, declarationName);
|
|
47327
47337
|
}
|
|
47328
47338
|
if (diagnosticMessage) {
|
|
47329
47339
|
addRelatedInfo(
|
|
@@ -47398,7 +47408,7 @@ ${lanes.join("\n")}
|
|
|
47398
47408
|
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;
|
|
47399
47409
|
const relatedMessage = isExport ? Diagnostics._0_was_exported_here : Diagnostics._0_was_imported_here;
|
|
47400
47410
|
const name = typeOnlyDeclaration.kind === 277 /* ExportDeclaration */ ? "*" : unescapeLeadingUnderscores(typeOnlyDeclaration.name.escapedText);
|
|
47401
|
-
addRelatedInfo(
|
|
47411
|
+
addRelatedInfo(error2(node.moduleReference, message), createDiagnosticForNode(typeOnlyDeclaration, relatedMessage, name));
|
|
47402
47412
|
}
|
|
47403
47413
|
}
|
|
47404
47414
|
function resolveExportByName(moduleSymbol, name, sourceNode, dontResolveAlias) {
|
|
@@ -47503,7 +47513,7 @@ ${lanes.join("\n")}
|
|
|
47503
47513
|
const compilerOptionName = moduleKind >= 5 /* ES2015 */ ? "allowSyntheticDefaultImports" : "esModuleInterop";
|
|
47504
47514
|
const exportEqualsSymbol = moduleSymbol.exports.get("export=" /* ExportEquals */);
|
|
47505
47515
|
const exportAssignment = exportEqualsSymbol.valueDeclaration;
|
|
47506
|
-
const err =
|
|
47516
|
+
const err = error2(node.name, Diagnostics.Module_0_can_only_be_default_imported_using_the_1_flag, symbolToString(moduleSymbol), compilerOptionName);
|
|
47507
47517
|
if (exportAssignment) {
|
|
47508
47518
|
addRelatedInfo(err, createDiagnosticForNode(
|
|
47509
47519
|
exportAssignment,
|
|
@@ -47556,14 +47566,14 @@ ${lanes.join("\n")}
|
|
|
47556
47566
|
function reportNonDefaultExport(moduleSymbol, node) {
|
|
47557
47567
|
var _a, _b, _c;
|
|
47558
47568
|
if ((_a = moduleSymbol.exports) == null ? void 0 : _a.has(node.symbol.escapedName)) {
|
|
47559
|
-
|
|
47569
|
+
error2(
|
|
47560
47570
|
node.name,
|
|
47561
47571
|
Diagnostics.Module_0_has_no_default_export_Did_you_mean_to_use_import_1_from_0_instead,
|
|
47562
47572
|
symbolToString(moduleSymbol),
|
|
47563
47573
|
symbolToString(node.symbol)
|
|
47564
47574
|
);
|
|
47565
47575
|
} else {
|
|
47566
|
-
const diagnostic =
|
|
47576
|
+
const diagnostic = error2(node.name, Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol));
|
|
47567
47577
|
const exportStar = (_b = moduleSymbol.exports) == null ? void 0 : _b.get("__export" /* ExportStar */);
|
|
47568
47578
|
if (exportStar) {
|
|
47569
47579
|
const defaultExport = (_c = exportStar.declarations) == null ? void 0 : _c.find((decl) => {
|
|
@@ -47714,7 +47724,7 @@ ${lanes.join("\n")}
|
|
|
47714
47724
|
const suggestion = getSuggestedSymbolForNonexistentModule(name, targetSymbol);
|
|
47715
47725
|
if (suggestion !== void 0) {
|
|
47716
47726
|
const suggestionName = symbolToString(suggestion);
|
|
47717
|
-
const diagnostic =
|
|
47727
|
+
const diagnostic = error2(name, Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, moduleName, declarationName, suggestionName);
|
|
47718
47728
|
if (suggestion.valueDeclaration) {
|
|
47719
47729
|
addRelatedInfo(
|
|
47720
47730
|
diagnostic,
|
|
@@ -47723,7 +47733,7 @@ ${lanes.join("\n")}
|
|
|
47723
47733
|
}
|
|
47724
47734
|
} else {
|
|
47725
47735
|
if ((_a = moduleSymbol.exports) == null ? void 0 : _a.has("default" /* Default */)) {
|
|
47726
|
-
|
|
47736
|
+
error2(
|
|
47727
47737
|
name,
|
|
47728
47738
|
Diagnostics.Module_0_has_no_exported_member_1_Did_you_mean_to_use_import_1_from_0_instead,
|
|
47729
47739
|
moduleName,
|
|
@@ -47741,10 +47751,10 @@ ${lanes.join("\n")}
|
|
|
47741
47751
|
if (localSymbol) {
|
|
47742
47752
|
const exportedEqualsSymbol = exports == null ? void 0 : exports.get("export=" /* ExportEquals */);
|
|
47743
47753
|
if (exportedEqualsSymbol) {
|
|
47744
|
-
getSymbolIfSameReference(exportedEqualsSymbol, localSymbol) ? reportInvalidImportEqualsExportMember(node, name, declarationName, moduleName) :
|
|
47754
|
+
getSymbolIfSameReference(exportedEqualsSymbol, localSymbol) ? reportInvalidImportEqualsExportMember(node, name, declarationName, moduleName) : error2(name, Diagnostics.Module_0_has_no_exported_member_1, moduleName, declarationName);
|
|
47745
47755
|
} else {
|
|
47746
47756
|
const exportedSymbol = exports ? find(symbolsToArray(exports), (symbol) => !!getSymbolIfSameReference(symbol, localSymbol)) : void 0;
|
|
47747
|
-
const diagnostic = exportedSymbol ?
|
|
47757
|
+
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);
|
|
47748
47758
|
if (localSymbol.declarations) {
|
|
47749
47759
|
addRelatedInfo(
|
|
47750
47760
|
diagnostic,
|
|
@@ -47753,20 +47763,20 @@ ${lanes.join("\n")}
|
|
|
47753
47763
|
}
|
|
47754
47764
|
}
|
|
47755
47765
|
} else {
|
|
47756
|
-
|
|
47766
|
+
error2(name, Diagnostics.Module_0_has_no_exported_member_1, moduleName, declarationName);
|
|
47757
47767
|
}
|
|
47758
47768
|
}
|
|
47759
47769
|
function reportInvalidImportEqualsExportMember(node, name, declarationName, moduleName) {
|
|
47760
47770
|
if (moduleKind >= 5 /* ES2015 */) {
|
|
47761
47771
|
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;
|
|
47762
|
-
|
|
47772
|
+
error2(name, message, declarationName);
|
|
47763
47773
|
} else {
|
|
47764
47774
|
if (isInJSFile(node)) {
|
|
47765
47775
|
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;
|
|
47766
|
-
|
|
47776
|
+
error2(name, message, declarationName);
|
|
47767
47777
|
} else {
|
|
47768
47778
|
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;
|
|
47769
|
-
|
|
47779
|
+
error2(name, message, declarationName, declarationName, moduleName);
|
|
47770
47780
|
}
|
|
47771
47781
|
}
|
|
47772
47782
|
}
|
|
@@ -47936,7 +47946,7 @@ ${lanes.join("\n")}
|
|
|
47936
47946
|
if (links.aliasTarget === resolvingSymbol) {
|
|
47937
47947
|
links.aliasTarget = target || unknownSymbol;
|
|
47938
47948
|
} else {
|
|
47939
|
-
|
|
47949
|
+
error2(node, Diagnostics.Circular_definition_of_import_alias_0, symbolToString(symbol));
|
|
47940
47950
|
}
|
|
47941
47951
|
} else if (links.aliasTarget === resolvingSymbol) {
|
|
47942
47952
|
links.aliasTarget = unknownSymbol;
|
|
@@ -48172,13 +48182,13 @@ ${lanes.join("\n")}
|
|
|
48172
48182
|
const declarationName = declarationNameToString(right);
|
|
48173
48183
|
const suggestionForNonexistentModule = getSuggestedSymbolForNonexistentModule(right, namespace);
|
|
48174
48184
|
if (suggestionForNonexistentModule) {
|
|
48175
|
-
|
|
48185
|
+
error2(right, Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, namespaceName, declarationName, symbolToString(suggestionForNonexistentModule));
|
|
48176
48186
|
return void 0;
|
|
48177
48187
|
}
|
|
48178
48188
|
const containingQualifiedName = isQualifiedName(name) && getContainingQualifiedNameNode(name);
|
|
48179
48189
|
const canSuggestTypeof = globalObjectType && meaning & 788968 /* Type */ && containingQualifiedName && !isTypeOfExpression(containingQualifiedName.parent) && tryGetQualifiedNameAsValue(containingQualifiedName);
|
|
48180
48190
|
if (canSuggestTypeof) {
|
|
48181
|
-
|
|
48191
|
+
error2(
|
|
48182
48192
|
containingQualifiedName,
|
|
48183
48193
|
Diagnostics._0_refers_to_a_value_but_is_being_used_as_a_type_here_Did_you_mean_typeof_0,
|
|
48184
48194
|
entityNameToString(containingQualifiedName)
|
|
@@ -48188,7 +48198,7 @@ ${lanes.join("\n")}
|
|
|
48188
48198
|
if (meaning & 1920 /* Namespace */ && isQualifiedName(name.parent)) {
|
|
48189
48199
|
const exportedTypeSymbol = getMergedSymbol(getSymbol2(getExportsOfSymbol(namespace), right.escapedText, 788968 /* Type */));
|
|
48190
48200
|
if (exportedTypeSymbol) {
|
|
48191
|
-
|
|
48201
|
+
error2(
|
|
48192
48202
|
name.parent.right,
|
|
48193
48203
|
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,
|
|
48194
48204
|
symbolToString(exportedTypeSymbol),
|
|
@@ -48197,7 +48207,7 @@ ${lanes.join("\n")}
|
|
|
48197
48207
|
return void 0;
|
|
48198
48208
|
}
|
|
48199
48209
|
}
|
|
48200
|
-
|
|
48210
|
+
error2(right, Diagnostics.Namespace_0_has_no_exported_member_1, namespaceName, declarationName);
|
|
48201
48211
|
}
|
|
48202
48212
|
return void 0;
|
|
48203
48213
|
}
|
|
@@ -48302,7 +48312,7 @@ ${lanes.join("\n")}
|
|
|
48302
48312
|
if (startsWith(moduleReference, "@types/")) {
|
|
48303
48313
|
const diag2 = Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
|
|
48304
48314
|
const withoutAtTypePrefix = removePrefix(moduleReference, "@types/");
|
|
48305
|
-
|
|
48315
|
+
error2(errorNode, diag2, withoutAtTypePrefix, moduleReference);
|
|
48306
48316
|
}
|
|
48307
48317
|
const ambientModule = tryFindAmbientModule(
|
|
48308
48318
|
moduleReference,
|
|
@@ -48321,12 +48331,12 @@ ${lanes.join("\n")}
|
|
|
48321
48331
|
const sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName);
|
|
48322
48332
|
if (sourceFile) {
|
|
48323
48333
|
if (resolutionDiagnostic) {
|
|
48324
|
-
|
|
48334
|
+
error2(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
|
|
48325
48335
|
}
|
|
48326
48336
|
if (resolvedModule.resolvedUsingTsExtension && isDeclarationFileName(moduleReference)) {
|
|
48327
48337
|
const importOrExport = ((_g = findAncestor(location, isImportDeclaration)) == null ? void 0 : _g.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
|
|
48328
48338
|
if (importOrExport && !importOrExport.isTypeOnly || findAncestor(location, isImportCall)) {
|
|
48329
|
-
|
|
48339
|
+
error2(
|
|
48330
48340
|
errorNode,
|
|
48331
48341
|
Diagnostics.A_declaration_file_cannot_be_imported_without_import_type_Did_you_mean_to_import_an_implementation_file_0_instead,
|
|
48332
48342
|
getSuggestedImportSource(Debug.checkDefined(tryExtractTSExtension(moduleReference)))
|
|
@@ -48334,7 +48344,7 @@ ${lanes.join("\n")}
|
|
|
48334
48344
|
}
|
|
48335
48345
|
} else if (resolvedModule.resolvedUsingTsExtension && !shouldAllowImportingTsExtension(compilerOptions, currentSourceFile.fileName)) {
|
|
48336
48346
|
const tsExtension = Debug.checkDefined(tryExtractTSExtension(moduleReference));
|
|
48337
|
-
|
|
48347
|
+
error2(errorNode, Diagnostics.An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled, tsExtension);
|
|
48338
48348
|
}
|
|
48339
48349
|
if (sourceFile.symbol) {
|
|
48340
48350
|
if (resolvedModule.isExternalLibraryImport && !resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
|
|
@@ -48354,7 +48364,7 @@ ${lanes.join("\n")}
|
|
|
48354
48364
|
const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (_h = overrideClauseHost.assertions) == null ? void 0 : _h.assertClause : overrideClauseHost == null ? void 0 : overrideClauseHost.assertClause;
|
|
48355
48365
|
if (isSyncImport && sourceFile.impliedNodeFormat === 99 /* ESNext */ && !getResolutionModeOverrideForClause(overrideClause)) {
|
|
48356
48366
|
if (findAncestor(location, isImportEqualsDeclaration)) {
|
|
48357
|
-
|
|
48367
|
+
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);
|
|
48358
48368
|
} else {
|
|
48359
48369
|
let diagnosticDetails;
|
|
48360
48370
|
const ext = tryGetExtensionFromPath2(currentSourceFile.fileName);
|
|
@@ -48406,7 +48416,7 @@ ${lanes.join("\n")}
|
|
|
48406
48416
|
return getMergedSymbol(sourceFile.symbol);
|
|
48407
48417
|
}
|
|
48408
48418
|
if (moduleNotFoundError) {
|
|
48409
|
-
|
|
48419
|
+
error2(errorNode, Diagnostics.File_0_is_not_a_module, sourceFile.fileName);
|
|
48410
48420
|
}
|
|
48411
48421
|
return void 0;
|
|
48412
48422
|
}
|
|
@@ -48423,7 +48433,7 @@ ${lanes.join("\n")}
|
|
|
48423
48433
|
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) {
|
|
48424
48434
|
if (isForAugmentation) {
|
|
48425
48435
|
const diag2 = Diagnostics.Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented;
|
|
48426
|
-
|
|
48436
|
+
error2(errorNode, diag2, moduleReference, resolvedModule.resolvedFileName);
|
|
48427
48437
|
} else {
|
|
48428
48438
|
errorOnImplicitAnyModule(
|
|
48429
48439
|
/*isError*/
|
|
@@ -48441,31 +48451,31 @@ ${lanes.join("\n")}
|
|
|
48441
48451
|
if (resolvedModule) {
|
|
48442
48452
|
const redirect = host.getProjectReferenceRedirect(resolvedModule.resolvedFileName);
|
|
48443
48453
|
if (redirect) {
|
|
48444
|
-
|
|
48454
|
+
error2(errorNode, Diagnostics.Output_file_0_has_not_been_built_from_source_file_1, redirect, resolvedModule.resolvedFileName);
|
|
48445
48455
|
return void 0;
|
|
48446
48456
|
}
|
|
48447
48457
|
}
|
|
48448
48458
|
if (resolutionDiagnostic) {
|
|
48449
|
-
|
|
48459
|
+
error2(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
|
|
48450
48460
|
} else {
|
|
48451
48461
|
const isExtensionlessRelativePathImport = pathIsRelative(moduleReference) && !hasExtension(moduleReference);
|
|
48452
48462
|
const resolutionIsNode16OrNext = moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */;
|
|
48453
48463
|
if (!getResolveJsonModule(compilerOptions) && fileExtensionIs(moduleReference, ".json" /* Json */) && moduleResolutionKind !== 1 /* Classic */ && hasJsonModuleEmitEnabled(compilerOptions)) {
|
|
48454
|
-
|
|
48464
|
+
error2(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
48455
48465
|
} else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
|
|
48456
48466
|
const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
|
|
48457
48467
|
const suggestedExt = (_i = suggestedExtensions.find(([actualExt, _importExt]) => host.fileExists(absoluteRef + actualExt))) == null ? void 0 : _i[1];
|
|
48458
48468
|
if (suggestedExt) {
|
|
48459
|
-
|
|
48469
|
+
error2(
|
|
48460
48470
|
errorNode,
|
|
48461
48471
|
Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0,
|
|
48462
48472
|
moduleReference + suggestedExt
|
|
48463
48473
|
);
|
|
48464
48474
|
} else {
|
|
48465
|
-
|
|
48475
|
+
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);
|
|
48466
48476
|
}
|
|
48467
48477
|
} else {
|
|
48468
|
-
|
|
48478
|
+
error2(errorNode, moduleNotFoundError, moduleReference);
|
|
48469
48479
|
}
|
|
48470
48480
|
}
|
|
48471
48481
|
}
|
|
@@ -48531,7 +48541,7 @@ ${lanes.join("\n")}
|
|
|
48531
48541
|
if (!dontResolveAlias && symbol) {
|
|
48532
48542
|
if (!suppressInteropError && !(symbol.flags & (1536 /* Module */ | 3 /* Variable */)) && !getDeclarationOfKind(symbol, 311 /* SourceFile */)) {
|
|
48533
48543
|
const compilerOptionName = moduleKind >= 5 /* ES2015 */ ? "allowSyntheticDefaultImports" : "esModuleInterop";
|
|
48534
|
-
|
|
48544
|
+
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);
|
|
48535
48545
|
return symbol;
|
|
48536
48546
|
}
|
|
48537
48547
|
const referenceParent = referencingLocation.parent;
|
|
@@ -48915,7 +48925,7 @@ ${lanes.join("\n")}
|
|
|
48915
48925
|
function createIntrinsicType(kind, intrinsicName, objectFlags = 0 /* None */) {
|
|
48916
48926
|
const type = createType(kind);
|
|
48917
48927
|
type.intrinsicName = intrinsicName;
|
|
48918
|
-
type.objectFlags = objectFlags
|
|
48928
|
+
type.objectFlags = objectFlags | 524288 /* CouldContainTypeVariablesComputed */ | 2097152 /* IsGenericTypeComputed */ | 33554432 /* IsUnknownLikeUnionComputed */ | 16777216 /* IsNeverIntersectionComputed */;
|
|
48919
48929
|
return type;
|
|
48920
48930
|
}
|
|
48921
48931
|
function createObjectType(objectFlags, symbol) {
|
|
@@ -53339,7 +53349,7 @@ ${lanes.join("\n")}
|
|
|
53339
53349
|
return type.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */) ? "" + type.value : void 0;
|
|
53340
53350
|
}
|
|
53341
53351
|
function getTypeForBindingElement(declaration) {
|
|
53342
|
-
const checkMode = declaration.dotDotDotToken ?
|
|
53352
|
+
const checkMode = declaration.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */;
|
|
53343
53353
|
const parentType = getTypeForBindingElementParent(declaration.parent.parent, checkMode);
|
|
53344
53354
|
return parentType && getBindingElementTypeFromParentType(declaration, parentType);
|
|
53345
53355
|
}
|
|
@@ -53358,7 +53368,7 @@ ${lanes.join("\n")}
|
|
|
53358
53368
|
if (declaration.dotDotDotToken) {
|
|
53359
53369
|
parentType = getReducedType(parentType);
|
|
53360
53370
|
if (parentType.flags & 2 /* Unknown */ || !isValidSpreadType(parentType)) {
|
|
53361
|
-
|
|
53371
|
+
error2(declaration, Diagnostics.Rest_types_may_only_be_created_from_object_types);
|
|
53362
53372
|
return errorType;
|
|
53363
53373
|
}
|
|
53364
53374
|
const literalMembers = [];
|
|
@@ -53591,7 +53601,7 @@ ${lanes.join("\n")}
|
|
|
53591
53601
|
reference.flowNode = staticBlock.returnFlowNode;
|
|
53592
53602
|
const flowType = getFlowTypeOfProperty(reference, symbol);
|
|
53593
53603
|
if (noImplicitAny && (flowType === autoType || flowType === autoArrayType)) {
|
|
53594
|
-
|
|
53604
|
+
error2(symbol.valueDeclaration, Diagnostics.Member_0_implicitly_has_an_1_type, symbolToString(symbol), typeToString(flowType));
|
|
53595
53605
|
}
|
|
53596
53606
|
if (everyType(flowType, isNullableType)) {
|
|
53597
53607
|
continue;
|
|
@@ -53607,7 +53617,7 @@ ${lanes.join("\n")}
|
|
|
53607
53617
|
reference.flowNode = constructor.returnFlowNode;
|
|
53608
53618
|
const flowType = getFlowTypeOfProperty(reference, symbol);
|
|
53609
53619
|
if (noImplicitAny && (flowType === autoType || flowType === autoArrayType)) {
|
|
53610
|
-
|
|
53620
|
+
error2(symbol.valueDeclaration, Diagnostics.Member_0_implicitly_has_an_1_type, symbolToString(symbol), typeToString(flowType));
|
|
53611
53621
|
}
|
|
53612
53622
|
return everyType(flowType, isNullableType) ? void 0 : convertAutoToAny(flowType);
|
|
53613
53623
|
}
|
|
@@ -53782,11 +53792,11 @@ ${lanes.join("\n")}
|
|
|
53782
53792
|
const unescapedName = unescapeLeadingUnderscores(s.escapedName);
|
|
53783
53793
|
const exportedMemberName = ((_a = tryCast(exportedMember.valueDeclaration, isNamedDeclaration)) == null ? void 0 : _a.name) || exportedMember.valueDeclaration;
|
|
53784
53794
|
addRelatedInfo(
|
|
53785
|
-
|
|
53795
|
+
error2(s.valueDeclaration, Diagnostics.Duplicate_identifier_0, unescapedName),
|
|
53786
53796
|
createDiagnosticForNode(exportedMemberName, Diagnostics._0_was_also_declared_here, unescapedName)
|
|
53787
53797
|
);
|
|
53788
53798
|
addRelatedInfo(
|
|
53789
|
-
|
|
53799
|
+
error2(exportedMemberName, Diagnostics.Duplicate_identifier_0, unescapedName),
|
|
53790
53800
|
createDiagnosticForNode(s.valueDeclaration, Diagnostics._0_was_also_declared_here, unescapedName)
|
|
53791
53801
|
);
|
|
53792
53802
|
}
|
|
@@ -54141,13 +54151,13 @@ ${lanes.join("\n")}
|
|
|
54141
54151
|
}
|
|
54142
54152
|
if (!popTypeResolution()) {
|
|
54143
54153
|
if (getAnnotatedAccessorTypeNode(getter)) {
|
|
54144
|
-
|
|
54154
|
+
error2(getter, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol));
|
|
54145
54155
|
} else if (getAnnotatedAccessorTypeNode(setter)) {
|
|
54146
|
-
|
|
54156
|
+
error2(setter, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol));
|
|
54147
54157
|
} else if (getAnnotatedAccessorTypeNode(accessor)) {
|
|
54148
|
-
|
|
54158
|
+
error2(setter, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol));
|
|
54149
54159
|
} else if (getter && noImplicitAny) {
|
|
54150
|
-
|
|
54160
|
+
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));
|
|
54151
54161
|
}
|
|
54152
54162
|
type = anyType;
|
|
54153
54163
|
}
|
|
@@ -54165,7 +54175,7 @@ ${lanes.join("\n")}
|
|
|
54165
54175
|
let writeType = getAnnotatedAccessorType(setter);
|
|
54166
54176
|
if (!popTypeResolution()) {
|
|
54167
54177
|
if (getAnnotatedAccessorTypeNode(setter)) {
|
|
54168
|
-
|
|
54178
|
+
error2(setter, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol));
|
|
54169
54179
|
}
|
|
54170
54180
|
writeType = anyType;
|
|
54171
54181
|
}
|
|
@@ -54258,7 +54268,7 @@ ${lanes.join("\n")}
|
|
|
54258
54268
|
function reportCircularityError(symbol) {
|
|
54259
54269
|
const declaration = symbol.valueDeclaration;
|
|
54260
54270
|
if (getEffectiveTypeAnnotationNode(declaration)) {
|
|
54261
|
-
|
|
54271
|
+
error2(
|
|
54262
54272
|
symbol.valueDeclaration,
|
|
54263
54273
|
Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation,
|
|
54264
54274
|
symbolToString(symbol)
|
|
@@ -54266,7 +54276,7 @@ ${lanes.join("\n")}
|
|
|
54266
54276
|
return errorType;
|
|
54267
54277
|
}
|
|
54268
54278
|
if (noImplicitAny && (declaration.kind !== 168 /* Parameter */ || declaration.initializer)) {
|
|
54269
|
-
|
|
54279
|
+
error2(
|
|
54270
54280
|
symbol.valueDeclaration,
|
|
54271
54281
|
Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer,
|
|
54272
54282
|
symbolToString(symbol)
|
|
@@ -54511,11 +54521,11 @@ ${lanes.join("\n")}
|
|
|
54511
54521
|
resolveStructuredTypeMembers(baseConstructorType);
|
|
54512
54522
|
}
|
|
54513
54523
|
if (!popTypeResolution()) {
|
|
54514
|
-
|
|
54524
|
+
error2(type.symbol.valueDeclaration, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_base_expression, symbolToString(type.symbol));
|
|
54515
54525
|
return type.resolvedBaseConstructorType = errorType;
|
|
54516
54526
|
}
|
|
54517
54527
|
if (!(baseConstructorType.flags & 1 /* Any */) && baseConstructorType !== nullWideningType && !isConstructorType(baseConstructorType)) {
|
|
54518
|
-
const err =
|
|
54528
|
+
const err = error2(baseTypeNode.expression, Diagnostics.Type_0_is_not_a_constructor_function_type, typeToString(baseConstructorType));
|
|
54519
54529
|
if (baseConstructorType.flags & 262144 /* TypeParameter */) {
|
|
54520
54530
|
const constraint = getConstraintFromTypeParameter(baseConstructorType);
|
|
54521
54531
|
let ctorReturn = unknownType;
|
|
@@ -54557,7 +54567,7 @@ ${lanes.join("\n")}
|
|
|
54557
54567
|
return resolvedImplementsTypes;
|
|
54558
54568
|
}
|
|
54559
54569
|
function reportCircularBaseType(node, type) {
|
|
54560
|
-
|
|
54570
|
+
error2(node, Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(
|
|
54561
54571
|
type,
|
|
54562
54572
|
/*enclosingDeclaration*/
|
|
54563
54573
|
void 0,
|
|
@@ -54611,7 +54621,7 @@ ${lanes.join("\n")}
|
|
|
54611
54621
|
} else {
|
|
54612
54622
|
const constructors = getInstantiatedConstructorsForTypeArguments(baseConstructorType, baseTypeNode.typeArguments, baseTypeNode);
|
|
54613
54623
|
if (!constructors.length) {
|
|
54614
|
-
|
|
54624
|
+
error2(baseTypeNode.expression, Diagnostics.No_base_constructor_has_the_specified_number_of_type_arguments);
|
|
54615
54625
|
return type.resolvedBaseTypes = emptyArray;
|
|
54616
54626
|
}
|
|
54617
54627
|
baseType = getReturnTypeOfSignature(constructors[0]);
|
|
@@ -54631,7 +54641,7 @@ ${lanes.join("\n")}
|
|
|
54631
54641
|
return type.resolvedBaseTypes = emptyArray;
|
|
54632
54642
|
}
|
|
54633
54643
|
if (type === reducedBaseType || hasBaseType(reducedBaseType, type)) {
|
|
54634
|
-
|
|
54644
|
+
error2(
|
|
54635
54645
|
type.symbol.valueDeclaration,
|
|
54636
54646
|
Diagnostics.Type_0_recursively_references_itself_as_a_base_type,
|
|
54637
54647
|
typeToString(
|
|
@@ -54685,7 +54695,7 @@ ${lanes.join("\n")}
|
|
|
54685
54695
|
reportCircularBaseType(declaration, type);
|
|
54686
54696
|
}
|
|
54687
54697
|
} else {
|
|
54688
|
-
|
|
54698
|
+
error2(node, Diagnostics.An_interface_can_only_extend_an_object_type_or_intersection_of_object_types_with_statically_known_members);
|
|
54689
54699
|
}
|
|
54690
54700
|
}
|
|
54691
54701
|
}
|
|
@@ -54771,9 +54781,9 @@ ${lanes.join("\n")}
|
|
|
54771
54781
|
} else {
|
|
54772
54782
|
type = errorType;
|
|
54773
54783
|
if (declaration.kind === 346 /* JSDocEnumTag */) {
|
|
54774
|
-
|
|
54784
|
+
error2(declaration.typeExpression.type, Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
|
|
54775
54785
|
} else {
|
|
54776
|
-
|
|
54786
|
+
error2(isNamedDeclaration(declaration) ? declaration.name || declaration : declaration, Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
|
|
54777
54787
|
}
|
|
54778
54788
|
}
|
|
54779
54789
|
links.declaredType = type;
|
|
@@ -55022,8 +55032,8 @@ ${lanes.join("\n")}
|
|
|
55022
55032
|
if (lateSymbol.flags & getExcludedSymbolFlags(symbolFlags) || earlySymbol) {
|
|
55023
55033
|
const declarations = earlySymbol ? concatenate(earlySymbol.declarations, lateSymbol.declarations) : lateSymbol.declarations;
|
|
55024
55034
|
const name = !(type.flags & 8192 /* UniqueESSymbol */) && unescapeLeadingUnderscores(memberName) || declarationNameToString(declName);
|
|
55025
|
-
forEach(declarations, (declaration) =>
|
|
55026
|
-
|
|
55035
|
+
forEach(declarations, (declaration) => error2(getNameOfDeclaration(declaration) || declaration, Diagnostics.Property_0_was_also_declared_here, name));
|
|
55036
|
+
error2(declName || decl, Diagnostics.Duplicate_property_0, name);
|
|
55027
55037
|
lateSymbol = createSymbol(0 /* None */, memberName, 4096 /* Late */);
|
|
55028
55038
|
}
|
|
55029
55039
|
lateSymbol.links.nameType = type;
|
|
@@ -55869,7 +55879,7 @@ ${lanes.join("\n")}
|
|
|
55869
55879
|
true
|
|
55870
55880
|
) : symbol.links.checkFlags & 524288 /* StripOptional */ ? removeMissingOrUndefinedType(propType) : propType;
|
|
55871
55881
|
if (!popTypeResolution()) {
|
|
55872
|
-
|
|
55882
|
+
error2(currentNode, Diagnostics.Type_of_property_0_circularly_references_itself_in_mapped_type_1, symbolToString(symbol), typeToString(mappedType));
|
|
55873
55883
|
type = errorType;
|
|
55874
55884
|
}
|
|
55875
55885
|
symbol.links.type = type;
|
|
@@ -56195,7 +56205,7 @@ ${lanes.join("\n")}
|
|
|
56195
56205
|
if (t.flags & 262144 /* TypeParameter */) {
|
|
56196
56206
|
const errorNode = getConstraintDeclaration(t);
|
|
56197
56207
|
if (errorNode) {
|
|
56198
|
-
const diagnostic =
|
|
56208
|
+
const diagnostic = error2(errorNode, Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(t));
|
|
56199
56209
|
if (currentNode && !isNodeDescendantOf(errorNode, currentNode) && !isNodeDescendantOf(currentNode, errorNode)) {
|
|
56200
56210
|
addRelatedInfo(diagnostic, createDiagnosticForNode(currentNode, Diagnostics.Circularity_originates_in_type_at_this_location));
|
|
56201
56211
|
}
|
|
@@ -57045,14 +57055,14 @@ ${lanes.join("\n")}
|
|
|
57045
57055
|
if (signature.declaration) {
|
|
57046
57056
|
const typeNode = getEffectiveReturnTypeNode(signature.declaration);
|
|
57047
57057
|
if (typeNode) {
|
|
57048
|
-
|
|
57058
|
+
error2(typeNode, Diagnostics.Return_type_annotation_circularly_references_itself);
|
|
57049
57059
|
} else if (noImplicitAny) {
|
|
57050
57060
|
const declaration = signature.declaration;
|
|
57051
57061
|
const name = getNameOfDeclaration(declaration);
|
|
57052
57062
|
if (name) {
|
|
57053
|
-
|
|
57063
|
+
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));
|
|
57054
57064
|
} else {
|
|
57055
|
-
|
|
57065
|
+
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);
|
|
57056
57066
|
}
|
|
57057
57067
|
}
|
|
57058
57068
|
}
|
|
@@ -57396,7 +57406,7 @@ ${lanes.join("\n")}
|
|
|
57396
57406
|
type.resolvedTypeArguments = type.mapper ? instantiateTypes(typeArguments, type.mapper) : typeArguments;
|
|
57397
57407
|
} else {
|
|
57398
57408
|
type.resolvedTypeArguments = ((_b = type.target.localTypeParameters) == null ? void 0 : _b.map(() => errorType)) || emptyArray;
|
|
57399
|
-
|
|
57409
|
+
error2(
|
|
57400
57410
|
type.node || currentNode,
|
|
57401
57411
|
type.target.symbol ? Diagnostics.Type_arguments_for_0_circularly_reference_themselves : Diagnostics.Tuple_type_arguments_circularly_reference_themselves,
|
|
57402
57412
|
type.target.symbol && symbolToString(type.target.symbol)
|
|
@@ -57425,7 +57435,7 @@ ${lanes.join("\n")}
|
|
|
57425
57435
|
void 0,
|
|
57426
57436
|
2 /* WriteArrayAsGenericType */
|
|
57427
57437
|
);
|
|
57428
|
-
|
|
57438
|
+
error2(node, diag2, typeStr, minTypeArgumentCount, typeParameters.length);
|
|
57429
57439
|
if (!isJs) {
|
|
57430
57440
|
return errorType;
|
|
57431
57441
|
}
|
|
@@ -57481,7 +57491,7 @@ ${lanes.join("\n")}
|
|
|
57481
57491
|
const numTypeArguments = length(node.typeArguments);
|
|
57482
57492
|
const minTypeArgumentCount = getMinTypeArgumentCount(typeParameters);
|
|
57483
57493
|
if (numTypeArguments < minTypeArgumentCount || numTypeArguments > typeParameters.length) {
|
|
57484
|
-
|
|
57494
|
+
error2(
|
|
57485
57495
|
node,
|
|
57486
57496
|
minTypeArgumentCount === typeParameters.length ? Diagnostics.Generic_type_0_requires_1_type_argument_s : Diagnostics.Generic_type_0_requires_between_1_and_2_type_arguments,
|
|
57487
57497
|
symbolToString(symbol),
|
|
@@ -57657,7 +57667,7 @@ ${lanes.join("\n")}
|
|
|
57657
57667
|
}
|
|
57658
57668
|
function checkNoTypeArguments(node, symbol) {
|
|
57659
57669
|
if (node.typeArguments) {
|
|
57660
|
-
|
|
57670
|
+
error2(node, Diagnostics.Type_0_is_not_generic, symbol ? symbolToString(symbol) : node.typeName ? declarationNameToString(node.typeName) : anon);
|
|
57661
57671
|
return false;
|
|
57662
57672
|
}
|
|
57663
57673
|
return true;
|
|
@@ -57789,11 +57799,11 @@ ${lanes.join("\n")}
|
|
|
57789
57799
|
}
|
|
57790
57800
|
const type = getDeclaredTypeOfSymbol(symbol);
|
|
57791
57801
|
if (!(type.flags & 524288 /* Object */)) {
|
|
57792
|
-
|
|
57802
|
+
error2(getTypeDeclaration(symbol), Diagnostics.Global_type_0_must_be_a_class_or_interface_type, symbolName(symbol));
|
|
57793
57803
|
return arity ? emptyGenericType : emptyObjectType;
|
|
57794
57804
|
}
|
|
57795
57805
|
if (length(type.typeParameters) !== arity) {
|
|
57796
|
-
|
|
57806
|
+
error2(getTypeDeclaration(symbol), Diagnostics.Global_type_0_must_have_1_type_parameter_s, symbolName(symbol), arity);
|
|
57797
57807
|
return arity ? emptyGenericType : emptyObjectType;
|
|
57798
57808
|
}
|
|
57799
57809
|
return type;
|
|
@@ -57810,7 +57820,7 @@ ${lanes.join("\n")}
|
|
|
57810
57820
|
getDeclaredTypeOfSymbol(symbol);
|
|
57811
57821
|
if (length(getSymbolLinks(symbol).typeParameters) !== arity) {
|
|
57812
57822
|
const decl = symbol.declarations && find(symbol.declarations, isTypeAliasDeclaration);
|
|
57813
|
-
|
|
57823
|
+
error2(decl, Diagnostics.Global_type_0_must_have_1_type_parameter_s, symbolName(symbol), arity);
|
|
57814
57824
|
return void 0;
|
|
57815
57825
|
}
|
|
57816
57826
|
}
|
|
@@ -58355,7 +58365,7 @@ ${lanes.join("\n")}
|
|
|
58355
58365
|
} else if (isTupleType(type)) {
|
|
58356
58366
|
const elements = getElementTypes(type);
|
|
58357
58367
|
if (elements.length + expandedTypes.length >= 1e4) {
|
|
58358
|
-
|
|
58368
|
+
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);
|
|
58359
58369
|
return errorType;
|
|
58360
58370
|
}
|
|
58361
58371
|
forEach(elements, (t, n) => {
|
|
@@ -58520,7 +58530,7 @@ ${lanes.join("\n")}
|
|
|
58520
58530
|
const estimatedCount = count / (len - i) * len;
|
|
58521
58531
|
if (estimatedCount > 1e6) {
|
|
58522
58532
|
(_a = tracing) == null ? void 0 : _a.instant(tracing.Phase.CheckTypes, "removeSubtypes_DepthLimit", { typeIds: types.map((t) => t.id) });
|
|
58523
|
-
|
|
58533
|
+
error2(currentNode, Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent);
|
|
58524
58534
|
return void 0;
|
|
58525
58535
|
}
|
|
58526
58536
|
}
|
|
@@ -58929,7 +58939,7 @@ ${lanes.join("\n")}
|
|
|
58929
58939
|
const size = getCrossProductUnionSize(types);
|
|
58930
58940
|
if (size >= 1e5) {
|
|
58931
58941
|
(_a = tracing) == null ? void 0 : _a.instant(tracing.Phase.CheckTypes, "checkCrossProductUnion_DepthLimit", { typeIds: types.map((t) => t.id), size });
|
|
58932
|
-
|
|
58942
|
+
error2(currentNode, Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent);
|
|
58933
58943
|
return false;
|
|
58934
58944
|
}
|
|
58935
58945
|
return true;
|
|
@@ -59301,7 +59311,7 @@ ${lanes.join("\n")}
|
|
|
59301
59311
|
if (accessExpression) {
|
|
59302
59312
|
markPropertyAsReferenced(prop, accessExpression, isSelfTypeAccess(accessExpression.expression, objectType.symbol));
|
|
59303
59313
|
if (isAssignmentToReadonlyEntity(accessExpression, prop, getAssignmentTargetKind(accessExpression))) {
|
|
59304
|
-
|
|
59314
|
+
error2(accessExpression.argumentExpression, Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, symbolToString(prop));
|
|
59305
59315
|
return void 0;
|
|
59306
59316
|
}
|
|
59307
59317
|
if (accessFlags & 8 /* CacheSymbol */) {
|
|
@@ -59320,10 +59330,10 @@ ${lanes.join("\n")}
|
|
|
59320
59330
|
const indexNode = getIndexNodeForAccessExpression(accessNode);
|
|
59321
59331
|
if (isTupleType(objectType)) {
|
|
59322
59332
|
if (index < 0) {
|
|
59323
|
-
|
|
59333
|
+
error2(indexNode, Diagnostics.A_tuple_type_cannot_be_indexed_with_a_negative_value);
|
|
59324
59334
|
return undefinedType;
|
|
59325
59335
|
}
|
|
59326
|
-
|
|
59336
|
+
error2(
|
|
59327
59337
|
indexNode,
|
|
59328
59338
|
Diagnostics.Tuple_type_0_of_length_1_has_no_element_at_index_2,
|
|
59329
59339
|
typeToString(objectType),
|
|
@@ -59331,7 +59341,7 @@ ${lanes.join("\n")}
|
|
|
59331
59341
|
unescapeLeadingUnderscores(propName)
|
|
59332
59342
|
);
|
|
59333
59343
|
} else {
|
|
59334
|
-
|
|
59344
|
+
error2(indexNode, Diagnostics.Property_0_does_not_exist_on_type_1, unescapeLeadingUnderscores(propName), typeToString(objectType));
|
|
59335
59345
|
}
|
|
59336
59346
|
}
|
|
59337
59347
|
if (index >= 0) {
|
|
@@ -59351,13 +59361,13 @@ ${lanes.join("\n")}
|
|
|
59351
59361
|
if (indexInfo) {
|
|
59352
59362
|
if (accessFlags & 2 /* NoIndexSignatures */ && indexInfo.keyType !== numberType) {
|
|
59353
59363
|
if (accessExpression) {
|
|
59354
|
-
|
|
59364
|
+
error2(accessExpression, Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(originalObjectType));
|
|
59355
59365
|
}
|
|
59356
59366
|
return void 0;
|
|
59357
59367
|
}
|
|
59358
59368
|
if (accessNode && indexInfo.keyType === stringType && !isTypeAssignableToKind(indexType, 4 /* String */ | 8 /* Number */)) {
|
|
59359
59369
|
const indexNode = getIndexNodeForAccessExpression(accessNode);
|
|
59360
|
-
|
|
59370
|
+
error2(indexNode, Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType));
|
|
59361
59371
|
return accessFlags & 1 /* IncludeUndefined */ ? getUnionType([indexInfo.type, missingType]) : indexInfo.type;
|
|
59362
59372
|
}
|
|
59363
59373
|
errorIfWritingToReadonlyIndex(indexInfo);
|
|
@@ -59385,23 +59395,23 @@ ${lanes.join("\n")}
|
|
|
59385
59395
|
}
|
|
59386
59396
|
}
|
|
59387
59397
|
if (objectType.symbol === globalThisSymbol && propName !== void 0 && globalThisSymbol.exports.has(propName) && globalThisSymbol.exports.get(propName).flags & 418 /* BlockScoped */) {
|
|
59388
|
-
|
|
59398
|
+
error2(accessExpression, Diagnostics.Property_0_does_not_exist_on_type_1, unescapeLeadingUnderscores(propName), typeToString(objectType));
|
|
59389
59399
|
} else if (noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors && !(accessFlags & 128 /* SuppressNoImplicitAnyError */)) {
|
|
59390
59400
|
if (propName !== void 0 && typeHasStaticProperty(propName, objectType)) {
|
|
59391
59401
|
const typeName = typeToString(objectType);
|
|
59392
|
-
|
|
59402
|
+
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) + "]");
|
|
59393
59403
|
} else if (getIndexTypeOfType(objectType, numberType)) {
|
|
59394
|
-
|
|
59404
|
+
error2(accessExpression.argumentExpression, Diagnostics.Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number);
|
|
59395
59405
|
} else {
|
|
59396
59406
|
let suggestion;
|
|
59397
59407
|
if (propName !== void 0 && (suggestion = getSuggestionForNonexistentProperty(propName, objectType))) {
|
|
59398
59408
|
if (suggestion !== void 0) {
|
|
59399
|
-
|
|
59409
|
+
error2(accessExpression.argumentExpression, Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2, propName, typeToString(objectType), suggestion);
|
|
59400
59410
|
}
|
|
59401
59411
|
} else {
|
|
59402
59412
|
const suggestion2 = getSuggestionForNonexistentIndexSignature(objectType, accessExpression, indexType);
|
|
59403
59413
|
if (suggestion2 !== void 0) {
|
|
59404
|
-
|
|
59414
|
+
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);
|
|
59405
59415
|
} else {
|
|
59406
59416
|
let errorInfo;
|
|
59407
59417
|
if (indexType.flags & 1024 /* EnumLiteral */) {
|
|
@@ -59466,11 +59476,11 @@ ${lanes.join("\n")}
|
|
|
59466
59476
|
if (accessNode) {
|
|
59467
59477
|
const indexNode = getIndexNodeForAccessExpression(accessNode);
|
|
59468
59478
|
if (indexType.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */)) {
|
|
59469
|
-
|
|
59479
|
+
error2(indexNode, Diagnostics.Property_0_does_not_exist_on_type_1, "" + indexType.value, typeToString(objectType));
|
|
59470
59480
|
} else if (indexType.flags & (4 /* String */ | 8 /* Number */)) {
|
|
59471
|
-
|
|
59481
|
+
error2(indexNode, Diagnostics.Type_0_has_no_matching_index_signature_for_type_1, typeToString(objectType), typeToString(indexType));
|
|
59472
59482
|
} else {
|
|
59473
|
-
|
|
59483
|
+
error2(indexNode, Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType));
|
|
59474
59484
|
}
|
|
59475
59485
|
}
|
|
59476
59486
|
if (isTypeAny(indexType)) {
|
|
@@ -59479,7 +59489,7 @@ ${lanes.join("\n")}
|
|
|
59479
59489
|
return void 0;
|
|
59480
59490
|
function errorIfWritingToReadonlyIndex(indexInfo) {
|
|
59481
59491
|
if (indexInfo && indexInfo.isReadonly && accessExpression && (isAssignmentTarget(accessExpression) || isDeleteTarget(accessExpression))) {
|
|
59482
|
-
|
|
59492
|
+
error2(accessExpression, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
|
|
59483
59493
|
}
|
|
59484
59494
|
}
|
|
59485
59495
|
}
|
|
@@ -59704,7 +59714,7 @@ ${lanes.join("\n")}
|
|
|
59704
59714
|
let tailCount = 0;
|
|
59705
59715
|
while (true) {
|
|
59706
59716
|
if (tailCount === 1e3) {
|
|
59707
|
-
|
|
59717
|
+
error2(currentNode, Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
|
|
59708
59718
|
return errorType;
|
|
59709
59719
|
}
|
|
59710
59720
|
const checkType = instantiateType(getActualTypeVariable(root.checkType), mapper);
|
|
@@ -59882,7 +59892,7 @@ ${lanes.join("\n")}
|
|
|
59882
59892
|
const links = getNodeLinks(node);
|
|
59883
59893
|
if (!links.resolvedType) {
|
|
59884
59894
|
if (!isLiteralImportTypeNode(node)) {
|
|
59885
|
-
|
|
59895
|
+
error2(node.argument, Diagnostics.String_literal_expected);
|
|
59886
59896
|
links.resolvedSymbol = unknownSymbol;
|
|
59887
59897
|
return links.resolvedType = errorType;
|
|
59888
59898
|
}
|
|
@@ -59916,7 +59926,7 @@ ${lanes.join("\n")}
|
|
|
59916
59926
|
const symbolFromModule = node.isTypeOf ? void 0 : getSymbol2(getExportsOfSymbol(mergedResolvedSymbol), current.escapedText, meaning);
|
|
59917
59927
|
const next = symbolFromModule ?? symbolFromVariable;
|
|
59918
59928
|
if (!next) {
|
|
59919
|
-
|
|
59929
|
+
error2(current, Diagnostics.Namespace_0_has_no_exported_member_1, getFullyQualifiedName(currentNamespace), declarationNameToString(current));
|
|
59920
59930
|
return links.resolvedType = errorType;
|
|
59921
59931
|
}
|
|
59922
59932
|
getNodeLinks(current).resolvedSymbol = next;
|
|
@@ -59929,7 +59939,7 @@ ${lanes.join("\n")}
|
|
|
59929
59939
|
links.resolvedType = resolveImportSymbolType(node, links, moduleSymbol, targetMeaning);
|
|
59930
59940
|
} else {
|
|
59931
59941
|
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;
|
|
59932
|
-
|
|
59942
|
+
error2(node, errorMessage, node.argument.literal.text);
|
|
59933
59943
|
links.resolvedSymbol = unknownSymbol;
|
|
59934
59944
|
links.resolvedType = errorType;
|
|
59935
59945
|
}
|
|
@@ -60207,7 +60217,7 @@ ${lanes.join("\n")}
|
|
|
60207
60217
|
if (isJSConstructor(container) && isNodeDescendantOf(node, container.body)) {
|
|
60208
60218
|
return getDeclaredTypeOfClassOrInterface(getSymbolOfDeclaration(container)).thisType;
|
|
60209
60219
|
}
|
|
60210
|
-
|
|
60220
|
+
error2(node, Diagnostics.A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface);
|
|
60211
60221
|
return errorType;
|
|
60212
60222
|
}
|
|
60213
60223
|
function getTypeFromThisTypeNode(node) {
|
|
@@ -60536,10 +60546,18 @@ ${lanes.join("\n")}
|
|
|
60536
60546
|
if (!result) {
|
|
60537
60547
|
const newMapper = createTypeMapper(typeParameters, typeArguments);
|
|
60538
60548
|
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);
|
|
60539
|
-
if (result.flags & 138117121 /* ObjectFlagsType */ && !(result.objectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
|
|
60540
|
-
result.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (some(typeArguments, couldContainTypeVariables) ? 1048576 /* CouldContainTypeVariables */ : 0);
|
|
60541
|
-
}
|
|
60542
60549
|
target.instantiations.set(id, result);
|
|
60550
|
+
const resultObjectFlags = getObjectFlags(result);
|
|
60551
|
+
if (result.flags & 138117121 /* ObjectFlagsType */ && !(resultObjectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
|
|
60552
|
+
const resultCouldContainTypeVariables = some(typeArguments, couldContainTypeVariables);
|
|
60553
|
+
if (!(getObjectFlags(result) & 524288 /* CouldContainTypeVariablesComputed */)) {
|
|
60554
|
+
if (resultObjectFlags & (32 /* Mapped */ | 16 /* Anonymous */ | 4 /* Reference */)) {
|
|
60555
|
+
result.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (resultCouldContainTypeVariables ? 1048576 /* CouldContainTypeVariables */ : 0);
|
|
60556
|
+
} else {
|
|
60557
|
+
result.objectFlags |= !resultCouldContainTypeVariables ? 524288 /* CouldContainTypeVariablesComputed */ : 0;
|
|
60558
|
+
}
|
|
60559
|
+
}
|
|
60560
|
+
}
|
|
60543
60561
|
}
|
|
60544
60562
|
return result;
|
|
60545
60563
|
}
|
|
@@ -60724,7 +60742,7 @@ ${lanes.join("\n")}
|
|
|
60724
60742
|
}
|
|
60725
60743
|
if (instantiationDepth === 100 || instantiationCount >= 5e6) {
|
|
60726
60744
|
(_a = tracing) == null ? void 0 : _a.instant(tracing.Phase.CheckTypes, "instantiateType_DepthLimit", { typeId: type.id, instantiationDepth, instantiationCount });
|
|
60727
|
-
|
|
60745
|
+
error2(currentNode, Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
|
|
60728
60746
|
return errorType;
|
|
60729
60747
|
}
|
|
60730
60748
|
totalInstantiationCount++;
|
|
@@ -61344,7 +61362,7 @@ ${lanes.join("\n")}
|
|
|
61344
61362
|
result = elaborateIterableOrArrayLikeTargetElementwise(children, realSource, arrayLikeTargetParts, relation, containingMessageChain, errorOutputContainer) || result;
|
|
61345
61363
|
} else if (!isTypeRelatedTo(getIndexedAccessType(source, childrenNameType), childrenTargetType, relation)) {
|
|
61346
61364
|
result = true;
|
|
61347
|
-
const diag2 =
|
|
61365
|
+
const diag2 = error2(
|
|
61348
61366
|
containingElement.openingElement.tagName,
|
|
61349
61367
|
Diagnostics.This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided,
|
|
61350
61368
|
childrenPropName,
|
|
@@ -61372,7 +61390,7 @@ ${lanes.join("\n")}
|
|
|
61372
61390
|
}
|
|
61373
61391
|
} else if (!isTypeRelatedTo(getIndexedAccessType(source, childrenNameType), childrenTargetType, relation)) {
|
|
61374
61392
|
result = true;
|
|
61375
|
-
const diag2 =
|
|
61393
|
+
const diag2 = error2(
|
|
61376
61394
|
containingElement.openingElement.tagName,
|
|
61377
61395
|
Diagnostics.This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_provided,
|
|
61378
61396
|
childrenPropName,
|
|
@@ -61877,7 +61895,7 @@ ${lanes.join("\n")}
|
|
|
61877
61895
|
}
|
|
61878
61896
|
if (overflow) {
|
|
61879
61897
|
(_a = tracing) == null ? void 0 : _a.instant(tracing.Phase.CheckTypes, "checkTypeRelatedTo_DepthLimit", { sourceId: source.id, targetId: target.id, depth: sourceDepth, targetDepth });
|
|
61880
|
-
const diag2 =
|
|
61898
|
+
const diag2 = error2(errorNode || currentNode, Diagnostics.Excessive_stack_depth_comparing_types_0_and_1, typeToString(source), typeToString(target));
|
|
61881
61899
|
if (errorOutputContainer) {
|
|
61882
61900
|
(errorOutputContainer.errors || (errorOutputContainer.errors = [])).push(diag2);
|
|
61883
61901
|
}
|
|
@@ -64993,7 +65011,7 @@ ${lanes.join("\n")}
|
|
|
64993
65011
|
const t = getTypeOfSymbol(p);
|
|
64994
65012
|
if (getObjectFlags(t) & 65536 /* ContainsWideningType */) {
|
|
64995
65013
|
if (!reportWideningErrorsInType(t)) {
|
|
64996
|
-
|
|
65014
|
+
error2(p.valueDeclaration, Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, symbolToString(p), typeToString(getWidenedType(t)));
|
|
64997
65015
|
}
|
|
64998
65016
|
errorReported = true;
|
|
64999
65017
|
}
|
|
@@ -65043,11 +65061,11 @@ ${lanes.join("\n")}
|
|
|
65043
65061
|
}
|
|
65044
65062
|
break;
|
|
65045
65063
|
case 323 /* JSDocFunctionType */:
|
|
65046
|
-
|
|
65064
|
+
error2(declaration, Diagnostics.Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString);
|
|
65047
65065
|
return;
|
|
65048
65066
|
case 329 /* JSDocSignature */:
|
|
65049
65067
|
if (noImplicitAny && isJSDocOverloadTag(declaration.parent)) {
|
|
65050
|
-
|
|
65068
|
+
error2(declaration.parent.tagName, Diagnostics.This_overload_implicitly_returns_the_type_0_because_it_lacks_a_return_type_annotation, typeAsString);
|
|
65051
65069
|
}
|
|
65052
65070
|
return;
|
|
65053
65071
|
case 261 /* FunctionDeclaration */:
|
|
@@ -65059,9 +65077,9 @@ ${lanes.join("\n")}
|
|
|
65059
65077
|
case 218 /* ArrowFunction */:
|
|
65060
65078
|
if (noImplicitAny && !declaration.name) {
|
|
65061
65079
|
if (wideningKind === 3 /* GeneratorYield */) {
|
|
65062
|
-
|
|
65080
|
+
error2(declaration, Diagnostics.Generator_implicitly_has_yield_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type_annotation, typeAsString);
|
|
65063
65081
|
} else {
|
|
65064
|
-
|
|
65082
|
+
error2(declaration, Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString);
|
|
65065
65083
|
}
|
|
65066
65084
|
return;
|
|
65067
65085
|
}
|
|
@@ -65069,7 +65087,7 @@ ${lanes.join("\n")}
|
|
|
65069
65087
|
break;
|
|
65070
65088
|
case 199 /* MappedType */:
|
|
65071
65089
|
if (noImplicitAny) {
|
|
65072
|
-
|
|
65090
|
+
error2(declaration, Diagnostics.Mapped_object_type_implicitly_has_an_any_template_type);
|
|
65073
65091
|
}
|
|
65074
65092
|
return;
|
|
65075
65093
|
default:
|
|
@@ -68236,7 +68254,7 @@ ${lanes.join("\n")}
|
|
|
68236
68254
|
return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithoutNullableConstraint) : !!(type.flags & 465829888 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* Nullable */));
|
|
68237
68255
|
}
|
|
68238
68256
|
function hasContextualTypeWithNoGenericTypes(node, checkMode) {
|
|
68239
|
-
const contextualType = (isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node)) && !((isJsxOpeningElement(node.parent) || isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) && (checkMode && checkMode &
|
|
68257
|
+
const contextualType = (isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node)) && !((isJsxOpeningElement(node.parent) || isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) && (checkMode && checkMode & 128 /* RestBindingElement */ ? getContextualType2(node, 8 /* SkipBindingPatterns */) : getContextualType2(
|
|
68240
68258
|
node,
|
|
68241
68259
|
/*contextFlags*/
|
|
68242
68260
|
void 0
|
|
@@ -68347,15 +68365,15 @@ ${lanes.join("\n")}
|
|
|
68347
68365
|
}
|
|
68348
68366
|
if (symbol === argumentsSymbol) {
|
|
68349
68367
|
if (isInPropertyInitializerOrClassStaticBlock(node)) {
|
|
68350
|
-
|
|
68368
|
+
error2(node, Diagnostics.arguments_cannot_be_referenced_in_property_initializers);
|
|
68351
68369
|
return errorType;
|
|
68352
68370
|
}
|
|
68353
68371
|
const container = getContainingFunction(node);
|
|
68354
68372
|
if (languageVersion < 2 /* ES2015 */) {
|
|
68355
68373
|
if (container.kind === 218 /* ArrowFunction */) {
|
|
68356
|
-
|
|
68374
|
+
error2(node, Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression);
|
|
68357
68375
|
} else if (hasSyntacticModifier(container, 512 /* Async */)) {
|
|
68358
|
-
|
|
68376
|
+
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);
|
|
68359
68377
|
}
|
|
68360
68378
|
}
|
|
68361
68379
|
getNodeLinks(container).flags |= 512 /* CaptureArguments */;
|
|
@@ -68413,14 +68431,14 @@ ${lanes.join("\n")}
|
|
|
68413
68431
|
if (assignmentKind) {
|
|
68414
68432
|
if (!(localOrExportSymbol.flags & 3 /* Variable */) && !(isInJSFile(node) && localOrExportSymbol.flags & 512 /* ValueModule */)) {
|
|
68415
68433
|
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;
|
|
68416
|
-
|
|
68434
|
+
error2(node, assignmentError, symbolToString(symbol));
|
|
68417
68435
|
return errorType;
|
|
68418
68436
|
}
|
|
68419
68437
|
if (isReadonlySymbol(localOrExportSymbol)) {
|
|
68420
68438
|
if (localOrExportSymbol.flags & 3 /* Variable */) {
|
|
68421
|
-
|
|
68439
|
+
error2(node, Diagnostics.Cannot_assign_to_0_because_it_is_a_constant, symbolToString(symbol));
|
|
68422
68440
|
} else {
|
|
68423
|
-
|
|
68441
|
+
error2(node, Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, symbolToString(symbol));
|
|
68424
68442
|
}
|
|
68425
68443
|
return errorType;
|
|
68426
68444
|
}
|
|
@@ -68456,13 +68474,13 @@ ${lanes.join("\n")}
|
|
|
68456
68474
|
if (!isEvolvingArrayOperationTarget(node) && (type === autoType || type === autoArrayType)) {
|
|
68457
68475
|
if (flowType === autoType || flowType === autoArrayType) {
|
|
68458
68476
|
if (noImplicitAny) {
|
|
68459
|
-
|
|
68460
|
-
|
|
68477
|
+
error2(getNameOfDeclaration(declaration), Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined, symbolToString(symbol), typeToString(flowType));
|
|
68478
|
+
error2(node, Diagnostics.Variable_0_implicitly_has_an_1_type, symbolToString(symbol), typeToString(flowType));
|
|
68461
68479
|
}
|
|
68462
68480
|
return convertAutoToAny(flowType);
|
|
68463
68481
|
}
|
|
68464
68482
|
} else if (!assumeInitialized && !containsUndefinedType(type) && containsUndefinedType(flowType)) {
|
|
68465
|
-
|
|
68483
|
+
error2(node, Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol));
|
|
68466
68484
|
return type;
|
|
68467
68485
|
}
|
|
68468
68486
|
return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType;
|
|
@@ -68592,13 +68610,13 @@ ${lanes.join("\n")}
|
|
|
68592
68610
|
/*noCacheCheck*/
|
|
68593
68611
|
false
|
|
68594
68612
|
)) {
|
|
68595
|
-
|
|
68613
|
+
error2(node, diagnosticMessage);
|
|
68596
68614
|
}
|
|
68597
68615
|
}
|
|
68598
68616
|
}
|
|
68599
68617
|
function checkThisInStaticClassFieldInitializerInDecoratedClass(thisExpression, container) {
|
|
68600
68618
|
if (isPropertyDeclaration(container) && hasStaticModifier(container) && legacyDecorators && container.initializer && textRangeContainsPositionInclusive(container.initializer, thisExpression.pos) && hasDecorators(container.parent)) {
|
|
68601
|
-
|
|
68619
|
+
error2(thisExpression, Diagnostics.Cannot_use_this_in_a_static_property_initializer_of_a_decorated_class);
|
|
68602
68620
|
}
|
|
68603
68621
|
}
|
|
68604
68622
|
function checkThisExpression(node) {
|
|
@@ -68639,18 +68657,18 @@ ${lanes.join("\n")}
|
|
|
68639
68657
|
}
|
|
68640
68658
|
checkThisInStaticClassFieldInitializerInDecoratedClass(node, container);
|
|
68641
68659
|
if (thisInComputedPropertyName) {
|
|
68642
|
-
|
|
68660
|
+
error2(node, Diagnostics.this_cannot_be_referenced_in_a_computed_property_name);
|
|
68643
68661
|
} else {
|
|
68644
68662
|
switch (container.kind) {
|
|
68645
68663
|
case 266 /* ModuleDeclaration */:
|
|
68646
|
-
|
|
68664
|
+
error2(node, Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body);
|
|
68647
68665
|
break;
|
|
68648
68666
|
case 265 /* EnumDeclaration */:
|
|
68649
|
-
|
|
68667
|
+
error2(node, Diagnostics.this_cannot_be_referenced_in_current_location);
|
|
68650
68668
|
break;
|
|
68651
68669
|
case 175 /* Constructor */:
|
|
68652
68670
|
if (isInConstructorArgumentInitializer(node, container)) {
|
|
68653
|
-
|
|
68671
|
+
error2(node, Diagnostics.this_cannot_be_referenced_in_constructor_arguments);
|
|
68654
68672
|
}
|
|
68655
68673
|
break;
|
|
68656
68674
|
}
|
|
@@ -68667,9 +68685,9 @@ ${lanes.join("\n")}
|
|
|
68667
68685
|
if (noImplicitThis) {
|
|
68668
68686
|
const globalThisType2 = getTypeOfSymbol(globalThisSymbol);
|
|
68669
68687
|
if (type === globalThisType2 && capturedByArrowFunction) {
|
|
68670
|
-
|
|
68688
|
+
error2(node, Diagnostics.The_containing_arrow_function_captures_the_global_value_of_this);
|
|
68671
68689
|
} else if (!type) {
|
|
68672
|
-
const diag2 =
|
|
68690
|
+
const diag2 = error2(node, Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation);
|
|
68673
68691
|
if (!isSourceFile(container)) {
|
|
68674
68692
|
const outsideThis = tryGetThisTypeAt(container);
|
|
68675
68693
|
if (outsideThis && outsideThis !== globalThisType2) {
|
|
@@ -68798,13 +68816,13 @@ ${lanes.join("\n")}
|
|
|
68798
68816
|
if (!container || !isLegalUsageOfSuperExpression(container)) {
|
|
68799
68817
|
const current = findAncestor(node, (n) => n === container ? "quit" : n.kind === 166 /* ComputedPropertyName */);
|
|
68800
68818
|
if (current && current.kind === 166 /* ComputedPropertyName */) {
|
|
68801
|
-
|
|
68819
|
+
error2(node, Diagnostics.super_cannot_be_referenced_in_a_computed_property_name);
|
|
68802
68820
|
} else if (isCallExpression2) {
|
|
68803
|
-
|
|
68821
|
+
error2(node, Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors);
|
|
68804
68822
|
} else if (!container || !container.parent || !(isClassLike(container.parent) || container.parent.kind === 209 /* ObjectLiteralExpression */)) {
|
|
68805
|
-
|
|
68823
|
+
error2(node, Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions);
|
|
68806
68824
|
} else {
|
|
68807
|
-
|
|
68825
|
+
error2(node, Diagnostics.super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class);
|
|
68808
68826
|
}
|
|
68809
68827
|
return errorType;
|
|
68810
68828
|
}
|
|
@@ -68836,7 +68854,7 @@ ${lanes.join("\n")}
|
|
|
68836
68854
|
}
|
|
68837
68855
|
if (container.parent.kind === 209 /* ObjectLiteralExpression */) {
|
|
68838
68856
|
if (languageVersion < 2 /* ES2015 */) {
|
|
68839
|
-
|
|
68857
|
+
error2(node, Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher);
|
|
68840
68858
|
return errorType;
|
|
68841
68859
|
} else {
|
|
68842
68860
|
return anyType;
|
|
@@ -68844,7 +68862,7 @@ ${lanes.join("\n")}
|
|
|
68844
68862
|
}
|
|
68845
68863
|
const classLikeDeclaration = container.parent;
|
|
68846
68864
|
if (!getClassExtendsHeritageElement(classLikeDeclaration)) {
|
|
68847
|
-
|
|
68865
|
+
error2(node, Diagnostics.super_can_only_be_referenced_in_a_derived_class);
|
|
68848
68866
|
return errorType;
|
|
68849
68867
|
}
|
|
68850
68868
|
const classType = getDeclaredTypeOfSymbol(getSymbolOfDeclaration(classLikeDeclaration));
|
|
@@ -68853,7 +68871,7 @@ ${lanes.join("\n")}
|
|
|
68853
68871
|
return errorType;
|
|
68854
68872
|
}
|
|
68855
68873
|
if (container.kind === 175 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) {
|
|
68856
|
-
|
|
68874
|
+
error2(node, Diagnostics.super_cannot_be_referenced_in_constructor_arguments);
|
|
68857
68875
|
return errorType;
|
|
68858
68876
|
}
|
|
68859
68877
|
return nodeCheckFlag === 32 /* SuperStatic */ ? getBaseConstructorTypeOfClass(classType) : getTypeWithThisArgument(baseClassType, classType.thisType);
|
|
@@ -68993,7 +69011,7 @@ ${lanes.join("\n")}
|
|
|
68993
69011
|
function getContextualTypeForBindingElement(declaration, contextFlags) {
|
|
68994
69012
|
const parent2 = declaration.parent.parent;
|
|
68995
69013
|
const name = declaration.propertyName || declaration.name;
|
|
68996
|
-
const parentType = getContextualTypeForVariableLikeDeclaration(parent2, contextFlags) || parent2.kind !== 207 /* BindingElement */ && parent2.initializer && checkDeclarationInitializer(parent2, declaration.dotDotDotToken ?
|
|
69014
|
+
const parentType = getContextualTypeForVariableLikeDeclaration(parent2, contextFlags) || parent2.kind !== 207 /* BindingElement */ && parent2.initializer && checkDeclarationInitializer(parent2, declaration.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */);
|
|
68997
69015
|
if (!parentType || isBindingPattern(name) || isComputedNonLiteralName(name))
|
|
68998
69016
|
return void 0;
|
|
68999
69017
|
if (parent2.name.kind === 206 /* ArrayBindingPattern */) {
|
|
@@ -69809,7 +69827,7 @@ ${lanes.join("\n")}
|
|
|
69809
69827
|
let attributesType = forcedLookupLocation === void 0 ? getTypeOfFirstParameterOfSignatureWithFallback(sig, unknownType) : forcedLookupLocation === "" ? getReturnTypeOfSignature(sig) : getJsxPropsTypeForSignatureFromMember(sig, forcedLookupLocation);
|
|
69810
69828
|
if (!attributesType) {
|
|
69811
69829
|
if (!!forcedLookupLocation && !!length(context.attributes.properties)) {
|
|
69812
|
-
|
|
69830
|
+
error2(context, Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, unescapeLeadingUnderscores(forcedLookupLocation));
|
|
69813
69831
|
}
|
|
69814
69832
|
return unknownType;
|
|
69815
69833
|
}
|
|
@@ -70042,7 +70060,9 @@ ${lanes.join("\n")}
|
|
|
70042
70060
|
elementTypes.push(undefinedOrMissingType);
|
|
70043
70061
|
elementFlags.push(2 /* Optional */);
|
|
70044
70062
|
} else {
|
|
70045
|
-
const
|
|
70063
|
+
const shouldAddAsIntraExpressionInferenceSite = inTupleContext && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && isContextSensitive(e);
|
|
70064
|
+
const elementCheckMode = (checkMode || 0 /* Normal */) | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
|
|
70065
|
+
const type = checkExpressionForMutableLocation(e, elementCheckMode, forceTuple);
|
|
70046
70066
|
elementTypes.push(addOptionality(
|
|
70047
70067
|
type,
|
|
70048
70068
|
/*isProperty*/
|
|
@@ -70050,7 +70070,7 @@ ${lanes.join("\n")}
|
|
|
70050
70070
|
hasOmittedExpression
|
|
70051
70071
|
));
|
|
70052
70072
|
elementFlags.push(hasOmittedExpression ? 2 /* Optional */ : 1 /* Required */);
|
|
70053
|
-
if (
|
|
70073
|
+
if (shouldAddAsIntraExpressionInferenceSite) {
|
|
70054
70074
|
const inferenceContext = getInferenceContext(node);
|
|
70055
70075
|
Debug.assert(inferenceContext);
|
|
70056
70076
|
addIntraExpressionInferenceSite(inferenceContext, e, type);
|
|
@@ -70115,7 +70135,7 @@ ${lanes.join("\n")}
|
|
|
70115
70135
|
}
|
|
70116
70136
|
}
|
|
70117
70137
|
if (links.resolvedType.flags & 98304 /* Nullable */ || !isTypeAssignableToKind(links.resolvedType, 402653316 /* StringLike */ | 296 /* NumberLike */ | 12288 /* ESSymbolLike */) && !isTypeAssignableTo(links.resolvedType, stringNumberSymbolType)) {
|
|
70118
|
-
|
|
70138
|
+
error2(node, Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any);
|
|
70119
70139
|
}
|
|
70120
70140
|
}
|
|
70121
70141
|
return links.resolvedType;
|
|
@@ -70191,11 +70211,13 @@ ${lanes.join("\n")}
|
|
|
70191
70211
|
let member = getSymbolOfDeclaration(memberDecl);
|
|
70192
70212
|
const computedNameType = memberDecl.name && memberDecl.name.kind === 166 /* ComputedPropertyName */ ? checkComputedPropertyName(memberDecl.name) : void 0;
|
|
70193
70213
|
if (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 303 /* ShorthandPropertyAssignment */ || isObjectLiteralMethod(memberDecl)) {
|
|
70194
|
-
|
|
70214
|
+
const shouldAddAsIntraExpressionInferenceSite = contextualType && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 173 /* MethodDeclaration */) && isContextSensitive(memberDecl);
|
|
70215
|
+
const propCheckMode = checkMode | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
|
|
70216
|
+
let type = memberDecl.kind === 302 /* PropertyAssignment */ ? checkPropertyAssignment(memberDecl, propCheckMode) : (
|
|
70195
70217
|
// avoid resolving the left side of the ShorthandPropertyAssignment outside of the destructuring
|
|
70196
70218
|
// for error recovery purposes. For example, if a user wrote `{ a = 100 }` instead of `{ a: 100 }`.
|
|
70197
70219
|
// we don't want to say "could not find 'a'".
|
|
70198
|
-
memberDecl.kind === 303 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name,
|
|
70220
|
+
memberDecl.kind === 303 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, propCheckMode) : checkObjectLiteralMethod(memberDecl, propCheckMode)
|
|
70199
70221
|
);
|
|
70200
70222
|
if (isInJavascript) {
|
|
70201
70223
|
const jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl);
|
|
@@ -70222,7 +70244,7 @@ ${lanes.join("\n")}
|
|
|
70222
70244
|
if (impliedProp) {
|
|
70223
70245
|
prop.flags |= impliedProp.flags & 16777216 /* Optional */;
|
|
70224
70246
|
} else if (!compilerOptions.suppressExcessPropertyErrors && !getIndexInfoOfType(contextualType, stringType)) {
|
|
70225
|
-
|
|
70247
|
+
error2(
|
|
70226
70248
|
memberDecl.name,
|
|
70227
70249
|
Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1,
|
|
70228
70250
|
symbolToString(member),
|
|
@@ -70239,7 +70261,7 @@ ${lanes.join("\n")}
|
|
|
70239
70261
|
prop.links.target = member;
|
|
70240
70262
|
member = prop;
|
|
70241
70263
|
allPropertiesTable == null ? void 0 : allPropertiesTable.set(prop.escapedName, prop);
|
|
70242
|
-
if (
|
|
70264
|
+
if (shouldAddAsIntraExpressionInferenceSite) {
|
|
70243
70265
|
const inferenceContext = getInferenceContext(node);
|
|
70244
70266
|
Debug.assert(inferenceContext);
|
|
70245
70267
|
const inferenceNode = memberDecl.kind === 302 /* PropertyAssignment */ ? memberDecl.initializer : memberDecl;
|
|
@@ -70269,7 +70291,7 @@ ${lanes.join("\n")}
|
|
|
70269
70291
|
}
|
|
70270
70292
|
spread = getSpreadType(spread, mergedType, node.symbol, objectFlags, inConstContext);
|
|
70271
70293
|
} else {
|
|
70272
|
-
|
|
70294
|
+
error2(memberDecl, Diagnostics.Spread_types_may_only_be_created_from_object_types);
|
|
70273
70295
|
spread = errorType;
|
|
70274
70296
|
}
|
|
70275
70297
|
continue;
|
|
@@ -70309,7 +70331,7 @@ ${lanes.join("\n")}
|
|
|
70309
70331
|
for (const prop of getPropertiesOfType(contextualType)) {
|
|
70310
70332
|
if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) {
|
|
70311
70333
|
if (!(prop.flags & 16777216 /* Optional */)) {
|
|
70312
|
-
|
|
70334
|
+
error2(
|
|
70313
70335
|
prop.valueDeclaration || ((_a = tryCast(prop, isTransientSymbol)) == null ? void 0 : _a.links.bindingElement),
|
|
70314
70336
|
Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value
|
|
70315
70337
|
);
|
|
@@ -70384,7 +70406,7 @@ ${lanes.join("\n")}
|
|
|
70384
70406
|
checkJsxOpeningLikeElementOrOpeningFragment(node.openingFragment);
|
|
70385
70407
|
const nodeSourceFile = getSourceFileOfNode(node);
|
|
70386
70408
|
if (getJSXTransformEnabled(compilerOptions) && (compilerOptions.jsxFactory || nodeSourceFile.pragmas.has("jsx")) && !compilerOptions.jsxFragmentFactory && !nodeSourceFile.pragmas.has("jsxfrag")) {
|
|
70387
|
-
|
|
70409
|
+
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);
|
|
70388
70410
|
}
|
|
70389
70411
|
checkJsxChildren(node);
|
|
70390
70412
|
return getJsxElementTypeAt(node) || anyType;
|
|
@@ -70412,7 +70434,9 @@ ${lanes.join("\n")}
|
|
|
70412
70434
|
for (const attributeDecl of attributes.properties) {
|
|
70413
70435
|
const member = attributeDecl.symbol;
|
|
70414
70436
|
if (isJsxAttribute(attributeDecl)) {
|
|
70415
|
-
const
|
|
70437
|
+
const shouldAddAsIntraExpressionInferenceSite = contextualType && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && isContextSensitive(attributeDecl);
|
|
70438
|
+
const attributeCheckMode = checkMode | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
|
|
70439
|
+
const exprType = checkJsxAttribute(attributeDecl, attributeCheckMode);
|
|
70416
70440
|
objectFlags |= getObjectFlags(exprType) & 458752 /* PropagatingFlags */;
|
|
70417
70441
|
const attributeSymbol = createSymbol(4 /* Property */ | member.flags, member.escapedName);
|
|
70418
70442
|
attributeSymbol.declarations = member.declarations;
|
|
@@ -70433,7 +70457,7 @@ ${lanes.join("\n")}
|
|
|
70433
70457
|
addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText);
|
|
70434
70458
|
}
|
|
70435
70459
|
}
|
|
70436
|
-
if (
|
|
70460
|
+
if (shouldAddAsIntraExpressionInferenceSite) {
|
|
70437
70461
|
const inferenceContext = getInferenceContext(attributes);
|
|
70438
70462
|
Debug.assert(inferenceContext);
|
|
70439
70463
|
const inferenceNode = attributeDecl.initializer.expression;
|
|
@@ -70469,7 +70493,7 @@ ${lanes.join("\n")}
|
|
|
70469
70493
|
checkSpreadPropOverrides(exprType, allAttributesTable, attributeDecl);
|
|
70470
70494
|
}
|
|
70471
70495
|
} else {
|
|
70472
|
-
|
|
70496
|
+
error2(attributeDecl.expression, Diagnostics.Spread_types_may_only_be_created_from_object_types);
|
|
70473
70497
|
typeToIntersect = typeToIntersect ? getIntersectionType([typeToIntersect, exprType]) : exprType;
|
|
70474
70498
|
}
|
|
70475
70499
|
}
|
|
@@ -70491,7 +70515,7 @@ ${lanes.join("\n")}
|
|
|
70491
70515
|
const childrenTypes = checkJsxChildren(parent2, checkMode);
|
|
70492
70516
|
if (!hasSpreadAnyType && jsxChildrenPropertyName && jsxChildrenPropertyName !== "") {
|
|
70493
70517
|
if (explicitlySpecifyChildrenAttribute) {
|
|
70494
|
-
|
|
70518
|
+
error2(attributes, Diagnostics._0_are_specified_twice_The_attribute_named_0_will_be_overwritten, unescapeLeadingUnderscores(jsxChildrenPropertyName));
|
|
70495
70519
|
}
|
|
70496
70520
|
const contextualType2 = getApparentTypeOfContextualType(
|
|
70497
70521
|
openingLikeElement.attributes,
|
|
@@ -70558,7 +70582,7 @@ ${lanes.join("\n")}
|
|
|
70558
70582
|
if (!(right.flags & 16777216 /* Optional */)) {
|
|
70559
70583
|
const left = props.get(right.escapedName);
|
|
70560
70584
|
if (left) {
|
|
70561
|
-
const diagnostic =
|
|
70585
|
+
const diagnostic = error2(left.valueDeclaration, Diagnostics._0_is_specified_more_than_once_so_this_usage_will_be_overwritten, unescapeLeadingUnderscores(left.escapedName));
|
|
70562
70586
|
addRelatedInfo(diagnostic, createDiagnosticForNode(spread, Diagnostics.This_spread_always_overwrites_this_property));
|
|
70563
70587
|
}
|
|
70564
70588
|
}
|
|
@@ -70590,11 +70614,11 @@ ${lanes.join("\n")}
|
|
|
70590
70614
|
links.jsxFlags |= 2 /* IntrinsicIndexedElement */;
|
|
70591
70615
|
return links.resolvedSymbol = intrinsicElementsType.symbol;
|
|
70592
70616
|
}
|
|
70593
|
-
|
|
70617
|
+
error2(node, Diagnostics.Property_0_does_not_exist_on_type_1, intrinsicTagNameToString(node.tagName), "JSX." + JsxNames.IntrinsicElements);
|
|
70594
70618
|
return links.resolvedSymbol = unknownSymbol;
|
|
70595
70619
|
} else {
|
|
70596
70620
|
if (noImplicitAny) {
|
|
70597
|
-
|
|
70621
|
+
error2(node, Diagnostics.JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists, unescapeLeadingUnderscores(JsxNames.IntrinsicElements));
|
|
70598
70622
|
}
|
|
70599
70623
|
return links.resolvedSymbol = unknownSymbol;
|
|
70600
70624
|
}
|
|
@@ -70677,7 +70701,7 @@ ${lanes.join("\n")}
|
|
|
70677
70701
|
} else if (propertiesOfJsxElementAttribPropInterface.length === 1) {
|
|
70678
70702
|
return propertiesOfJsxElementAttribPropInterface[0].escapedName;
|
|
70679
70703
|
} else if (propertiesOfJsxElementAttribPropInterface.length > 1 && jsxElementAttribPropInterfaceSym.declarations) {
|
|
70680
|
-
|
|
70704
|
+
error2(jsxElementAttribPropInterfaceSym.declarations[0], Diagnostics.The_global_type_JSX_0_may_not_have_more_than_one_property, unescapeLeadingUnderscores(nameOfAttribPropContainer));
|
|
70681
70705
|
}
|
|
70682
70706
|
}
|
|
70683
70707
|
return void 0;
|
|
@@ -70700,7 +70724,7 @@ ${lanes.join("\n")}
|
|
|
70700
70724
|
} else if (elementType.flags & 128 /* StringLiteral */) {
|
|
70701
70725
|
const intrinsicType = getIntrinsicAttributesTypeFromStringLiteralType(elementType, caller);
|
|
70702
70726
|
if (!intrinsicType) {
|
|
70703
|
-
|
|
70727
|
+
error2(caller, Diagnostics.Property_0_does_not_exist_on_type_1, elementType.value, "JSX." + JsxNames.IntrinsicElements);
|
|
70704
70728
|
return emptyArray;
|
|
70705
70729
|
} else {
|
|
70706
70730
|
const fakeSignature = createSignatureForJSXIntrinsic(caller, intrinsicType);
|
|
@@ -70826,11 +70850,11 @@ ${lanes.join("\n")}
|
|
|
70826
70850
|
}
|
|
70827
70851
|
function checkJsxPreconditions(errorNode) {
|
|
70828
70852
|
if ((compilerOptions.jsx || 0 /* None */) === 0 /* None */) {
|
|
70829
|
-
|
|
70853
|
+
error2(errorNode, Diagnostics.Cannot_use_JSX_unless_the_jsx_flag_is_provided);
|
|
70830
70854
|
}
|
|
70831
70855
|
if (getJsxElementTypeAt(errorNode) === void 0) {
|
|
70832
70856
|
if (noImplicitAny) {
|
|
70833
|
-
|
|
70857
|
+
error2(errorNode, Diagnostics.JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist);
|
|
70834
70858
|
}
|
|
70835
70859
|
}
|
|
70836
70860
|
}
|
|
@@ -70922,7 +70946,7 @@ ${lanes.join("\n")}
|
|
|
70922
70946
|
if (node.expression) {
|
|
70923
70947
|
const type = checkExpression(node.expression, checkMode);
|
|
70924
70948
|
if (node.dotDotDotToken && type !== anyType && !isArrayType(type)) {
|
|
70925
|
-
|
|
70949
|
+
error2(node, Diagnostics.JSX_spread_child_must_be_an_array_type);
|
|
70926
70950
|
}
|
|
70927
70951
|
return type;
|
|
70928
70952
|
} else {
|
|
@@ -70951,14 +70975,14 @@ ${lanes.join("\n")}
|
|
|
70951
70975
|
if (languageVersion < 2 /* ES2015 */) {
|
|
70952
70976
|
if (symbolHasNonMethodDeclaration(prop)) {
|
|
70953
70977
|
if (errorNode) {
|
|
70954
|
-
|
|
70978
|
+
error2(errorNode, Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword);
|
|
70955
70979
|
}
|
|
70956
70980
|
return false;
|
|
70957
70981
|
}
|
|
70958
70982
|
}
|
|
70959
70983
|
if (flags & 256 /* Abstract */) {
|
|
70960
70984
|
if (errorNode) {
|
|
70961
|
-
|
|
70985
|
+
error2(
|
|
70962
70986
|
errorNode,
|
|
70963
70987
|
Diagnostics.Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression,
|
|
70964
70988
|
symbolToString(prop),
|
|
@@ -70972,7 +70996,7 @@ ${lanes.join("\n")}
|
|
|
70972
70996
|
const declaringClassDeclaration = getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop));
|
|
70973
70997
|
if (declaringClassDeclaration && isNodeUsedDuringClassInitialization(location)) {
|
|
70974
70998
|
if (errorNode) {
|
|
70975
|
-
|
|
70999
|
+
error2(
|
|
70976
71000
|
errorNode,
|
|
70977
71001
|
Diagnostics.Abstract_property_0_in_class_1_cannot_be_accessed_in_the_constructor,
|
|
70978
71002
|
symbolToString(prop),
|
|
@@ -70989,7 +71013,7 @@ ${lanes.join("\n")}
|
|
|
70989
71013
|
const declaringClassDeclaration = getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop));
|
|
70990
71014
|
if (!isNodeWithinClass(location, declaringClassDeclaration)) {
|
|
70991
71015
|
if (errorNode) {
|
|
70992
|
-
|
|
71016
|
+
error2(
|
|
70993
71017
|
errorNode,
|
|
70994
71018
|
Diagnostics.Property_0_is_private_and_only_accessible_within_class_1,
|
|
70995
71019
|
symbolToString(prop),
|
|
@@ -71012,7 +71036,7 @@ ${lanes.join("\n")}
|
|
|
71012
71036
|
enclosingClass = enclosingClass && isClassDerivedFromDeclaringClasses(enclosingClass, prop, writing);
|
|
71013
71037
|
if (flags & 32 /* Static */ || !enclosingClass) {
|
|
71014
71038
|
if (errorNode) {
|
|
71015
|
-
|
|
71039
|
+
error2(
|
|
71016
71040
|
errorNode,
|
|
71017
71041
|
Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses,
|
|
71018
71042
|
symbolToString(prop),
|
|
@@ -71030,7 +71054,7 @@ ${lanes.join("\n")}
|
|
|
71030
71054
|
}
|
|
71031
71055
|
if (!containingType || !hasBaseType(containingType, enclosingClass)) {
|
|
71032
71056
|
if (errorNode) {
|
|
71033
|
-
|
|
71057
|
+
error2(
|
|
71034
71058
|
errorNode,
|
|
71035
71059
|
Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1_This_is_an_instance_of_class_2,
|
|
71036
71060
|
symbolToString(prop),
|
|
@@ -71078,28 +71102,28 @@ ${lanes.join("\n")}
|
|
|
71078
71102
|
function reportObjectPossiblyNullOrUndefinedError(node, facts) {
|
|
71079
71103
|
const nodeText2 = isEntityNameExpression(node) ? entityNameToString(node) : void 0;
|
|
71080
71104
|
if (node.kind === 106 /* NullKeyword */) {
|
|
71081
|
-
|
|
71105
|
+
error2(node, Diagnostics.The_value_0_cannot_be_used_here, "null");
|
|
71082
71106
|
return;
|
|
71083
71107
|
}
|
|
71084
71108
|
if (nodeText2 !== void 0 && nodeText2.length < 100) {
|
|
71085
71109
|
if (isIdentifier(node) && nodeText2 === "undefined") {
|
|
71086
|
-
|
|
71110
|
+
error2(node, Diagnostics.The_value_0_cannot_be_used_here, "undefined");
|
|
71087
71111
|
return;
|
|
71088
71112
|
}
|
|
71089
|
-
|
|
71113
|
+
error2(
|
|
71090
71114
|
node,
|
|
71091
71115
|
facts & 16777216 /* IsUndefined */ ? facts & 33554432 /* IsNull */ ? Diagnostics._0_is_possibly_null_or_undefined : Diagnostics._0_is_possibly_undefined : Diagnostics._0_is_possibly_null,
|
|
71092
71116
|
nodeText2
|
|
71093
71117
|
);
|
|
71094
71118
|
} else {
|
|
71095
|
-
|
|
71119
|
+
error2(
|
|
71096
71120
|
node,
|
|
71097
71121
|
facts & 16777216 /* IsUndefined */ ? facts & 33554432 /* IsNull */ ? Diagnostics.Object_is_possibly_null_or_undefined : Diagnostics.Object_is_possibly_undefined : Diagnostics.Object_is_possibly_null
|
|
71098
71122
|
);
|
|
71099
71123
|
}
|
|
71100
71124
|
}
|
|
71101
71125
|
function reportCannotInvokePossiblyNullOrUndefinedError(node, facts) {
|
|
71102
|
-
|
|
71126
|
+
error2(
|
|
71103
71127
|
node,
|
|
71104
71128
|
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
|
|
71105
71129
|
);
|
|
@@ -71109,11 +71133,11 @@ ${lanes.join("\n")}
|
|
|
71109
71133
|
if (isEntityNameExpression(node)) {
|
|
71110
71134
|
const nodeText2 = entityNameToString(node);
|
|
71111
71135
|
if (nodeText2.length < 100) {
|
|
71112
|
-
|
|
71136
|
+
error2(node, Diagnostics._0_is_of_type_unknown, nodeText2);
|
|
71113
71137
|
return errorType;
|
|
71114
71138
|
}
|
|
71115
71139
|
}
|
|
71116
|
-
|
|
71140
|
+
error2(node, Diagnostics.Object_is_of_type_unknown);
|
|
71117
71141
|
return errorType;
|
|
71118
71142
|
}
|
|
71119
71143
|
const facts = getTypeFacts(type);
|
|
@@ -71133,15 +71157,15 @@ ${lanes.join("\n")}
|
|
|
71133
71157
|
if (isEntityNameExpression(node)) {
|
|
71134
71158
|
const nodeText2 = entityNameToString(node);
|
|
71135
71159
|
if (isIdentifier(node) && nodeText2 === "undefined") {
|
|
71136
|
-
|
|
71160
|
+
error2(node, Diagnostics.The_value_0_cannot_be_used_here, nodeText2);
|
|
71137
71161
|
return nonNullType;
|
|
71138
71162
|
}
|
|
71139
71163
|
if (nodeText2.length < 100) {
|
|
71140
|
-
|
|
71164
|
+
error2(node, Diagnostics._0_is_possibly_undefined, nodeText2);
|
|
71141
71165
|
return nonNullType;
|
|
71142
71166
|
}
|
|
71143
71167
|
}
|
|
71144
|
-
|
|
71168
|
+
error2(node, Diagnostics.Object_is_possibly_undefined);
|
|
71145
71169
|
}
|
|
71146
71170
|
return nonNullType;
|
|
71147
71171
|
}
|
|
@@ -71236,7 +71260,7 @@ ${lanes.join("\n")}
|
|
|
71236
71260
|
const lexicalClass = getContainingClass(lexicalValueDecl);
|
|
71237
71261
|
Debug.assert(!!lexicalClass);
|
|
71238
71262
|
if (findAncestor(lexicalClass, (n) => typeClass === n)) {
|
|
71239
|
-
const diagnostic =
|
|
71263
|
+
const diagnostic = error2(
|
|
71240
71264
|
right,
|
|
71241
71265
|
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,
|
|
71242
71266
|
diagName,
|
|
@@ -71258,7 +71282,7 @@ ${lanes.join("\n")}
|
|
|
71258
71282
|
return true;
|
|
71259
71283
|
}
|
|
71260
71284
|
}
|
|
71261
|
-
|
|
71285
|
+
error2(
|
|
71262
71286
|
right,
|
|
71263
71287
|
Diagnostics.Property_0_is_not_accessible_outside_class_1_because_it_has_a_private_identifier,
|
|
71264
71288
|
diagName,
|
|
@@ -71311,7 +71335,7 @@ ${lanes.join("\n")}
|
|
|
71311
71335
|
} else {
|
|
71312
71336
|
const isSetonlyAccessor = prop && prop.flags & 65536 /* SetAccessor */ && !(prop.flags & 32768 /* GetAccessor */);
|
|
71313
71337
|
if (isSetonlyAccessor && assignmentKind !== 1 /* Definite */) {
|
|
71314
|
-
|
|
71338
|
+
error2(node, Diagnostics.Private_accessor_was_defined_without_a_getter);
|
|
71315
71339
|
}
|
|
71316
71340
|
}
|
|
71317
71341
|
} else {
|
|
@@ -71348,9 +71372,9 @@ ${lanes.join("\n")}
|
|
|
71348
71372
|
}
|
|
71349
71373
|
if (leftType.symbol === globalThisSymbol) {
|
|
71350
71374
|
if (globalThisSymbol.exports.has(right.escapedText) && globalThisSymbol.exports.get(right.escapedText).flags & 418 /* BlockScoped */) {
|
|
71351
|
-
|
|
71375
|
+
error2(right, Diagnostics.Property_0_does_not_exist_on_type_1, unescapeLeadingUnderscores(right.escapedText), typeToString(leftType));
|
|
71352
71376
|
} else if (noImplicitAny) {
|
|
71353
|
-
|
|
71377
|
+
error2(right, Diagnostics.Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature, typeToString(leftType));
|
|
71354
71378
|
}
|
|
71355
71379
|
return anyType;
|
|
71356
71380
|
}
|
|
@@ -71360,11 +71384,11 @@ ${lanes.join("\n")}
|
|
|
71360
71384
|
return errorType;
|
|
71361
71385
|
}
|
|
71362
71386
|
if (indexInfo.isReadonly && (isAssignmentTarget(node) || isDeleteTarget(node))) {
|
|
71363
|
-
|
|
71387
|
+
error2(node, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(apparentType));
|
|
71364
71388
|
}
|
|
71365
71389
|
propType = compilerOptions.noUncheckedIndexedAccess && !isAssignmentTarget(node) ? getUnionType([indexInfo.type, missingType]) : indexInfo.type;
|
|
71366
71390
|
if (compilerOptions.noPropertyAccessFromIndexSignature && isPropertyAccessExpression(node)) {
|
|
71367
|
-
|
|
71391
|
+
error2(right, Diagnostics.Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0, unescapeLeadingUnderscores(right.escapedText));
|
|
71368
71392
|
}
|
|
71369
71393
|
if (indexInfo.declaration && getCombinedNodeFlags(indexInfo.declaration) & 268435456 /* Deprecated */) {
|
|
71370
71394
|
addDeprecatedSuggestion(right, [indexInfo.declaration], right.escapedText);
|
|
@@ -71379,7 +71403,7 @@ ${lanes.join("\n")}
|
|
|
71379
71403
|
getNodeLinks(node).resolvedSymbol = prop;
|
|
71380
71404
|
checkPropertyAccessibility(node, left.kind === 108 /* SuperKeyword */, isWriteAccess(node), apparentType, prop);
|
|
71381
71405
|
if (isAssignmentToReadonlyEntity(node, prop, assignmentKind)) {
|
|
71382
|
-
|
|
71406
|
+
error2(right, Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, idText(right));
|
|
71383
71407
|
return errorType;
|
|
71384
71408
|
}
|
|
71385
71409
|
propType = isThisPropertyAccessInConstructor(node, prop) ? autoType : writeOnly || isWriteOnlyAccess(node) ? getWriteTypeOfSymbol(prop) : getTypeOfSymbol(prop);
|
|
@@ -71424,7 +71448,7 @@ ${lanes.join("\n")}
|
|
|
71424
71448
|
}
|
|
71425
71449
|
const flowType = getFlowTypeOfReference(node, propType, assumeUninitialized ? getOptionalType(propType) : propType);
|
|
71426
71450
|
if (assumeUninitialized && !containsUndefinedType(propType) && containsUndefinedType(flowType)) {
|
|
71427
|
-
|
|
71451
|
+
error2(errorNode, Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(prop));
|
|
71428
71452
|
return propType;
|
|
71429
71453
|
}
|
|
71430
71454
|
return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType;
|
|
@@ -71437,9 +71461,9 @@ ${lanes.join("\n")}
|
|
|
71437
71461
|
let diagnosticMessage;
|
|
71438
71462
|
const declarationName = idText(right);
|
|
71439
71463
|
if (isInPropertyInitializerOrClassStaticBlock(node) && !isOptionalPropertyDeclaration(valueDeclaration) && !(isAccessExpression(node) && isAccessExpression(node.expression)) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right) && !(isMethodDeclaration(valueDeclaration) && getCombinedModifierFlags(valueDeclaration) & 32 /* Static */) && (compilerOptions.useDefineForClassFields || !isPropertyDeclaredInAncestorClass(prop))) {
|
|
71440
|
-
diagnosticMessage =
|
|
71464
|
+
diagnosticMessage = error2(right, Diagnostics.Property_0_is_used_before_its_initialization, declarationName);
|
|
71441
71465
|
} else if (valueDeclaration.kind === 262 /* ClassDeclaration */ && node.parent.kind !== 182 /* TypeReference */ && !(valueDeclaration.flags & 16777216 /* Ambient */) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) {
|
|
71442
|
-
diagnosticMessage =
|
|
71466
|
+
diagnosticMessage = error2(right, Diagnostics.Class_0_used_before_its_declaration, declarationName);
|
|
71443
71467
|
}
|
|
71444
71468
|
if (diagnosticMessage) {
|
|
71445
71469
|
addRelatedInfo(
|
|
@@ -71817,7 +71841,7 @@ ${lanes.join("\n")}
|
|
|
71817
71841
|
return objectType;
|
|
71818
71842
|
}
|
|
71819
71843
|
if (isConstEnumObjectType(objectType) && !isStringLiteralLike(indexExpression)) {
|
|
71820
|
-
|
|
71844
|
+
error2(indexExpression, Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal);
|
|
71821
71845
|
return errorType;
|
|
71822
71846
|
}
|
|
71823
71847
|
const effectiveIndexType = isForInVariableForNumericPropertyNames(indexExpression) ? numberType : indexType;
|
|
@@ -72051,7 +72075,7 @@ ${lanes.join("\n")}
|
|
|
72051
72075
|
}
|
|
72052
72076
|
for (let i = 0; i < argCount; i++) {
|
|
72053
72077
|
const arg = args[i];
|
|
72054
|
-
if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode &
|
|
72078
|
+
if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode & 64 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) {
|
|
72055
72079
|
const paramType = getTypeAtPosition(signature, i);
|
|
72056
72080
|
if (couldContainTypeVariables(paramType)) {
|
|
72057
72081
|
const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
|
|
@@ -72524,7 +72548,7 @@ ${lanes.join("\n")}
|
|
|
72524
72548
|
if (isVoidPromiseError && isInJSFile(node)) {
|
|
72525
72549
|
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);
|
|
72526
72550
|
}
|
|
72527
|
-
const
|
|
72551
|
+
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;
|
|
72528
72552
|
if (min2 < args.length && args.length < max) {
|
|
72529
72553
|
if (headMessage) {
|
|
72530
72554
|
let chain = chainDiagnosticMessages(
|
|
@@ -72545,14 +72569,14 @@ ${lanes.join("\n")}
|
|
|
72545
72569
|
let chain = chainDiagnosticMessages(
|
|
72546
72570
|
/*details*/
|
|
72547
72571
|
void 0,
|
|
72548
|
-
|
|
72572
|
+
error3,
|
|
72549
72573
|
parameterRange,
|
|
72550
72574
|
args.length
|
|
72551
72575
|
);
|
|
72552
72576
|
chain = chainDiagnosticMessages(chain, headMessage);
|
|
72553
72577
|
diagnostic = getDiagnosticForCallNode(node, chain);
|
|
72554
72578
|
} else {
|
|
72555
|
-
diagnostic = getDiagnosticForCallNode(node,
|
|
72579
|
+
diagnostic = getDiagnosticForCallNode(node, error3, parameterRange, args.length);
|
|
72556
72580
|
}
|
|
72557
72581
|
const parameter = (_a = closestSignature == null ? void 0 : closestSignature.declaration) == null ? void 0 : _a.parameters[closestSignature.thisParameter ? args.length + 1 : args.length];
|
|
72558
72582
|
if (parameter) {
|
|
@@ -72573,14 +72597,14 @@ ${lanes.join("\n")}
|
|
|
72573
72597
|
let chain = chainDiagnosticMessages(
|
|
72574
72598
|
/*details*/
|
|
72575
72599
|
void 0,
|
|
72576
|
-
|
|
72600
|
+
error3,
|
|
72577
72601
|
parameterRange,
|
|
72578
72602
|
args.length
|
|
72579
72603
|
);
|
|
72580
72604
|
chain = chainDiagnosticMessages(chain, headMessage);
|
|
72581
72605
|
return createDiagnosticForNodeArrayFromMessageChain(getSourceFileOfNode(node), errorSpan, chain);
|
|
72582
72606
|
}
|
|
72583
|
-
return createDiagnosticForNodeArray(getSourceFileOfNode(node), errorSpan,
|
|
72607
|
+
return createDiagnosticForNodeArray(getSourceFileOfNode(node), errorSpan, error3, parameterRange, args.length);
|
|
72584
72608
|
}
|
|
72585
72609
|
}
|
|
72586
72610
|
function getTypeArgumentArityError(node, signatures, typeArguments, headMessage) {
|
|
@@ -72664,12 +72688,12 @@ ${lanes.join("\n")}
|
|
|
72664
72688
|
const args = getEffectiveCallArguments(node);
|
|
72665
72689
|
const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
|
|
72666
72690
|
let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
|
|
72667
|
-
argCheckMode |= checkMode &
|
|
72691
|
+
argCheckMode |= checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
|
|
72668
72692
|
let candidatesForArgumentError;
|
|
72669
72693
|
let candidateForArgumentArityError;
|
|
72670
72694
|
let candidateForTypeArgumentError;
|
|
72671
72695
|
let result;
|
|
72672
|
-
const signatureHelpTrailingComma = !!(checkMode &
|
|
72696
|
+
const signatureHelpTrailingComma = !!(checkMode & 32 /* IsForSignatureHelp */) && node.kind === 212 /* CallExpression */ && node.arguments.hasTrailingComma;
|
|
72673
72697
|
if (candidates.length > 1) {
|
|
72674
72698
|
result = chooseOverload(candidates, subtypeRelation, isSingleNonGenericCandidate, signatureHelpTrailingComma);
|
|
72675
72699
|
}
|
|
@@ -72888,7 +72912,7 @@ ${lanes.join("\n")}
|
|
|
72888
72912
|
continue;
|
|
72889
72913
|
}
|
|
72890
72914
|
if (argCheckMode) {
|
|
72891
|
-
argCheckMode = checkMode &
|
|
72915
|
+
argCheckMode = checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
|
|
72892
72916
|
if (inferenceContext) {
|
|
72893
72917
|
const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
|
|
72894
72918
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
|
|
@@ -73062,13 +73086,13 @@ ${lanes.join("\n")}
|
|
|
73062
73086
|
const numConstructSignatures = getSignaturesOfType(apparentType, 1 /* Construct */).length;
|
|
73063
73087
|
if (isUntypedFunctionCall(funcType, apparentType, callSignatures.length, numConstructSignatures)) {
|
|
73064
73088
|
if (!isErrorType(funcType) && node.typeArguments) {
|
|
73065
|
-
|
|
73089
|
+
error2(node, Diagnostics.Untyped_function_calls_may_not_accept_type_arguments);
|
|
73066
73090
|
}
|
|
73067
73091
|
return resolveUntypedCall(node);
|
|
73068
73092
|
}
|
|
73069
73093
|
if (!callSignatures.length) {
|
|
73070
73094
|
if (numConstructSignatures) {
|
|
73071
|
-
|
|
73095
|
+
error2(node, Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new, typeToString(funcType));
|
|
73072
73096
|
} else {
|
|
73073
73097
|
let relatedInformation;
|
|
73074
73098
|
if (node.arguments.length === 1) {
|
|
@@ -73091,7 +73115,7 @@ ${lanes.join("\n")}
|
|
|
73091
73115
|
return resolvingSignature;
|
|
73092
73116
|
}
|
|
73093
73117
|
if (callSignatures.some((sig) => isInJSFile(sig.declaration) && !!getJSDocClassTag(sig.declaration))) {
|
|
73094
|
-
|
|
73118
|
+
error2(node, Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new, typeToString(funcType));
|
|
73095
73119
|
return resolveErrorCall(node);
|
|
73096
73120
|
}
|
|
73097
73121
|
return resolveCall(node, callSignatures, candidatesOutArray, checkMode, callChainFlags);
|
|
@@ -73106,7 +73130,7 @@ ${lanes.join("\n")}
|
|
|
73106
73130
|
if (node.arguments && languageVersion < 1 /* ES5 */) {
|
|
73107
73131
|
const spreadIndex = getSpreadArgumentIndex(node.arguments);
|
|
73108
73132
|
if (spreadIndex >= 0) {
|
|
73109
|
-
|
|
73133
|
+
error2(node.arguments[spreadIndex], Diagnostics.Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher);
|
|
73110
73134
|
}
|
|
73111
73135
|
}
|
|
73112
73136
|
let expressionType = checkNonNullExpression(node.expression);
|
|
@@ -73119,7 +73143,7 @@ ${lanes.join("\n")}
|
|
|
73119
73143
|
}
|
|
73120
73144
|
if (isTypeAny(expressionType)) {
|
|
73121
73145
|
if (node.typeArguments) {
|
|
73122
|
-
|
|
73146
|
+
error2(node, Diagnostics.Untyped_function_calls_may_not_accept_type_arguments);
|
|
73123
73147
|
}
|
|
73124
73148
|
return resolveUntypedCall(node);
|
|
73125
73149
|
}
|
|
@@ -73129,12 +73153,12 @@ ${lanes.join("\n")}
|
|
|
73129
73153
|
return resolveErrorCall(node);
|
|
73130
73154
|
}
|
|
73131
73155
|
if (someSignature(constructSignatures, (signature) => !!(signature.flags & 4 /* Abstract */))) {
|
|
73132
|
-
|
|
73156
|
+
error2(node, Diagnostics.Cannot_create_an_instance_of_an_abstract_class);
|
|
73133
73157
|
return resolveErrorCall(node);
|
|
73134
73158
|
}
|
|
73135
73159
|
const valueDecl = expressionType.symbol && getClassLikeDeclarationOfSymbol(expressionType.symbol);
|
|
73136
73160
|
if (valueDecl && hasSyntacticModifier(valueDecl, 256 /* Abstract */)) {
|
|
73137
|
-
|
|
73161
|
+
error2(node, Diagnostics.Cannot_create_an_instance_of_an_abstract_class);
|
|
73138
73162
|
return resolveErrorCall(node);
|
|
73139
73163
|
}
|
|
73140
73164
|
return resolveCall(node, constructSignatures, candidatesOutArray, checkMode, 0 /* None */);
|
|
@@ -73144,10 +73168,10 @@ ${lanes.join("\n")}
|
|
|
73144
73168
|
const signature = resolveCall(node, callSignatures, candidatesOutArray, checkMode, 0 /* None */);
|
|
73145
73169
|
if (!noImplicitAny) {
|
|
73146
73170
|
if (signature.declaration && !isJSConstructor(signature.declaration) && getReturnTypeOfSignature(signature) !== voidType) {
|
|
73147
|
-
|
|
73171
|
+
error2(node, Diagnostics.Only_a_void_function_can_be_called_with_the_new_keyword);
|
|
73148
73172
|
}
|
|
73149
73173
|
if (getThisTypeOfSignature(signature) === voidType) {
|
|
73150
|
-
|
|
73174
|
+
error2(node, Diagnostics.A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void);
|
|
73151
73175
|
}
|
|
73152
73176
|
}
|
|
73153
73177
|
return signature;
|
|
@@ -73211,10 +73235,10 @@ ${lanes.join("\n")}
|
|
|
73211
73235
|
}
|
|
73212
73236
|
}
|
|
73213
73237
|
if (modifiers & 8 /* Private */) {
|
|
73214
|
-
|
|
73238
|
+
error2(node, Diagnostics.Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration, typeToString(declaringClass));
|
|
73215
73239
|
}
|
|
73216
73240
|
if (modifiers & 16 /* Protected */) {
|
|
73217
|
-
|
|
73241
|
+
error2(node, Diagnostics.Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration, typeToString(declaringClass));
|
|
73218
73242
|
}
|
|
73219
73243
|
return false;
|
|
73220
73244
|
}
|
|
@@ -73376,7 +73400,7 @@ ${lanes.join("\n")}
|
|
|
73376
73400
|
/*includeTrivia*/
|
|
73377
73401
|
false
|
|
73378
73402
|
);
|
|
73379
|
-
|
|
73403
|
+
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);
|
|
73380
73404
|
return resolveErrorCall(node);
|
|
73381
73405
|
}
|
|
73382
73406
|
const headMessage = getDiagnosticHeadMessageForDecoratorResolution(node);
|
|
@@ -73466,7 +73490,7 @@ ${lanes.join("\n")}
|
|
|
73466
73490
|
return resolveUntypedCall(node);
|
|
73467
73491
|
}
|
|
73468
73492
|
if (signatures.length === 0) {
|
|
73469
|
-
|
|
73493
|
+
error2(node.tagName, Diagnostics.JSX_element_type_0_does_not_have_any_construct_or_call_signatures, getTextOfNode(node.tagName));
|
|
73470
73494
|
return resolveErrorCall(node);
|
|
73471
73495
|
}
|
|
73472
73496
|
return resolveCall(node, signatures, candidatesOutArray, checkMode, 0 /* None */);
|
|
@@ -73626,7 +73650,7 @@ ${lanes.join("\n")}
|
|
|
73626
73650
|
const declaration = signature.declaration;
|
|
73627
73651
|
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)) {
|
|
73628
73652
|
if (noImplicitAny) {
|
|
73629
|
-
|
|
73653
|
+
error2(node, Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type);
|
|
73630
73654
|
}
|
|
73631
73655
|
return anyType;
|
|
73632
73656
|
}
|
|
@@ -73640,9 +73664,9 @@ ${lanes.join("\n")}
|
|
|
73640
73664
|
}
|
|
73641
73665
|
if (node.kind === 212 /* CallExpression */ && !node.questionDotToken && node.parent.kind === 243 /* ExpressionStatement */ && returnType.flags & 16384 /* Void */ && getTypePredicateOfSignature(signature)) {
|
|
73642
73666
|
if (!isDottedName(node.expression)) {
|
|
73643
|
-
|
|
73667
|
+
error2(node.expression, Diagnostics.Assertions_require_the_call_target_to_be_an_identifier_or_qualified_name);
|
|
73644
73668
|
} else if (!getEffectsSignature(node)) {
|
|
73645
|
-
const diagnostic =
|
|
73669
|
+
const diagnostic = error2(node.expression, Diagnostics.Assertions_require_every_name_in_the_call_target_to_be_declared_with_an_explicit_type_annotation);
|
|
73646
73670
|
getTypeOfDottedName(node.expression, diagnostic);
|
|
73647
73671
|
}
|
|
73648
73672
|
}
|
|
@@ -73731,7 +73755,7 @@ ${lanes.join("\n")}
|
|
|
73731
73755
|
checkExpressionCached(node.arguments[i]);
|
|
73732
73756
|
}
|
|
73733
73757
|
if (specifierType.flags & 32768 /* Undefined */ || specifierType.flags & 65536 /* Null */ || !isTypeAssignableTo(specifierType, stringType)) {
|
|
73734
|
-
|
|
73758
|
+
error2(specifier, Diagnostics.Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0, typeToString(specifierType));
|
|
73735
73759
|
}
|
|
73736
73760
|
if (optionsType) {
|
|
73737
73761
|
const importCallOptionsType = getGlobalImportCallOptionsType(
|
|
@@ -73905,7 +73929,7 @@ ${lanes.join("\n")}
|
|
|
73905
73929
|
const exprType = checkExpression(expression, checkMode);
|
|
73906
73930
|
if (isConstTypeReference(type)) {
|
|
73907
73931
|
if (!isValidConstAssertionArgument(expression)) {
|
|
73908
|
-
|
|
73932
|
+
error2(expression, Diagnostics.A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array_or_object_literals);
|
|
73909
73933
|
}
|
|
73910
73934
|
return getRegularTypeOfLiteralType(exprType);
|
|
73911
73935
|
}
|
|
@@ -73966,7 +73990,7 @@ ${lanes.join("\n")}
|
|
|
73966
73990
|
if (node.kind === 232 /* ExpressionWithTypeArguments */) {
|
|
73967
73991
|
const parent2 = walkUpParenthesizedExpressions(node.parent);
|
|
73968
73992
|
if (parent2.kind === 225 /* BinaryExpression */ && parent2.operatorToken.kind === 104 /* InstanceOfKeyword */ && isNodeDescendantOf(node, parent2.right)) {
|
|
73969
|
-
|
|
73993
|
+
error2(node, Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_not_be_an_instantiation_expression);
|
|
73970
73994
|
}
|
|
73971
73995
|
}
|
|
73972
73996
|
const exprType = node.kind === 232 /* ExpressionWithTypeArguments */ ? checkExpression(node.expression) : isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName);
|
|
@@ -74081,7 +74105,7 @@ ${lanes.join("\n")}
|
|
|
74081
74105
|
function checkNewTargetMetaProperty(node) {
|
|
74082
74106
|
const container = getNewTargetContainer(node);
|
|
74083
74107
|
if (!container) {
|
|
74084
|
-
|
|
74108
|
+
error2(node, Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target");
|
|
74085
74109
|
return errorType;
|
|
74086
74110
|
} else if (container.kind === 175 /* Constructor */) {
|
|
74087
74111
|
const symbol = getSymbolOfDeclaration(container.parent);
|
|
@@ -74094,10 +74118,10 @@ ${lanes.join("\n")}
|
|
|
74094
74118
|
function checkImportMetaProperty(node) {
|
|
74095
74119
|
if (moduleKind === 100 /* Node16 */ || moduleKind === 199 /* NodeNext */) {
|
|
74096
74120
|
if (getSourceFileOfNode(node).impliedNodeFormat !== 99 /* ESNext */) {
|
|
74097
|
-
|
|
74121
|
+
error2(node, Diagnostics.The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output);
|
|
74098
74122
|
}
|
|
74099
74123
|
} else if (moduleKind < 6 /* ES2020 */ && moduleKind !== 4 /* System */) {
|
|
74100
|
-
|
|
74124
|
+
error2(node, Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_or_nodenext);
|
|
74101
74125
|
}
|
|
74102
74126
|
const file = getSourceFileOfNode(node);
|
|
74103
74127
|
Debug.assert(!!(file.flags & 4194304 /* PossiblyContainsImportMeta */), "Containing file is missing import meta node flag.");
|
|
@@ -74654,13 +74678,13 @@ ${lanes.join("\n")}
|
|
|
74654
74678
|
function createPromiseReturnType(func, promisedType) {
|
|
74655
74679
|
const promiseType = createPromiseType(promisedType);
|
|
74656
74680
|
if (promiseType === unknownType) {
|
|
74657
|
-
|
|
74681
|
+
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);
|
|
74658
74682
|
return errorType;
|
|
74659
74683
|
} else if (!getGlobalPromiseConstructorSymbol(
|
|
74660
74684
|
/*reportErrors*/
|
|
74661
74685
|
true
|
|
74662
74686
|
)) {
|
|
74663
|
-
|
|
74687
|
+
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);
|
|
74664
74688
|
}
|
|
74665
74689
|
return promiseType;
|
|
74666
74690
|
}
|
|
@@ -74956,11 +74980,11 @@ ${lanes.join("\n")}
|
|
|
74956
74980
|
const hasExplicitReturn = func.flags & 512 /* HasExplicitReturn */;
|
|
74957
74981
|
const errorNode = getEffectiveReturnTypeNode(func) || func;
|
|
74958
74982
|
if (type && type.flags & 131072 /* Never */) {
|
|
74959
|
-
|
|
74983
|
+
error2(errorNode, Diagnostics.A_function_returning_never_cannot_have_a_reachable_end_point);
|
|
74960
74984
|
} else if (type && !hasExplicitReturn) {
|
|
74961
|
-
|
|
74985
|
+
error2(errorNode, Diagnostics.A_function_whose_declared_type_is_neither_undefined_void_nor_any_must_return_a_value);
|
|
74962
74986
|
} else if (type && strictNullChecks && !isTypeAssignableTo(undefinedType, type)) {
|
|
74963
|
-
|
|
74987
|
+
error2(errorNode, Diagnostics.Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined);
|
|
74964
74988
|
} else if (compilerOptions.noImplicitReturns) {
|
|
74965
74989
|
if (!type) {
|
|
74966
74990
|
if (!hasExplicitReturn) {
|
|
@@ -74971,7 +74995,7 @@ ${lanes.join("\n")}
|
|
|
74971
74995
|
return;
|
|
74972
74996
|
}
|
|
74973
74997
|
}
|
|
74974
|
-
|
|
74998
|
+
error2(errorNode, Diagnostics.Not_all_code_paths_return_a_value);
|
|
74975
74999
|
}
|
|
74976
75000
|
}
|
|
74977
75001
|
}
|
|
@@ -75171,11 +75195,11 @@ ${lanes.join("\n")}
|
|
|
75171
75195
|
function checkReferenceExpression(expr, invalidReferenceMessage, invalidOptionalChainMessage) {
|
|
75172
75196
|
const node = skipOuterExpressions(expr, 6 /* Assertions */ | 1 /* Parentheses */);
|
|
75173
75197
|
if (node.kind !== 80 /* Identifier */ && !isAccessExpression(node)) {
|
|
75174
|
-
|
|
75198
|
+
error2(expr, invalidReferenceMessage);
|
|
75175
75199
|
return false;
|
|
75176
75200
|
}
|
|
75177
75201
|
if (node.flags & 32 /* OptionalChain */) {
|
|
75178
|
-
|
|
75202
|
+
error2(expr, invalidOptionalChainMessage);
|
|
75179
75203
|
return false;
|
|
75180
75204
|
}
|
|
75181
75205
|
return true;
|
|
@@ -75184,17 +75208,17 @@ ${lanes.join("\n")}
|
|
|
75184
75208
|
checkExpression(node.expression);
|
|
75185
75209
|
const expr = skipParentheses(node.expression);
|
|
75186
75210
|
if (!isAccessExpression(expr)) {
|
|
75187
|
-
|
|
75211
|
+
error2(expr, Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference);
|
|
75188
75212
|
return booleanType;
|
|
75189
75213
|
}
|
|
75190
75214
|
if (isPropertyAccessExpression(expr) && isPrivateIdentifier(expr.name)) {
|
|
75191
|
-
|
|
75215
|
+
error2(expr, Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_private_identifier);
|
|
75192
75216
|
}
|
|
75193
75217
|
const links = getNodeLinks(expr);
|
|
75194
75218
|
const symbol = getExportSymbolOfValueSymbolIfExported(links.resolvedSymbol);
|
|
75195
75219
|
if (symbol) {
|
|
75196
75220
|
if (isReadonlySymbol(symbol)) {
|
|
75197
|
-
|
|
75221
|
+
error2(expr, Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_read_only_property);
|
|
75198
75222
|
}
|
|
75199
75223
|
checkDeleteExpressionMustBeOptional(expr, symbol);
|
|
75200
75224
|
}
|
|
@@ -75203,7 +75227,7 @@ ${lanes.join("\n")}
|
|
|
75203
75227
|
function checkDeleteExpressionMustBeOptional(expr, symbol) {
|
|
75204
75228
|
const type = getTypeOfSymbol(symbol);
|
|
75205
75229
|
if (strictNullChecks && !(type.flags & (3 /* AnyOrUnknown */ | 131072 /* Never */)) && !(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ : getTypeFacts(type) & 16777216 /* IsUndefined */)) {
|
|
75206
|
-
|
|
75230
|
+
error2(expr, Diagnostics.The_operand_of_a_delete_operator_must_be_optional);
|
|
75207
75231
|
}
|
|
75208
75232
|
}
|
|
75209
75233
|
function checkTypeOfExpression(node) {
|
|
@@ -75217,7 +75241,7 @@ ${lanes.join("\n")}
|
|
|
75217
75241
|
function checkAwaitExpressionGrammar(node) {
|
|
75218
75242
|
const container = getContainingFunctionOrClassStaticBlock(node);
|
|
75219
75243
|
if (container && isClassStaticBlockDeclaration(container)) {
|
|
75220
|
-
|
|
75244
|
+
error2(node, Diagnostics.Await_expression_cannot_be_used_inside_a_class_static_block);
|
|
75221
75245
|
} else if (!(node.flags & 32768 /* AwaitContext */)) {
|
|
75222
75246
|
if (isInTopLevelContext(node)) {
|
|
75223
75247
|
const sourceFile = getSourceFileOfNode(node);
|
|
@@ -75276,7 +75300,7 @@ ${lanes.join("\n")}
|
|
|
75276
75300
|
}
|
|
75277
75301
|
}
|
|
75278
75302
|
if (isInParameterInitializerBeforeContainingFunction(node)) {
|
|
75279
|
-
|
|
75303
|
+
error2(node, Diagnostics.await_expressions_cannot_be_used_in_a_parameter_initializer);
|
|
75280
75304
|
}
|
|
75281
75305
|
}
|
|
75282
75306
|
function checkAwaitExpression(node) {
|
|
@@ -75326,11 +75350,11 @@ ${lanes.join("\n")}
|
|
|
75326
75350
|
case 55 /* TildeToken */:
|
|
75327
75351
|
checkNonNullType(operandType, node.operand);
|
|
75328
75352
|
if (maybeTypeOfKindConsideringBaseConstraint(operandType, 12288 /* ESSymbolLike */)) {
|
|
75329
|
-
|
|
75353
|
+
error2(node.operand, Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, tokenToString(node.operator));
|
|
75330
75354
|
}
|
|
75331
75355
|
if (node.operator === 40 /* PlusToken */) {
|
|
75332
75356
|
if (maybeTypeOfKindConsideringBaseConstraint(operandType, 2112 /* BigIntLike */)) {
|
|
75333
|
-
|
|
75357
|
+
error2(node.operand, Diagnostics.Operator_0_cannot_be_applied_to_type_1, tokenToString(node.operator), typeToString(getBaseTypeOfLiteralType(operandType)));
|
|
75334
75358
|
}
|
|
75335
75359
|
return numberType;
|
|
75336
75360
|
}
|
|
@@ -75426,10 +75450,10 @@ ${lanes.join("\n")}
|
|
|
75426
75450
|
return silentNeverType;
|
|
75427
75451
|
}
|
|
75428
75452
|
if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 402784252 /* Primitive */)) {
|
|
75429
|
-
|
|
75453
|
+
error2(left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
|
|
75430
75454
|
}
|
|
75431
75455
|
if (!(isTypeAny(rightType) || typeHasCallOrConstructSignatures(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
|
|
75432
|
-
|
|
75456
|
+
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);
|
|
75433
75457
|
}
|
|
75434
75458
|
return booleanType;
|
|
75435
75459
|
}
|
|
@@ -75458,7 +75482,7 @@ ${lanes.join("\n")}
|
|
|
75458
75482
|
}
|
|
75459
75483
|
if (checkTypeAssignableTo(checkNonNullType(rightType, right), nonPrimitiveType, right)) {
|
|
75460
75484
|
if (hasEmptyObjectIntersection(rightType)) {
|
|
75461
|
-
|
|
75485
|
+
error2(right, Diagnostics.Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator, typeToString(rightType));
|
|
75462
75486
|
}
|
|
75463
75487
|
}
|
|
75464
75488
|
return booleanType;
|
|
@@ -75500,7 +75524,7 @@ ${lanes.join("\n")}
|
|
|
75500
75524
|
return checkDestructuringAssignment(property.kind === 303 /* ShorthandPropertyAssignment */ ? property : property.initializer, type);
|
|
75501
75525
|
} else if (property.kind === 304 /* SpreadAssignment */) {
|
|
75502
75526
|
if (propertyIndex < properties.length - 1) {
|
|
75503
|
-
|
|
75527
|
+
error2(property, Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern);
|
|
75504
75528
|
} else {
|
|
75505
75529
|
if (languageVersion < 99 /* ESNext */) {
|
|
75506
75530
|
checkExternalEmitHelpers(property, 4 /* Rest */);
|
|
@@ -75518,7 +75542,7 @@ ${lanes.join("\n")}
|
|
|
75518
75542
|
return checkDestructuringAssignment(property.expression, type);
|
|
75519
75543
|
}
|
|
75520
75544
|
} else {
|
|
75521
|
-
|
|
75545
|
+
error2(property, Diagnostics.Property_assignment_expected);
|
|
75522
75546
|
}
|
|
75523
75547
|
}
|
|
75524
75548
|
function checkArrayLiteralAssignment(node, sourceType, checkMode) {
|
|
@@ -75553,11 +75577,11 @@ ${lanes.join("\n")}
|
|
|
75553
75577
|
return checkDestructuringAssignment(element, elementType, checkMode);
|
|
75554
75578
|
}
|
|
75555
75579
|
if (elementIndex < elements.length - 1) {
|
|
75556
|
-
|
|
75580
|
+
error2(element, Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern);
|
|
75557
75581
|
} else {
|
|
75558
75582
|
const restExpression = element.expression;
|
|
75559
75583
|
if (restExpression.kind === 225 /* BinaryExpression */ && restExpression.operatorToken.kind === 64 /* EqualsToken */) {
|
|
75560
|
-
|
|
75584
|
+
error2(restExpression.operatorToken, Diagnostics.A_rest_element_cannot_have_an_initializer);
|
|
75561
75585
|
} else {
|
|
75562
75586
|
checkGrammarForDisallowedTrailingComma(node.elements, Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma);
|
|
75563
75587
|
const type = everyType(sourceType, isTupleType) ? mapType(sourceType, (t) => sliceTupleType(t, elementIndex)) : createArrayType(elementType);
|
|
@@ -75598,9 +75622,9 @@ ${lanes.join("\n")}
|
|
|
75598
75622
|
}
|
|
75599
75623
|
function checkReferenceAssignment(target, sourceType, checkMode) {
|
|
75600
75624
|
const targetType = checkExpression(target, checkMode);
|
|
75601
|
-
const
|
|
75625
|
+
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;
|
|
75602
75626
|
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;
|
|
75603
|
-
if (checkReferenceExpression(target,
|
|
75627
|
+
if (checkReferenceExpression(target, error3, optionalError)) {
|
|
75604
75628
|
checkTypeAssignableToAndOptionallyElaborate(sourceType, targetType, target, target);
|
|
75605
75629
|
}
|
|
75606
75630
|
if (isPrivateIdentifierPropertyAccessExpression(target)) {
|
|
@@ -75841,7 +75865,7 @@ ${lanes.join("\n")}
|
|
|
75841
75865
|
rightType = checkNonNullType(rightType, right);
|
|
75842
75866
|
let suggestedOperator;
|
|
75843
75867
|
if (leftType.flags & 528 /* BooleanLike */ && rightType.flags & 528 /* BooleanLike */ && (suggestedOperator = getSuggestedBooleanOperator(operatorToken.kind)) !== void 0) {
|
|
75844
|
-
|
|
75868
|
+
error2(errorNode || operatorToken, Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, tokenToString(operatorToken.kind), tokenToString(suggestedOperator));
|
|
75845
75869
|
return numberType;
|
|
75846
75870
|
} else {
|
|
75847
75871
|
const leftOk = checkArithmeticOperandType(
|
|
@@ -75871,7 +75895,7 @@ ${lanes.join("\n")}
|
|
|
75871
75895
|
case 43 /* AsteriskAsteriskToken */:
|
|
75872
75896
|
case 68 /* AsteriskAsteriskEqualsToken */:
|
|
75873
75897
|
if (languageVersion < 3 /* ES2016 */) {
|
|
75874
|
-
|
|
75898
|
+
error2(errorNode, Diagnostics.Exponentiation_cannot_be_performed_on_bigint_values_unless_the_target_option_is_set_to_es2016_or_later);
|
|
75875
75899
|
}
|
|
75876
75900
|
}
|
|
75877
75901
|
resultType2 = bigintType;
|
|
@@ -75966,10 +75990,10 @@ ${lanes.join("\n")}
|
|
|
75966
75990
|
case 36 /* ExclamationEqualsToken */:
|
|
75967
75991
|
case 37 /* EqualsEqualsEqualsToken */:
|
|
75968
75992
|
case 38 /* ExclamationEqualsEqualsToken */:
|
|
75969
|
-
if (!(checkMode && checkMode &
|
|
75993
|
+
if (!(checkMode && checkMode & 256 /* TypeOnly */)) {
|
|
75970
75994
|
if (isLiteralExpressionOfObject(left) || isLiteralExpressionOfObject(right)) {
|
|
75971
75995
|
const eqType = operator === 35 /* EqualsEqualsToken */ || operator === 37 /* EqualsEqualsEqualsToken */;
|
|
75972
|
-
|
|
75996
|
+
error2(errorNode, Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true");
|
|
75973
75997
|
}
|
|
75974
75998
|
checkNaNEquality(errorNode, operator, left, right);
|
|
75975
75999
|
reportOperatorErrorUnless((left2, right2) => isTypeEqualityComparableTo(left2, right2) || isTypeEqualityComparableTo(right2, left2));
|
|
@@ -76026,7 +76050,7 @@ ${lanes.join("\n")}
|
|
|
76026
76050
|
return textSpanContainsPosition(diag2, start);
|
|
76027
76051
|
});
|
|
76028
76052
|
if (!isInDiag2657)
|
|
76029
|
-
|
|
76053
|
+
error2(left, Diagnostics.Left_side_of_comma_operator_is_unused_and_has_no_side_effects);
|
|
76030
76054
|
}
|
|
76031
76055
|
return rightType;
|
|
76032
76056
|
default:
|
|
@@ -76066,7 +76090,7 @@ ${lanes.join("\n")}
|
|
|
76066
76090
|
function checkForDisallowedESSymbolOperand(operator2) {
|
|
76067
76091
|
const offendingSymbolOperand = maybeTypeOfKindConsideringBaseConstraint(leftType, 12288 /* ESSymbolLike */) ? left : maybeTypeOfKindConsideringBaseConstraint(rightType, 12288 /* ESSymbolLike */) ? right : void 0;
|
|
76068
76092
|
if (offendingSymbolOperand) {
|
|
76069
|
-
|
|
76093
|
+
error2(offendingSymbolOperand, Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, tokenToString(operator2));
|
|
76070
76094
|
return false;
|
|
76071
76095
|
}
|
|
76072
76096
|
return true;
|
|
@@ -76187,7 +76211,7 @@ ${lanes.join("\n")}
|
|
|
76187
76211
|
const isLeftNaN = isGlobalNaN(skipParentheses(left2));
|
|
76188
76212
|
const isRightNaN = isGlobalNaN(skipParentheses(right2));
|
|
76189
76213
|
if (isLeftNaN || isRightNaN) {
|
|
76190
|
-
const err =
|
|
76214
|
+
const err = error2(
|
|
76191
76215
|
errorNode2,
|
|
76192
76216
|
Diagnostics.This_condition_will_always_return_0,
|
|
76193
76217
|
tokenToString(operator2 === 37 /* EqualsEqualsEqualsToken */ || operator2 === 35 /* EqualsEqualsToken */ ? 97 /* FalseKeyword */ : 112 /* TrueKeyword */)
|
|
@@ -76268,7 +76292,7 @@ ${lanes.join("\n")}
|
|
|
76268
76292
|
void 0
|
|
76269
76293
|
);
|
|
76270
76294
|
if (!contextualType || isTypeAny(contextualType)) {
|
|
76271
|
-
|
|
76295
|
+
error2(node, Diagnostics.yield_expression_implicitly_results_in_an_any_type_because_its_containing_generator_lacks_a_return_type_annotation);
|
|
76272
76296
|
}
|
|
76273
76297
|
}
|
|
76274
76298
|
});
|
|
@@ -76279,7 +76303,7 @@ ${lanes.join("\n")}
|
|
|
76279
76303
|
grammarErrorOnFirstToken(node, Diagnostics.A_yield_expression_is_only_allowed_in_a_generator_body);
|
|
76280
76304
|
}
|
|
76281
76305
|
if (isInParameterInitializerBeforeContainingFunction(node)) {
|
|
76282
|
-
|
|
76306
|
+
error2(node, Diagnostics.yield_expressions_cannot_be_used_in_a_parameter_initializer);
|
|
76283
76307
|
}
|
|
76284
76308
|
}
|
|
76285
76309
|
}
|
|
@@ -76300,7 +76324,7 @@ ${lanes.join("\n")}
|
|
|
76300
76324
|
for (const span of node.templateSpans) {
|
|
76301
76325
|
const type = checkExpression(span.expression);
|
|
76302
76326
|
if (maybeTypeOfKindConsideringBaseConstraint(type, 12288 /* ESSymbolLike */)) {
|
|
76303
|
-
|
|
76327
|
+
error2(span.expression, Diagnostics.Implicit_conversion_of_a_symbol_to_a_string_will_fail_at_runtime_Consider_wrapping_this_expression_in_String);
|
|
76304
76328
|
}
|
|
76305
76329
|
texts.push(span.literal.text);
|
|
76306
76330
|
types.push(isTypeAssignableTo(type, templateConstraintType) ? type : stringType);
|
|
@@ -76625,7 +76649,7 @@ ${lanes.join("\n")}
|
|
|
76625
76649
|
}
|
|
76626
76650
|
}
|
|
76627
76651
|
const startInvocationCount = flowInvocationCount;
|
|
76628
|
-
const type = checkExpression(node,
|
|
76652
|
+
const type = checkExpression(node, 256 /* TypeOnly */);
|
|
76629
76653
|
if (flowInvocationCount !== startInvocationCount) {
|
|
76630
76654
|
const cache = flowTypeCache || (flowTypeCache = []);
|
|
76631
76655
|
cache[getNodeId(node)] = type;
|
|
@@ -76696,13 +76720,13 @@ ${lanes.join("\n")}
|
|
|
76696
76720
|
function checkConstEnumAccess(node, type) {
|
|
76697
76721
|
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 */;
|
|
76698
76722
|
if (!ok) {
|
|
76699
|
-
|
|
76723
|
+
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);
|
|
76700
76724
|
}
|
|
76701
76725
|
if (getIsolatedModules(compilerOptions)) {
|
|
76702
76726
|
Debug.assert(!!(type.symbol.flags & 128 /* ConstEnum */));
|
|
76703
76727
|
const constEnumDeclaration = type.symbol.valueDeclaration;
|
|
76704
76728
|
if (constEnumDeclaration.flags & 16777216 /* Ambient */ && !isValidTypeOnlyAliasUseSite(node)) {
|
|
76705
|
-
|
|
76729
|
+
error2(node, Diagnostics.Cannot_access_ambient_const_enums_when_0_is_enabled, isolatedModulesLikeFlagName);
|
|
76706
76730
|
}
|
|
76707
76731
|
}
|
|
76708
76732
|
}
|
|
@@ -76843,7 +76867,7 @@ ${lanes.join("\n")}
|
|
|
76843
76867
|
const typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfDeclaration(node));
|
|
76844
76868
|
getBaseConstraintOfType(typeParameter);
|
|
76845
76869
|
if (!hasNonCircularTypeParameterDefault(typeParameter)) {
|
|
76846
|
-
|
|
76870
|
+
error2(node.default, Diagnostics.Type_parameter_0_has_a_circular_default, typeToString(typeParameter));
|
|
76847
76871
|
}
|
|
76848
76872
|
const constraintType = getConstraintOfTypeParameter(typeParameter);
|
|
76849
76873
|
const defaultType = getDefaultFromTypeParameter(typeParameter);
|
|
@@ -76861,7 +76885,7 @@ ${lanes.join("\n")}
|
|
|
76861
76885
|
if (modifiers) {
|
|
76862
76886
|
const symbol = getSymbolOfDeclaration(node.parent);
|
|
76863
76887
|
if (isTypeAliasDeclaration(node.parent) && !(getObjectFlags(getDeclaredTypeOfSymbol(symbol)) & (16 /* Anonymous */ | 32 /* Mapped */))) {
|
|
76864
|
-
|
|
76888
|
+
error2(node, Diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types);
|
|
76865
76889
|
} else if (modifiers === 32768 /* In */ || modifiers === 65536 /* Out */) {
|
|
76866
76890
|
(_a = tracing) == null ? void 0 : _a.push(tracing.Phase.CheckTypes, "checkTypeParameterDeferred", { parent: getTypeId(getDeclaredTypeOfSymbol(symbol)), id: getTypeId(typeParameter) });
|
|
76867
76891
|
const source = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSubTypeForCheck : markerSuperTypeForCheck);
|
|
@@ -76881,37 +76905,37 @@ ${lanes.join("\n")}
|
|
|
76881
76905
|
const func = getContainingFunction(node);
|
|
76882
76906
|
if (hasSyntacticModifier(node, 16476 /* ParameterPropertyModifier */)) {
|
|
76883
76907
|
if (!(func.kind === 175 /* Constructor */ && nodeIsPresent(func.body))) {
|
|
76884
|
-
|
|
76908
|
+
error2(node, Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation);
|
|
76885
76909
|
}
|
|
76886
76910
|
if (func.kind === 175 /* Constructor */ && isIdentifier(node.name) && node.name.escapedText === "constructor") {
|
|
76887
|
-
|
|
76911
|
+
error2(node.name, Diagnostics.constructor_cannot_be_used_as_a_parameter_property_name);
|
|
76888
76912
|
}
|
|
76889
76913
|
}
|
|
76890
76914
|
if (!node.initializer && isOptionalDeclaration(node) && isBindingPattern(node.name) && func.body) {
|
|
76891
|
-
|
|
76915
|
+
error2(node, Diagnostics.A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature);
|
|
76892
76916
|
}
|
|
76893
76917
|
if (node.name && isIdentifier(node.name) && (node.name.escapedText === "this" || node.name.escapedText === "new")) {
|
|
76894
76918
|
if (func.parameters.indexOf(node) !== 0) {
|
|
76895
|
-
|
|
76919
|
+
error2(node, Diagnostics.A_0_parameter_must_be_the_first_parameter, node.name.escapedText);
|
|
76896
76920
|
}
|
|
76897
76921
|
if (func.kind === 175 /* Constructor */ || func.kind === 179 /* ConstructSignature */ || func.kind === 184 /* ConstructorType */) {
|
|
76898
|
-
|
|
76922
|
+
error2(node, Diagnostics.A_constructor_cannot_have_a_this_parameter);
|
|
76899
76923
|
}
|
|
76900
76924
|
if (func.kind === 218 /* ArrowFunction */) {
|
|
76901
|
-
|
|
76925
|
+
error2(node, Diagnostics.An_arrow_function_cannot_have_a_this_parameter);
|
|
76902
76926
|
}
|
|
76903
76927
|
if (func.kind === 176 /* GetAccessor */ || func.kind === 177 /* SetAccessor */) {
|
|
76904
|
-
|
|
76928
|
+
error2(node, Diagnostics.get_and_set_accessors_cannot_declare_this_parameters);
|
|
76905
76929
|
}
|
|
76906
76930
|
}
|
|
76907
76931
|
if (node.dotDotDotToken && !isBindingPattern(node.name) && !isTypeAssignableTo(getReducedType(getTypeOfSymbol(node.symbol)), anyReadonlyArrayType)) {
|
|
76908
|
-
|
|
76932
|
+
error2(node, Diagnostics.A_rest_parameter_must_be_of_an_array_type);
|
|
76909
76933
|
}
|
|
76910
76934
|
}
|
|
76911
76935
|
function checkTypePredicate(node) {
|
|
76912
76936
|
const parent2 = getTypePredicateParent(node);
|
|
76913
76937
|
if (!parent2) {
|
|
76914
|
-
|
|
76938
|
+
error2(node, Diagnostics.A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods);
|
|
76915
76939
|
return;
|
|
76916
76940
|
}
|
|
76917
76941
|
const signature = getSignatureFromDeclaration(parent2);
|
|
@@ -76926,7 +76950,7 @@ ${lanes.join("\n")}
|
|
|
76926
76950
|
} else {
|
|
76927
76951
|
if (typePredicate.parameterIndex >= 0) {
|
|
76928
76952
|
if (signatureHasRestParameter(signature) && typePredicate.parameterIndex === signature.parameters.length - 1) {
|
|
76929
|
-
|
|
76953
|
+
error2(parameterName, Diagnostics.A_type_predicate_cannot_reference_a_rest_parameter);
|
|
76930
76954
|
} else {
|
|
76931
76955
|
if (typePredicate.type) {
|
|
76932
76956
|
const leadingError = () => chainDiagnosticMessages(
|
|
@@ -76953,7 +76977,7 @@ ${lanes.join("\n")}
|
|
|
76953
76977
|
}
|
|
76954
76978
|
}
|
|
76955
76979
|
if (!hasReportedError) {
|
|
76956
|
-
|
|
76980
|
+
error2(node.parameterName, Diagnostics.Cannot_find_parameter_0, typePredicate.parameterName);
|
|
76957
76981
|
}
|
|
76958
76982
|
}
|
|
76959
76983
|
}
|
|
@@ -76980,7 +77004,7 @@ ${lanes.join("\n")}
|
|
|
76980
77004
|
}
|
|
76981
77005
|
const name = element.name;
|
|
76982
77006
|
if (name.kind === 80 /* Identifier */ && name.escapedText === predicateVariableName) {
|
|
76983
|
-
|
|
77007
|
+
error2(
|
|
76984
77008
|
predicateVariableNode,
|
|
76985
77009
|
Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern,
|
|
76986
77010
|
predicateVariableName
|
|
@@ -77028,10 +77052,10 @@ ${lanes.join("\n")}
|
|
|
77028
77052
|
if (noImplicitAny && !returnTypeNode) {
|
|
77029
77053
|
switch (node.kind) {
|
|
77030
77054
|
case 179 /* ConstructSignature */:
|
|
77031
|
-
|
|
77055
|
+
error2(node, Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type);
|
|
77032
77056
|
break;
|
|
77033
77057
|
case 178 /* CallSignature */:
|
|
77034
|
-
|
|
77058
|
+
error2(node, Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type);
|
|
77035
77059
|
break;
|
|
77036
77060
|
}
|
|
77037
77061
|
}
|
|
@@ -77040,7 +77064,7 @@ ${lanes.join("\n")}
|
|
|
77040
77064
|
if ((functionFlags2 & (4 /* Invalid */ | 1 /* Generator */)) === 1 /* Generator */) {
|
|
77041
77065
|
const returnType = getTypeFromTypeNode(returnTypeNode);
|
|
77042
77066
|
if (returnType === voidType) {
|
|
77043
|
-
|
|
77067
|
+
error2(returnTypeNode, Diagnostics.A_generator_cannot_have_a_void_type_annotation);
|
|
77044
77068
|
} else {
|
|
77045
77069
|
const generatorYieldType = getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || anyType;
|
|
77046
77070
|
const generatorReturnType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || generatorYieldType;
|
|
@@ -77100,16 +77124,16 @@ ${lanes.join("\n")}
|
|
|
77100
77124
|
const prev = names.get(name);
|
|
77101
77125
|
if (prev) {
|
|
77102
77126
|
if ((prev & 16 /* PrivateStatic */) !== (meaning & 16 /* PrivateStatic */)) {
|
|
77103
|
-
|
|
77127
|
+
error2(location, Diagnostics.Duplicate_identifier_0_Static_and_instance_elements_cannot_share_the_same_private_name, getTextOfNode(location));
|
|
77104
77128
|
} else {
|
|
77105
77129
|
const prevIsMethod = !!(prev & 8 /* Method */);
|
|
77106
77130
|
const isMethod = !!(meaning & 8 /* Method */);
|
|
77107
77131
|
if (prevIsMethod || isMethod) {
|
|
77108
77132
|
if (prevIsMethod !== isMethod) {
|
|
77109
|
-
|
|
77133
|
+
error2(location, Diagnostics.Duplicate_identifier_0, getTextOfNode(location));
|
|
77110
77134
|
}
|
|
77111
77135
|
} else if (prev & meaning & ~16 /* PrivateStatic */) {
|
|
77112
|
-
|
|
77136
|
+
error2(location, Diagnostics.Duplicate_identifier_0, getTextOfNode(location));
|
|
77113
77137
|
} else {
|
|
77114
77138
|
names.set(name, prev | meaning);
|
|
77115
77139
|
}
|
|
@@ -77136,7 +77160,7 @@ ${lanes.join("\n")}
|
|
|
77136
77160
|
case "prototype":
|
|
77137
77161
|
const message = Diagnostics.Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1;
|
|
77138
77162
|
const className = getNameOfSymbolAsWritten(getSymbolOfDeclaration(node));
|
|
77139
|
-
|
|
77163
|
+
error2(memberNameNode, message, memberName, className);
|
|
77140
77164
|
break;
|
|
77141
77165
|
}
|
|
77142
77166
|
}
|
|
@@ -77160,8 +77184,8 @@ ${lanes.join("\n")}
|
|
|
77160
77184
|
continue;
|
|
77161
77185
|
}
|
|
77162
77186
|
if (names.get(memberName)) {
|
|
77163
|
-
|
|
77164
|
-
|
|
77187
|
+
error2(getNameOfDeclaration(member.symbol.valueDeclaration), Diagnostics.Duplicate_identifier_0, memberName);
|
|
77188
|
+
error2(member.name, Diagnostics.Duplicate_identifier_0, memberName);
|
|
77165
77189
|
} else {
|
|
77166
77190
|
names.set(memberName, true);
|
|
77167
77191
|
}
|
|
@@ -77193,7 +77217,7 @@ ${lanes.join("\n")}
|
|
|
77193
77217
|
indexSignatureMap.forEach((entry) => {
|
|
77194
77218
|
if (entry.declarations.length > 1) {
|
|
77195
77219
|
for (const declaration of entry.declarations) {
|
|
77196
|
-
|
|
77220
|
+
error2(declaration, Diagnostics.Duplicate_index_signature_for_type_0, typeToString(entry.type));
|
|
77197
77221
|
}
|
|
77198
77222
|
}
|
|
77199
77223
|
});
|
|
@@ -77205,12 +77229,12 @@ ${lanes.join("\n")}
|
|
|
77205
77229
|
checkVariableLikeDeclaration(node);
|
|
77206
77230
|
setNodeLinksForPrivateIdentifierScope(node);
|
|
77207
77231
|
if (hasSyntacticModifier(node, 256 /* Abstract */) && node.kind === 171 /* PropertyDeclaration */ && node.initializer) {
|
|
77208
|
-
|
|
77232
|
+
error2(node, Diagnostics.Property_0_cannot_have_an_initializer_because_it_is_marked_abstract, declarationNameToString(node.name));
|
|
77209
77233
|
}
|
|
77210
77234
|
}
|
|
77211
77235
|
function checkPropertySignature(node) {
|
|
77212
77236
|
if (isPrivateIdentifier(node.name)) {
|
|
77213
|
-
|
|
77237
|
+
error2(node, Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);
|
|
77214
77238
|
}
|
|
77215
77239
|
return checkPropertyDeclaration(node);
|
|
77216
77240
|
}
|
|
@@ -77218,14 +77242,14 @@ ${lanes.join("\n")}
|
|
|
77218
77242
|
if (!checkGrammarMethod(node))
|
|
77219
77243
|
checkGrammarComputedPropertyName(node.name);
|
|
77220
77244
|
if (isMethodDeclaration(node) && node.asteriskToken && isIdentifier(node.name) && idText(node.name) === "constructor") {
|
|
77221
|
-
|
|
77245
|
+
error2(node.name, Diagnostics.Class_constructor_may_not_be_a_generator);
|
|
77222
77246
|
}
|
|
77223
77247
|
checkFunctionOrMethodDeclaration(node);
|
|
77224
77248
|
if (hasSyntacticModifier(node, 256 /* Abstract */) && node.kind === 173 /* MethodDeclaration */ && node.body) {
|
|
77225
|
-
|
|
77249
|
+
error2(node, Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, declarationNameToString(node.name));
|
|
77226
77250
|
}
|
|
77227
77251
|
if (isPrivateIdentifier(node.name) && !getContainingClass(node)) {
|
|
77228
|
-
|
|
77252
|
+
error2(node, Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);
|
|
77229
77253
|
}
|
|
77230
77254
|
setNodeLinksForPrivateIdentifierScope(node);
|
|
77231
77255
|
}
|
|
@@ -77276,12 +77300,12 @@ ${lanes.join("\n")}
|
|
|
77276
77300
|
const superCall = findFirstSuperCall(node.body);
|
|
77277
77301
|
if (superCall) {
|
|
77278
77302
|
if (classExtendsNull) {
|
|
77279
|
-
|
|
77303
|
+
error2(superCall, Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null);
|
|
77280
77304
|
}
|
|
77281
77305
|
const superCallShouldBeRootLevel = (getEmitScriptTarget(compilerOptions) !== 99 /* ESNext */ || !useDefineForClassFields) && (some(node.parent.members, isInstancePropertyWithInitializerOrPrivateIdentifierProperty) || some(node.parameters, (p) => hasSyntacticModifier(p, 16476 /* ParameterPropertyModifier */)));
|
|
77282
77306
|
if (superCallShouldBeRootLevel) {
|
|
77283
77307
|
if (!superCallIsRootLevelInConstructor(superCall, node.body)) {
|
|
77284
|
-
|
|
77308
|
+
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);
|
|
77285
77309
|
} else {
|
|
77286
77310
|
let superCallStatement;
|
|
77287
77311
|
for (const statement of node.body.statements) {
|
|
@@ -77294,12 +77318,12 @@ ${lanes.join("\n")}
|
|
|
77294
77318
|
}
|
|
77295
77319
|
}
|
|
77296
77320
|
if (superCallStatement === void 0) {
|
|
77297
|
-
|
|
77321
|
+
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);
|
|
77298
77322
|
}
|
|
77299
77323
|
}
|
|
77300
77324
|
}
|
|
77301
77325
|
} else if (!classExtendsNull) {
|
|
77302
|
-
|
|
77326
|
+
error2(node, Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call);
|
|
77303
77327
|
}
|
|
77304
77328
|
}
|
|
77305
77329
|
}
|
|
@@ -77319,7 +77343,7 @@ ${lanes.join("\n")}
|
|
|
77319
77343
|
}
|
|
77320
77344
|
function checkAccessorDeclaration(node) {
|
|
77321
77345
|
if (isIdentifier(node.name) && idText(node.name) === "constructor" && isClassLike(node.parent)) {
|
|
77322
|
-
|
|
77346
|
+
error2(node.name, Diagnostics.Class_constructor_may_not_be_an_accessor);
|
|
77323
77347
|
}
|
|
77324
77348
|
addLazyDiagnostic(checkAccessorDeclarationDiagnostics);
|
|
77325
77349
|
checkSourceElement(node.body);
|
|
@@ -77332,7 +77356,7 @@ ${lanes.join("\n")}
|
|
|
77332
77356
|
if (node.kind === 176 /* GetAccessor */) {
|
|
77333
77357
|
if (!(node.flags & 16777216 /* Ambient */) && nodeIsPresent(node.body) && node.flags & 256 /* HasImplicitReturn */) {
|
|
77334
77358
|
if (!(node.flags & 512 /* HasExplicitReturn */)) {
|
|
77335
|
-
|
|
77359
|
+
error2(node.name, Diagnostics.A_get_accessor_must_return_a_value);
|
|
77336
77360
|
}
|
|
77337
77361
|
}
|
|
77338
77362
|
}
|
|
@@ -77348,12 +77372,12 @@ ${lanes.join("\n")}
|
|
|
77348
77372
|
const getterFlags = getEffectiveModifierFlags(getter);
|
|
77349
77373
|
const setterFlags = getEffectiveModifierFlags(setter);
|
|
77350
77374
|
if ((getterFlags & 256 /* Abstract */) !== (setterFlags & 256 /* Abstract */)) {
|
|
77351
|
-
|
|
77352
|
-
|
|
77375
|
+
error2(getter.name, Diagnostics.Accessors_must_both_be_abstract_or_non_abstract);
|
|
77376
|
+
error2(setter.name, Diagnostics.Accessors_must_both_be_abstract_or_non_abstract);
|
|
77353
77377
|
}
|
|
77354
77378
|
if (getterFlags & 16 /* Protected */ && !(setterFlags & (16 /* Protected */ | 8 /* Private */)) || getterFlags & 8 /* Private */ && !(setterFlags & 8 /* Private */)) {
|
|
77355
|
-
|
|
77356
|
-
|
|
77379
|
+
error2(getter.name, Diagnostics.A_get_accessor_must_be_at_least_as_accessible_as_the_setter);
|
|
77380
|
+
error2(setter.name, Diagnostics.A_get_accessor_must_be_at_least_as_accessible_as_the_setter);
|
|
77357
77381
|
}
|
|
77358
77382
|
}
|
|
77359
77383
|
}
|
|
@@ -77491,7 +77515,7 @@ ${lanes.join("\n")}
|
|
|
77491
77515
|
if (flags & 8 /* Variadic */) {
|
|
77492
77516
|
const type = getTypeFromTypeNode(e.type);
|
|
77493
77517
|
if (!isArrayLikeType(type)) {
|
|
77494
|
-
|
|
77518
|
+
error2(e, Diagnostics.A_rest_element_type_must_be_an_array_type);
|
|
77495
77519
|
break;
|
|
77496
77520
|
}
|
|
77497
77521
|
if (isArrayType(type) || isTupleType(type) && type.target.combinedFlags & 4 /* Rest */) {
|
|
@@ -77529,7 +77553,7 @@ ${lanes.join("\n")}
|
|
|
77529
77553
|
const indexType = type.indexType;
|
|
77530
77554
|
if (isTypeAssignableTo(indexType, getIndexType(objectType, 0 /* None */))) {
|
|
77531
77555
|
if (accessNode.kind === 211 /* ElementAccessExpression */ && isAssignmentTarget(accessNode) && getObjectFlags(objectType) & 32 /* Mapped */ && getMappedTypeModifiers(objectType) & 1 /* IncludeReadonly */) {
|
|
77532
|
-
|
|
77556
|
+
error2(accessNode, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
|
|
77533
77557
|
}
|
|
77534
77558
|
return type;
|
|
77535
77559
|
}
|
|
@@ -77542,12 +77566,12 @@ ${lanes.join("\n")}
|
|
|
77542
77566
|
if (propertyName) {
|
|
77543
77567
|
const propertySymbol = forEachType(apparentObjectType, (t) => getPropertyOfType(t, propertyName));
|
|
77544
77568
|
if (propertySymbol && getDeclarationModifierFlagsFromSymbol(propertySymbol) & 24 /* NonPublicAccessibilityModifier */) {
|
|
77545
|
-
|
|
77569
|
+
error2(accessNode, Diagnostics.Private_or_protected_member_0_cannot_be_accessed_on_a_type_parameter, unescapeLeadingUnderscores(propertyName));
|
|
77546
77570
|
return errorType;
|
|
77547
77571
|
}
|
|
77548
77572
|
}
|
|
77549
77573
|
}
|
|
77550
|
-
|
|
77574
|
+
error2(accessNode, Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType));
|
|
77551
77575
|
return errorType;
|
|
77552
77576
|
}
|
|
77553
77577
|
function checkIndexedAccessType(node) {
|
|
@@ -77603,7 +77627,7 @@ ${lanes.join("\n")}
|
|
|
77603
77627
|
if (!areTypeParametersIdentical(declarations, [typeParameter], (decl) => [decl])) {
|
|
77604
77628
|
const name = symbolToString(symbol);
|
|
77605
77629
|
for (const declaration of declarations) {
|
|
77606
|
-
|
|
77630
|
+
error2(declaration.name, Diagnostics.All_declarations_of_0_must_have_identical_constraints, name);
|
|
77607
77631
|
}
|
|
77608
77632
|
}
|
|
77609
77633
|
}
|
|
@@ -77674,13 +77698,13 @@ ${lanes.join("\n")}
|
|
|
77674
77698
|
forEach(overloads, (o) => {
|
|
77675
77699
|
const deviation = getEffectiveDeclarationFlags(o, flagsToCheck2) ^ canonicalFlags;
|
|
77676
77700
|
if (deviation & 1 /* Export */) {
|
|
77677
|
-
|
|
77701
|
+
error2(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_exported_or_non_exported);
|
|
77678
77702
|
} else if (deviation & 2 /* Ambient */) {
|
|
77679
|
-
|
|
77703
|
+
error2(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_ambient_or_non_ambient);
|
|
77680
77704
|
} else if (deviation & (8 /* Private */ | 16 /* Protected */)) {
|
|
77681
|
-
|
|
77705
|
+
error2(getNameOfDeclaration(o) || o, Diagnostics.Overload_signatures_must_all_be_public_private_or_protected);
|
|
77682
77706
|
} else if (deviation & 256 /* Abstract */) {
|
|
77683
|
-
|
|
77707
|
+
error2(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_abstract_or_non_abstract);
|
|
77684
77708
|
}
|
|
77685
77709
|
});
|
|
77686
77710
|
}
|
|
@@ -77691,7 +77715,7 @@ ${lanes.join("\n")}
|
|
|
77691
77715
|
forEach(overloads, (o) => {
|
|
77692
77716
|
const deviation = hasQuestionToken(o) !== canonicalHasQuestionToken;
|
|
77693
77717
|
if (deviation) {
|
|
77694
|
-
|
|
77718
|
+
error2(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_optional_or_required);
|
|
77695
77719
|
}
|
|
77696
77720
|
});
|
|
77697
77721
|
}
|
|
@@ -77730,24 +77754,24 @@ ${lanes.join("\n")}
|
|
|
77730
77754
|
const reportError = (node.kind === 173 /* MethodDeclaration */ || node.kind === 172 /* MethodSignature */) && isStatic(node) !== isStatic(subsequentNode);
|
|
77731
77755
|
if (reportError) {
|
|
77732
77756
|
const diagnostic = isStatic(node) ? Diagnostics.Function_overload_must_be_static : Diagnostics.Function_overload_must_not_be_static;
|
|
77733
|
-
|
|
77757
|
+
error2(errorNode2, diagnostic);
|
|
77734
77758
|
}
|
|
77735
77759
|
return;
|
|
77736
77760
|
}
|
|
77737
77761
|
if (nodeIsPresent(subsequentNode.body)) {
|
|
77738
|
-
|
|
77762
|
+
error2(errorNode2, Diagnostics.Function_implementation_name_must_be_0, declarationNameToString(node.name));
|
|
77739
77763
|
return;
|
|
77740
77764
|
}
|
|
77741
77765
|
}
|
|
77742
77766
|
}
|
|
77743
77767
|
const errorNode = node.name || node;
|
|
77744
77768
|
if (isConstructor) {
|
|
77745
|
-
|
|
77769
|
+
error2(errorNode, Diagnostics.Constructor_implementation_is_missing);
|
|
77746
77770
|
} else {
|
|
77747
77771
|
if (hasSyntacticModifier(node, 256 /* Abstract */)) {
|
|
77748
|
-
|
|
77772
|
+
error2(errorNode, Diagnostics.All_declarations_of_an_abstract_method_must_be_consecutive);
|
|
77749
77773
|
} else {
|
|
77750
|
-
|
|
77774
|
+
error2(errorNode, Diagnostics.Function_implementation_is_missing_or_not_immediately_following_the_declaration);
|
|
77751
77775
|
}
|
|
77752
77776
|
}
|
|
77753
77777
|
}
|
|
@@ -77810,12 +77834,12 @@ ${lanes.join("\n")}
|
|
|
77810
77834
|
}
|
|
77811
77835
|
if (multipleConstructorImplementation) {
|
|
77812
77836
|
forEach(functionDeclarations, (declaration) => {
|
|
77813
|
-
|
|
77837
|
+
error2(declaration, Diagnostics.Multiple_constructor_implementations_are_not_allowed);
|
|
77814
77838
|
});
|
|
77815
77839
|
}
|
|
77816
77840
|
if (duplicateFunctionDeclaration) {
|
|
77817
77841
|
forEach(functionDeclarations, (declaration) => {
|
|
77818
|
-
|
|
77842
|
+
error2(getNameOfDeclaration(declaration) || declaration, Diagnostics.Duplicate_function_implementation);
|
|
77819
77843
|
});
|
|
77820
77844
|
}
|
|
77821
77845
|
if (hasNonAmbientClass && !isConstructor && symbol.flags & 16 /* Function */ && declarations) {
|
|
@@ -77824,7 +77848,7 @@ ${lanes.join("\n")}
|
|
|
77824
77848
|
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;
|
|
77825
77849
|
if (diagnostic) {
|
|
77826
77850
|
addRelatedInfo(
|
|
77827
|
-
|
|
77851
|
+
error2(getNameOfDeclaration(declaration) || declaration, diagnostic, symbolName(symbol)),
|
|
77828
77852
|
...relatedDiagnostics
|
|
77829
77853
|
);
|
|
77830
77854
|
}
|
|
@@ -77845,7 +77869,7 @@ ${lanes.join("\n")}
|
|
|
77845
77869
|
if (!isImplementationCompatibleWithOverload(bodySignature, signature)) {
|
|
77846
77870
|
const errorNode = signature.declaration && isJSDocSignature(signature.declaration) ? signature.declaration.parent.tagName : signature.declaration;
|
|
77847
77871
|
addRelatedInfo(
|
|
77848
|
-
|
|
77872
|
+
error2(errorNode, Diagnostics.This_overload_signature_is_not_compatible_with_its_implementation_signature),
|
|
77849
77873
|
createDiagnosticForNode(bodyDeclaration, Diagnostics.The_implementation_signature_is_declared_here)
|
|
77850
77874
|
);
|
|
77851
77875
|
break;
|
|
@@ -77892,9 +77916,9 @@ ${lanes.join("\n")}
|
|
|
77892
77916
|
const declarationSpaces = getDeclarationSpaces(d);
|
|
77893
77917
|
const name = getNameOfDeclaration(d);
|
|
77894
77918
|
if (declarationSpaces & commonDeclarationSpacesForDefaultAndNonDefault) {
|
|
77895
|
-
|
|
77919
|
+
error2(name, Diagnostics.Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead, declarationNameToString(name));
|
|
77896
77920
|
} else if (declarationSpaces & commonDeclarationSpacesForExportsAndLocals) {
|
|
77897
|
-
|
|
77921
|
+
error2(name, Diagnostics.Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local, declarationNameToString(name));
|
|
77898
77922
|
}
|
|
77899
77923
|
}
|
|
77900
77924
|
}
|
|
@@ -77974,7 +77998,7 @@ ${lanes.join("\n")}
|
|
|
77974
77998
|
const thenSignatures = thenFunction ? getSignaturesOfType(thenFunction, 0 /* Call */) : emptyArray;
|
|
77975
77999
|
if (thenSignatures.length === 0) {
|
|
77976
78000
|
if (errorNode) {
|
|
77977
|
-
|
|
78001
|
+
error2(errorNode, Diagnostics.A_promise_must_have_a_then_method);
|
|
77978
78002
|
}
|
|
77979
78003
|
return void 0;
|
|
77980
78004
|
}
|
|
@@ -77994,7 +78018,7 @@ ${lanes.join("\n")}
|
|
|
77994
78018
|
thisTypeForErrorOut.value = thisTypeForError;
|
|
77995
78019
|
}
|
|
77996
78020
|
if (errorNode) {
|
|
77997
|
-
|
|
78021
|
+
error2(errorNode, Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1, typeToString(type), typeToString(thisTypeForError));
|
|
77998
78022
|
}
|
|
77999
78023
|
return void 0;
|
|
78000
78024
|
}
|
|
@@ -78005,7 +78029,7 @@ ${lanes.join("\n")}
|
|
|
78005
78029
|
const onfulfilledParameterSignatures = getSignaturesOfType(onfulfilledParameterType, 0 /* Call */);
|
|
78006
78030
|
if (onfulfilledParameterSignatures.length === 0) {
|
|
78007
78031
|
if (errorNode) {
|
|
78008
|
-
|
|
78032
|
+
error2(errorNode, Diagnostics.The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback);
|
|
78009
78033
|
}
|
|
78010
78034
|
return void 0;
|
|
78011
78035
|
}
|
|
@@ -78086,7 +78110,7 @@ ${lanes.join("\n")}
|
|
|
78086
78110
|
if (type.flags & 1048576 /* Union */) {
|
|
78087
78111
|
if (awaitedTypeStack.lastIndexOf(type.id) >= 0) {
|
|
78088
78112
|
if (errorNode) {
|
|
78089
|
-
|
|
78113
|
+
error2(errorNode, Diagnostics.Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method);
|
|
78090
78114
|
}
|
|
78091
78115
|
return void 0;
|
|
78092
78116
|
}
|
|
@@ -78109,7 +78133,7 @@ ${lanes.join("\n")}
|
|
|
78109
78133
|
if (promisedType) {
|
|
78110
78134
|
if (type.id === promisedType.id || awaitedTypeStack.lastIndexOf(promisedType.id) >= 0) {
|
|
78111
78135
|
if (errorNode) {
|
|
78112
|
-
|
|
78136
|
+
error2(errorNode, Diagnostics.Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method);
|
|
78113
78137
|
}
|
|
78114
78138
|
return void 0;
|
|
78115
78139
|
}
|
|
@@ -78146,7 +78170,7 @@ ${lanes.join("\n")}
|
|
|
78146
78170
|
true
|
|
78147
78171
|
);
|
|
78148
78172
|
if (globalPromiseType !== emptyGenericType && !isReferenceToType2(returnType, globalPromiseType)) {
|
|
78149
|
-
|
|
78173
|
+
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));
|
|
78150
78174
|
return;
|
|
78151
78175
|
}
|
|
78152
78176
|
} else {
|
|
@@ -78156,7 +78180,7 @@ ${lanes.join("\n")}
|
|
|
78156
78180
|
}
|
|
78157
78181
|
const promiseConstructorName = getEntityNameFromTypeNode(returnTypeNode);
|
|
78158
78182
|
if (promiseConstructorName === void 0) {
|
|
78159
|
-
|
|
78183
|
+
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));
|
|
78160
78184
|
return;
|
|
78161
78185
|
}
|
|
78162
78186
|
const promiseConstructorSymbol = resolveEntityName(
|
|
@@ -78171,9 +78195,9 @@ ${lanes.join("\n")}
|
|
|
78171
78195
|
/*reportErrors*/
|
|
78172
78196
|
false
|
|
78173
78197
|
)) {
|
|
78174
|
-
|
|
78198
|
+
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);
|
|
78175
78199
|
} else {
|
|
78176
|
-
|
|
78200
|
+
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));
|
|
78177
78201
|
}
|
|
78178
78202
|
return;
|
|
78179
78203
|
}
|
|
@@ -78182,7 +78206,7 @@ ${lanes.join("\n")}
|
|
|
78182
78206
|
true
|
|
78183
78207
|
);
|
|
78184
78208
|
if (globalPromiseConstructorLikeType === emptyObjectType) {
|
|
78185
|
-
|
|
78209
|
+
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));
|
|
78186
78210
|
return;
|
|
78187
78211
|
}
|
|
78188
78212
|
if (!checkTypeAssignableTo(
|
|
@@ -78196,7 +78220,7 @@ ${lanes.join("\n")}
|
|
|
78196
78220
|
const rootName = promiseConstructorName && getFirstIdentifier(promiseConstructorName);
|
|
78197
78221
|
const collidingSymbol = getSymbol2(node.locals, rootName.escapedText, 111551 /* Value */);
|
|
78198
78222
|
if (collidingSymbol) {
|
|
78199
|
-
|
|
78223
|
+
error2(
|
|
78200
78224
|
collidingSymbol.valueDeclaration,
|
|
78201
78225
|
Diagnostics.Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions,
|
|
78202
78226
|
idText(rootName),
|
|
@@ -78309,7 +78333,7 @@ ${lanes.join("\n")}
|
|
|
78309
78333
|
if (canCollectSymbolAliasAccessabilityData && symbolIsValue(rootSymbol) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol)) && !getTypeOnlyAliasDeclaration(rootSymbol)) {
|
|
78310
78334
|
markAliasSymbolAsReferenced(rootSymbol);
|
|
78311
78335
|
} else if (forDecoratorMetadata && getIsolatedModules(compilerOptions) && getEmitModuleKind(compilerOptions) >= 5 /* ES2015 */ && !symbolIsValue(rootSymbol) && !some(rootSymbol.declarations, isTypeOnlyImportOrExportDeclaration)) {
|
|
78312
|
-
const diag2 =
|
|
78336
|
+
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);
|
|
78313
78337
|
const aliasDeclaration = find(rootSymbol.declarations || emptyArray, isAliasSymbolDeclaration2);
|
|
78314
78338
|
if (aliasDeclaration) {
|
|
78315
78339
|
addRelatedInfo(diag2, createDiagnosticForNode(aliasDeclaration, Diagnostics._0_was_imported_here, idText(rootName)));
|
|
@@ -78457,7 +78481,7 @@ ${lanes.join("\n")}
|
|
|
78457
78481
|
}
|
|
78458
78482
|
function checkJSDocTypeAliasTag(node) {
|
|
78459
78483
|
if (!node.typeExpression) {
|
|
78460
|
-
|
|
78484
|
+
error2(node.name, Diagnostics.JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags);
|
|
78461
78485
|
}
|
|
78462
78486
|
if (node.name) {
|
|
78463
78487
|
checkTypeNameIsReserved(node.name, Diagnostics.Type_alias_name_cannot_be_0);
|
|
@@ -78482,7 +78506,7 @@ ${lanes.join("\n")}
|
|
|
78482
78506
|
if (length(tags) > 1) {
|
|
78483
78507
|
for (let i = 1; i < length(tags); i++) {
|
|
78484
78508
|
const tagName = tags[i].tagName;
|
|
78485
|
-
|
|
78509
|
+
error2(tagName, Diagnostics._0_tag_already_specified, idText(tagName));
|
|
78486
78510
|
}
|
|
78487
78511
|
}
|
|
78488
78512
|
}
|
|
@@ -78514,33 +78538,33 @@ ${lanes.join("\n")}
|
|
|
78514
78538
|
function checkJSDocImplementsTag(node) {
|
|
78515
78539
|
const classLike = getEffectiveJSDocHost(node);
|
|
78516
78540
|
if (!classLike || !isClassDeclaration(classLike) && !isClassExpression(classLike)) {
|
|
78517
|
-
|
|
78541
|
+
error2(classLike, Diagnostics.JSDoc_0_is_not_attached_to_a_class, idText(node.tagName));
|
|
78518
78542
|
}
|
|
78519
78543
|
}
|
|
78520
78544
|
function checkJSDocAugmentsTag(node) {
|
|
78521
78545
|
const classLike = getEffectiveJSDocHost(node);
|
|
78522
78546
|
if (!classLike || !isClassDeclaration(classLike) && !isClassExpression(classLike)) {
|
|
78523
|
-
|
|
78547
|
+
error2(classLike, Diagnostics.JSDoc_0_is_not_attached_to_a_class, idText(node.tagName));
|
|
78524
78548
|
return;
|
|
78525
78549
|
}
|
|
78526
78550
|
const augmentsTags = getJSDocTags(classLike).filter(isJSDocAugmentsTag);
|
|
78527
78551
|
Debug.assert(augmentsTags.length > 0);
|
|
78528
78552
|
if (augmentsTags.length > 1) {
|
|
78529
|
-
|
|
78553
|
+
error2(augmentsTags[1], Diagnostics.Class_declarations_cannot_have_more_than_one_augments_or_extends_tag);
|
|
78530
78554
|
}
|
|
78531
78555
|
const name = getIdentifierFromEntityNameExpression(node.class.expression);
|
|
78532
78556
|
const extend2 = getClassExtendsHeritageElement(classLike);
|
|
78533
78557
|
if (extend2) {
|
|
78534
78558
|
const className = getIdentifierFromEntityNameExpression(extend2.expression);
|
|
78535
78559
|
if (className && name.escapedText !== className.escapedText) {
|
|
78536
|
-
|
|
78560
|
+
error2(name, Diagnostics.JSDoc_0_1_does_not_match_the_extends_2_clause, idText(node.tagName), idText(name), idText(className));
|
|
78537
78561
|
}
|
|
78538
78562
|
}
|
|
78539
78563
|
}
|
|
78540
78564
|
function checkJSDocAccessibilityModifiers(node) {
|
|
78541
78565
|
const host2 = getJSDocHost(node);
|
|
78542
78566
|
if (host2 && isPrivateIdentifierClassElementDeclaration(host2)) {
|
|
78543
|
-
|
|
78567
|
+
error2(node, Diagnostics.An_accessibility_modifier_cannot_be_used_with_a_private_identifier);
|
|
78544
78568
|
}
|
|
78545
78569
|
}
|
|
78546
78570
|
function getIdentifierFromEntityNameExpression(node) {
|
|
@@ -78582,7 +78606,7 @@ ${lanes.join("\n")}
|
|
|
78582
78606
|
if (isInJSFile(node)) {
|
|
78583
78607
|
const typeTag = getJSDocTypeTag(node);
|
|
78584
78608
|
if (typeTag && typeTag.typeExpression && !getContextualCallSignature(getTypeFromTypeNode(typeTag.typeExpression), node)) {
|
|
78585
|
-
|
|
78609
|
+
error2(typeTag.typeExpression.type, Diagnostics.The_type_of_a_function_declaration_must_match_the_function_s_signature);
|
|
78586
78610
|
}
|
|
78587
78611
|
}
|
|
78588
78612
|
function checkFunctionOrMethodDeclarationDiagnostics() {
|
|
@@ -78906,9 +78930,9 @@ ${lanes.join("\n")}
|
|
|
78906
78930
|
if (getNodeCheckFlags(current) & 4 /* CaptureThis */) {
|
|
78907
78931
|
const isDeclaration2 = node.kind !== 80 /* Identifier */;
|
|
78908
78932
|
if (isDeclaration2) {
|
|
78909
|
-
|
|
78933
|
+
error2(getNameOfDeclaration(node), Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference);
|
|
78910
78934
|
} else {
|
|
78911
|
-
|
|
78935
|
+
error2(node, Diagnostics.Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference);
|
|
78912
78936
|
}
|
|
78913
78937
|
return true;
|
|
78914
78938
|
}
|
|
@@ -78920,9 +78944,9 @@ ${lanes.join("\n")}
|
|
|
78920
78944
|
if (getNodeCheckFlags(current) & 8 /* CaptureNewTarget */) {
|
|
78921
78945
|
const isDeclaration2 = node.kind !== 80 /* Identifier */;
|
|
78922
78946
|
if (isDeclaration2) {
|
|
78923
|
-
|
|
78947
|
+
error2(getNameOfDeclaration(node), Diagnostics.Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference);
|
|
78924
78948
|
} else {
|
|
78925
|
-
|
|
78949
|
+
error2(node, Diagnostics.Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference);
|
|
78926
78950
|
}
|
|
78927
78951
|
return true;
|
|
78928
78952
|
}
|
|
@@ -79060,7 +79084,7 @@ ${lanes.join("\n")}
|
|
|
79060
79084
|
const namesShareScope = container && (container.kind === 240 /* Block */ && isFunctionLike(container.parent) || container.kind === 267 /* ModuleBlock */ || container.kind === 266 /* ModuleDeclaration */ || container.kind === 311 /* SourceFile */);
|
|
79061
79085
|
if (!namesShareScope) {
|
|
79062
79086
|
const name = symbolToString(localDeclarationSymbol);
|
|
79063
|
-
|
|
79087
|
+
error2(node, Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name);
|
|
79064
79088
|
}
|
|
79065
79089
|
}
|
|
79066
79090
|
}
|
|
@@ -79096,7 +79120,7 @@ ${lanes.join("\n")}
|
|
|
79096
79120
|
checkComputedPropertyName(node.propertyName);
|
|
79097
79121
|
}
|
|
79098
79122
|
const parent2 = node.parent.parent;
|
|
79099
|
-
const parentCheckMode = node.dotDotDotToken ?
|
|
79123
|
+
const parentCheckMode = node.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */;
|
|
79100
79124
|
const parentType = getTypeForBindingElementParent(parent2, parentCheckMode);
|
|
79101
79125
|
const name = node.propertyName || node.name;
|
|
79102
79126
|
if (parentType && !isBindingPattern(name)) {
|
|
@@ -79131,7 +79155,7 @@ ${lanes.join("\n")}
|
|
|
79131
79155
|
forEach(node.name.elements, checkSourceElement);
|
|
79132
79156
|
}
|
|
79133
79157
|
if (isParameter(node) && node.initializer && nodeIsMissing(getContainingFunction(node).body)) {
|
|
79134
|
-
|
|
79158
|
+
error2(node, Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation);
|
|
79135
79159
|
return;
|
|
79136
79160
|
}
|
|
79137
79161
|
if (isBindingPattern(node.name)) {
|
|
@@ -79183,7 +79207,7 @@ ${lanes.join("\n")}
|
|
|
79183
79207
|
}
|
|
79184
79208
|
if (symbol.declarations && symbol.declarations.length > 1) {
|
|
79185
79209
|
if (some(symbol.declarations, (d) => d !== node && isVariableLike(d) && !areDeclarationFlagsIdentical(d, node))) {
|
|
79186
|
-
|
|
79210
|
+
error2(node.name, Diagnostics.All_declarations_of_0_must_have_identical_modifiers, declarationNameToString(node.name));
|
|
79187
79211
|
}
|
|
79188
79212
|
}
|
|
79189
79213
|
} else {
|
|
@@ -79202,7 +79226,7 @@ ${lanes.join("\n")}
|
|
|
79202
79226
|
);
|
|
79203
79227
|
}
|
|
79204
79228
|
if (symbol.valueDeclaration && !areDeclarationFlagsIdentical(node, symbol.valueDeclaration)) {
|
|
79205
|
-
|
|
79229
|
+
error2(node.name, Diagnostics.All_declarations_of_0_must_have_identical_modifiers, declarationNameToString(node.name));
|
|
79206
79230
|
}
|
|
79207
79231
|
}
|
|
79208
79232
|
if (node.kind !== 171 /* PropertyDeclaration */ && node.kind !== 170 /* PropertySignature */) {
|
|
@@ -79217,7 +79241,7 @@ ${lanes.join("\n")}
|
|
|
79217
79241
|
const nextDeclarationName = getNameOfDeclaration(nextDeclaration);
|
|
79218
79242
|
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;
|
|
79219
79243
|
const declName = declarationNameToString(nextDeclarationName);
|
|
79220
|
-
const err =
|
|
79244
|
+
const err = error2(
|
|
79221
79245
|
nextDeclarationName,
|
|
79222
79246
|
message,
|
|
79223
79247
|
declName,
|
|
@@ -79267,7 +79291,7 @@ ${lanes.join("\n")}
|
|
|
79267
79291
|
checkTestingKnownTruthyCallableOrAwaitableType(node.expression, type, node.thenStatement);
|
|
79268
79292
|
checkSourceElement(node.thenStatement);
|
|
79269
79293
|
if (node.thenStatement.kind === 241 /* EmptyStatement */) {
|
|
79270
|
-
|
|
79294
|
+
error2(node.thenStatement, Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement);
|
|
79271
79295
|
}
|
|
79272
79296
|
checkSourceElement(node.elseStatement);
|
|
79273
79297
|
}
|
|
@@ -79317,7 +79341,7 @@ ${lanes.join("\n")}
|
|
|
79317
79341
|
getTypeNameForErrorDisplay(type)
|
|
79318
79342
|
);
|
|
79319
79343
|
} else {
|
|
79320
|
-
|
|
79344
|
+
error2(location, Diagnostics.This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_instead);
|
|
79321
79345
|
}
|
|
79322
79346
|
}
|
|
79323
79347
|
}
|
|
@@ -79383,7 +79407,7 @@ ${lanes.join("\n")}
|
|
|
79383
79407
|
}
|
|
79384
79408
|
function checkTruthinessOfType(type, node) {
|
|
79385
79409
|
if (type.flags & 16384 /* Void */) {
|
|
79386
|
-
|
|
79410
|
+
error2(node, Diagnostics.An_expression_of_type_void_cannot_be_tested_for_truthiness);
|
|
79387
79411
|
}
|
|
79388
79412
|
return type;
|
|
79389
79413
|
}
|
|
@@ -79457,16 +79481,16 @@ ${lanes.join("\n")}
|
|
|
79457
79481
|
if (node.initializer.kind === 260 /* VariableDeclarationList */) {
|
|
79458
79482
|
const variable = node.initializer.declarations[0];
|
|
79459
79483
|
if (variable && isBindingPattern(variable.name)) {
|
|
79460
|
-
|
|
79484
|
+
error2(variable.name, Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern);
|
|
79461
79485
|
}
|
|
79462
79486
|
checkForInOrForOfVariableDeclaration(node);
|
|
79463
79487
|
} else {
|
|
79464
79488
|
const varExpr = node.initializer;
|
|
79465
79489
|
const leftType = checkExpression(varExpr);
|
|
79466
79490
|
if (varExpr.kind === 208 /* ArrayLiteralExpression */ || varExpr.kind === 209 /* ObjectLiteralExpression */) {
|
|
79467
|
-
|
|
79491
|
+
error2(varExpr, Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern);
|
|
79468
79492
|
} else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) {
|
|
79469
|
-
|
|
79493
|
+
error2(varExpr, Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any);
|
|
79470
79494
|
} else {
|
|
79471
79495
|
checkReferenceExpression(
|
|
79472
79496
|
varExpr,
|
|
@@ -79476,7 +79500,7 @@ ${lanes.join("\n")}
|
|
|
79476
79500
|
}
|
|
79477
79501
|
}
|
|
79478
79502
|
if (rightType === neverType || !isTypeAssignableToKind(rightType, 67108864 /* NonPrimitive */ | 58982400 /* InstantiableNonPrimitive */)) {
|
|
79479
|
-
|
|
79503
|
+
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));
|
|
79480
79504
|
}
|
|
79481
79505
|
checkSourceElement(node.statement);
|
|
79482
79506
|
if (node.locals) {
|
|
@@ -79547,7 +79571,7 @@ ${lanes.join("\n")}
|
|
|
79547
79571
|
if (hasStringConstituent) {
|
|
79548
79572
|
if (languageVersion < 1 /* ES5 */) {
|
|
79549
79573
|
if (errorNode) {
|
|
79550
|
-
|
|
79574
|
+
error2(errorNode, Diagnostics.Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher);
|
|
79551
79575
|
reportedError = true;
|
|
79552
79576
|
}
|
|
79553
79577
|
}
|
|
@@ -80007,7 +80031,7 @@ ${lanes.join("\n")}
|
|
|
80007
80031
|
errorOutputContainer.errors ?? (errorOutputContainer.errors = []);
|
|
80008
80032
|
errorOutputContainer.errors.push(createDiagnosticForNode(errorNode, diagnostic, methodName));
|
|
80009
80033
|
} else {
|
|
80010
|
-
|
|
80034
|
+
error2(errorNode, diagnostic, methodName);
|
|
80011
80035
|
}
|
|
80012
80036
|
}
|
|
80013
80037
|
return methodName === "next" ? noIterationTypes : void 0;
|
|
@@ -80062,7 +80086,7 @@ ${lanes.join("\n")}
|
|
|
80062
80086
|
errorOutputContainer.errors ?? (errorOutputContainer.errors = []);
|
|
80063
80087
|
errorOutputContainer.errors.push(createDiagnosticForNode(errorNode, resolver.mustHaveAValueDiagnostic, methodName));
|
|
80064
80088
|
} else {
|
|
80065
|
-
|
|
80089
|
+
error2(errorNode, resolver.mustHaveAValueDiagnostic, methodName);
|
|
80066
80090
|
}
|
|
80067
80091
|
}
|
|
80068
80092
|
yieldType = anyType;
|
|
@@ -80148,11 +80172,11 @@ ${lanes.join("\n")}
|
|
|
80148
80172
|
const exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType;
|
|
80149
80173
|
if (container.kind === 177 /* SetAccessor */) {
|
|
80150
80174
|
if (node.expression) {
|
|
80151
|
-
|
|
80175
|
+
error2(node, Diagnostics.Setters_cannot_return_a_value);
|
|
80152
80176
|
}
|
|
80153
80177
|
} else if (container.kind === 175 /* Constructor */) {
|
|
80154
80178
|
if (node.expression && !checkTypeAssignableToAndOptionallyElaborate(exprType, returnType, node, node.expression)) {
|
|
80155
|
-
|
|
80179
|
+
error2(node, Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class);
|
|
80156
80180
|
}
|
|
80157
80181
|
} else if (getReturnTypeFromAnnotation(container)) {
|
|
80158
80182
|
const unwrappedReturnType = unwrapReturnType(returnType, functionFlags) ?? returnType;
|
|
@@ -80168,7 +80192,7 @@ ${lanes.join("\n")}
|
|
|
80168
80192
|
}
|
|
80169
80193
|
}
|
|
80170
80194
|
} else if (container.kind !== 175 /* Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeUndefinedVoidOrAny(container, returnType)) {
|
|
80171
|
-
|
|
80195
|
+
error2(node, Diagnostics.Not_all_code_paths_return_a_value);
|
|
80172
80196
|
}
|
|
80173
80197
|
}
|
|
80174
80198
|
function checkWithStatement(node) {
|
|
@@ -80204,7 +80228,7 @@ ${lanes.join("\n")}
|
|
|
80204
80228
|
}
|
|
80205
80229
|
forEach(clause.statements, checkSourceElement);
|
|
80206
80230
|
if (compilerOptions.noFallthroughCasesInSwitch && clause.fallthroughFlowNode && isReachableFlowNode(clause.fallthroughFlowNode)) {
|
|
80207
|
-
|
|
80231
|
+
error2(clause, Diagnostics.Fallthrough_case_in_switch);
|
|
80208
80232
|
}
|
|
80209
80233
|
function createLazyCaseClauseDiagnostics(clause2) {
|
|
80210
80234
|
return () => {
|
|
@@ -80354,7 +80378,7 @@ ${lanes.join("\n")}
|
|
|
80354
80378
|
const localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfDeclaration(info.declaration)) === type.symbol ? info.declaration : void 0;
|
|
80355
80379
|
const errorNode = localCheckDeclaration || localIndexDeclaration || (interfaceDeclaration && !some(getBaseTypes(type), (base) => !!getIndexInfoOfType(base, checkInfo.keyType) && !!getIndexTypeOfType(base, info.keyType)) ? interfaceDeclaration : void 0);
|
|
80356
80380
|
if (errorNode && !isTypeAssignableTo(checkInfo.type, info.type)) {
|
|
80357
|
-
|
|
80381
|
+
error2(
|
|
80358
80382
|
errorNode,
|
|
80359
80383
|
Diagnostics._0_index_type_1_is_not_assignable_to_2_index_type_3,
|
|
80360
80384
|
typeToString(checkInfo.keyType),
|
|
@@ -80377,12 +80401,12 @@ ${lanes.join("\n")}
|
|
|
80377
80401
|
case "symbol":
|
|
80378
80402
|
case "void":
|
|
80379
80403
|
case "object":
|
|
80380
|
-
|
|
80404
|
+
error2(name, message, name.escapedText);
|
|
80381
80405
|
}
|
|
80382
80406
|
}
|
|
80383
80407
|
function checkClassNameCollisionWithObject(name) {
|
|
80384
80408
|
if (languageVersion >= 1 /* ES5 */ && name.escapedText === "Object" && (moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(name).impliedNodeFormat === 1 /* CommonJS */)) {
|
|
80385
|
-
|
|
80409
|
+
error2(name, Diagnostics.Class_name_cannot_be_Object_when_targeting_ES5_with_module_0, ModuleKind[moduleKind]);
|
|
80386
80410
|
}
|
|
80387
80411
|
}
|
|
80388
80412
|
function checkUnmatchedJSDocParameters(node) {
|
|
@@ -80405,7 +80429,7 @@ ${lanes.join("\n")}
|
|
|
80405
80429
|
const lastJSDocParamIndex = jsdocParameters.length - 1;
|
|
80406
80430
|
const lastJSDocParam = jsdocParameters[lastJSDocParamIndex];
|
|
80407
80431
|
if (isJs && lastJSDocParam && isIdentifier(lastJSDocParam.name) && lastJSDocParam.typeExpression && lastJSDocParam.typeExpression.type && !parameters.has(lastJSDocParam.name.escapedText) && !excludedParameters.has(lastJSDocParamIndex) && !isArrayType(getTypeFromTypeNode(lastJSDocParam.typeExpression.type))) {
|
|
80408
|
-
|
|
80432
|
+
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));
|
|
80409
80433
|
}
|
|
80410
80434
|
} else {
|
|
80411
80435
|
forEach(jsdocParameters, ({ name, isNameFirst }, index) => {
|
|
@@ -80414,7 +80438,7 @@ ${lanes.join("\n")}
|
|
|
80414
80438
|
}
|
|
80415
80439
|
if (isQualifiedName(name)) {
|
|
80416
80440
|
if (isJs) {
|
|
80417
|
-
|
|
80441
|
+
error2(name, Diagnostics.Qualified_name_0_is_not_allowed_without_a_leading_param_object_1, entityNameToString(name), entityNameToString(name.left));
|
|
80418
80442
|
}
|
|
80419
80443
|
} else {
|
|
80420
80444
|
if (!isNameFirst) {
|
|
@@ -80439,11 +80463,11 @@ ${lanes.join("\n")}
|
|
|
80439
80463
|
seenDefault = true;
|
|
80440
80464
|
checkTypeParametersNotReferenced(node.default, typeParameterDeclarations, i);
|
|
80441
80465
|
} else if (seenDefault) {
|
|
80442
|
-
|
|
80466
|
+
error2(node, Diagnostics.Required_type_parameters_may_not_follow_optional_type_parameters);
|
|
80443
80467
|
}
|
|
80444
80468
|
for (let j = 0; j < i; j++) {
|
|
80445
80469
|
if (typeParameterDeclarations[j].symbol === node.symbol) {
|
|
80446
|
-
|
|
80470
|
+
error2(node.name, Diagnostics.Duplicate_identifier_0, declarationNameToString(node.name));
|
|
80447
80471
|
}
|
|
80448
80472
|
}
|
|
80449
80473
|
};
|
|
@@ -80457,7 +80481,7 @@ ${lanes.join("\n")}
|
|
|
80457
80481
|
if (type.flags & 262144 /* TypeParameter */) {
|
|
80458
80482
|
for (let i = index; i < typeParameters.length; i++) {
|
|
80459
80483
|
if (type.symbol === getSymbolOfDeclaration(typeParameters[i])) {
|
|
80460
|
-
|
|
80484
|
+
error2(node, Diagnostics.Type_parameter_defaults_can_only_reference_previously_declared_type_parameters);
|
|
80461
80485
|
}
|
|
80462
80486
|
}
|
|
80463
80487
|
}
|
|
@@ -80480,7 +80504,7 @@ ${lanes.join("\n")}
|
|
|
80480
80504
|
if (!areTypeParametersIdentical(declarations, type.localTypeParameters, getEffectiveTypeParameterDeclarations)) {
|
|
80481
80505
|
const name = symbolToString(symbol);
|
|
80482
80506
|
for (const declaration of declarations) {
|
|
80483
|
-
|
|
80507
|
+
error2(declaration.name, Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, name);
|
|
80484
80508
|
}
|
|
80485
80509
|
}
|
|
80486
80510
|
}
|
|
@@ -80651,18 +80675,18 @@ ${lanes.join("\n")}
|
|
|
80651
80675
|
}
|
|
80652
80676
|
if (baseConstructorType.flags & 8650752 /* TypeVariable */) {
|
|
80653
80677
|
if (!isMixinConstructorType(staticType)) {
|
|
80654
|
-
|
|
80678
|
+
error2(node.name || node, Diagnostics.A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any);
|
|
80655
80679
|
} else {
|
|
80656
80680
|
const constructSignatures = getSignaturesOfType(baseConstructorType, 1 /* Construct */);
|
|
80657
80681
|
if (constructSignatures.some((signature) => signature.flags & 4 /* Abstract */) && !hasSyntacticModifier(node, 256 /* Abstract */)) {
|
|
80658
|
-
|
|
80682
|
+
error2(node.name || node, Diagnostics.A_mixin_class_that_extends_from_a_type_variable_containing_an_abstract_construct_signature_must_also_be_declared_abstract);
|
|
80659
80683
|
}
|
|
80660
80684
|
}
|
|
80661
80685
|
}
|
|
80662
80686
|
if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32 /* Class */) && !(baseConstructorType.flags & 8650752 /* TypeVariable */)) {
|
|
80663
80687
|
const constructors = getInstantiatedConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments, baseTypeNode);
|
|
80664
80688
|
if (forEach(constructors, (sig) => !isJSConstructor(sig.declaration) && !isTypeIdenticalTo(getReturnTypeOfSignature(sig), baseType))) {
|
|
80665
|
-
|
|
80689
|
+
error2(baseTypeNode.expression, Diagnostics.Base_constructors_must_all_have_the_same_return_type);
|
|
80666
80690
|
}
|
|
80667
80691
|
}
|
|
80668
80692
|
checkKindsOfPropertyMemberOverrides(type, baseType);
|
|
@@ -80674,7 +80698,7 @@ ${lanes.join("\n")}
|
|
|
80674
80698
|
if (implementedTypeNodes) {
|
|
80675
80699
|
for (const typeRefNode of implementedTypeNodes) {
|
|
80676
80700
|
if (!isEntityNameExpression(typeRefNode.expression) || isOptionalChain(typeRefNode.expression)) {
|
|
80677
|
-
|
|
80701
|
+
error2(typeRefNode.expression, Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments);
|
|
80678
80702
|
}
|
|
80679
80703
|
checkTypeReferenceNode(typeRefNode);
|
|
80680
80704
|
addLazyDiagnostic(createImplementsDiagnostics(typeRefNode));
|
|
@@ -80707,7 +80731,7 @@ ${lanes.join("\n")}
|
|
|
80707
80731
|
issueMemberSpecificError(node, typeWithThis, baseWithThis, genericDiag);
|
|
80708
80732
|
}
|
|
80709
80733
|
} else {
|
|
80710
|
-
|
|
80734
|
+
error2(typeRefNode, Diagnostics.A_class_can_only_implement_an_object_type_or_intersection_of_object_types_with_statically_known_members);
|
|
80711
80735
|
}
|
|
80712
80736
|
}
|
|
80713
80737
|
};
|
|
@@ -80785,12 +80809,12 @@ ${lanes.join("\n")}
|
|
|
80785
80809
|
if (prop && !baseProp && memberHasOverrideModifier) {
|
|
80786
80810
|
if (errorNode) {
|
|
80787
80811
|
const suggestion = getSuggestedSymbolForNonexistentClassMember(memberName, baseType);
|
|
80788
|
-
suggestion ?
|
|
80812
|
+
suggestion ? error2(
|
|
80789
80813
|
errorNode,
|
|
80790
80814
|
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,
|
|
80791
80815
|
baseClassName,
|
|
80792
80816
|
symbolToString(suggestion)
|
|
80793
|
-
) :
|
|
80817
|
+
) : error2(
|
|
80794
80818
|
errorNode,
|
|
80795
80819
|
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,
|
|
80796
80820
|
baseClassName
|
|
@@ -80805,12 +80829,12 @@ ${lanes.join("\n")}
|
|
|
80805
80829
|
if (!baseHasAbstract) {
|
|
80806
80830
|
if (errorNode) {
|
|
80807
80831
|
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;
|
|
80808
|
-
|
|
80832
|
+
error2(errorNode, diag2, baseClassName);
|
|
80809
80833
|
}
|
|
80810
80834
|
return 1 /* NeedsOverride */;
|
|
80811
80835
|
} else if (memberHasAbstractModifier && baseHasAbstract) {
|
|
80812
80836
|
if (errorNode) {
|
|
80813
|
-
|
|
80837
|
+
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);
|
|
80814
80838
|
}
|
|
80815
80839
|
return 1 /* NeedsOverride */;
|
|
80816
80840
|
}
|
|
@@ -80818,7 +80842,7 @@ ${lanes.join("\n")}
|
|
|
80818
80842
|
} else if (memberHasOverrideModifier) {
|
|
80819
80843
|
if (errorNode) {
|
|
80820
80844
|
const className = typeToString(type);
|
|
80821
|
-
|
|
80845
|
+
error2(
|
|
80822
80846
|
errorNode,
|
|
80823
80847
|
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,
|
|
80824
80848
|
className
|
|
@@ -80871,7 +80895,7 @@ ${lanes.join("\n")}
|
|
|
80871
80895
|
if (declaration && hasEffectiveModifier(declaration, 8 /* Private */)) {
|
|
80872
80896
|
const typeClassDeclaration = getClassLikeDeclarationOfSymbol(type.symbol);
|
|
80873
80897
|
if (!isNodeWithinClass(node, typeClassDeclaration)) {
|
|
80874
|
-
|
|
80898
|
+
error2(node, Diagnostics.Cannot_extend_a_class_0_Class_constructor_is_marked_as_private, getFullyQualifiedName(type.symbol));
|
|
80875
80899
|
}
|
|
80876
80900
|
}
|
|
80877
80901
|
}
|
|
@@ -80940,7 +80964,7 @@ ${lanes.join("\n")}
|
|
|
80940
80964
|
}
|
|
80941
80965
|
}
|
|
80942
80966
|
if (!inheritedAbstractMemberNotImplementedError) {
|
|
80943
|
-
inheritedAbstractMemberNotImplementedError =
|
|
80967
|
+
inheritedAbstractMemberNotImplementedError = error2(
|
|
80944
80968
|
derivedClassDecl,
|
|
80945
80969
|
Diagnostics.Non_abstract_class_0_does_not_implement_all_abstract_members_of_1,
|
|
80946
80970
|
typeToString(type),
|
|
@@ -80986,7 +81010,7 @@ ${lanes.join("\n")}
|
|
|
80986
81010
|
const overriddenInstanceAccessor = basePropertyFlags === 4 /* Property */ && derivedPropertyFlags !== 4 /* Property */;
|
|
80987
81011
|
if (overriddenInstanceProperty || overriddenInstanceAccessor) {
|
|
80988
81012
|
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;
|
|
80989
|
-
|
|
81013
|
+
error2(getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage2, symbolToString(base), typeToString(baseType), typeToString(type));
|
|
80990
81014
|
} else if (useDefineForClassFields) {
|
|
80991
81015
|
const uninitialized = (_c = derived.declarations) == null ? void 0 : _c.find((d) => d.kind === 171 /* PropertyDeclaration */ && !d.initializer);
|
|
80992
81016
|
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 */)))) {
|
|
@@ -80994,7 +81018,7 @@ ${lanes.join("\n")}
|
|
|
80994
81018
|
const propName = uninitialized.name;
|
|
80995
81019
|
if (uninitialized.exclamationToken || !constructor || !isIdentifier(propName) || !strictNullChecks || !isPropertyInitializedInConstructor(propName, type, constructor)) {
|
|
80996
81020
|
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;
|
|
80997
|
-
|
|
81021
|
+
error2(getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage2, symbolToString(base), typeToString(baseType));
|
|
80998
81022
|
}
|
|
80999
81023
|
}
|
|
81000
81024
|
}
|
|
@@ -81011,7 +81035,7 @@ ${lanes.join("\n")}
|
|
|
81011
81035
|
} else {
|
|
81012
81036
|
errorMessage = Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function;
|
|
81013
81037
|
}
|
|
81014
|
-
|
|
81038
|
+
error2(getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type));
|
|
81015
81039
|
}
|
|
81016
81040
|
}
|
|
81017
81041
|
}
|
|
@@ -81090,7 +81114,7 @@ ${lanes.join("\n")}
|
|
|
81090
81114
|
const type = getTypeOfSymbol(getSymbolOfDeclaration(member));
|
|
81091
81115
|
if (!(type.flags & 3 /* AnyOrUnknown */ || containsUndefinedType(type))) {
|
|
81092
81116
|
if (!constructor || !isPropertyInitializedInConstructor(propName, type, constructor)) {
|
|
81093
|
-
|
|
81117
|
+
error2(member.name, Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor, declarationNameToString(propName));
|
|
81094
81118
|
}
|
|
81095
81119
|
}
|
|
81096
81120
|
}
|
|
@@ -81147,7 +81171,7 @@ ${lanes.join("\n")}
|
|
|
81147
81171
|
});
|
|
81148
81172
|
forEach(getInterfaceBaseTypeNodes(node), (heritageElement) => {
|
|
81149
81173
|
if (!isEntityNameExpression(heritageElement.expression) || isOptionalChain(heritageElement.expression)) {
|
|
81150
|
-
|
|
81174
|
+
error2(heritageElement.expression, Diagnostics.An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments);
|
|
81151
81175
|
}
|
|
81152
81176
|
checkTypeReferenceNode(heritageElement);
|
|
81153
81177
|
});
|
|
@@ -81164,7 +81188,7 @@ ${lanes.join("\n")}
|
|
|
81164
81188
|
checkTypeParameters(node.typeParameters);
|
|
81165
81189
|
if (node.type.kind === 141 /* IntrinsicKeyword */) {
|
|
81166
81190
|
if (!intrinsicTypeKinds.has(node.name.escapedText) || length(node.typeParameters) !== 1) {
|
|
81167
|
-
|
|
81191
|
+
error2(node.type, Diagnostics.The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types);
|
|
81168
81192
|
}
|
|
81169
81193
|
} else {
|
|
81170
81194
|
checkSourceElement(node.type);
|
|
@@ -81185,11 +81209,11 @@ ${lanes.join("\n")}
|
|
|
81185
81209
|
}
|
|
81186
81210
|
function computeMemberValue(member, autoValue) {
|
|
81187
81211
|
if (isComputedNonLiteralName(member.name)) {
|
|
81188
|
-
|
|
81212
|
+
error2(member.name, Diagnostics.Computed_property_names_are_not_allowed_in_enums);
|
|
81189
81213
|
} else {
|
|
81190
81214
|
const text = getTextOfPropertyName(member.name);
|
|
81191
81215
|
if (isNumericLiteralName(text) && !isInfinityOrNaNString(text)) {
|
|
81192
|
-
|
|
81216
|
+
error2(member.name, Diagnostics.An_enum_member_cannot_have_a_numeric_name);
|
|
81193
81217
|
}
|
|
81194
81218
|
}
|
|
81195
81219
|
if (member.initializer) {
|
|
@@ -81201,7 +81225,7 @@ ${lanes.join("\n")}
|
|
|
81201
81225
|
if (autoValue !== void 0) {
|
|
81202
81226
|
return autoValue;
|
|
81203
81227
|
}
|
|
81204
|
-
|
|
81228
|
+
error2(member.name, Diagnostics.Enum_member_must_have_initializer);
|
|
81205
81229
|
return void 0;
|
|
81206
81230
|
}
|
|
81207
81231
|
function computeConstantValue(member) {
|
|
@@ -81210,12 +81234,12 @@ ${lanes.join("\n")}
|
|
|
81210
81234
|
const value = evaluate(initializer, member);
|
|
81211
81235
|
if (value !== void 0) {
|
|
81212
81236
|
if (isConstEnum && typeof value === "number" && !isFinite(value)) {
|
|
81213
|
-
|
|
81237
|
+
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);
|
|
81214
81238
|
}
|
|
81215
81239
|
} else if (isConstEnum) {
|
|
81216
|
-
|
|
81240
|
+
error2(initializer, Diagnostics.const_enum_member_initializers_must_be_constant_expressions);
|
|
81217
81241
|
} else if (member.parent.flags & 16777216 /* Ambient */) {
|
|
81218
|
-
|
|
81242
|
+
error2(initializer, Diagnostics.In_ambient_enum_declarations_member_initializer_must_be_constant_expression);
|
|
81219
81243
|
} else {
|
|
81220
81244
|
checkTypeAssignableTo(checkExpression(initializer), numberType, initializer, Diagnostics.Type_0_is_not_assignable_to_type_1_as_required_for_computed_enum_member_values);
|
|
81221
81245
|
}
|
|
@@ -81329,11 +81353,11 @@ ${lanes.join("\n")}
|
|
|
81329
81353
|
function evaluateEnumMember(expr, symbol, location) {
|
|
81330
81354
|
const declaration = symbol.valueDeclaration;
|
|
81331
81355
|
if (!declaration || declaration === location) {
|
|
81332
|
-
|
|
81356
|
+
error2(expr, Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(symbol));
|
|
81333
81357
|
return void 0;
|
|
81334
81358
|
}
|
|
81335
81359
|
if (!isBlockScopedNameDeclaredBeforeUse(declaration, location)) {
|
|
81336
|
-
|
|
81360
|
+
error2(expr, Diagnostics.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums);
|
|
81337
81361
|
return 0;
|
|
81338
81362
|
}
|
|
81339
81363
|
return getEnumMemberValue(declaration);
|
|
@@ -81366,7 +81390,7 @@ ${lanes.join("\n")}
|
|
|
81366
81390
|
const enumIsConst = isEnumConst(node);
|
|
81367
81391
|
forEach(enumSymbol.declarations, (decl) => {
|
|
81368
81392
|
if (isEnumDeclaration(decl) && isEnumConst(decl) !== enumIsConst) {
|
|
81369
|
-
|
|
81393
|
+
error2(getNameOfDeclaration(decl), Diagnostics.Enum_declarations_must_all_be_const_or_non_const);
|
|
81370
81394
|
}
|
|
81371
81395
|
});
|
|
81372
81396
|
}
|
|
@@ -81382,7 +81406,7 @@ ${lanes.join("\n")}
|
|
|
81382
81406
|
const firstEnumMember = enumDeclaration.members[0];
|
|
81383
81407
|
if (!firstEnumMember.initializer) {
|
|
81384
81408
|
if (seenEnumMissingInitialInitializer) {
|
|
81385
|
-
|
|
81409
|
+
error2(firstEnumMember.name, Diagnostics.In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element);
|
|
81386
81410
|
} else {
|
|
81387
81411
|
seenEnumMissingInitialInitializer = true;
|
|
81388
81412
|
}
|
|
@@ -81392,7 +81416,7 @@ ${lanes.join("\n")}
|
|
|
81392
81416
|
}
|
|
81393
81417
|
function checkEnumMember(node) {
|
|
81394
81418
|
if (isPrivateIdentifier(node.name)) {
|
|
81395
|
-
|
|
81419
|
+
error2(node, Diagnostics.An_enum_member_cannot_be_named_with_a_private_identifier);
|
|
81396
81420
|
}
|
|
81397
81421
|
if (node.initializer) {
|
|
81398
81422
|
checkExpression(node.initializer);
|
|
@@ -81433,7 +81457,7 @@ ${lanes.join("\n")}
|
|
|
81433
81457
|
const isGlobalAugmentation = isGlobalScopeAugmentation(node);
|
|
81434
81458
|
const inAmbientContext = node.flags & 16777216 /* Ambient */;
|
|
81435
81459
|
if (isGlobalAugmentation && !inAmbientContext) {
|
|
81436
|
-
|
|
81460
|
+
error2(node.name, Diagnostics.Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context);
|
|
81437
81461
|
}
|
|
81438
81462
|
const isAmbientExternalModule = isAmbientModule(node);
|
|
81439
81463
|
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;
|
|
@@ -81452,15 +81476,15 @@ ${lanes.join("\n")}
|
|
|
81452
81476
|
const symbol = getSymbolOfDeclaration(node);
|
|
81453
81477
|
if (symbol.flags & 512 /* ValueModule */ && !inAmbientContext && isInstantiatedModule(node, shouldPreserveConstEnums(compilerOptions))) {
|
|
81454
81478
|
if (getIsolatedModules(compilerOptions) && !getSourceFileOfNode(node).externalModuleIndicator) {
|
|
81455
|
-
|
|
81479
|
+
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);
|
|
81456
81480
|
}
|
|
81457
81481
|
if (((_a = symbol.declarations) == null ? void 0 : _a.length) > 1) {
|
|
81458
81482
|
const firstNonAmbientClassOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol);
|
|
81459
81483
|
if (firstNonAmbientClassOrFunc) {
|
|
81460
81484
|
if (getSourceFileOfNode(node) !== getSourceFileOfNode(firstNonAmbientClassOrFunc)) {
|
|
81461
|
-
|
|
81485
|
+
error2(node.name, Diagnostics.A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged);
|
|
81462
81486
|
} else if (node.pos < firstNonAmbientClassOrFunc.pos) {
|
|
81463
|
-
|
|
81487
|
+
error2(node.name, Diagnostics.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged);
|
|
81464
81488
|
}
|
|
81465
81489
|
}
|
|
81466
81490
|
const mergedClass = getDeclarationOfKind(symbol, 262 /* ClassDeclaration */);
|
|
@@ -81471,7 +81495,7 @@ ${lanes.join("\n")}
|
|
|
81471
81495
|
if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 311 /* SourceFile */ && (moduleKind === 1 /* CommonJS */ || node.parent.impliedNodeFormat === 1 /* CommonJS */)) {
|
|
81472
81496
|
const exportModifier = (_b = node.modifiers) == null ? void 0 : _b.find((m) => m.kind === 95 /* ExportKeyword */);
|
|
81473
81497
|
if (exportModifier) {
|
|
81474
|
-
|
|
81498
|
+
error2(exportModifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
|
81475
81499
|
}
|
|
81476
81500
|
}
|
|
81477
81501
|
}
|
|
@@ -81485,15 +81509,15 @@ ${lanes.join("\n")}
|
|
|
81485
81509
|
}
|
|
81486
81510
|
} else if (isGlobalSourceFile(node.parent)) {
|
|
81487
81511
|
if (isGlobalAugmentation) {
|
|
81488
|
-
|
|
81512
|
+
error2(node.name, Diagnostics.Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations);
|
|
81489
81513
|
} else if (isExternalModuleNameRelative(getTextOfIdentifierOrLiteral(node.name))) {
|
|
81490
|
-
|
|
81514
|
+
error2(node.name, Diagnostics.Ambient_module_declaration_cannot_specify_relative_module_name);
|
|
81491
81515
|
}
|
|
81492
81516
|
} else {
|
|
81493
81517
|
if (isGlobalAugmentation) {
|
|
81494
|
-
|
|
81518
|
+
error2(node.name, Diagnostics.Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations);
|
|
81495
81519
|
} else {
|
|
81496
|
-
|
|
81520
|
+
error2(node.name, Diagnostics.Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces);
|
|
81497
81521
|
}
|
|
81498
81522
|
}
|
|
81499
81523
|
}
|
|
@@ -81560,17 +81584,17 @@ ${lanes.join("\n")}
|
|
|
81560
81584
|
return false;
|
|
81561
81585
|
}
|
|
81562
81586
|
if (!isStringLiteral(moduleName)) {
|
|
81563
|
-
|
|
81587
|
+
error2(moduleName, Diagnostics.String_literal_expected);
|
|
81564
81588
|
return false;
|
|
81565
81589
|
}
|
|
81566
81590
|
const inAmbientExternalModule = node.parent.kind === 267 /* ModuleBlock */ && isAmbientModule(node.parent.parent);
|
|
81567
81591
|
if (node.parent.kind !== 311 /* SourceFile */ && !inAmbientExternalModule) {
|
|
81568
|
-
|
|
81592
|
+
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);
|
|
81569
81593
|
return false;
|
|
81570
81594
|
}
|
|
81571
81595
|
if (inAmbientExternalModule && isExternalModuleNameRelative(moduleName.text)) {
|
|
81572
81596
|
if (!isTopLevelInExternalModuleAugmentation(node)) {
|
|
81573
|
-
|
|
81597
|
+
error2(node, Diagnostics.Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name);
|
|
81574
81598
|
return false;
|
|
81575
81599
|
}
|
|
81576
81600
|
}
|
|
@@ -81579,7 +81603,7 @@ ${lanes.join("\n")}
|
|
|
81579
81603
|
for (const clause of node.assertClause.elements) {
|
|
81580
81604
|
if (!isStringLiteral(clause.value)) {
|
|
81581
81605
|
hasError = true;
|
|
81582
|
-
|
|
81606
|
+
error2(clause.value, Diagnostics.Import_assertion_values_must_be_string_literal_expressions);
|
|
81583
81607
|
}
|
|
81584
81608
|
}
|
|
81585
81609
|
return !hasError;
|
|
@@ -81596,7 +81620,7 @@ ${lanes.join("\n")}
|
|
|
81596
81620
|
const errorNode = isImportOrExportSpecifier(node) ? node.propertyName || node.name : isNamedDeclaration(node) ? node.name : node;
|
|
81597
81621
|
Debug.assert(node.kind !== 279 /* NamespaceExport */);
|
|
81598
81622
|
if (node.kind === 280 /* ExportSpecifier */) {
|
|
81599
|
-
const diag2 =
|
|
81623
|
+
const diag2 = error2(errorNode, Diagnostics.Types_cannot_appear_in_export_declarations_in_JavaScript_files);
|
|
81600
81624
|
const alreadyExportedSymbol = (_b = (_a = getSourceFileOfNode(node).symbol) == null ? void 0 : _a.exports) == null ? void 0 : _b.get((node.propertyName || node.name).escapedText);
|
|
81601
81625
|
if (alreadyExportedSymbol === target) {
|
|
81602
81626
|
const exportingDeclaration = (_c = alreadyExportedSymbol.declarations) == null ? void 0 : _c.find(isJSDocNode);
|
|
@@ -81613,7 +81637,7 @@ ${lanes.join("\n")}
|
|
|
81613
81637
|
const importDeclaration = findAncestor(node, or(isImportDeclaration, isImportEqualsDeclaration));
|
|
81614
81638
|
const moduleSpecifier = (importDeclaration && ((_d = tryGetModuleSpecifierFromDeclaration(importDeclaration)) == null ? void 0 : _d.text)) ?? "...";
|
|
81615
81639
|
const importedIdentifier = unescapeLeadingUnderscores(isIdentifier(errorNode) ? errorNode.escapedText : symbol.escapedName);
|
|
81616
|
-
|
|
81640
|
+
error2(
|
|
81617
81641
|
errorNode,
|
|
81618
81642
|
Diagnostics._0_is_a_type_and_cannot_be_imported_in_JavaScript_files_Use_1_in_a_JSDoc_type_annotation,
|
|
81619
81643
|
importedIdentifier,
|
|
@@ -81626,7 +81650,7 @@ ${lanes.join("\n")}
|
|
|
81626
81650
|
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);
|
|
81627
81651
|
if (targetFlags & excludedMeanings) {
|
|
81628
81652
|
const message = node.kind === 280 /* ExportSpecifier */ ? Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0;
|
|
81629
|
-
|
|
81653
|
+
error2(node, message, symbolToString(symbol));
|
|
81630
81654
|
}
|
|
81631
81655
|
if (getIsolatedModules(compilerOptions) && !isTypeOnlyImportOrExportDeclaration(node) && !(node.flags & 16777216 /* Ambient */)) {
|
|
81632
81656
|
const typeOnlyAlias = getTypeOnlyAliasDeclaration(symbol);
|
|
@@ -81641,20 +81665,20 @@ ${lanes.join("\n")}
|
|
|
81641
81665
|
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;
|
|
81642
81666
|
const name = idText(node.kind === 275 /* ImportSpecifier */ ? node.propertyName || node.name : node.name);
|
|
81643
81667
|
addTypeOnlyDeclarationRelatedInfo(
|
|
81644
|
-
|
|
81668
|
+
error2(node, message, name),
|
|
81645
81669
|
isType ? void 0 : typeOnlyAlias,
|
|
81646
81670
|
name
|
|
81647
81671
|
);
|
|
81648
81672
|
}
|
|
81649
81673
|
if (isType && node.kind === 270 /* ImportEqualsDeclaration */ && hasEffectiveModifier(node, 1 /* Export */)) {
|
|
81650
|
-
|
|
81674
|
+
error2(node, Diagnostics.Cannot_use_export_import_on_a_type_or_type_only_namespace_when_0_is_enabled, isolatedModulesLikeFlagName);
|
|
81651
81675
|
}
|
|
81652
81676
|
break;
|
|
81653
81677
|
}
|
|
81654
81678
|
case 280 /* ExportSpecifier */: {
|
|
81655
81679
|
if (compilerOptions.verbatimModuleSyntax || getSourceFileOfNode(typeOnlyAlias) !== getSourceFileOfNode(node)) {
|
|
81656
81680
|
const name = idText(node.propertyName || node.name);
|
|
81657
|
-
const diagnostic = isType ?
|
|
81681
|
+
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);
|
|
81658
81682
|
addTypeOnlyDeclarationRelatedInfo(diagnostic, isType ? void 0 : typeOnlyAlias, name);
|
|
81659
81683
|
break;
|
|
81660
81684
|
}
|
|
@@ -81662,7 +81686,7 @@ ${lanes.join("\n")}
|
|
|
81662
81686
|
}
|
|
81663
81687
|
}
|
|
81664
81688
|
if (compilerOptions.verbatimModuleSyntax && node.kind !== 270 /* ImportEqualsDeclaration */ && !isInJSFile(node) && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) {
|
|
81665
|
-
|
|
81689
|
+
error2(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
|
81666
81690
|
}
|
|
81667
81691
|
}
|
|
81668
81692
|
if (isImportSpecifier(node)) {
|
|
@@ -81784,7 +81808,7 @@ ${lanes.join("\n")}
|
|
|
81784
81808
|
if (targetFlags & 111551 /* Value */) {
|
|
81785
81809
|
const moduleName = getFirstIdentifier(node.moduleReference);
|
|
81786
81810
|
if (!(resolveEntityName(moduleName, 111551 /* Value */ | 1920 /* Namespace */).flags & 1920 /* Namespace */)) {
|
|
81787
|
-
|
|
81811
|
+
error2(moduleName, Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name, declarationNameToString(moduleName));
|
|
81788
81812
|
}
|
|
81789
81813
|
}
|
|
81790
81814
|
if (targetFlags & 788968 /* Type */) {
|
|
@@ -81818,12 +81842,12 @@ ${lanes.join("\n")}
|
|
|
81818
81842
|
const inAmbientExternalModule = node.parent.kind === 267 /* ModuleBlock */ && isAmbientModule(node.parent.parent);
|
|
81819
81843
|
const inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 267 /* ModuleBlock */ && !node.moduleSpecifier && node.flags & 16777216 /* Ambient */;
|
|
81820
81844
|
if (node.parent.kind !== 311 /* SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) {
|
|
81821
|
-
|
|
81845
|
+
error2(node, Diagnostics.Export_declarations_are_not_permitted_in_a_namespace);
|
|
81822
81846
|
}
|
|
81823
81847
|
} else {
|
|
81824
81848
|
const moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier);
|
|
81825
81849
|
if (moduleSymbol && hasExportAssignmentSymbol(moduleSymbol)) {
|
|
81826
|
-
|
|
81850
|
+
error2(node.moduleSpecifier, Diagnostics.Module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol));
|
|
81827
81851
|
} else if (node.exportClause) {
|
|
81828
81852
|
checkAliasSymbol(node.exportClause);
|
|
81829
81853
|
}
|
|
@@ -81884,7 +81908,7 @@ ${lanes.join("\n")}
|
|
|
81884
81908
|
}
|
|
81885
81909
|
for (const statement of sourceFile.statements) {
|
|
81886
81910
|
if (canConvertImportDeclarationToTypeOnly(statement) || canConvertImportEqualsDeclarationToTypeOnly(statement)) {
|
|
81887
|
-
|
|
81911
|
+
error2(
|
|
81888
81912
|
statement,
|
|
81889
81913
|
Diagnostics.This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error
|
|
81890
81914
|
);
|
|
@@ -81914,7 +81938,7 @@ ${lanes.join("\n")}
|
|
|
81914
81938
|
true
|
|
81915
81939
|
);
|
|
81916
81940
|
if (symbol && (symbol === undefinedSymbol || symbol === globalThisSymbol || symbol.declarations && isGlobalSourceFile(getDeclarationContainer(symbol.declarations[0])))) {
|
|
81917
|
-
|
|
81941
|
+
error2(exportedName, Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, idText(exportedName));
|
|
81918
81942
|
} else {
|
|
81919
81943
|
if (!node.isTypeOnly && !node.parent.parent.isTypeOnly) {
|
|
81920
81944
|
markExportAsReferenced(node);
|
|
@@ -81938,9 +81962,9 @@ ${lanes.join("\n")}
|
|
|
81938
81962
|
const container = node.parent.kind === 311 /* SourceFile */ ? node.parent : node.parent.parent;
|
|
81939
81963
|
if (container.kind === 266 /* ModuleDeclaration */ && !isAmbientModule(container)) {
|
|
81940
81964
|
if (node.isExportEquals) {
|
|
81941
|
-
|
|
81965
|
+
error2(node, Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace);
|
|
81942
81966
|
} else {
|
|
81943
|
-
|
|
81967
|
+
error2(node, Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module);
|
|
81944
81968
|
}
|
|
81945
81969
|
return;
|
|
81946
81970
|
}
|
|
@@ -81968,14 +81992,14 @@ ${lanes.join("\n")}
|
|
|
81968
81992
|
if (getAllSymbolFlags(sym) & 111551 /* Value */) {
|
|
81969
81993
|
checkExpressionCached(id);
|
|
81970
81994
|
if (!isIllegalExportDefaultInCJS && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax && getTypeOnlyAliasDeclaration(sym, 111551 /* Value */)) {
|
|
81971
|
-
|
|
81995
|
+
error2(
|
|
81972
81996
|
id,
|
|
81973
81997
|
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,
|
|
81974
81998
|
idText(id)
|
|
81975
81999
|
);
|
|
81976
82000
|
}
|
|
81977
82001
|
} else if (!isIllegalExportDefaultInCJS && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax) {
|
|
81978
|
-
|
|
82002
|
+
error2(
|
|
81979
82003
|
id,
|
|
81980
82004
|
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,
|
|
81981
82005
|
idText(id)
|
|
@@ -81995,7 +82019,7 @@ ${lanes.join("\n")}
|
|
|
81995
82019
|
checkExpressionCached(node.expression);
|
|
81996
82020
|
}
|
|
81997
82021
|
if (isIllegalExportDefaultInCJS) {
|
|
81998
|
-
|
|
82022
|
+
error2(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
|
81999
82023
|
}
|
|
82000
82024
|
checkExternalModuleExports(container);
|
|
82001
82025
|
if (node.flags & 16777216 /* Ambient */ && !isEntityNameExpression(node.expression)) {
|
|
@@ -82020,7 +82044,7 @@ ${lanes.join("\n")}
|
|
|
82020
82044
|
if (exportEqualsSymbol && hasExportedMembers(moduleSymbol)) {
|
|
82021
82045
|
const declaration = getDeclarationOfAliasSymbol(exportEqualsSymbol) || exportEqualsSymbol.valueDeclaration;
|
|
82022
82046
|
if (declaration && !isTopLevelInExternalModuleAugmentation(declaration) && !isInJSFile(declaration)) {
|
|
82023
|
-
|
|
82047
|
+
error2(declaration, Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements);
|
|
82024
82048
|
}
|
|
82025
82049
|
}
|
|
82026
82050
|
const exports = getExportsOfModule(moduleSymbol);
|
|
@@ -82286,16 +82310,16 @@ ${lanes.join("\n")}
|
|
|
82286
82310
|
const { parent: parent2 } = node;
|
|
82287
82311
|
if (isParameter(parent2) && isJSDocFunctionType(parent2.parent)) {
|
|
82288
82312
|
if (last(parent2.parent.parameters) !== parent2) {
|
|
82289
|
-
|
|
82313
|
+
error2(node, Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list);
|
|
82290
82314
|
}
|
|
82291
82315
|
return;
|
|
82292
82316
|
}
|
|
82293
82317
|
if (!isJSDocTypeExpression(parent2)) {
|
|
82294
|
-
|
|
82318
|
+
error2(node, Diagnostics.JSDoc_may_only_appear_in_the_last_parameter_of_a_signature);
|
|
82295
82319
|
}
|
|
82296
82320
|
const paramTag = node.parent.parent;
|
|
82297
82321
|
if (!isJSDocParameterTag(paramTag)) {
|
|
82298
|
-
|
|
82322
|
+
error2(node, Diagnostics.JSDoc_may_only_appear_in_the_last_parameter_of_a_signature);
|
|
82299
82323
|
return;
|
|
82300
82324
|
}
|
|
82301
82325
|
const param = getParameterSymbolFromJSDoc(paramTag);
|
|
@@ -82304,7 +82328,7 @@ ${lanes.join("\n")}
|
|
|
82304
82328
|
}
|
|
82305
82329
|
const host2 = getHostSignatureFromJSDoc(paramTag);
|
|
82306
82330
|
if (!host2 || last(host2.parameters).symbol !== param) {
|
|
82307
|
-
|
|
82331
|
+
error2(node, Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list);
|
|
82308
82332
|
}
|
|
82309
82333
|
}
|
|
82310
82334
|
function getTypeFromJSDocVariadicType(node) {
|
|
@@ -84141,18 +84165,18 @@ ${lanes.join("\n")}
|
|
|
84141
84165
|
requestedExternalEmitHelperNames.add(name);
|
|
84142
84166
|
const symbol = resolveSymbol(getSymbol2(getExportsOfModule(helpersModule), escapeLeadingUnderscores(name), 111551 /* Value */));
|
|
84143
84167
|
if (!symbol) {
|
|
84144
|
-
|
|
84168
|
+
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);
|
|
84145
84169
|
} else if (helper & 524288 /* ClassPrivateFieldGet */) {
|
|
84146
84170
|
if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 3)) {
|
|
84147
|
-
|
|
84171
|
+
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);
|
|
84148
84172
|
}
|
|
84149
84173
|
} else if (helper & 1048576 /* ClassPrivateFieldSet */) {
|
|
84150
84174
|
if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 4)) {
|
|
84151
|
-
|
|
84175
|
+
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);
|
|
84152
84176
|
}
|
|
84153
84177
|
} else if (helper & 1024 /* SpreadArray */) {
|
|
84154
84178
|
if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 2)) {
|
|
84155
|
-
|
|
84179
|
+
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);
|
|
84156
84180
|
}
|
|
84157
84181
|
}
|
|
84158
84182
|
}
|
|
@@ -84259,7 +84283,7 @@ ${lanes.join("\n")}
|
|
|
84259
84283
|
const sourceFile = getSourceFileOfNode(modifier);
|
|
84260
84284
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
84261
84285
|
addRelatedInfo(
|
|
84262
|
-
|
|
84286
|
+
error2(modifier, Diagnostics.Decorators_may_not_appear_after_export_or_export_default_if_they_also_appear_before_export),
|
|
84263
84287
|
createDiagnosticForNode(firstDecorator, Diagnostics.Decorator_used_before_export_here)
|
|
84264
84288
|
);
|
|
84265
84289
|
return true;
|
|
@@ -84652,12 +84676,12 @@ ${lanes.join("\n")}
|
|
|
84652
84676
|
if (length(nonSimpleParameters)) {
|
|
84653
84677
|
forEach(nonSimpleParameters, (parameter) => {
|
|
84654
84678
|
addRelatedInfo(
|
|
84655
|
-
|
|
84679
|
+
error2(parameter, Diagnostics.This_parameter_is_not_allowed_with_use_strict_directive),
|
|
84656
84680
|
createDiagnosticForNode(useStrictDirective, Diagnostics.use_strict_directive_used_here)
|
|
84657
84681
|
);
|
|
84658
84682
|
});
|
|
84659
84683
|
const diagnostics2 = nonSimpleParameters.map((parameter, index) => index === 0 ? createDiagnosticForNode(parameter, Diagnostics.Non_simple_parameter_declared_here) : createDiagnosticForNode(parameter, Diagnostics.and_here));
|
|
84660
|
-
addRelatedInfo(
|
|
84684
|
+
addRelatedInfo(error2(useStrictDirective, Diagnostics.use_strict_directive_cannot_be_used_with_non_simple_parameter_list), ...diagnostics2);
|
|
84661
84685
|
return true;
|
|
84662
84686
|
}
|
|
84663
84687
|
}
|
|
@@ -85832,10 +85856,11 @@ ${lanes.join("\n")}
|
|
|
85832
85856
|
CheckMode3[CheckMode3["Inferential"] = 2] = "Inferential";
|
|
85833
85857
|
CheckMode3[CheckMode3["SkipContextSensitive"] = 4] = "SkipContextSensitive";
|
|
85834
85858
|
CheckMode3[CheckMode3["SkipGenericFunctions"] = 8] = "SkipGenericFunctions";
|
|
85835
|
-
CheckMode3[CheckMode3["
|
|
85836
|
-
CheckMode3[CheckMode3["
|
|
85837
|
-
CheckMode3[CheckMode3["
|
|
85838
|
-
CheckMode3[CheckMode3["
|
|
85859
|
+
CheckMode3[CheckMode3["SkipAddingIntraExpressionSites"] = 16] = "SkipAddingIntraExpressionSites";
|
|
85860
|
+
CheckMode3[CheckMode3["IsForSignatureHelp"] = 32] = "IsForSignatureHelp";
|
|
85861
|
+
CheckMode3[CheckMode3["IsForStringLiteralArgumentCompletions"] = 64] = "IsForStringLiteralArgumentCompletions";
|
|
85862
|
+
CheckMode3[CheckMode3["RestBindingElement"] = 128] = "RestBindingElement";
|
|
85863
|
+
CheckMode3[CheckMode3["TypeOnly"] = 256] = "TypeOnly";
|
|
85839
85864
|
return CheckMode3;
|
|
85840
85865
|
})(CheckMode || {});
|
|
85841
85866
|
SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
|
|
@@ -87563,13 +87588,13 @@ ${lanes.join("\n")}
|
|
|
87563
87588
|
let sourceLine = 0;
|
|
87564
87589
|
let sourceCharacter = 0;
|
|
87565
87590
|
let nameIndex = 0;
|
|
87566
|
-
let
|
|
87591
|
+
let error2;
|
|
87567
87592
|
return {
|
|
87568
87593
|
get pos() {
|
|
87569
87594
|
return pos;
|
|
87570
87595
|
},
|
|
87571
87596
|
get error() {
|
|
87572
|
-
return
|
|
87597
|
+
return error2;
|
|
87573
87598
|
},
|
|
87574
87599
|
get state() {
|
|
87575
87600
|
return captureMapping(
|
|
@@ -87654,8 +87679,8 @@ ${lanes.join("\n")}
|
|
|
87654
87679
|
return { value: void 0, done: true };
|
|
87655
87680
|
}
|
|
87656
87681
|
function setError(message) {
|
|
87657
|
-
if (
|
|
87658
|
-
|
|
87682
|
+
if (error2 === void 0) {
|
|
87683
|
+
error2 = message;
|
|
87659
87684
|
}
|
|
87660
87685
|
}
|
|
87661
87686
|
function setErrorAndStopIterating(message) {
|
|
@@ -87663,7 +87688,7 @@ ${lanes.join("\n")}
|
|
|
87663
87688
|
return stopIterating();
|
|
87664
87689
|
}
|
|
87665
87690
|
function hasReportedError() {
|
|
87666
|
-
return
|
|
87691
|
+
return error2 !== void 0;
|
|
87667
87692
|
}
|
|
87668
87693
|
function isSourceMappingSegmentEnd() {
|
|
87669
87694
|
return pos === mappings.length || mappings.charCodeAt(pos) === 44 /* comma */ || mappings.charCodeAt(pos) === 59 /* semicolon */;
|
|
@@ -117363,13 +117388,13 @@ ${lanes.join("\n")}
|
|
|
117363
117388
|
sourceFileOptions,
|
|
117364
117389
|
/*onError*/
|
|
117365
117390
|
void 0,
|
|
117366
|
-
shouldCreateNewSourceFile
|
|
117391
|
+
shouldCreateNewSourceFile
|
|
117367
117392
|
) : host.getSourceFile(
|
|
117368
117393
|
oldSourceFile.fileName,
|
|
117369
117394
|
sourceFileOptions,
|
|
117370
117395
|
/*onError*/
|
|
117371
117396
|
void 0,
|
|
117372
|
-
shouldCreateNewSourceFile
|
|
117397
|
+
shouldCreateNewSourceFile
|
|
117373
117398
|
);
|
|
117374
117399
|
if (!newSourceFile) {
|
|
117375
117400
|
return 0 /* Not */;
|
|
@@ -118325,7 +118350,7 @@ ${lanes.join("\n")}
|
|
|
118325
118350
|
return typeof result === "object" ? { ...result, languageVersion, setExternalModuleIndicator: setExternalModuleIndicator2 } : { languageVersion, impliedNodeFormat: result, setExternalModuleIndicator: setExternalModuleIndicator2 };
|
|
118326
118351
|
}
|
|
118327
118352
|
function findSourceFileWorker(fileName, isDefaultLib, ignoreNoDefaultLib, reason, packageId) {
|
|
118328
|
-
var _a2
|
|
118353
|
+
var _a2;
|
|
118329
118354
|
const path = toPath3(fileName);
|
|
118330
118355
|
if (useSourceOfProjectReferenceRedirect) {
|
|
118331
118356
|
let source = getSourceOfProjectReferenceRedirect(path);
|
|
@@ -118404,7 +118429,7 @@ ${lanes.join("\n")}
|
|
|
118404
118429
|
Diagnostics.Cannot_read_file_0_Colon_1,
|
|
118405
118430
|
[fileName, hostErrorMessage]
|
|
118406
118431
|
),
|
|
118407
|
-
shouldCreateNewSourceFile
|
|
118432
|
+
shouldCreateNewSourceFile
|
|
118408
118433
|
);
|
|
118409
118434
|
if (packageId) {
|
|
118410
118435
|
const packageIdKey = packageIdToString(packageId);
|
|
@@ -118429,7 +118454,7 @@ ${lanes.join("\n")}
|
|
|
118429
118454
|
file.path = path;
|
|
118430
118455
|
file.resolvedPath = toPath3(fileName);
|
|
118431
118456
|
file.originalFileName = originalFileName;
|
|
118432
|
-
file.packageJsonLocations = ((
|
|
118457
|
+
file.packageJsonLocations = ((_a2 = sourceFileOptions.packageJsonLocations) == null ? void 0 : _a2.length) ? sourceFileOptions.packageJsonLocations : void 0;
|
|
118433
118458
|
file.packageJsonScope = sourceFileOptions.packageJsonScope;
|
|
118434
118459
|
addFileIncludeReason(file, reason);
|
|
118435
118460
|
if (host.useCaseSensitiveFileNames()) {
|
|
@@ -122836,17 +122861,17 @@ ${lanes.join("\n")}
|
|
|
122836
122861
|
function getWatchErrorSummaryDiagnosticMessage(errorCount) {
|
|
122837
122862
|
return errorCount === 1 ? Diagnostics.Found_1_error_Watching_for_file_changes : Diagnostics.Found_0_errors_Watching_for_file_changes;
|
|
122838
122863
|
}
|
|
122839
|
-
function prettyPathForFileError(
|
|
122840
|
-
const line = formatColorAndReset(":" +
|
|
122841
|
-
if (pathIsAbsolute(
|
|
122864
|
+
function prettyPathForFileError(error2, cwd) {
|
|
122865
|
+
const line = formatColorAndReset(":" + error2.line, "\x1B[90m" /* Grey */);
|
|
122866
|
+
if (pathIsAbsolute(error2.fileName) && pathIsAbsolute(cwd)) {
|
|
122842
122867
|
return getRelativePathFromDirectory(
|
|
122843
122868
|
cwd,
|
|
122844
|
-
|
|
122869
|
+
error2.fileName,
|
|
122845
122870
|
/*ignoreCase*/
|
|
122846
122871
|
false
|
|
122847
122872
|
) + line;
|
|
122848
122873
|
}
|
|
122849
|
-
return
|
|
122874
|
+
return error2.fileName + line;
|
|
122850
122875
|
}
|
|
122851
122876
|
function getErrorSummaryText(errorCount, filesInError, newLine, host) {
|
|
122852
122877
|
if (errorCount === 0)
|
|
@@ -123727,7 +123752,8 @@ ${lanes.join("\n")}
|
|
|
123727
123752
|
if (isFileMissingOnHost(hostSourceFile)) {
|
|
123728
123753
|
return void 0;
|
|
123729
123754
|
}
|
|
123730
|
-
|
|
123755
|
+
const impliedNodeFormat = typeof languageVersionOrOptions === "object" ? languageVersionOrOptions.impliedNodeFormat : void 0;
|
|
123756
|
+
if (hostSourceFile === void 0 || shouldCreateNewSourceFile || isFilePresenceUnknownOnHost(hostSourceFile) || hostSourceFile.sourceFile.impliedNodeFormat !== impliedNodeFormat) {
|
|
123731
123757
|
const sourceFile = getNewSourceFile(fileName, languageVersionOrOptions, onError);
|
|
123732
123758
|
if (hostSourceFile) {
|
|
123733
123759
|
if (sourceFile) {
|
|
@@ -131687,13 +131713,6 @@ ${lanes.join("\n")}
|
|
|
131687
131713
|
}
|
|
131688
131714
|
}
|
|
131689
131715
|
}
|
|
131690
|
-
function getLanguageServiceRefCounts(path, scriptKind) {
|
|
131691
|
-
return arrayFrom(buckets.entries(), ([key, bucket]) => {
|
|
131692
|
-
const bucketEntry = bucket.get(path);
|
|
131693
|
-
const entry = bucketEntry && getDocumentRegistryEntry(bucketEntry, scriptKind);
|
|
131694
|
-
return [key, entry && entry.languageServiceRefCount];
|
|
131695
|
-
});
|
|
131696
|
-
}
|
|
131697
131716
|
return {
|
|
131698
131717
|
acquireDocument,
|
|
131699
131718
|
acquireDocumentWithKey,
|
|
@@ -131701,9 +131720,10 @@ ${lanes.join("\n")}
|
|
|
131701
131720
|
updateDocumentWithKey,
|
|
131702
131721
|
releaseDocument,
|
|
131703
131722
|
releaseDocumentWithKey,
|
|
131704
|
-
|
|
131723
|
+
getKeyForCompilationSettings,
|
|
131724
|
+
getDocumentRegistryBucketKeyWithMode,
|
|
131705
131725
|
reportStats,
|
|
131706
|
-
|
|
131726
|
+
getBuckets: () => buckets
|
|
131707
131727
|
};
|
|
131708
131728
|
}
|
|
131709
131729
|
function getKeyForCompilationSettings(settings) {
|
|
@@ -134942,6 +134962,9 @@ ${lanes.join("\n")}
|
|
|
134942
134962
|
});
|
|
134943
134963
|
|
|
134944
134964
|
// src/services/refactors/moveToFile.ts
|
|
134965
|
+
function error(notApplicableReason) {
|
|
134966
|
+
return { edits: [], renameFilename: void 0, renameLocation: void 0, notApplicableReason };
|
|
134967
|
+
}
|
|
134945
134968
|
function doChange4(context, oldFile, targetFile, program, toMove, changes, host, preferences) {
|
|
134946
134969
|
const checker = program.getTypeChecker();
|
|
134947
134970
|
const usage = getUsageInfo(oldFile, toMove.all, checker);
|
|
@@ -135824,13 +135847,17 @@ ${lanes.join("\n")}
|
|
|
135824
135847
|
getEditsForAction: function getRefactorEditsToMoveToFile(context, actionName2, interactiveRefactorArguments) {
|
|
135825
135848
|
Debug.assert(actionName2 === refactorNameForMoveToFile, "Wrong refactor invoked");
|
|
135826
135849
|
const statements = Debug.checkDefined(getStatementsToMove(context));
|
|
135850
|
+
const { host, program } = context;
|
|
135827
135851
|
Debug.assert(interactiveRefactorArguments, "No interactive refactor arguments available");
|
|
135828
135852
|
const targetFile = interactiveRefactorArguments.targetFile;
|
|
135829
135853
|
if (hasJSFileExtension(targetFile) || hasTSFileExtension(targetFile)) {
|
|
135830
|
-
|
|
135854
|
+
if (host.fileExists(targetFile) && program.getSourceFile(targetFile) === void 0) {
|
|
135855
|
+
return error(getLocaleSpecificMessage(Diagnostics.Cannot_move_statements_to_the_selected_file));
|
|
135856
|
+
}
|
|
135857
|
+
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange4(context, context.file, interactiveRefactorArguments.targetFile, program, statements, t, context.host, context.preferences));
|
|
135831
135858
|
return { edits, renameFilename: void 0, renameLocation: void 0 };
|
|
135832
135859
|
}
|
|
135833
|
-
return
|
|
135860
|
+
return error(getLocaleSpecificMessage(Diagnostics.Cannot_move_to_file_selected_file_is_invalid));
|
|
135834
135861
|
}
|
|
135835
135862
|
});
|
|
135836
135863
|
}
|
|
@@ -136211,25 +136238,25 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
136211
136238
|
const possibleActions = [];
|
|
136212
136239
|
const errors = [];
|
|
136213
136240
|
if (refactorKindBeginsWith(toNamedFunctionAction.kind, kind)) {
|
|
136214
|
-
const
|
|
136215
|
-
if (
|
|
136216
|
-
errors.push({ ...toNamedFunctionAction, notApplicableReason:
|
|
136241
|
+
const error2 = selectedVariableDeclaration || isArrowFunction(func) && isVariableDeclaration(func.parent) ? void 0 : getLocaleSpecificMessage(Diagnostics.Could_not_convert_to_named_function);
|
|
136242
|
+
if (error2) {
|
|
136243
|
+
errors.push({ ...toNamedFunctionAction, notApplicableReason: error2 });
|
|
136217
136244
|
} else {
|
|
136218
136245
|
possibleActions.push(toNamedFunctionAction);
|
|
136219
136246
|
}
|
|
136220
136247
|
}
|
|
136221
136248
|
if (refactorKindBeginsWith(toAnonymousFunctionAction.kind, kind)) {
|
|
136222
|
-
const
|
|
136223
|
-
if (
|
|
136224
|
-
errors.push({ ...toAnonymousFunctionAction, notApplicableReason:
|
|
136249
|
+
const error2 = !selectedVariableDeclaration && isArrowFunction(func) ? void 0 : getLocaleSpecificMessage(Diagnostics.Could_not_convert_to_anonymous_function);
|
|
136250
|
+
if (error2) {
|
|
136251
|
+
errors.push({ ...toAnonymousFunctionAction, notApplicableReason: error2 });
|
|
136225
136252
|
} else {
|
|
136226
136253
|
possibleActions.push(toAnonymousFunctionAction);
|
|
136227
136254
|
}
|
|
136228
136255
|
}
|
|
136229
136256
|
if (refactorKindBeginsWith(toArrowFunctionAction.kind, kind)) {
|
|
136230
|
-
const
|
|
136231
|
-
if (
|
|
136232
|
-
errors.push({ ...toArrowFunctionAction, notApplicableReason:
|
|
136257
|
+
const error2 = isFunctionExpression(func) ? void 0 : getLocaleSpecificMessage(Diagnostics.Could_not_convert_to_arrow_function);
|
|
136258
|
+
if (error2) {
|
|
136259
|
+
errors.push({ ...toArrowFunctionAction, notApplicableReason: error2 });
|
|
136233
136260
|
} else {
|
|
136234
136261
|
possibleActions.push(toArrowFunctionAction);
|
|
136235
136262
|
}
|
|
@@ -137572,11 +137599,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
137572
137599
|
}
|
|
137573
137600
|
return infos.length ? infos : emptyArray;
|
|
137574
137601
|
function getStringError(errors) {
|
|
137575
|
-
let
|
|
137576
|
-
if (typeof
|
|
137577
|
-
|
|
137602
|
+
let error2 = errors[0].messageText;
|
|
137603
|
+
if (typeof error2 !== "string") {
|
|
137604
|
+
error2 = error2.messageText;
|
|
137578
137605
|
}
|
|
137579
|
-
return
|
|
137606
|
+
return error2;
|
|
137580
137607
|
}
|
|
137581
137608
|
}
|
|
137582
137609
|
function getRefactorEditsToExtractSymbol(context, actionName2) {
|
|
@@ -139820,9 +139847,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
139820
139847
|
function getValidSourceFile(fileName) {
|
|
139821
139848
|
const sourceFile = program.getSourceFile(fileName);
|
|
139822
139849
|
if (!sourceFile) {
|
|
139823
|
-
const
|
|
139824
|
-
|
|
139825
|
-
throw
|
|
139850
|
+
const error2 = new Error(`Could not find source file: '${fileName}'.`);
|
|
139851
|
+
error2.ProgramFiles = program.getSourceFiles().map((f) => f.fileName);
|
|
139852
|
+
throw error2;
|
|
139826
139853
|
}
|
|
139827
139854
|
return sourceFile;
|
|
139828
139855
|
}
|
|
@@ -140055,14 +140082,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
140055
140082
|
}
|
|
140056
140083
|
}
|
|
140057
140084
|
function cleanupSemanticCache() {
|
|
140058
|
-
program = void 0;
|
|
140059
|
-
}
|
|
140060
|
-
function dispose() {
|
|
140061
140085
|
if (program) {
|
|
140062
140086
|
const key = documentRegistry.getKeyForCompilationSettings(program.getCompilerOptions());
|
|
140063
140087
|
forEach(program.getSourceFiles(), (f) => documentRegistry.releaseDocumentWithKey(f.resolvedPath, key, f.scriptKind, f.impliedNodeFormat));
|
|
140064
140088
|
program = void 0;
|
|
140065
140089
|
}
|
|
140090
|
+
}
|
|
140091
|
+
function dispose() {
|
|
140092
|
+
cleanupSemanticCache();
|
|
140066
140093
|
host = void 0;
|
|
140067
140094
|
}
|
|
140068
140095
|
function getSyntacticDiagnostics(fileName) {
|
|
@@ -143718,9 +143745,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
143718
143745
|
return { fixName: fixName8, description: description3, changes, fixId: fixId52, fixAllDescription, commands: command ? [command] : void 0 };
|
|
143719
143746
|
}
|
|
143720
143747
|
function registerCodeFix(reg) {
|
|
143721
|
-
for (const
|
|
143748
|
+
for (const error2 of reg.errorCodes) {
|
|
143722
143749
|
errorCodeToFixesArray = void 0;
|
|
143723
|
-
errorCodeToFixes.add(String(
|
|
143750
|
+
errorCodeToFixes.add(String(error2), reg);
|
|
143724
143751
|
}
|
|
143725
143752
|
if (reg.fixIds) {
|
|
143726
143753
|
for (const fixId52 of reg.fixIds) {
|
|
@@ -153957,8 +153984,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153957
153984
|
return [createCodeFixAction(fixId48, changes, Diagnostics.Split_into_two_separate_import_declarations, fixId48, Diagnostics.Split_all_invalid_type_only_imports)];
|
|
153958
153985
|
}
|
|
153959
153986
|
},
|
|
153960
|
-
getAllCodeActions: (context) => codeFixAll(context, errorCodes60, (changes,
|
|
153961
|
-
splitTypeOnlyImport(changes, getImportDeclaration2(context.sourceFile,
|
|
153987
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes60, (changes, error2) => {
|
|
153988
|
+
splitTypeOnlyImport(changes, getImportDeclaration2(context.sourceFile, error2), context);
|
|
153962
153989
|
})
|
|
153963
153990
|
});
|
|
153964
153991
|
}
|
|
@@ -162092,13 +162119,29 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
162092
162119
|
if (!signature || !candidates.length) {
|
|
162093
162120
|
return;
|
|
162094
162121
|
}
|
|
162095
|
-
|
|
162096
|
-
|
|
162122
|
+
let signatureParamPos = 0;
|
|
162123
|
+
for (const originalArg of args) {
|
|
162097
162124
|
const arg = skipParentheses(originalArg);
|
|
162098
162125
|
if (shouldShowLiteralParameterNameHintsOnly(preferences) && !isHintableLiteral(arg)) {
|
|
162099
162126
|
continue;
|
|
162100
162127
|
}
|
|
162101
|
-
|
|
162128
|
+
let spreadArgs = 0;
|
|
162129
|
+
if (isSpreadElement(arg)) {
|
|
162130
|
+
const spreadType = checker.getTypeAtLocation(arg.expression);
|
|
162131
|
+
if (checker.isTupleType(spreadType)) {
|
|
162132
|
+
const { elementFlags, fixedLength } = spreadType.target;
|
|
162133
|
+
if (fixedLength === 0) {
|
|
162134
|
+
continue;
|
|
162135
|
+
}
|
|
162136
|
+
const firstOptionalIndex = findIndex(elementFlags, (f) => !(f & 1 /* Required */));
|
|
162137
|
+
const requiredArgs = firstOptionalIndex < 0 ? fixedLength : firstOptionalIndex;
|
|
162138
|
+
if (requiredArgs > 0) {
|
|
162139
|
+
spreadArgs = firstOptionalIndex < 0 ? fixedLength : firstOptionalIndex;
|
|
162140
|
+
}
|
|
162141
|
+
}
|
|
162142
|
+
}
|
|
162143
|
+
const identifierNameInfo = checker.getParameterIdentifierNameAtPosition(signature, signatureParamPos);
|
|
162144
|
+
signatureParamPos = signatureParamPos + (spreadArgs || 1);
|
|
162102
162145
|
if (identifierNameInfo) {
|
|
162103
162146
|
const [parameterName, isFirstVariadicArgument] = identifierNameInfo;
|
|
162104
162147
|
const isParameterNameNotSameAsArgument = preferences.includeInlayParameterNameHintsWhenArgumentMatchesName || !identifierOrAccessExpressionPostfixMatchesParameterName(arg, parameterName);
|
|
@@ -162739,7 +162782,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
162739
162782
|
if (length(oldImportDecls) === 0) {
|
|
162740
162783
|
return;
|
|
162741
162784
|
}
|
|
162742
|
-
|
|
162785
|
+
setEmitFlags(oldImportDecls[0], 1024 /* NoLeadingComments */);
|
|
162743
162786
|
const oldImportGroups = shouldCombine ? group(oldImportDecls, (importDecl) => getExternalModuleName2(importDecl.moduleSpecifier)) : [oldImportDecls];
|
|
162744
162787
|
const sortedImportGroups = shouldSort ? stableSort(oldImportGroups, (group1, group2) => compareModuleSpecifiersWorker(group1[0].moduleSpecifier, group2[0].moduleSpecifier, comparer)) : oldImportGroups;
|
|
162745
162788
|
const newImportDecls = flatMap(sortedImportGroups, (importGroup) => getExternalModuleName2(importGroup[0].moduleSpecifier) || importGroup[0].moduleSpecifier === void 0 ? coalesce(importGroup) : importGroup);
|
|
@@ -167951,11 +167994,11 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
167951
167994
|
if (index >= sorted.length) {
|
|
167952
167995
|
return false;
|
|
167953
167996
|
}
|
|
167954
|
-
const
|
|
167955
|
-
if (r.end <=
|
|
167997
|
+
const error2 = sorted[index];
|
|
167998
|
+
if (r.end <= error2.start) {
|
|
167956
167999
|
return false;
|
|
167957
168000
|
}
|
|
167958
|
-
if (startEndOverlapsWithStartEnd(r.pos, r.end,
|
|
168001
|
+
if (startEndOverlapsWithStartEnd(r.pos, r.end, error2.start, error2.start + error2.length)) {
|
|
167959
168002
|
return true;
|
|
167960
168003
|
}
|
|
167961
168004
|
index++;
|
|
@@ -169476,11 +169519,11 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
169476
169519
|
function getTypeScriptVersion() {
|
|
169477
169520
|
return typeScriptVersion2 ?? (typeScriptVersion2 = new Version(version));
|
|
169478
169521
|
}
|
|
169479
|
-
function formatDeprecationMessage(name,
|
|
169480
|
-
let deprecationMessage =
|
|
169522
|
+
function formatDeprecationMessage(name, error2, errorAfter, since, message) {
|
|
169523
|
+
let deprecationMessage = error2 ? "DeprecationError: " : "DeprecationWarning: ";
|
|
169481
169524
|
deprecationMessage += `'${name}' `;
|
|
169482
169525
|
deprecationMessage += since ? `has been deprecated since v${since}` : "is deprecated";
|
|
169483
|
-
deprecationMessage +=
|
|
169526
|
+
deprecationMessage += error2 ? " and can no longer be used." : errorAfter ? ` and will no longer be usable after v${errorAfter}.` : ".";
|
|
169484
169527
|
deprecationMessage += message ? ` ${formatStringFromArgs(message, [name], 0)}` : "";
|
|
169485
169528
|
return deprecationMessage;
|
|
169486
169529
|
}
|
|
@@ -169518,9 +169561,9 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
169518
169561
|
const errorAfter = typeof options.errorAfter === "string" ? new Version(options.errorAfter) : options.errorAfter;
|
|
169519
169562
|
const warnAfter = typeof options.warnAfter === "string" ? new Version(options.warnAfter) : options.warnAfter;
|
|
169520
169563
|
const since = typeof options.since === "string" ? new Version(options.since) : options.since ?? warnAfter;
|
|
169521
|
-
const
|
|
169564
|
+
const error2 = options.error || errorAfter && version2.compareTo(errorAfter) >= 0;
|
|
169522
169565
|
const warn = !warnAfter || version2.compareTo(warnAfter) >= 0;
|
|
169523
|
-
return
|
|
169566
|
+
return error2 ? createErrorDeprecation(name, errorAfter, since, options.message) : warn ? createWarningDeprecation(name, errorAfter, since, options.message) : noop;
|
|
169524
169567
|
}
|
|
169525
169568
|
function wrapFunction(deprecation, func) {
|
|
169526
169569
|
return function() {
|
|
@@ -171709,6 +171752,16 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
171709
171752
|
true
|
|
171710
171753
|
);
|
|
171711
171754
|
}
|
|
171755
|
+
/** @internal */
|
|
171756
|
+
cleanupProgram() {
|
|
171757
|
+
if (this.program) {
|
|
171758
|
+
for (const f of this.program.getSourceFiles()) {
|
|
171759
|
+
this.detachScriptInfoIfNotRoot(f.fileName);
|
|
171760
|
+
}
|
|
171761
|
+
this.program.forEachResolvedProjectReference((ref) => this.detachScriptInfoFromProject(ref.sourceFile.fileName));
|
|
171762
|
+
this.program = void 0;
|
|
171763
|
+
}
|
|
171764
|
+
}
|
|
171712
171765
|
disableLanguageService(lastFileExceededProgramSize) {
|
|
171713
171766
|
if (!this.languageServiceEnabled) {
|
|
171714
171767
|
return;
|
|
@@ -171716,6 +171769,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
171716
171769
|
Debug.assert(this.projectService.serverMode !== 2 /* Syntactic */);
|
|
171717
171770
|
this.languageService.cleanupSemanticCache();
|
|
171718
171771
|
this.languageServiceEnabled = false;
|
|
171772
|
+
this.cleanupProgram();
|
|
171719
171773
|
this.lastFileExceededProgramSize = lastFileExceededProgramSize;
|
|
171720
171774
|
this.builderState = void 0;
|
|
171721
171775
|
if (this.autoImportProviderHost) {
|
|
@@ -171724,6 +171778,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
171724
171778
|
this.autoImportProviderHost = void 0;
|
|
171725
171779
|
this.resolutionCache.closeTypeRootsWatch();
|
|
171726
171780
|
this.clearGeneratedFileWatch();
|
|
171781
|
+
this.projectService.verifyDocumentRegistry();
|
|
171727
171782
|
this.projectService.onUpdateLanguageServiceStateForProject(
|
|
171728
171783
|
this,
|
|
171729
171784
|
/*languageServiceEnabled*/
|
|
@@ -171767,12 +171822,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
171767
171822
|
close() {
|
|
171768
171823
|
this.projectService.typingsCache.onProjectClosed(this);
|
|
171769
171824
|
this.closeWatchingTypingLocations();
|
|
171770
|
-
|
|
171771
|
-
for (const f of this.program.getSourceFiles()) {
|
|
171772
|
-
this.detachScriptInfoIfNotRoot(f.fileName);
|
|
171773
|
-
}
|
|
171774
|
-
this.program.forEachResolvedProjectReference((ref) => this.detachScriptInfoFromProject(ref.sourceFile.fileName));
|
|
171775
|
-
}
|
|
171825
|
+
this.cleanupProgram();
|
|
171776
171826
|
forEach(this.externalFiles, (externalFile) => this.detachScriptInfoIfNotRoot(externalFile));
|
|
171777
171827
|
for (const root of this.rootFiles) {
|
|
171778
171828
|
root.detachFromProject(this);
|
|
@@ -172150,6 +172200,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
172150
172200
|
updateGraphWorker() {
|
|
172151
172201
|
var _a, _b;
|
|
172152
172202
|
const oldProgram = this.languageService.getCurrentProgram();
|
|
172203
|
+
Debug.assert(oldProgram === this.program);
|
|
172153
172204
|
Debug.assert(!this.isClosed(), "Called update graph worker of closed project");
|
|
172154
172205
|
this.writeLog(`Starting updateGraphWorker: Project: ${this.getProjectName()}`);
|
|
172155
172206
|
const start = timestamp();
|
|
@@ -172280,6 +172331,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
172280
172331
|
} else if (this.program !== oldProgram) {
|
|
172281
172332
|
this.writeLog(`Different program with same set of files`);
|
|
172282
172333
|
}
|
|
172334
|
+
this.projectService.verifyDocumentRegistry();
|
|
172283
172335
|
return hasNewProgram;
|
|
172284
172336
|
}
|
|
172285
172337
|
/** @internal */
|
|
@@ -172902,7 +172954,6 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
172902
172954
|
isOrphan() {
|
|
172903
172955
|
return true;
|
|
172904
172956
|
}
|
|
172905
|
-
/** @internal */
|
|
172906
172957
|
scheduleInvalidateResolutionsOfFailedLookupLocations() {
|
|
172907
172958
|
return;
|
|
172908
172959
|
}
|
|
@@ -173808,6 +173859,9 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
173808
173859
|
this.sharedExtendedConfigFileWatchers = /* @__PURE__ */ new Map();
|
|
173809
173860
|
/** @internal */
|
|
173810
173861
|
this.extendedConfigCache = /* @__PURE__ */ new Map();
|
|
173862
|
+
/** @internal */
|
|
173863
|
+
this.verifyDocumentRegistry = noop;
|
|
173864
|
+
var _a;
|
|
173811
173865
|
this.host = opts.host;
|
|
173812
173866
|
this.logger = opts.logger;
|
|
173813
173867
|
this.cancellationToken = opts.cancellationToken;
|
|
@@ -173855,6 +173909,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
173855
173909
|
watchFile: returnNoopFileWatcher,
|
|
173856
173910
|
watchDirectory: returnNoopFileWatcher
|
|
173857
173911
|
} : getWatchFactory(this.host, watchLogLevel, log, getDetailWatchInfo);
|
|
173912
|
+
(_a = opts.incrementalVerifier) == null ? void 0 : _a.call(opts, this);
|
|
173858
173913
|
}
|
|
173859
173914
|
toPath(fileName) {
|
|
173860
173915
|
return toPath(fileName, this.currentDirectory, this.toCanonicalFileName);
|
|
@@ -175183,6 +175238,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
175183
175238
|
/*ensureSynchronized*/
|
|
175184
175239
|
false
|
|
175185
175240
|
).cleanupSemanticCache();
|
|
175241
|
+
project.cleanupProgram();
|
|
175186
175242
|
project.markAsDirty();
|
|
175187
175243
|
}
|
|
175188
175244
|
sendConfigFileDiagEvent(project, triggerFile) {
|
|
@@ -178121,7 +178177,8 @@ ${json}${newLine}`;
|
|
|
178121
178177
|
allowLocalPluginLoads: opts.allowLocalPluginLoads,
|
|
178122
178178
|
typesMapLocation: opts.typesMapLocation,
|
|
178123
178179
|
serverMode: opts.serverMode,
|
|
178124
|
-
session: this
|
|
178180
|
+
session: this,
|
|
178181
|
+
incrementalVerifier: opts.incrementalVerifier
|
|
178125
178182
|
};
|
|
178126
178183
|
this.projectService = new ProjectService3(settings);
|
|
178127
178184
|
this.projectService.setPerformanceEventHandler(this.performanceEventHandler.bind(this));
|
|
@@ -178441,6 +178498,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
178441
178498
|
/*ensureSynchronized*/
|
|
178442
178499
|
false
|
|
178443
178500
|
).cleanupSemanticCache();
|
|
178501
|
+
p.cleanupProgram();
|
|
178444
178502
|
}
|
|
178445
178503
|
}
|
|
178446
178504
|
cleanup() {
|
|
@@ -180914,6 +180972,7 @@ ${e.message}`;
|
|
|
180914
180972
|
ActionWatchTypingLocations: () => ActionWatchTypingLocations,
|
|
180915
180973
|
Arguments: () => Arguments,
|
|
180916
180974
|
AutoImportProviderProject: () => AutoImportProviderProject,
|
|
180975
|
+
AuxiliaryProject: () => AuxiliaryProject,
|
|
180917
180976
|
CharRangeSection: () => CharRangeSection,
|
|
180918
180977
|
CommandNames: () => CommandNames,
|
|
180919
180978
|
ConfigFileDiagEvent: () => ConfigFileDiagEvent,
|
|
@@ -182270,6 +182329,7 @@ ${e.message}`;
|
|
|
182270
182329
|
isDiagnosticWithLocation: () => isDiagnosticWithLocation,
|
|
182271
182330
|
isDiskPathRoot: () => isDiskPathRoot,
|
|
182272
182331
|
isDoStatement: () => isDoStatement,
|
|
182332
|
+
isDocumentRegistryEntry: () => isDocumentRegistryEntry,
|
|
182273
182333
|
isDotDotDotToken: () => isDotDotDotToken,
|
|
182274
182334
|
isDottedName: () => isDottedName,
|
|
182275
182335
|
isDynamicName: () => isDynamicName,
|
|
@@ -183305,6 +183365,7 @@ ${e.message}`;
|
|
|
183305
183365
|
ActionWatchTypingLocations: () => ActionWatchTypingLocations,
|
|
183306
183366
|
Arguments: () => Arguments,
|
|
183307
183367
|
AutoImportProviderProject: () => AutoImportProviderProject,
|
|
183368
|
+
AuxiliaryProject: () => AuxiliaryProject,
|
|
183308
183369
|
CharRangeSection: () => CharRangeSection,
|
|
183309
183370
|
CommandNames: () => CommandNames,
|
|
183310
183371
|
ConfigFileDiagEvent: () => ConfigFileDiagEvent,
|
|
@@ -184649,6 +184710,7 @@ ${e.message}`;
|
|
|
184649
184710
|
isDiagnosticWithLocation: () => isDiagnosticWithLocation,
|
|
184650
184711
|
isDiskPathRoot: () => isDiskPathRoot,
|
|
184651
184712
|
isDoStatement: () => isDoStatement,
|
|
184713
|
+
isDocumentRegistryEntry: () => isDocumentRegistryEntry,
|
|
184652
184714
|
isDotDotDotToken: () => isDotDotDotToken,
|
|
184653
184715
|
isDottedName: () => isDottedName,
|
|
184654
184716
|
isDynamicName: () => isDynamicName,
|