typescript 5.2.0-dev.20230606 → 5.2.0-dev.20230608
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 +40 -13
- package/lib/tsserver.js +628 -591
- package/lib/tsserverlibrary.js +627 -591
- package/lib/typescript.js +601 -583
- package/lib/typingsInstaller.js +22 -1
- package/package.json +2 -2
package/lib/typescript.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.20230608`;
|
|
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
|
NewLineKind2[NewLineKind2["LineFeed"] = 1] = "LineFeed";
|
|
4706
4715
|
return NewLineKind2;
|
|
4707
4716
|
})(NewLineKind || {});
|
|
4708
|
-
ScriptKind = /* @__PURE__ */ ((
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
return
|
|
4717
|
+
ScriptKind = /* @__PURE__ */ ((ScriptKind6) => {
|
|
4718
|
+
ScriptKind6[ScriptKind6["Unknown"] = 0] = "Unknown";
|
|
4719
|
+
ScriptKind6[ScriptKind6["JS"] = 1] = "JS";
|
|
4720
|
+
ScriptKind6[ScriptKind6["JSX"] = 2] = "JSX";
|
|
4721
|
+
ScriptKind6[ScriptKind6["TS"] = 3] = "TS";
|
|
4722
|
+
ScriptKind6[ScriptKind6["TSX"] = 4] = "TSX";
|
|
4723
|
+
ScriptKind6[ScriptKind6["External"] = 5] = "External";
|
|
4724
|
+
ScriptKind6[ScriptKind6["JSON"] = 6] = "JSON";
|
|
4725
|
+
ScriptKind6[ScriptKind6["Deferred"] = 7] = "Deferred";
|
|
4726
|
+
return ScriptKind6;
|
|
4718
4727
|
})(ScriptKind || {});
|
|
4719
4728
|
ScriptTarget = /* @__PURE__ */ ((ScriptTarget10) => {
|
|
4720
4729
|
ScriptTarget10[ScriptTarget10["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();
|
|
@@ -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) {
|
|
@@ -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,13 +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
|
-
|
|
60549
|
+
target.instantiations.set(id, result);
|
|
60550
|
+
const resultObjectFlags = getObjectFlags(result);
|
|
60551
|
+
if (result.flags & 138117121 /* ObjectFlagsType */ && !(resultObjectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
|
|
60540
60552
|
const resultCouldContainTypeVariables = some(typeArguments, couldContainTypeVariables);
|
|
60541
|
-
if (!(result
|
|
60542
|
-
|
|
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
|
+
}
|
|
60543
60559
|
}
|
|
60544
60560
|
}
|
|
60545
|
-
target.instantiations.set(id, result);
|
|
60546
60561
|
}
|
|
60547
60562
|
return result;
|
|
60548
60563
|
}
|
|
@@ -60727,7 +60742,7 @@ ${lanes.join("\n")}
|
|
|
60727
60742
|
}
|
|
60728
60743
|
if (instantiationDepth === 100 || instantiationCount >= 5e6) {
|
|
60729
60744
|
(_a = tracing) == null ? void 0 : _a.instant(tracing.Phase.CheckTypes, "instantiateType_DepthLimit", { typeId: type.id, instantiationDepth, instantiationCount });
|
|
60730
|
-
|
|
60745
|
+
error2(currentNode, Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
|
|
60731
60746
|
return errorType;
|
|
60732
60747
|
}
|
|
60733
60748
|
totalInstantiationCount++;
|
|
@@ -61347,7 +61362,7 @@ ${lanes.join("\n")}
|
|
|
61347
61362
|
result = elaborateIterableOrArrayLikeTargetElementwise(children, realSource, arrayLikeTargetParts, relation, containingMessageChain, errorOutputContainer) || result;
|
|
61348
61363
|
} else if (!isTypeRelatedTo(getIndexedAccessType(source, childrenNameType), childrenTargetType, relation)) {
|
|
61349
61364
|
result = true;
|
|
61350
|
-
const diag2 =
|
|
61365
|
+
const diag2 = error2(
|
|
61351
61366
|
containingElement.openingElement.tagName,
|
|
61352
61367
|
Diagnostics.This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided,
|
|
61353
61368
|
childrenPropName,
|
|
@@ -61375,7 +61390,7 @@ ${lanes.join("\n")}
|
|
|
61375
61390
|
}
|
|
61376
61391
|
} else if (!isTypeRelatedTo(getIndexedAccessType(source, childrenNameType), childrenTargetType, relation)) {
|
|
61377
61392
|
result = true;
|
|
61378
|
-
const diag2 =
|
|
61393
|
+
const diag2 = error2(
|
|
61379
61394
|
containingElement.openingElement.tagName,
|
|
61380
61395
|
Diagnostics.This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_provided,
|
|
61381
61396
|
childrenPropName,
|
|
@@ -61880,7 +61895,7 @@ ${lanes.join("\n")}
|
|
|
61880
61895
|
}
|
|
61881
61896
|
if (overflow) {
|
|
61882
61897
|
(_a = tracing) == null ? void 0 : _a.instant(tracing.Phase.CheckTypes, "checkTypeRelatedTo_DepthLimit", { sourceId: source.id, targetId: target.id, depth: sourceDepth, targetDepth });
|
|
61883
|
-
const diag2 =
|
|
61898
|
+
const diag2 = error2(errorNode || currentNode, Diagnostics.Excessive_stack_depth_comparing_types_0_and_1, typeToString(source), typeToString(target));
|
|
61884
61899
|
if (errorOutputContainer) {
|
|
61885
61900
|
(errorOutputContainer.errors || (errorOutputContainer.errors = [])).push(diag2);
|
|
61886
61901
|
}
|
|
@@ -64996,7 +65011,7 @@ ${lanes.join("\n")}
|
|
|
64996
65011
|
const t = getTypeOfSymbol(p);
|
|
64997
65012
|
if (getObjectFlags(t) & 65536 /* ContainsWideningType */) {
|
|
64998
65013
|
if (!reportWideningErrorsInType(t)) {
|
|
64999
|
-
|
|
65014
|
+
error2(p.valueDeclaration, Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, symbolToString(p), typeToString(getWidenedType(t)));
|
|
65000
65015
|
}
|
|
65001
65016
|
errorReported = true;
|
|
65002
65017
|
}
|
|
@@ -65046,11 +65061,11 @@ ${lanes.join("\n")}
|
|
|
65046
65061
|
}
|
|
65047
65062
|
break;
|
|
65048
65063
|
case 323 /* JSDocFunctionType */:
|
|
65049
|
-
|
|
65064
|
+
error2(declaration, Diagnostics.Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString);
|
|
65050
65065
|
return;
|
|
65051
65066
|
case 329 /* JSDocSignature */:
|
|
65052
65067
|
if (noImplicitAny && isJSDocOverloadTag(declaration.parent)) {
|
|
65053
|
-
|
|
65068
|
+
error2(declaration.parent.tagName, Diagnostics.This_overload_implicitly_returns_the_type_0_because_it_lacks_a_return_type_annotation, typeAsString);
|
|
65054
65069
|
}
|
|
65055
65070
|
return;
|
|
65056
65071
|
case 261 /* FunctionDeclaration */:
|
|
@@ -65062,9 +65077,9 @@ ${lanes.join("\n")}
|
|
|
65062
65077
|
case 218 /* ArrowFunction */:
|
|
65063
65078
|
if (noImplicitAny && !declaration.name) {
|
|
65064
65079
|
if (wideningKind === 3 /* GeneratorYield */) {
|
|
65065
|
-
|
|
65080
|
+
error2(declaration, Diagnostics.Generator_implicitly_has_yield_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type_annotation, typeAsString);
|
|
65066
65081
|
} else {
|
|
65067
|
-
|
|
65082
|
+
error2(declaration, Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString);
|
|
65068
65083
|
}
|
|
65069
65084
|
return;
|
|
65070
65085
|
}
|
|
@@ -65072,7 +65087,7 @@ ${lanes.join("\n")}
|
|
|
65072
65087
|
break;
|
|
65073
65088
|
case 199 /* MappedType */:
|
|
65074
65089
|
if (noImplicitAny) {
|
|
65075
|
-
|
|
65090
|
+
error2(declaration, Diagnostics.Mapped_object_type_implicitly_has_an_any_template_type);
|
|
65076
65091
|
}
|
|
65077
65092
|
return;
|
|
65078
65093
|
default:
|
|
@@ -68350,15 +68365,15 @@ ${lanes.join("\n")}
|
|
|
68350
68365
|
}
|
|
68351
68366
|
if (symbol === argumentsSymbol) {
|
|
68352
68367
|
if (isInPropertyInitializerOrClassStaticBlock(node)) {
|
|
68353
|
-
|
|
68368
|
+
error2(node, Diagnostics.arguments_cannot_be_referenced_in_property_initializers);
|
|
68354
68369
|
return errorType;
|
|
68355
68370
|
}
|
|
68356
68371
|
const container = getContainingFunction(node);
|
|
68357
68372
|
if (languageVersion < 2 /* ES2015 */) {
|
|
68358
68373
|
if (container.kind === 218 /* ArrowFunction */) {
|
|
68359
|
-
|
|
68374
|
+
error2(node, Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression);
|
|
68360
68375
|
} else if (hasSyntacticModifier(container, 512 /* Async */)) {
|
|
68361
|
-
|
|
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);
|
|
68362
68377
|
}
|
|
68363
68378
|
}
|
|
68364
68379
|
getNodeLinks(container).flags |= 512 /* CaptureArguments */;
|
|
@@ -68416,14 +68431,14 @@ ${lanes.join("\n")}
|
|
|
68416
68431
|
if (assignmentKind) {
|
|
68417
68432
|
if (!(localOrExportSymbol.flags & 3 /* Variable */) && !(isInJSFile(node) && localOrExportSymbol.flags & 512 /* ValueModule */)) {
|
|
68418
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;
|
|
68419
|
-
|
|
68434
|
+
error2(node, assignmentError, symbolToString(symbol));
|
|
68420
68435
|
return errorType;
|
|
68421
68436
|
}
|
|
68422
68437
|
if (isReadonlySymbol(localOrExportSymbol)) {
|
|
68423
68438
|
if (localOrExportSymbol.flags & 3 /* Variable */) {
|
|
68424
|
-
|
|
68439
|
+
error2(node, Diagnostics.Cannot_assign_to_0_because_it_is_a_constant, symbolToString(symbol));
|
|
68425
68440
|
} else {
|
|
68426
|
-
|
|
68441
|
+
error2(node, Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, symbolToString(symbol));
|
|
68427
68442
|
}
|
|
68428
68443
|
return errorType;
|
|
68429
68444
|
}
|
|
@@ -68459,13 +68474,13 @@ ${lanes.join("\n")}
|
|
|
68459
68474
|
if (!isEvolvingArrayOperationTarget(node) && (type === autoType || type === autoArrayType)) {
|
|
68460
68475
|
if (flowType === autoType || flowType === autoArrayType) {
|
|
68461
68476
|
if (noImplicitAny) {
|
|
68462
|
-
|
|
68463
|
-
|
|
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));
|
|
68464
68479
|
}
|
|
68465
68480
|
return convertAutoToAny(flowType);
|
|
68466
68481
|
}
|
|
68467
68482
|
} else if (!assumeInitialized && !containsUndefinedType(type) && containsUndefinedType(flowType)) {
|
|
68468
|
-
|
|
68483
|
+
error2(node, Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol));
|
|
68469
68484
|
return type;
|
|
68470
68485
|
}
|
|
68471
68486
|
return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType;
|
|
@@ -68595,13 +68610,13 @@ ${lanes.join("\n")}
|
|
|
68595
68610
|
/*noCacheCheck*/
|
|
68596
68611
|
false
|
|
68597
68612
|
)) {
|
|
68598
|
-
|
|
68613
|
+
error2(node, diagnosticMessage);
|
|
68599
68614
|
}
|
|
68600
68615
|
}
|
|
68601
68616
|
}
|
|
68602
68617
|
function checkThisInStaticClassFieldInitializerInDecoratedClass(thisExpression, container) {
|
|
68603
68618
|
if (isPropertyDeclaration(container) && hasStaticModifier(container) && legacyDecorators && container.initializer && textRangeContainsPositionInclusive(container.initializer, thisExpression.pos) && hasDecorators(container.parent)) {
|
|
68604
|
-
|
|
68619
|
+
error2(thisExpression, Diagnostics.Cannot_use_this_in_a_static_property_initializer_of_a_decorated_class);
|
|
68605
68620
|
}
|
|
68606
68621
|
}
|
|
68607
68622
|
function checkThisExpression(node) {
|
|
@@ -68642,18 +68657,18 @@ ${lanes.join("\n")}
|
|
|
68642
68657
|
}
|
|
68643
68658
|
checkThisInStaticClassFieldInitializerInDecoratedClass(node, container);
|
|
68644
68659
|
if (thisInComputedPropertyName) {
|
|
68645
|
-
|
|
68660
|
+
error2(node, Diagnostics.this_cannot_be_referenced_in_a_computed_property_name);
|
|
68646
68661
|
} else {
|
|
68647
68662
|
switch (container.kind) {
|
|
68648
68663
|
case 266 /* ModuleDeclaration */:
|
|
68649
|
-
|
|
68664
|
+
error2(node, Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body);
|
|
68650
68665
|
break;
|
|
68651
68666
|
case 265 /* EnumDeclaration */:
|
|
68652
|
-
|
|
68667
|
+
error2(node, Diagnostics.this_cannot_be_referenced_in_current_location);
|
|
68653
68668
|
break;
|
|
68654
68669
|
case 175 /* Constructor */:
|
|
68655
68670
|
if (isInConstructorArgumentInitializer(node, container)) {
|
|
68656
|
-
|
|
68671
|
+
error2(node, Diagnostics.this_cannot_be_referenced_in_constructor_arguments);
|
|
68657
68672
|
}
|
|
68658
68673
|
break;
|
|
68659
68674
|
}
|
|
@@ -68670,9 +68685,9 @@ ${lanes.join("\n")}
|
|
|
68670
68685
|
if (noImplicitThis) {
|
|
68671
68686
|
const globalThisType2 = getTypeOfSymbol(globalThisSymbol);
|
|
68672
68687
|
if (type === globalThisType2 && capturedByArrowFunction) {
|
|
68673
|
-
|
|
68688
|
+
error2(node, Diagnostics.The_containing_arrow_function_captures_the_global_value_of_this);
|
|
68674
68689
|
} else if (!type) {
|
|
68675
|
-
const diag2 =
|
|
68690
|
+
const diag2 = error2(node, Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation);
|
|
68676
68691
|
if (!isSourceFile(container)) {
|
|
68677
68692
|
const outsideThis = tryGetThisTypeAt(container);
|
|
68678
68693
|
if (outsideThis && outsideThis !== globalThisType2) {
|
|
@@ -68801,13 +68816,13 @@ ${lanes.join("\n")}
|
|
|
68801
68816
|
if (!container || !isLegalUsageOfSuperExpression(container)) {
|
|
68802
68817
|
const current = findAncestor(node, (n) => n === container ? "quit" : n.kind === 166 /* ComputedPropertyName */);
|
|
68803
68818
|
if (current && current.kind === 166 /* ComputedPropertyName */) {
|
|
68804
|
-
|
|
68819
|
+
error2(node, Diagnostics.super_cannot_be_referenced_in_a_computed_property_name);
|
|
68805
68820
|
} else if (isCallExpression2) {
|
|
68806
|
-
|
|
68821
|
+
error2(node, Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors);
|
|
68807
68822
|
} else if (!container || !container.parent || !(isClassLike(container.parent) || container.parent.kind === 209 /* ObjectLiteralExpression */)) {
|
|
68808
|
-
|
|
68823
|
+
error2(node, Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions);
|
|
68809
68824
|
} else {
|
|
68810
|
-
|
|
68825
|
+
error2(node, Diagnostics.super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class);
|
|
68811
68826
|
}
|
|
68812
68827
|
return errorType;
|
|
68813
68828
|
}
|
|
@@ -68839,7 +68854,7 @@ ${lanes.join("\n")}
|
|
|
68839
68854
|
}
|
|
68840
68855
|
if (container.parent.kind === 209 /* ObjectLiteralExpression */) {
|
|
68841
68856
|
if (languageVersion < 2 /* ES2015 */) {
|
|
68842
|
-
|
|
68857
|
+
error2(node, Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher);
|
|
68843
68858
|
return errorType;
|
|
68844
68859
|
} else {
|
|
68845
68860
|
return anyType;
|
|
@@ -68847,7 +68862,7 @@ ${lanes.join("\n")}
|
|
|
68847
68862
|
}
|
|
68848
68863
|
const classLikeDeclaration = container.parent;
|
|
68849
68864
|
if (!getClassExtendsHeritageElement(classLikeDeclaration)) {
|
|
68850
|
-
|
|
68865
|
+
error2(node, Diagnostics.super_can_only_be_referenced_in_a_derived_class);
|
|
68851
68866
|
return errorType;
|
|
68852
68867
|
}
|
|
68853
68868
|
const classType = getDeclaredTypeOfSymbol(getSymbolOfDeclaration(classLikeDeclaration));
|
|
@@ -68856,7 +68871,7 @@ ${lanes.join("\n")}
|
|
|
68856
68871
|
return errorType;
|
|
68857
68872
|
}
|
|
68858
68873
|
if (container.kind === 175 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) {
|
|
68859
|
-
|
|
68874
|
+
error2(node, Diagnostics.super_cannot_be_referenced_in_constructor_arguments);
|
|
68860
68875
|
return errorType;
|
|
68861
68876
|
}
|
|
68862
68877
|
return nodeCheckFlag === 32 /* SuperStatic */ ? getBaseConstructorTypeOfClass(classType) : getTypeWithThisArgument(baseClassType, classType.thisType);
|
|
@@ -69812,7 +69827,7 @@ ${lanes.join("\n")}
|
|
|
69812
69827
|
let attributesType = forcedLookupLocation === void 0 ? getTypeOfFirstParameterOfSignatureWithFallback(sig, unknownType) : forcedLookupLocation === "" ? getReturnTypeOfSignature(sig) : getJsxPropsTypeForSignatureFromMember(sig, forcedLookupLocation);
|
|
69813
69828
|
if (!attributesType) {
|
|
69814
69829
|
if (!!forcedLookupLocation && !!length(context.attributes.properties)) {
|
|
69815
|
-
|
|
69830
|
+
error2(context, Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, unescapeLeadingUnderscores(forcedLookupLocation));
|
|
69816
69831
|
}
|
|
69817
69832
|
return unknownType;
|
|
69818
69833
|
}
|
|
@@ -70120,7 +70135,7 @@ ${lanes.join("\n")}
|
|
|
70120
70135
|
}
|
|
70121
70136
|
}
|
|
70122
70137
|
if (links.resolvedType.flags & 98304 /* Nullable */ || !isTypeAssignableToKind(links.resolvedType, 402653316 /* StringLike */ | 296 /* NumberLike */ | 12288 /* ESSymbolLike */) && !isTypeAssignableTo(links.resolvedType, stringNumberSymbolType)) {
|
|
70123
|
-
|
|
70138
|
+
error2(node, Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any);
|
|
70124
70139
|
}
|
|
70125
70140
|
}
|
|
70126
70141
|
return links.resolvedType;
|
|
@@ -70229,7 +70244,7 @@ ${lanes.join("\n")}
|
|
|
70229
70244
|
if (impliedProp) {
|
|
70230
70245
|
prop.flags |= impliedProp.flags & 16777216 /* Optional */;
|
|
70231
70246
|
} else if (!compilerOptions.suppressExcessPropertyErrors && !getIndexInfoOfType(contextualType, stringType)) {
|
|
70232
|
-
|
|
70247
|
+
error2(
|
|
70233
70248
|
memberDecl.name,
|
|
70234
70249
|
Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1,
|
|
70235
70250
|
symbolToString(member),
|
|
@@ -70276,7 +70291,7 @@ ${lanes.join("\n")}
|
|
|
70276
70291
|
}
|
|
70277
70292
|
spread = getSpreadType(spread, mergedType, node.symbol, objectFlags, inConstContext);
|
|
70278
70293
|
} else {
|
|
70279
|
-
|
|
70294
|
+
error2(memberDecl, Diagnostics.Spread_types_may_only_be_created_from_object_types);
|
|
70280
70295
|
spread = errorType;
|
|
70281
70296
|
}
|
|
70282
70297
|
continue;
|
|
@@ -70316,7 +70331,7 @@ ${lanes.join("\n")}
|
|
|
70316
70331
|
for (const prop of getPropertiesOfType(contextualType)) {
|
|
70317
70332
|
if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) {
|
|
70318
70333
|
if (!(prop.flags & 16777216 /* Optional */)) {
|
|
70319
|
-
|
|
70334
|
+
error2(
|
|
70320
70335
|
prop.valueDeclaration || ((_a = tryCast(prop, isTransientSymbol)) == null ? void 0 : _a.links.bindingElement),
|
|
70321
70336
|
Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value
|
|
70322
70337
|
);
|
|
@@ -70391,7 +70406,7 @@ ${lanes.join("\n")}
|
|
|
70391
70406
|
checkJsxOpeningLikeElementOrOpeningFragment(node.openingFragment);
|
|
70392
70407
|
const nodeSourceFile = getSourceFileOfNode(node);
|
|
70393
70408
|
if (getJSXTransformEnabled(compilerOptions) && (compilerOptions.jsxFactory || nodeSourceFile.pragmas.has("jsx")) && !compilerOptions.jsxFragmentFactory && !nodeSourceFile.pragmas.has("jsxfrag")) {
|
|
70394
|
-
|
|
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);
|
|
70395
70410
|
}
|
|
70396
70411
|
checkJsxChildren(node);
|
|
70397
70412
|
return getJsxElementTypeAt(node) || anyType;
|
|
@@ -70478,7 +70493,7 @@ ${lanes.join("\n")}
|
|
|
70478
70493
|
checkSpreadPropOverrides(exprType, allAttributesTable, attributeDecl);
|
|
70479
70494
|
}
|
|
70480
70495
|
} else {
|
|
70481
|
-
|
|
70496
|
+
error2(attributeDecl.expression, Diagnostics.Spread_types_may_only_be_created_from_object_types);
|
|
70482
70497
|
typeToIntersect = typeToIntersect ? getIntersectionType([typeToIntersect, exprType]) : exprType;
|
|
70483
70498
|
}
|
|
70484
70499
|
}
|
|
@@ -70500,7 +70515,7 @@ ${lanes.join("\n")}
|
|
|
70500
70515
|
const childrenTypes = checkJsxChildren(parent2, checkMode);
|
|
70501
70516
|
if (!hasSpreadAnyType && jsxChildrenPropertyName && jsxChildrenPropertyName !== "") {
|
|
70502
70517
|
if (explicitlySpecifyChildrenAttribute) {
|
|
70503
|
-
|
|
70518
|
+
error2(attributes, Diagnostics._0_are_specified_twice_The_attribute_named_0_will_be_overwritten, unescapeLeadingUnderscores(jsxChildrenPropertyName));
|
|
70504
70519
|
}
|
|
70505
70520
|
const contextualType2 = getApparentTypeOfContextualType(
|
|
70506
70521
|
openingLikeElement.attributes,
|
|
@@ -70567,7 +70582,7 @@ ${lanes.join("\n")}
|
|
|
70567
70582
|
if (!(right.flags & 16777216 /* Optional */)) {
|
|
70568
70583
|
const left = props.get(right.escapedName);
|
|
70569
70584
|
if (left) {
|
|
70570
|
-
const diagnostic =
|
|
70585
|
+
const diagnostic = error2(left.valueDeclaration, Diagnostics._0_is_specified_more_than_once_so_this_usage_will_be_overwritten, unescapeLeadingUnderscores(left.escapedName));
|
|
70571
70586
|
addRelatedInfo(diagnostic, createDiagnosticForNode(spread, Diagnostics.This_spread_always_overwrites_this_property));
|
|
70572
70587
|
}
|
|
70573
70588
|
}
|
|
@@ -70599,11 +70614,11 @@ ${lanes.join("\n")}
|
|
|
70599
70614
|
links.jsxFlags |= 2 /* IntrinsicIndexedElement */;
|
|
70600
70615
|
return links.resolvedSymbol = intrinsicElementsType.symbol;
|
|
70601
70616
|
}
|
|
70602
|
-
|
|
70617
|
+
error2(node, Diagnostics.Property_0_does_not_exist_on_type_1, intrinsicTagNameToString(node.tagName), "JSX." + JsxNames.IntrinsicElements);
|
|
70603
70618
|
return links.resolvedSymbol = unknownSymbol;
|
|
70604
70619
|
} else {
|
|
70605
70620
|
if (noImplicitAny) {
|
|
70606
|
-
|
|
70621
|
+
error2(node, Diagnostics.JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists, unescapeLeadingUnderscores(JsxNames.IntrinsicElements));
|
|
70607
70622
|
}
|
|
70608
70623
|
return links.resolvedSymbol = unknownSymbol;
|
|
70609
70624
|
}
|
|
@@ -70686,7 +70701,7 @@ ${lanes.join("\n")}
|
|
|
70686
70701
|
} else if (propertiesOfJsxElementAttribPropInterface.length === 1) {
|
|
70687
70702
|
return propertiesOfJsxElementAttribPropInterface[0].escapedName;
|
|
70688
70703
|
} else if (propertiesOfJsxElementAttribPropInterface.length > 1 && jsxElementAttribPropInterfaceSym.declarations) {
|
|
70689
|
-
|
|
70704
|
+
error2(jsxElementAttribPropInterfaceSym.declarations[0], Diagnostics.The_global_type_JSX_0_may_not_have_more_than_one_property, unescapeLeadingUnderscores(nameOfAttribPropContainer));
|
|
70690
70705
|
}
|
|
70691
70706
|
}
|
|
70692
70707
|
return void 0;
|
|
@@ -70709,7 +70724,7 @@ ${lanes.join("\n")}
|
|
|
70709
70724
|
} else if (elementType.flags & 128 /* StringLiteral */) {
|
|
70710
70725
|
const intrinsicType = getIntrinsicAttributesTypeFromStringLiteralType(elementType, caller);
|
|
70711
70726
|
if (!intrinsicType) {
|
|
70712
|
-
|
|
70727
|
+
error2(caller, Diagnostics.Property_0_does_not_exist_on_type_1, elementType.value, "JSX." + JsxNames.IntrinsicElements);
|
|
70713
70728
|
return emptyArray;
|
|
70714
70729
|
} else {
|
|
70715
70730
|
const fakeSignature = createSignatureForJSXIntrinsic(caller, intrinsicType);
|
|
@@ -70835,11 +70850,11 @@ ${lanes.join("\n")}
|
|
|
70835
70850
|
}
|
|
70836
70851
|
function checkJsxPreconditions(errorNode) {
|
|
70837
70852
|
if ((compilerOptions.jsx || 0 /* None */) === 0 /* None */) {
|
|
70838
|
-
|
|
70853
|
+
error2(errorNode, Diagnostics.Cannot_use_JSX_unless_the_jsx_flag_is_provided);
|
|
70839
70854
|
}
|
|
70840
70855
|
if (getJsxElementTypeAt(errorNode) === void 0) {
|
|
70841
70856
|
if (noImplicitAny) {
|
|
70842
|
-
|
|
70857
|
+
error2(errorNode, Diagnostics.JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist);
|
|
70843
70858
|
}
|
|
70844
70859
|
}
|
|
70845
70860
|
}
|
|
@@ -70931,7 +70946,7 @@ ${lanes.join("\n")}
|
|
|
70931
70946
|
if (node.expression) {
|
|
70932
70947
|
const type = checkExpression(node.expression, checkMode);
|
|
70933
70948
|
if (node.dotDotDotToken && type !== anyType && !isArrayType(type)) {
|
|
70934
|
-
|
|
70949
|
+
error2(node, Diagnostics.JSX_spread_child_must_be_an_array_type);
|
|
70935
70950
|
}
|
|
70936
70951
|
return type;
|
|
70937
70952
|
} else {
|
|
@@ -70960,14 +70975,14 @@ ${lanes.join("\n")}
|
|
|
70960
70975
|
if (languageVersion < 2 /* ES2015 */) {
|
|
70961
70976
|
if (symbolHasNonMethodDeclaration(prop)) {
|
|
70962
70977
|
if (errorNode) {
|
|
70963
|
-
|
|
70978
|
+
error2(errorNode, Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword);
|
|
70964
70979
|
}
|
|
70965
70980
|
return false;
|
|
70966
70981
|
}
|
|
70967
70982
|
}
|
|
70968
70983
|
if (flags & 256 /* Abstract */) {
|
|
70969
70984
|
if (errorNode) {
|
|
70970
|
-
|
|
70985
|
+
error2(
|
|
70971
70986
|
errorNode,
|
|
70972
70987
|
Diagnostics.Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression,
|
|
70973
70988
|
symbolToString(prop),
|
|
@@ -70981,7 +70996,7 @@ ${lanes.join("\n")}
|
|
|
70981
70996
|
const declaringClassDeclaration = getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop));
|
|
70982
70997
|
if (declaringClassDeclaration && isNodeUsedDuringClassInitialization(location)) {
|
|
70983
70998
|
if (errorNode) {
|
|
70984
|
-
|
|
70999
|
+
error2(
|
|
70985
71000
|
errorNode,
|
|
70986
71001
|
Diagnostics.Abstract_property_0_in_class_1_cannot_be_accessed_in_the_constructor,
|
|
70987
71002
|
symbolToString(prop),
|
|
@@ -70998,7 +71013,7 @@ ${lanes.join("\n")}
|
|
|
70998
71013
|
const declaringClassDeclaration = getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop));
|
|
70999
71014
|
if (!isNodeWithinClass(location, declaringClassDeclaration)) {
|
|
71000
71015
|
if (errorNode) {
|
|
71001
|
-
|
|
71016
|
+
error2(
|
|
71002
71017
|
errorNode,
|
|
71003
71018
|
Diagnostics.Property_0_is_private_and_only_accessible_within_class_1,
|
|
71004
71019
|
symbolToString(prop),
|
|
@@ -71021,7 +71036,7 @@ ${lanes.join("\n")}
|
|
|
71021
71036
|
enclosingClass = enclosingClass && isClassDerivedFromDeclaringClasses(enclosingClass, prop, writing);
|
|
71022
71037
|
if (flags & 32 /* Static */ || !enclosingClass) {
|
|
71023
71038
|
if (errorNode) {
|
|
71024
|
-
|
|
71039
|
+
error2(
|
|
71025
71040
|
errorNode,
|
|
71026
71041
|
Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses,
|
|
71027
71042
|
symbolToString(prop),
|
|
@@ -71039,7 +71054,7 @@ ${lanes.join("\n")}
|
|
|
71039
71054
|
}
|
|
71040
71055
|
if (!containingType || !hasBaseType(containingType, enclosingClass)) {
|
|
71041
71056
|
if (errorNode) {
|
|
71042
|
-
|
|
71057
|
+
error2(
|
|
71043
71058
|
errorNode,
|
|
71044
71059
|
Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1_This_is_an_instance_of_class_2,
|
|
71045
71060
|
symbolToString(prop),
|
|
@@ -71087,28 +71102,28 @@ ${lanes.join("\n")}
|
|
|
71087
71102
|
function reportObjectPossiblyNullOrUndefinedError(node, facts) {
|
|
71088
71103
|
const nodeText2 = isEntityNameExpression(node) ? entityNameToString(node) : void 0;
|
|
71089
71104
|
if (node.kind === 106 /* NullKeyword */) {
|
|
71090
|
-
|
|
71105
|
+
error2(node, Diagnostics.The_value_0_cannot_be_used_here, "null");
|
|
71091
71106
|
return;
|
|
71092
71107
|
}
|
|
71093
71108
|
if (nodeText2 !== void 0 && nodeText2.length < 100) {
|
|
71094
71109
|
if (isIdentifier(node) && nodeText2 === "undefined") {
|
|
71095
|
-
|
|
71110
|
+
error2(node, Diagnostics.The_value_0_cannot_be_used_here, "undefined");
|
|
71096
71111
|
return;
|
|
71097
71112
|
}
|
|
71098
|
-
|
|
71113
|
+
error2(
|
|
71099
71114
|
node,
|
|
71100
71115
|
facts & 16777216 /* IsUndefined */ ? facts & 33554432 /* IsNull */ ? Diagnostics._0_is_possibly_null_or_undefined : Diagnostics._0_is_possibly_undefined : Diagnostics._0_is_possibly_null,
|
|
71101
71116
|
nodeText2
|
|
71102
71117
|
);
|
|
71103
71118
|
} else {
|
|
71104
|
-
|
|
71119
|
+
error2(
|
|
71105
71120
|
node,
|
|
71106
71121
|
facts & 16777216 /* IsUndefined */ ? facts & 33554432 /* IsNull */ ? Diagnostics.Object_is_possibly_null_or_undefined : Diagnostics.Object_is_possibly_undefined : Diagnostics.Object_is_possibly_null
|
|
71107
71122
|
);
|
|
71108
71123
|
}
|
|
71109
71124
|
}
|
|
71110
71125
|
function reportCannotInvokePossiblyNullOrUndefinedError(node, facts) {
|
|
71111
|
-
|
|
71126
|
+
error2(
|
|
71112
71127
|
node,
|
|
71113
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
|
|
71114
71129
|
);
|
|
@@ -71118,11 +71133,11 @@ ${lanes.join("\n")}
|
|
|
71118
71133
|
if (isEntityNameExpression(node)) {
|
|
71119
71134
|
const nodeText2 = entityNameToString(node);
|
|
71120
71135
|
if (nodeText2.length < 100) {
|
|
71121
|
-
|
|
71136
|
+
error2(node, Diagnostics._0_is_of_type_unknown, nodeText2);
|
|
71122
71137
|
return errorType;
|
|
71123
71138
|
}
|
|
71124
71139
|
}
|
|
71125
|
-
|
|
71140
|
+
error2(node, Diagnostics.Object_is_of_type_unknown);
|
|
71126
71141
|
return errorType;
|
|
71127
71142
|
}
|
|
71128
71143
|
const facts = getTypeFacts(type);
|
|
@@ -71142,15 +71157,15 @@ ${lanes.join("\n")}
|
|
|
71142
71157
|
if (isEntityNameExpression(node)) {
|
|
71143
71158
|
const nodeText2 = entityNameToString(node);
|
|
71144
71159
|
if (isIdentifier(node) && nodeText2 === "undefined") {
|
|
71145
|
-
|
|
71160
|
+
error2(node, Diagnostics.The_value_0_cannot_be_used_here, nodeText2);
|
|
71146
71161
|
return nonNullType;
|
|
71147
71162
|
}
|
|
71148
71163
|
if (nodeText2.length < 100) {
|
|
71149
|
-
|
|
71164
|
+
error2(node, Diagnostics._0_is_possibly_undefined, nodeText2);
|
|
71150
71165
|
return nonNullType;
|
|
71151
71166
|
}
|
|
71152
71167
|
}
|
|
71153
|
-
|
|
71168
|
+
error2(node, Diagnostics.Object_is_possibly_undefined);
|
|
71154
71169
|
}
|
|
71155
71170
|
return nonNullType;
|
|
71156
71171
|
}
|
|
@@ -71245,7 +71260,7 @@ ${lanes.join("\n")}
|
|
|
71245
71260
|
const lexicalClass = getContainingClass(lexicalValueDecl);
|
|
71246
71261
|
Debug.assert(!!lexicalClass);
|
|
71247
71262
|
if (findAncestor(lexicalClass, (n) => typeClass === n)) {
|
|
71248
|
-
const diagnostic =
|
|
71263
|
+
const diagnostic = error2(
|
|
71249
71264
|
right,
|
|
71250
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,
|
|
71251
71266
|
diagName,
|
|
@@ -71267,7 +71282,7 @@ ${lanes.join("\n")}
|
|
|
71267
71282
|
return true;
|
|
71268
71283
|
}
|
|
71269
71284
|
}
|
|
71270
|
-
|
|
71285
|
+
error2(
|
|
71271
71286
|
right,
|
|
71272
71287
|
Diagnostics.Property_0_is_not_accessible_outside_class_1_because_it_has_a_private_identifier,
|
|
71273
71288
|
diagName,
|
|
@@ -71320,7 +71335,7 @@ ${lanes.join("\n")}
|
|
|
71320
71335
|
} else {
|
|
71321
71336
|
const isSetonlyAccessor = prop && prop.flags & 65536 /* SetAccessor */ && !(prop.flags & 32768 /* GetAccessor */);
|
|
71322
71337
|
if (isSetonlyAccessor && assignmentKind !== 1 /* Definite */) {
|
|
71323
|
-
|
|
71338
|
+
error2(node, Diagnostics.Private_accessor_was_defined_without_a_getter);
|
|
71324
71339
|
}
|
|
71325
71340
|
}
|
|
71326
71341
|
} else {
|
|
@@ -71357,9 +71372,9 @@ ${lanes.join("\n")}
|
|
|
71357
71372
|
}
|
|
71358
71373
|
if (leftType.symbol === globalThisSymbol) {
|
|
71359
71374
|
if (globalThisSymbol.exports.has(right.escapedText) && globalThisSymbol.exports.get(right.escapedText).flags & 418 /* BlockScoped */) {
|
|
71360
|
-
|
|
71375
|
+
error2(right, Diagnostics.Property_0_does_not_exist_on_type_1, unescapeLeadingUnderscores(right.escapedText), typeToString(leftType));
|
|
71361
71376
|
} else if (noImplicitAny) {
|
|
71362
|
-
|
|
71377
|
+
error2(right, Diagnostics.Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature, typeToString(leftType));
|
|
71363
71378
|
}
|
|
71364
71379
|
return anyType;
|
|
71365
71380
|
}
|
|
@@ -71369,11 +71384,11 @@ ${lanes.join("\n")}
|
|
|
71369
71384
|
return errorType;
|
|
71370
71385
|
}
|
|
71371
71386
|
if (indexInfo.isReadonly && (isAssignmentTarget(node) || isDeleteTarget(node))) {
|
|
71372
|
-
|
|
71387
|
+
error2(node, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(apparentType));
|
|
71373
71388
|
}
|
|
71374
71389
|
propType = compilerOptions.noUncheckedIndexedAccess && !isAssignmentTarget(node) ? getUnionType([indexInfo.type, missingType]) : indexInfo.type;
|
|
71375
71390
|
if (compilerOptions.noPropertyAccessFromIndexSignature && isPropertyAccessExpression(node)) {
|
|
71376
|
-
|
|
71391
|
+
error2(right, Diagnostics.Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0, unescapeLeadingUnderscores(right.escapedText));
|
|
71377
71392
|
}
|
|
71378
71393
|
if (indexInfo.declaration && getCombinedNodeFlags(indexInfo.declaration) & 268435456 /* Deprecated */) {
|
|
71379
71394
|
addDeprecatedSuggestion(right, [indexInfo.declaration], right.escapedText);
|
|
@@ -71388,7 +71403,7 @@ ${lanes.join("\n")}
|
|
|
71388
71403
|
getNodeLinks(node).resolvedSymbol = prop;
|
|
71389
71404
|
checkPropertyAccessibility(node, left.kind === 108 /* SuperKeyword */, isWriteAccess(node), apparentType, prop);
|
|
71390
71405
|
if (isAssignmentToReadonlyEntity(node, prop, assignmentKind)) {
|
|
71391
|
-
|
|
71406
|
+
error2(right, Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, idText(right));
|
|
71392
71407
|
return errorType;
|
|
71393
71408
|
}
|
|
71394
71409
|
propType = isThisPropertyAccessInConstructor(node, prop) ? autoType : writeOnly || isWriteOnlyAccess(node) ? getWriteTypeOfSymbol(prop) : getTypeOfSymbol(prop);
|
|
@@ -71433,7 +71448,7 @@ ${lanes.join("\n")}
|
|
|
71433
71448
|
}
|
|
71434
71449
|
const flowType = getFlowTypeOfReference(node, propType, assumeUninitialized ? getOptionalType(propType) : propType);
|
|
71435
71450
|
if (assumeUninitialized && !containsUndefinedType(propType) && containsUndefinedType(flowType)) {
|
|
71436
|
-
|
|
71451
|
+
error2(errorNode, Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(prop));
|
|
71437
71452
|
return propType;
|
|
71438
71453
|
}
|
|
71439
71454
|
return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType;
|
|
@@ -71446,9 +71461,9 @@ ${lanes.join("\n")}
|
|
|
71446
71461
|
let diagnosticMessage;
|
|
71447
71462
|
const declarationName = idText(right);
|
|
71448
71463
|
if (isInPropertyInitializerOrClassStaticBlock(node) && !isOptionalPropertyDeclaration(valueDeclaration) && !(isAccessExpression(node) && isAccessExpression(node.expression)) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right) && !(isMethodDeclaration(valueDeclaration) && getCombinedModifierFlags(valueDeclaration) & 32 /* Static */) && (compilerOptions.useDefineForClassFields || !isPropertyDeclaredInAncestorClass(prop))) {
|
|
71449
|
-
diagnosticMessage =
|
|
71464
|
+
diagnosticMessage = error2(right, Diagnostics.Property_0_is_used_before_its_initialization, declarationName);
|
|
71450
71465
|
} else if (valueDeclaration.kind === 262 /* ClassDeclaration */ && node.parent.kind !== 182 /* TypeReference */ && !(valueDeclaration.flags & 16777216 /* Ambient */) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) {
|
|
71451
|
-
diagnosticMessage =
|
|
71466
|
+
diagnosticMessage = error2(right, Diagnostics.Class_0_used_before_its_declaration, declarationName);
|
|
71452
71467
|
}
|
|
71453
71468
|
if (diagnosticMessage) {
|
|
71454
71469
|
addRelatedInfo(
|
|
@@ -71826,7 +71841,7 @@ ${lanes.join("\n")}
|
|
|
71826
71841
|
return objectType;
|
|
71827
71842
|
}
|
|
71828
71843
|
if (isConstEnumObjectType(objectType) && !isStringLiteralLike(indexExpression)) {
|
|
71829
|
-
|
|
71844
|
+
error2(indexExpression, Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal);
|
|
71830
71845
|
return errorType;
|
|
71831
71846
|
}
|
|
71832
71847
|
const effectiveIndexType = isForInVariableForNumericPropertyNames(indexExpression) ? numberType : indexType;
|
|
@@ -72533,7 +72548,7 @@ ${lanes.join("\n")}
|
|
|
72533
72548
|
if (isVoidPromiseError && isInJSFile(node)) {
|
|
72534
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);
|
|
72535
72550
|
}
|
|
72536
|
-
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;
|
|
72537
72552
|
if (min2 < args.length && args.length < max) {
|
|
72538
72553
|
if (headMessage) {
|
|
72539
72554
|
let chain = chainDiagnosticMessages(
|
|
@@ -72554,14 +72569,14 @@ ${lanes.join("\n")}
|
|
|
72554
72569
|
let chain = chainDiagnosticMessages(
|
|
72555
72570
|
/*details*/
|
|
72556
72571
|
void 0,
|
|
72557
|
-
|
|
72572
|
+
error3,
|
|
72558
72573
|
parameterRange,
|
|
72559
72574
|
args.length
|
|
72560
72575
|
);
|
|
72561
72576
|
chain = chainDiagnosticMessages(chain, headMessage);
|
|
72562
72577
|
diagnostic = getDiagnosticForCallNode(node, chain);
|
|
72563
72578
|
} else {
|
|
72564
|
-
diagnostic = getDiagnosticForCallNode(node,
|
|
72579
|
+
diagnostic = getDiagnosticForCallNode(node, error3, parameterRange, args.length);
|
|
72565
72580
|
}
|
|
72566
72581
|
const parameter = (_a = closestSignature == null ? void 0 : closestSignature.declaration) == null ? void 0 : _a.parameters[closestSignature.thisParameter ? args.length + 1 : args.length];
|
|
72567
72582
|
if (parameter) {
|
|
@@ -72582,14 +72597,14 @@ ${lanes.join("\n")}
|
|
|
72582
72597
|
let chain = chainDiagnosticMessages(
|
|
72583
72598
|
/*details*/
|
|
72584
72599
|
void 0,
|
|
72585
|
-
|
|
72600
|
+
error3,
|
|
72586
72601
|
parameterRange,
|
|
72587
72602
|
args.length
|
|
72588
72603
|
);
|
|
72589
72604
|
chain = chainDiagnosticMessages(chain, headMessage);
|
|
72590
72605
|
return createDiagnosticForNodeArrayFromMessageChain(getSourceFileOfNode(node), errorSpan, chain);
|
|
72591
72606
|
}
|
|
72592
|
-
return createDiagnosticForNodeArray(getSourceFileOfNode(node), errorSpan,
|
|
72607
|
+
return createDiagnosticForNodeArray(getSourceFileOfNode(node), errorSpan, error3, parameterRange, args.length);
|
|
72593
72608
|
}
|
|
72594
72609
|
}
|
|
72595
72610
|
function getTypeArgumentArityError(node, signatures, typeArguments, headMessage) {
|
|
@@ -73071,13 +73086,13 @@ ${lanes.join("\n")}
|
|
|
73071
73086
|
const numConstructSignatures = getSignaturesOfType(apparentType, 1 /* Construct */).length;
|
|
73072
73087
|
if (isUntypedFunctionCall(funcType, apparentType, callSignatures.length, numConstructSignatures)) {
|
|
73073
73088
|
if (!isErrorType(funcType) && node.typeArguments) {
|
|
73074
|
-
|
|
73089
|
+
error2(node, Diagnostics.Untyped_function_calls_may_not_accept_type_arguments);
|
|
73075
73090
|
}
|
|
73076
73091
|
return resolveUntypedCall(node);
|
|
73077
73092
|
}
|
|
73078
73093
|
if (!callSignatures.length) {
|
|
73079
73094
|
if (numConstructSignatures) {
|
|
73080
|
-
|
|
73095
|
+
error2(node, Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new, typeToString(funcType));
|
|
73081
73096
|
} else {
|
|
73082
73097
|
let relatedInformation;
|
|
73083
73098
|
if (node.arguments.length === 1) {
|
|
@@ -73100,7 +73115,7 @@ ${lanes.join("\n")}
|
|
|
73100
73115
|
return resolvingSignature;
|
|
73101
73116
|
}
|
|
73102
73117
|
if (callSignatures.some((sig) => isInJSFile(sig.declaration) && !!getJSDocClassTag(sig.declaration))) {
|
|
73103
|
-
|
|
73118
|
+
error2(node, Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new, typeToString(funcType));
|
|
73104
73119
|
return resolveErrorCall(node);
|
|
73105
73120
|
}
|
|
73106
73121
|
return resolveCall(node, callSignatures, candidatesOutArray, checkMode, callChainFlags);
|
|
@@ -73115,7 +73130,7 @@ ${lanes.join("\n")}
|
|
|
73115
73130
|
if (node.arguments && languageVersion < 1 /* ES5 */) {
|
|
73116
73131
|
const spreadIndex = getSpreadArgumentIndex(node.arguments);
|
|
73117
73132
|
if (spreadIndex >= 0) {
|
|
73118
|
-
|
|
73133
|
+
error2(node.arguments[spreadIndex], Diagnostics.Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher);
|
|
73119
73134
|
}
|
|
73120
73135
|
}
|
|
73121
73136
|
let expressionType = checkNonNullExpression(node.expression);
|
|
@@ -73128,7 +73143,7 @@ ${lanes.join("\n")}
|
|
|
73128
73143
|
}
|
|
73129
73144
|
if (isTypeAny(expressionType)) {
|
|
73130
73145
|
if (node.typeArguments) {
|
|
73131
|
-
|
|
73146
|
+
error2(node, Diagnostics.Untyped_function_calls_may_not_accept_type_arguments);
|
|
73132
73147
|
}
|
|
73133
73148
|
return resolveUntypedCall(node);
|
|
73134
73149
|
}
|
|
@@ -73138,12 +73153,12 @@ ${lanes.join("\n")}
|
|
|
73138
73153
|
return resolveErrorCall(node);
|
|
73139
73154
|
}
|
|
73140
73155
|
if (someSignature(constructSignatures, (signature) => !!(signature.flags & 4 /* Abstract */))) {
|
|
73141
|
-
|
|
73156
|
+
error2(node, Diagnostics.Cannot_create_an_instance_of_an_abstract_class);
|
|
73142
73157
|
return resolveErrorCall(node);
|
|
73143
73158
|
}
|
|
73144
73159
|
const valueDecl = expressionType.symbol && getClassLikeDeclarationOfSymbol(expressionType.symbol);
|
|
73145
73160
|
if (valueDecl && hasSyntacticModifier(valueDecl, 256 /* Abstract */)) {
|
|
73146
|
-
|
|
73161
|
+
error2(node, Diagnostics.Cannot_create_an_instance_of_an_abstract_class);
|
|
73147
73162
|
return resolveErrorCall(node);
|
|
73148
73163
|
}
|
|
73149
73164
|
return resolveCall(node, constructSignatures, candidatesOutArray, checkMode, 0 /* None */);
|
|
@@ -73153,10 +73168,10 @@ ${lanes.join("\n")}
|
|
|
73153
73168
|
const signature = resolveCall(node, callSignatures, candidatesOutArray, checkMode, 0 /* None */);
|
|
73154
73169
|
if (!noImplicitAny) {
|
|
73155
73170
|
if (signature.declaration && !isJSConstructor(signature.declaration) && getReturnTypeOfSignature(signature) !== voidType) {
|
|
73156
|
-
|
|
73171
|
+
error2(node, Diagnostics.Only_a_void_function_can_be_called_with_the_new_keyword);
|
|
73157
73172
|
}
|
|
73158
73173
|
if (getThisTypeOfSignature(signature) === voidType) {
|
|
73159
|
-
|
|
73174
|
+
error2(node, Diagnostics.A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void);
|
|
73160
73175
|
}
|
|
73161
73176
|
}
|
|
73162
73177
|
return signature;
|
|
@@ -73220,10 +73235,10 @@ ${lanes.join("\n")}
|
|
|
73220
73235
|
}
|
|
73221
73236
|
}
|
|
73222
73237
|
if (modifiers & 8 /* Private */) {
|
|
73223
|
-
|
|
73238
|
+
error2(node, Diagnostics.Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration, typeToString(declaringClass));
|
|
73224
73239
|
}
|
|
73225
73240
|
if (modifiers & 16 /* Protected */) {
|
|
73226
|
-
|
|
73241
|
+
error2(node, Diagnostics.Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration, typeToString(declaringClass));
|
|
73227
73242
|
}
|
|
73228
73243
|
return false;
|
|
73229
73244
|
}
|
|
@@ -73385,7 +73400,7 @@ ${lanes.join("\n")}
|
|
|
73385
73400
|
/*includeTrivia*/
|
|
73386
73401
|
false
|
|
73387
73402
|
);
|
|
73388
|
-
|
|
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);
|
|
73389
73404
|
return resolveErrorCall(node);
|
|
73390
73405
|
}
|
|
73391
73406
|
const headMessage = getDiagnosticHeadMessageForDecoratorResolution(node);
|
|
@@ -73475,7 +73490,7 @@ ${lanes.join("\n")}
|
|
|
73475
73490
|
return resolveUntypedCall(node);
|
|
73476
73491
|
}
|
|
73477
73492
|
if (signatures.length === 0) {
|
|
73478
|
-
|
|
73493
|
+
error2(node.tagName, Diagnostics.JSX_element_type_0_does_not_have_any_construct_or_call_signatures, getTextOfNode(node.tagName));
|
|
73479
73494
|
return resolveErrorCall(node);
|
|
73480
73495
|
}
|
|
73481
73496
|
return resolveCall(node, signatures, candidatesOutArray, checkMode, 0 /* None */);
|
|
@@ -73635,7 +73650,7 @@ ${lanes.join("\n")}
|
|
|
73635
73650
|
const declaration = signature.declaration;
|
|
73636
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)) {
|
|
73637
73652
|
if (noImplicitAny) {
|
|
73638
|
-
|
|
73653
|
+
error2(node, Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type);
|
|
73639
73654
|
}
|
|
73640
73655
|
return anyType;
|
|
73641
73656
|
}
|
|
@@ -73649,9 +73664,9 @@ ${lanes.join("\n")}
|
|
|
73649
73664
|
}
|
|
73650
73665
|
if (node.kind === 212 /* CallExpression */ && !node.questionDotToken && node.parent.kind === 243 /* ExpressionStatement */ && returnType.flags & 16384 /* Void */ && getTypePredicateOfSignature(signature)) {
|
|
73651
73666
|
if (!isDottedName(node.expression)) {
|
|
73652
|
-
|
|
73667
|
+
error2(node.expression, Diagnostics.Assertions_require_the_call_target_to_be_an_identifier_or_qualified_name);
|
|
73653
73668
|
} else if (!getEffectsSignature(node)) {
|
|
73654
|
-
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);
|
|
73655
73670
|
getTypeOfDottedName(node.expression, diagnostic);
|
|
73656
73671
|
}
|
|
73657
73672
|
}
|
|
@@ -73740,7 +73755,7 @@ ${lanes.join("\n")}
|
|
|
73740
73755
|
checkExpressionCached(node.arguments[i]);
|
|
73741
73756
|
}
|
|
73742
73757
|
if (specifierType.flags & 32768 /* Undefined */ || specifierType.flags & 65536 /* Null */ || !isTypeAssignableTo(specifierType, stringType)) {
|
|
73743
|
-
|
|
73758
|
+
error2(specifier, Diagnostics.Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0, typeToString(specifierType));
|
|
73744
73759
|
}
|
|
73745
73760
|
if (optionsType) {
|
|
73746
73761
|
const importCallOptionsType = getGlobalImportCallOptionsType(
|
|
@@ -73914,7 +73929,7 @@ ${lanes.join("\n")}
|
|
|
73914
73929
|
const exprType = checkExpression(expression, checkMode);
|
|
73915
73930
|
if (isConstTypeReference(type)) {
|
|
73916
73931
|
if (!isValidConstAssertionArgument(expression)) {
|
|
73917
|
-
|
|
73932
|
+
error2(expression, Diagnostics.A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array_or_object_literals);
|
|
73918
73933
|
}
|
|
73919
73934
|
return getRegularTypeOfLiteralType(exprType);
|
|
73920
73935
|
}
|
|
@@ -73975,7 +73990,7 @@ ${lanes.join("\n")}
|
|
|
73975
73990
|
if (node.kind === 232 /* ExpressionWithTypeArguments */) {
|
|
73976
73991
|
const parent2 = walkUpParenthesizedExpressions(node.parent);
|
|
73977
73992
|
if (parent2.kind === 225 /* BinaryExpression */ && parent2.operatorToken.kind === 104 /* InstanceOfKeyword */ && isNodeDescendantOf(node, parent2.right)) {
|
|
73978
|
-
|
|
73993
|
+
error2(node, Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_not_be_an_instantiation_expression);
|
|
73979
73994
|
}
|
|
73980
73995
|
}
|
|
73981
73996
|
const exprType = node.kind === 232 /* ExpressionWithTypeArguments */ ? checkExpression(node.expression) : isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName);
|
|
@@ -74090,7 +74105,7 @@ ${lanes.join("\n")}
|
|
|
74090
74105
|
function checkNewTargetMetaProperty(node) {
|
|
74091
74106
|
const container = getNewTargetContainer(node);
|
|
74092
74107
|
if (!container) {
|
|
74093
|
-
|
|
74108
|
+
error2(node, Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target");
|
|
74094
74109
|
return errorType;
|
|
74095
74110
|
} else if (container.kind === 175 /* Constructor */) {
|
|
74096
74111
|
const symbol = getSymbolOfDeclaration(container.parent);
|
|
@@ -74103,10 +74118,10 @@ ${lanes.join("\n")}
|
|
|
74103
74118
|
function checkImportMetaProperty(node) {
|
|
74104
74119
|
if (moduleKind === 100 /* Node16 */ || moduleKind === 199 /* NodeNext */) {
|
|
74105
74120
|
if (getSourceFileOfNode(node).impliedNodeFormat !== 99 /* ESNext */) {
|
|
74106
|
-
|
|
74121
|
+
error2(node, Diagnostics.The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output);
|
|
74107
74122
|
}
|
|
74108
74123
|
} else if (moduleKind < 6 /* ES2020 */ && moduleKind !== 4 /* System */) {
|
|
74109
|
-
|
|
74124
|
+
error2(node, Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_or_nodenext);
|
|
74110
74125
|
}
|
|
74111
74126
|
const file = getSourceFileOfNode(node);
|
|
74112
74127
|
Debug.assert(!!(file.flags & 4194304 /* PossiblyContainsImportMeta */), "Containing file is missing import meta node flag.");
|
|
@@ -74663,13 +74678,13 @@ ${lanes.join("\n")}
|
|
|
74663
74678
|
function createPromiseReturnType(func, promisedType) {
|
|
74664
74679
|
const promiseType = createPromiseType(promisedType);
|
|
74665
74680
|
if (promiseType === unknownType) {
|
|
74666
|
-
|
|
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);
|
|
74667
74682
|
return errorType;
|
|
74668
74683
|
} else if (!getGlobalPromiseConstructorSymbol(
|
|
74669
74684
|
/*reportErrors*/
|
|
74670
74685
|
true
|
|
74671
74686
|
)) {
|
|
74672
|
-
|
|
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);
|
|
74673
74688
|
}
|
|
74674
74689
|
return promiseType;
|
|
74675
74690
|
}
|
|
@@ -74965,11 +74980,11 @@ ${lanes.join("\n")}
|
|
|
74965
74980
|
const hasExplicitReturn = func.flags & 512 /* HasExplicitReturn */;
|
|
74966
74981
|
const errorNode = getEffectiveReturnTypeNode(func) || func;
|
|
74967
74982
|
if (type && type.flags & 131072 /* Never */) {
|
|
74968
|
-
|
|
74983
|
+
error2(errorNode, Diagnostics.A_function_returning_never_cannot_have_a_reachable_end_point);
|
|
74969
74984
|
} else if (type && !hasExplicitReturn) {
|
|
74970
|
-
|
|
74985
|
+
error2(errorNode, Diagnostics.A_function_whose_declared_type_is_neither_undefined_void_nor_any_must_return_a_value);
|
|
74971
74986
|
} else if (type && strictNullChecks && !isTypeAssignableTo(undefinedType, type)) {
|
|
74972
|
-
|
|
74987
|
+
error2(errorNode, Diagnostics.Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined);
|
|
74973
74988
|
} else if (compilerOptions.noImplicitReturns) {
|
|
74974
74989
|
if (!type) {
|
|
74975
74990
|
if (!hasExplicitReturn) {
|
|
@@ -74980,7 +74995,7 @@ ${lanes.join("\n")}
|
|
|
74980
74995
|
return;
|
|
74981
74996
|
}
|
|
74982
74997
|
}
|
|
74983
|
-
|
|
74998
|
+
error2(errorNode, Diagnostics.Not_all_code_paths_return_a_value);
|
|
74984
74999
|
}
|
|
74985
75000
|
}
|
|
74986
75001
|
}
|
|
@@ -75180,11 +75195,11 @@ ${lanes.join("\n")}
|
|
|
75180
75195
|
function checkReferenceExpression(expr, invalidReferenceMessage, invalidOptionalChainMessage) {
|
|
75181
75196
|
const node = skipOuterExpressions(expr, 6 /* Assertions */ | 1 /* Parentheses */);
|
|
75182
75197
|
if (node.kind !== 80 /* Identifier */ && !isAccessExpression(node)) {
|
|
75183
|
-
|
|
75198
|
+
error2(expr, invalidReferenceMessage);
|
|
75184
75199
|
return false;
|
|
75185
75200
|
}
|
|
75186
75201
|
if (node.flags & 32 /* OptionalChain */) {
|
|
75187
|
-
|
|
75202
|
+
error2(expr, invalidOptionalChainMessage);
|
|
75188
75203
|
return false;
|
|
75189
75204
|
}
|
|
75190
75205
|
return true;
|
|
@@ -75193,17 +75208,17 @@ ${lanes.join("\n")}
|
|
|
75193
75208
|
checkExpression(node.expression);
|
|
75194
75209
|
const expr = skipParentheses(node.expression);
|
|
75195
75210
|
if (!isAccessExpression(expr)) {
|
|
75196
|
-
|
|
75211
|
+
error2(expr, Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference);
|
|
75197
75212
|
return booleanType;
|
|
75198
75213
|
}
|
|
75199
75214
|
if (isPropertyAccessExpression(expr) && isPrivateIdentifier(expr.name)) {
|
|
75200
|
-
|
|
75215
|
+
error2(expr, Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_private_identifier);
|
|
75201
75216
|
}
|
|
75202
75217
|
const links = getNodeLinks(expr);
|
|
75203
75218
|
const symbol = getExportSymbolOfValueSymbolIfExported(links.resolvedSymbol);
|
|
75204
75219
|
if (symbol) {
|
|
75205
75220
|
if (isReadonlySymbol(symbol)) {
|
|
75206
|
-
|
|
75221
|
+
error2(expr, Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_read_only_property);
|
|
75207
75222
|
}
|
|
75208
75223
|
checkDeleteExpressionMustBeOptional(expr, symbol);
|
|
75209
75224
|
}
|
|
@@ -75212,7 +75227,7 @@ ${lanes.join("\n")}
|
|
|
75212
75227
|
function checkDeleteExpressionMustBeOptional(expr, symbol) {
|
|
75213
75228
|
const type = getTypeOfSymbol(symbol);
|
|
75214
75229
|
if (strictNullChecks && !(type.flags & (3 /* AnyOrUnknown */ | 131072 /* Never */)) && !(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ : getTypeFacts(type) & 16777216 /* IsUndefined */)) {
|
|
75215
|
-
|
|
75230
|
+
error2(expr, Diagnostics.The_operand_of_a_delete_operator_must_be_optional);
|
|
75216
75231
|
}
|
|
75217
75232
|
}
|
|
75218
75233
|
function checkTypeOfExpression(node) {
|
|
@@ -75226,7 +75241,7 @@ ${lanes.join("\n")}
|
|
|
75226
75241
|
function checkAwaitExpressionGrammar(node) {
|
|
75227
75242
|
const container = getContainingFunctionOrClassStaticBlock(node);
|
|
75228
75243
|
if (container && isClassStaticBlockDeclaration(container)) {
|
|
75229
|
-
|
|
75244
|
+
error2(node, Diagnostics.Await_expression_cannot_be_used_inside_a_class_static_block);
|
|
75230
75245
|
} else if (!(node.flags & 32768 /* AwaitContext */)) {
|
|
75231
75246
|
if (isInTopLevelContext(node)) {
|
|
75232
75247
|
const sourceFile = getSourceFileOfNode(node);
|
|
@@ -75285,7 +75300,7 @@ ${lanes.join("\n")}
|
|
|
75285
75300
|
}
|
|
75286
75301
|
}
|
|
75287
75302
|
if (isInParameterInitializerBeforeContainingFunction(node)) {
|
|
75288
|
-
|
|
75303
|
+
error2(node, Diagnostics.await_expressions_cannot_be_used_in_a_parameter_initializer);
|
|
75289
75304
|
}
|
|
75290
75305
|
}
|
|
75291
75306
|
function checkAwaitExpression(node) {
|
|
@@ -75335,11 +75350,11 @@ ${lanes.join("\n")}
|
|
|
75335
75350
|
case 55 /* TildeToken */:
|
|
75336
75351
|
checkNonNullType(operandType, node.operand);
|
|
75337
75352
|
if (maybeTypeOfKindConsideringBaseConstraint(operandType, 12288 /* ESSymbolLike */)) {
|
|
75338
|
-
|
|
75353
|
+
error2(node.operand, Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, tokenToString(node.operator));
|
|
75339
75354
|
}
|
|
75340
75355
|
if (node.operator === 40 /* PlusToken */) {
|
|
75341
75356
|
if (maybeTypeOfKindConsideringBaseConstraint(operandType, 2112 /* BigIntLike */)) {
|
|
75342
|
-
|
|
75357
|
+
error2(node.operand, Diagnostics.Operator_0_cannot_be_applied_to_type_1, tokenToString(node.operator), typeToString(getBaseTypeOfLiteralType(operandType)));
|
|
75343
75358
|
}
|
|
75344
75359
|
return numberType;
|
|
75345
75360
|
}
|
|
@@ -75435,10 +75450,10 @@ ${lanes.join("\n")}
|
|
|
75435
75450
|
return silentNeverType;
|
|
75436
75451
|
}
|
|
75437
75452
|
if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 402784252 /* Primitive */)) {
|
|
75438
|
-
|
|
75453
|
+
error2(left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
|
|
75439
75454
|
}
|
|
75440
75455
|
if (!(isTypeAny(rightType) || typeHasCallOrConstructSignatures(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
|
|
75441
|
-
|
|
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);
|
|
75442
75457
|
}
|
|
75443
75458
|
return booleanType;
|
|
75444
75459
|
}
|
|
@@ -75467,7 +75482,7 @@ ${lanes.join("\n")}
|
|
|
75467
75482
|
}
|
|
75468
75483
|
if (checkTypeAssignableTo(checkNonNullType(rightType, right), nonPrimitiveType, right)) {
|
|
75469
75484
|
if (hasEmptyObjectIntersection(rightType)) {
|
|
75470
|
-
|
|
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));
|
|
75471
75486
|
}
|
|
75472
75487
|
}
|
|
75473
75488
|
return booleanType;
|
|
@@ -75509,7 +75524,7 @@ ${lanes.join("\n")}
|
|
|
75509
75524
|
return checkDestructuringAssignment(property.kind === 303 /* ShorthandPropertyAssignment */ ? property : property.initializer, type);
|
|
75510
75525
|
} else if (property.kind === 304 /* SpreadAssignment */) {
|
|
75511
75526
|
if (propertyIndex < properties.length - 1) {
|
|
75512
|
-
|
|
75527
|
+
error2(property, Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern);
|
|
75513
75528
|
} else {
|
|
75514
75529
|
if (languageVersion < 99 /* ESNext */) {
|
|
75515
75530
|
checkExternalEmitHelpers(property, 4 /* Rest */);
|
|
@@ -75527,7 +75542,7 @@ ${lanes.join("\n")}
|
|
|
75527
75542
|
return checkDestructuringAssignment(property.expression, type);
|
|
75528
75543
|
}
|
|
75529
75544
|
} else {
|
|
75530
|
-
|
|
75545
|
+
error2(property, Diagnostics.Property_assignment_expected);
|
|
75531
75546
|
}
|
|
75532
75547
|
}
|
|
75533
75548
|
function checkArrayLiteralAssignment(node, sourceType, checkMode) {
|
|
@@ -75562,11 +75577,11 @@ ${lanes.join("\n")}
|
|
|
75562
75577
|
return checkDestructuringAssignment(element, elementType, checkMode);
|
|
75563
75578
|
}
|
|
75564
75579
|
if (elementIndex < elements.length - 1) {
|
|
75565
|
-
|
|
75580
|
+
error2(element, Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern);
|
|
75566
75581
|
} else {
|
|
75567
75582
|
const restExpression = element.expression;
|
|
75568
75583
|
if (restExpression.kind === 225 /* BinaryExpression */ && restExpression.operatorToken.kind === 64 /* EqualsToken */) {
|
|
75569
|
-
|
|
75584
|
+
error2(restExpression.operatorToken, Diagnostics.A_rest_element_cannot_have_an_initializer);
|
|
75570
75585
|
} else {
|
|
75571
75586
|
checkGrammarForDisallowedTrailingComma(node.elements, Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma);
|
|
75572
75587
|
const type = everyType(sourceType, isTupleType) ? mapType(sourceType, (t) => sliceTupleType(t, elementIndex)) : createArrayType(elementType);
|
|
@@ -75607,9 +75622,9 @@ ${lanes.join("\n")}
|
|
|
75607
75622
|
}
|
|
75608
75623
|
function checkReferenceAssignment(target, sourceType, checkMode) {
|
|
75609
75624
|
const targetType = checkExpression(target, checkMode);
|
|
75610
|
-
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;
|
|
75611
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;
|
|
75612
|
-
if (checkReferenceExpression(target,
|
|
75627
|
+
if (checkReferenceExpression(target, error3, optionalError)) {
|
|
75613
75628
|
checkTypeAssignableToAndOptionallyElaborate(sourceType, targetType, target, target);
|
|
75614
75629
|
}
|
|
75615
75630
|
if (isPrivateIdentifierPropertyAccessExpression(target)) {
|
|
@@ -75850,7 +75865,7 @@ ${lanes.join("\n")}
|
|
|
75850
75865
|
rightType = checkNonNullType(rightType, right);
|
|
75851
75866
|
let suggestedOperator;
|
|
75852
75867
|
if (leftType.flags & 528 /* BooleanLike */ && rightType.flags & 528 /* BooleanLike */ && (suggestedOperator = getSuggestedBooleanOperator(operatorToken.kind)) !== void 0) {
|
|
75853
|
-
|
|
75868
|
+
error2(errorNode || operatorToken, Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, tokenToString(operatorToken.kind), tokenToString(suggestedOperator));
|
|
75854
75869
|
return numberType;
|
|
75855
75870
|
} else {
|
|
75856
75871
|
const leftOk = checkArithmeticOperandType(
|
|
@@ -75880,7 +75895,7 @@ ${lanes.join("\n")}
|
|
|
75880
75895
|
case 43 /* AsteriskAsteriskToken */:
|
|
75881
75896
|
case 68 /* AsteriskAsteriskEqualsToken */:
|
|
75882
75897
|
if (languageVersion < 3 /* ES2016 */) {
|
|
75883
|
-
|
|
75898
|
+
error2(errorNode, Diagnostics.Exponentiation_cannot_be_performed_on_bigint_values_unless_the_target_option_is_set_to_es2016_or_later);
|
|
75884
75899
|
}
|
|
75885
75900
|
}
|
|
75886
75901
|
resultType2 = bigintType;
|
|
@@ -75978,7 +75993,7 @@ ${lanes.join("\n")}
|
|
|
75978
75993
|
if (!(checkMode && checkMode & 256 /* TypeOnly */)) {
|
|
75979
75994
|
if (isLiteralExpressionOfObject(left) || isLiteralExpressionOfObject(right)) {
|
|
75980
75995
|
const eqType = operator === 35 /* EqualsEqualsToken */ || operator === 37 /* EqualsEqualsEqualsToken */;
|
|
75981
|
-
|
|
75996
|
+
error2(errorNode, Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true");
|
|
75982
75997
|
}
|
|
75983
75998
|
checkNaNEquality(errorNode, operator, left, right);
|
|
75984
75999
|
reportOperatorErrorUnless((left2, right2) => isTypeEqualityComparableTo(left2, right2) || isTypeEqualityComparableTo(right2, left2));
|
|
@@ -76035,7 +76050,7 @@ ${lanes.join("\n")}
|
|
|
76035
76050
|
return textSpanContainsPosition(diag2, start);
|
|
76036
76051
|
});
|
|
76037
76052
|
if (!isInDiag2657)
|
|
76038
|
-
|
|
76053
|
+
error2(left, Diagnostics.Left_side_of_comma_operator_is_unused_and_has_no_side_effects);
|
|
76039
76054
|
}
|
|
76040
76055
|
return rightType;
|
|
76041
76056
|
default:
|
|
@@ -76075,7 +76090,7 @@ ${lanes.join("\n")}
|
|
|
76075
76090
|
function checkForDisallowedESSymbolOperand(operator2) {
|
|
76076
76091
|
const offendingSymbolOperand = maybeTypeOfKindConsideringBaseConstraint(leftType, 12288 /* ESSymbolLike */) ? left : maybeTypeOfKindConsideringBaseConstraint(rightType, 12288 /* ESSymbolLike */) ? right : void 0;
|
|
76077
76092
|
if (offendingSymbolOperand) {
|
|
76078
|
-
|
|
76093
|
+
error2(offendingSymbolOperand, Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, tokenToString(operator2));
|
|
76079
76094
|
return false;
|
|
76080
76095
|
}
|
|
76081
76096
|
return true;
|
|
@@ -76196,7 +76211,7 @@ ${lanes.join("\n")}
|
|
|
76196
76211
|
const isLeftNaN = isGlobalNaN(skipParentheses(left2));
|
|
76197
76212
|
const isRightNaN = isGlobalNaN(skipParentheses(right2));
|
|
76198
76213
|
if (isLeftNaN || isRightNaN) {
|
|
76199
|
-
const err =
|
|
76214
|
+
const err = error2(
|
|
76200
76215
|
errorNode2,
|
|
76201
76216
|
Diagnostics.This_condition_will_always_return_0,
|
|
76202
76217
|
tokenToString(operator2 === 37 /* EqualsEqualsEqualsToken */ || operator2 === 35 /* EqualsEqualsToken */ ? 97 /* FalseKeyword */ : 112 /* TrueKeyword */)
|
|
@@ -76277,7 +76292,7 @@ ${lanes.join("\n")}
|
|
|
76277
76292
|
void 0
|
|
76278
76293
|
);
|
|
76279
76294
|
if (!contextualType || isTypeAny(contextualType)) {
|
|
76280
|
-
|
|
76295
|
+
error2(node, Diagnostics.yield_expression_implicitly_results_in_an_any_type_because_its_containing_generator_lacks_a_return_type_annotation);
|
|
76281
76296
|
}
|
|
76282
76297
|
}
|
|
76283
76298
|
});
|
|
@@ -76288,7 +76303,7 @@ ${lanes.join("\n")}
|
|
|
76288
76303
|
grammarErrorOnFirstToken(node, Diagnostics.A_yield_expression_is_only_allowed_in_a_generator_body);
|
|
76289
76304
|
}
|
|
76290
76305
|
if (isInParameterInitializerBeforeContainingFunction(node)) {
|
|
76291
|
-
|
|
76306
|
+
error2(node, Diagnostics.yield_expressions_cannot_be_used_in_a_parameter_initializer);
|
|
76292
76307
|
}
|
|
76293
76308
|
}
|
|
76294
76309
|
}
|
|
@@ -76309,7 +76324,7 @@ ${lanes.join("\n")}
|
|
|
76309
76324
|
for (const span of node.templateSpans) {
|
|
76310
76325
|
const type = checkExpression(span.expression);
|
|
76311
76326
|
if (maybeTypeOfKindConsideringBaseConstraint(type, 12288 /* ESSymbolLike */)) {
|
|
76312
|
-
|
|
76327
|
+
error2(span.expression, Diagnostics.Implicit_conversion_of_a_symbol_to_a_string_will_fail_at_runtime_Consider_wrapping_this_expression_in_String);
|
|
76313
76328
|
}
|
|
76314
76329
|
texts.push(span.literal.text);
|
|
76315
76330
|
types.push(isTypeAssignableTo(type, templateConstraintType) ? type : stringType);
|
|
@@ -76705,13 +76720,13 @@ ${lanes.join("\n")}
|
|
|
76705
76720
|
function checkConstEnumAccess(node, type) {
|
|
76706
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 */;
|
|
76707
76722
|
if (!ok) {
|
|
76708
|
-
|
|
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);
|
|
76709
76724
|
}
|
|
76710
76725
|
if (getIsolatedModules(compilerOptions)) {
|
|
76711
76726
|
Debug.assert(!!(type.symbol.flags & 128 /* ConstEnum */));
|
|
76712
76727
|
const constEnumDeclaration = type.symbol.valueDeclaration;
|
|
76713
76728
|
if (constEnumDeclaration.flags & 16777216 /* Ambient */ && !isValidTypeOnlyAliasUseSite(node)) {
|
|
76714
|
-
|
|
76729
|
+
error2(node, Diagnostics.Cannot_access_ambient_const_enums_when_0_is_enabled, isolatedModulesLikeFlagName);
|
|
76715
76730
|
}
|
|
76716
76731
|
}
|
|
76717
76732
|
}
|
|
@@ -76852,7 +76867,7 @@ ${lanes.join("\n")}
|
|
|
76852
76867
|
const typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfDeclaration(node));
|
|
76853
76868
|
getBaseConstraintOfType(typeParameter);
|
|
76854
76869
|
if (!hasNonCircularTypeParameterDefault(typeParameter)) {
|
|
76855
|
-
|
|
76870
|
+
error2(node.default, Diagnostics.Type_parameter_0_has_a_circular_default, typeToString(typeParameter));
|
|
76856
76871
|
}
|
|
76857
76872
|
const constraintType = getConstraintOfTypeParameter(typeParameter);
|
|
76858
76873
|
const defaultType = getDefaultFromTypeParameter(typeParameter);
|
|
@@ -76870,7 +76885,7 @@ ${lanes.join("\n")}
|
|
|
76870
76885
|
if (modifiers) {
|
|
76871
76886
|
const symbol = getSymbolOfDeclaration(node.parent);
|
|
76872
76887
|
if (isTypeAliasDeclaration(node.parent) && !(getObjectFlags(getDeclaredTypeOfSymbol(symbol)) & (16 /* Anonymous */ | 32 /* Mapped */))) {
|
|
76873
|
-
|
|
76888
|
+
error2(node, Diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types);
|
|
76874
76889
|
} else if (modifiers === 32768 /* In */ || modifiers === 65536 /* Out */) {
|
|
76875
76890
|
(_a = tracing) == null ? void 0 : _a.push(tracing.Phase.CheckTypes, "checkTypeParameterDeferred", { parent: getTypeId(getDeclaredTypeOfSymbol(symbol)), id: getTypeId(typeParameter) });
|
|
76876
76891
|
const source = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSubTypeForCheck : markerSuperTypeForCheck);
|
|
@@ -76890,37 +76905,37 @@ ${lanes.join("\n")}
|
|
|
76890
76905
|
const func = getContainingFunction(node);
|
|
76891
76906
|
if (hasSyntacticModifier(node, 16476 /* ParameterPropertyModifier */)) {
|
|
76892
76907
|
if (!(func.kind === 175 /* Constructor */ && nodeIsPresent(func.body))) {
|
|
76893
|
-
|
|
76908
|
+
error2(node, Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation);
|
|
76894
76909
|
}
|
|
76895
76910
|
if (func.kind === 175 /* Constructor */ && isIdentifier(node.name) && node.name.escapedText === "constructor") {
|
|
76896
|
-
|
|
76911
|
+
error2(node.name, Diagnostics.constructor_cannot_be_used_as_a_parameter_property_name);
|
|
76897
76912
|
}
|
|
76898
76913
|
}
|
|
76899
76914
|
if (!node.initializer && isOptionalDeclaration(node) && isBindingPattern(node.name) && func.body) {
|
|
76900
|
-
|
|
76915
|
+
error2(node, Diagnostics.A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature);
|
|
76901
76916
|
}
|
|
76902
76917
|
if (node.name && isIdentifier(node.name) && (node.name.escapedText === "this" || node.name.escapedText === "new")) {
|
|
76903
76918
|
if (func.parameters.indexOf(node) !== 0) {
|
|
76904
|
-
|
|
76919
|
+
error2(node, Diagnostics.A_0_parameter_must_be_the_first_parameter, node.name.escapedText);
|
|
76905
76920
|
}
|
|
76906
76921
|
if (func.kind === 175 /* Constructor */ || func.kind === 179 /* ConstructSignature */ || func.kind === 184 /* ConstructorType */) {
|
|
76907
|
-
|
|
76922
|
+
error2(node, Diagnostics.A_constructor_cannot_have_a_this_parameter);
|
|
76908
76923
|
}
|
|
76909
76924
|
if (func.kind === 218 /* ArrowFunction */) {
|
|
76910
|
-
|
|
76925
|
+
error2(node, Diagnostics.An_arrow_function_cannot_have_a_this_parameter);
|
|
76911
76926
|
}
|
|
76912
76927
|
if (func.kind === 176 /* GetAccessor */ || func.kind === 177 /* SetAccessor */) {
|
|
76913
|
-
|
|
76928
|
+
error2(node, Diagnostics.get_and_set_accessors_cannot_declare_this_parameters);
|
|
76914
76929
|
}
|
|
76915
76930
|
}
|
|
76916
76931
|
if (node.dotDotDotToken && !isBindingPattern(node.name) && !isTypeAssignableTo(getReducedType(getTypeOfSymbol(node.symbol)), anyReadonlyArrayType)) {
|
|
76917
|
-
|
|
76932
|
+
error2(node, Diagnostics.A_rest_parameter_must_be_of_an_array_type);
|
|
76918
76933
|
}
|
|
76919
76934
|
}
|
|
76920
76935
|
function checkTypePredicate(node) {
|
|
76921
76936
|
const parent2 = getTypePredicateParent(node);
|
|
76922
76937
|
if (!parent2) {
|
|
76923
|
-
|
|
76938
|
+
error2(node, Diagnostics.A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods);
|
|
76924
76939
|
return;
|
|
76925
76940
|
}
|
|
76926
76941
|
const signature = getSignatureFromDeclaration(parent2);
|
|
@@ -76935,7 +76950,7 @@ ${lanes.join("\n")}
|
|
|
76935
76950
|
} else {
|
|
76936
76951
|
if (typePredicate.parameterIndex >= 0) {
|
|
76937
76952
|
if (signatureHasRestParameter(signature) && typePredicate.parameterIndex === signature.parameters.length - 1) {
|
|
76938
|
-
|
|
76953
|
+
error2(parameterName, Diagnostics.A_type_predicate_cannot_reference_a_rest_parameter);
|
|
76939
76954
|
} else {
|
|
76940
76955
|
if (typePredicate.type) {
|
|
76941
76956
|
const leadingError = () => chainDiagnosticMessages(
|
|
@@ -76962,7 +76977,7 @@ ${lanes.join("\n")}
|
|
|
76962
76977
|
}
|
|
76963
76978
|
}
|
|
76964
76979
|
if (!hasReportedError) {
|
|
76965
|
-
|
|
76980
|
+
error2(node.parameterName, Diagnostics.Cannot_find_parameter_0, typePredicate.parameterName);
|
|
76966
76981
|
}
|
|
76967
76982
|
}
|
|
76968
76983
|
}
|
|
@@ -76989,7 +77004,7 @@ ${lanes.join("\n")}
|
|
|
76989
77004
|
}
|
|
76990
77005
|
const name = element.name;
|
|
76991
77006
|
if (name.kind === 80 /* Identifier */ && name.escapedText === predicateVariableName) {
|
|
76992
|
-
|
|
77007
|
+
error2(
|
|
76993
77008
|
predicateVariableNode,
|
|
76994
77009
|
Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern,
|
|
76995
77010
|
predicateVariableName
|
|
@@ -77037,10 +77052,10 @@ ${lanes.join("\n")}
|
|
|
77037
77052
|
if (noImplicitAny && !returnTypeNode) {
|
|
77038
77053
|
switch (node.kind) {
|
|
77039
77054
|
case 179 /* ConstructSignature */:
|
|
77040
|
-
|
|
77055
|
+
error2(node, Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type);
|
|
77041
77056
|
break;
|
|
77042
77057
|
case 178 /* CallSignature */:
|
|
77043
|
-
|
|
77058
|
+
error2(node, Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type);
|
|
77044
77059
|
break;
|
|
77045
77060
|
}
|
|
77046
77061
|
}
|
|
@@ -77049,7 +77064,7 @@ ${lanes.join("\n")}
|
|
|
77049
77064
|
if ((functionFlags2 & (4 /* Invalid */ | 1 /* Generator */)) === 1 /* Generator */) {
|
|
77050
77065
|
const returnType = getTypeFromTypeNode(returnTypeNode);
|
|
77051
77066
|
if (returnType === voidType) {
|
|
77052
|
-
|
|
77067
|
+
error2(returnTypeNode, Diagnostics.A_generator_cannot_have_a_void_type_annotation);
|
|
77053
77068
|
} else {
|
|
77054
77069
|
const generatorYieldType = getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || anyType;
|
|
77055
77070
|
const generatorReturnType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || generatorYieldType;
|
|
@@ -77109,16 +77124,16 @@ ${lanes.join("\n")}
|
|
|
77109
77124
|
const prev = names.get(name);
|
|
77110
77125
|
if (prev) {
|
|
77111
77126
|
if ((prev & 16 /* PrivateStatic */) !== (meaning & 16 /* PrivateStatic */)) {
|
|
77112
|
-
|
|
77127
|
+
error2(location, Diagnostics.Duplicate_identifier_0_Static_and_instance_elements_cannot_share_the_same_private_name, getTextOfNode(location));
|
|
77113
77128
|
} else {
|
|
77114
77129
|
const prevIsMethod = !!(prev & 8 /* Method */);
|
|
77115
77130
|
const isMethod = !!(meaning & 8 /* Method */);
|
|
77116
77131
|
if (prevIsMethod || isMethod) {
|
|
77117
77132
|
if (prevIsMethod !== isMethod) {
|
|
77118
|
-
|
|
77133
|
+
error2(location, Diagnostics.Duplicate_identifier_0, getTextOfNode(location));
|
|
77119
77134
|
}
|
|
77120
77135
|
} else if (prev & meaning & ~16 /* PrivateStatic */) {
|
|
77121
|
-
|
|
77136
|
+
error2(location, Diagnostics.Duplicate_identifier_0, getTextOfNode(location));
|
|
77122
77137
|
} else {
|
|
77123
77138
|
names.set(name, prev | meaning);
|
|
77124
77139
|
}
|
|
@@ -77145,7 +77160,7 @@ ${lanes.join("\n")}
|
|
|
77145
77160
|
case "prototype":
|
|
77146
77161
|
const message = Diagnostics.Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1;
|
|
77147
77162
|
const className = getNameOfSymbolAsWritten(getSymbolOfDeclaration(node));
|
|
77148
|
-
|
|
77163
|
+
error2(memberNameNode, message, memberName, className);
|
|
77149
77164
|
break;
|
|
77150
77165
|
}
|
|
77151
77166
|
}
|
|
@@ -77169,8 +77184,8 @@ ${lanes.join("\n")}
|
|
|
77169
77184
|
continue;
|
|
77170
77185
|
}
|
|
77171
77186
|
if (names.get(memberName)) {
|
|
77172
|
-
|
|
77173
|
-
|
|
77187
|
+
error2(getNameOfDeclaration(member.symbol.valueDeclaration), Diagnostics.Duplicate_identifier_0, memberName);
|
|
77188
|
+
error2(member.name, Diagnostics.Duplicate_identifier_0, memberName);
|
|
77174
77189
|
} else {
|
|
77175
77190
|
names.set(memberName, true);
|
|
77176
77191
|
}
|
|
@@ -77202,7 +77217,7 @@ ${lanes.join("\n")}
|
|
|
77202
77217
|
indexSignatureMap.forEach((entry) => {
|
|
77203
77218
|
if (entry.declarations.length > 1) {
|
|
77204
77219
|
for (const declaration of entry.declarations) {
|
|
77205
|
-
|
|
77220
|
+
error2(declaration, Diagnostics.Duplicate_index_signature_for_type_0, typeToString(entry.type));
|
|
77206
77221
|
}
|
|
77207
77222
|
}
|
|
77208
77223
|
});
|
|
@@ -77214,12 +77229,12 @@ ${lanes.join("\n")}
|
|
|
77214
77229
|
checkVariableLikeDeclaration(node);
|
|
77215
77230
|
setNodeLinksForPrivateIdentifierScope(node);
|
|
77216
77231
|
if (hasSyntacticModifier(node, 256 /* Abstract */) && node.kind === 171 /* PropertyDeclaration */ && node.initializer) {
|
|
77217
|
-
|
|
77232
|
+
error2(node, Diagnostics.Property_0_cannot_have_an_initializer_because_it_is_marked_abstract, declarationNameToString(node.name));
|
|
77218
77233
|
}
|
|
77219
77234
|
}
|
|
77220
77235
|
function checkPropertySignature(node) {
|
|
77221
77236
|
if (isPrivateIdentifier(node.name)) {
|
|
77222
|
-
|
|
77237
|
+
error2(node, Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);
|
|
77223
77238
|
}
|
|
77224
77239
|
return checkPropertyDeclaration(node);
|
|
77225
77240
|
}
|
|
@@ -77227,14 +77242,14 @@ ${lanes.join("\n")}
|
|
|
77227
77242
|
if (!checkGrammarMethod(node))
|
|
77228
77243
|
checkGrammarComputedPropertyName(node.name);
|
|
77229
77244
|
if (isMethodDeclaration(node) && node.asteriskToken && isIdentifier(node.name) && idText(node.name) === "constructor") {
|
|
77230
|
-
|
|
77245
|
+
error2(node.name, Diagnostics.Class_constructor_may_not_be_a_generator);
|
|
77231
77246
|
}
|
|
77232
77247
|
checkFunctionOrMethodDeclaration(node);
|
|
77233
77248
|
if (hasSyntacticModifier(node, 256 /* Abstract */) && node.kind === 173 /* MethodDeclaration */ && node.body) {
|
|
77234
|
-
|
|
77249
|
+
error2(node, Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, declarationNameToString(node.name));
|
|
77235
77250
|
}
|
|
77236
77251
|
if (isPrivateIdentifier(node.name) && !getContainingClass(node)) {
|
|
77237
|
-
|
|
77252
|
+
error2(node, Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);
|
|
77238
77253
|
}
|
|
77239
77254
|
setNodeLinksForPrivateIdentifierScope(node);
|
|
77240
77255
|
}
|
|
@@ -77285,12 +77300,12 @@ ${lanes.join("\n")}
|
|
|
77285
77300
|
const superCall = findFirstSuperCall(node.body);
|
|
77286
77301
|
if (superCall) {
|
|
77287
77302
|
if (classExtendsNull) {
|
|
77288
|
-
|
|
77303
|
+
error2(superCall, Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null);
|
|
77289
77304
|
}
|
|
77290
77305
|
const superCallShouldBeRootLevel = (getEmitScriptTarget(compilerOptions) !== 99 /* ESNext */ || !useDefineForClassFields) && (some(node.parent.members, isInstancePropertyWithInitializerOrPrivateIdentifierProperty) || some(node.parameters, (p) => hasSyntacticModifier(p, 16476 /* ParameterPropertyModifier */)));
|
|
77291
77306
|
if (superCallShouldBeRootLevel) {
|
|
77292
77307
|
if (!superCallIsRootLevelInConstructor(superCall, node.body)) {
|
|
77293
|
-
|
|
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);
|
|
77294
77309
|
} else {
|
|
77295
77310
|
let superCallStatement;
|
|
77296
77311
|
for (const statement of node.body.statements) {
|
|
@@ -77303,12 +77318,12 @@ ${lanes.join("\n")}
|
|
|
77303
77318
|
}
|
|
77304
77319
|
}
|
|
77305
77320
|
if (superCallStatement === void 0) {
|
|
77306
|
-
|
|
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);
|
|
77307
77322
|
}
|
|
77308
77323
|
}
|
|
77309
77324
|
}
|
|
77310
77325
|
} else if (!classExtendsNull) {
|
|
77311
|
-
|
|
77326
|
+
error2(node, Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call);
|
|
77312
77327
|
}
|
|
77313
77328
|
}
|
|
77314
77329
|
}
|
|
@@ -77328,7 +77343,7 @@ ${lanes.join("\n")}
|
|
|
77328
77343
|
}
|
|
77329
77344
|
function checkAccessorDeclaration(node) {
|
|
77330
77345
|
if (isIdentifier(node.name) && idText(node.name) === "constructor" && isClassLike(node.parent)) {
|
|
77331
|
-
|
|
77346
|
+
error2(node.name, Diagnostics.Class_constructor_may_not_be_an_accessor);
|
|
77332
77347
|
}
|
|
77333
77348
|
addLazyDiagnostic(checkAccessorDeclarationDiagnostics);
|
|
77334
77349
|
checkSourceElement(node.body);
|
|
@@ -77341,7 +77356,7 @@ ${lanes.join("\n")}
|
|
|
77341
77356
|
if (node.kind === 176 /* GetAccessor */) {
|
|
77342
77357
|
if (!(node.flags & 16777216 /* Ambient */) && nodeIsPresent(node.body) && node.flags & 256 /* HasImplicitReturn */) {
|
|
77343
77358
|
if (!(node.flags & 512 /* HasExplicitReturn */)) {
|
|
77344
|
-
|
|
77359
|
+
error2(node.name, Diagnostics.A_get_accessor_must_return_a_value);
|
|
77345
77360
|
}
|
|
77346
77361
|
}
|
|
77347
77362
|
}
|
|
@@ -77357,12 +77372,12 @@ ${lanes.join("\n")}
|
|
|
77357
77372
|
const getterFlags = getEffectiveModifierFlags(getter);
|
|
77358
77373
|
const setterFlags = getEffectiveModifierFlags(setter);
|
|
77359
77374
|
if ((getterFlags & 256 /* Abstract */) !== (setterFlags & 256 /* Abstract */)) {
|
|
77360
|
-
|
|
77361
|
-
|
|
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);
|
|
77362
77377
|
}
|
|
77363
77378
|
if (getterFlags & 16 /* Protected */ && !(setterFlags & (16 /* Protected */ | 8 /* Private */)) || getterFlags & 8 /* Private */ && !(setterFlags & 8 /* Private */)) {
|
|
77364
|
-
|
|
77365
|
-
|
|
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);
|
|
77366
77381
|
}
|
|
77367
77382
|
}
|
|
77368
77383
|
}
|
|
@@ -77500,7 +77515,7 @@ ${lanes.join("\n")}
|
|
|
77500
77515
|
if (flags & 8 /* Variadic */) {
|
|
77501
77516
|
const type = getTypeFromTypeNode(e.type);
|
|
77502
77517
|
if (!isArrayLikeType(type)) {
|
|
77503
|
-
|
|
77518
|
+
error2(e, Diagnostics.A_rest_element_type_must_be_an_array_type);
|
|
77504
77519
|
break;
|
|
77505
77520
|
}
|
|
77506
77521
|
if (isArrayType(type) || isTupleType(type) && type.target.combinedFlags & 4 /* Rest */) {
|
|
@@ -77538,7 +77553,7 @@ ${lanes.join("\n")}
|
|
|
77538
77553
|
const indexType = type.indexType;
|
|
77539
77554
|
if (isTypeAssignableTo(indexType, getIndexType(objectType, 0 /* None */))) {
|
|
77540
77555
|
if (accessNode.kind === 211 /* ElementAccessExpression */ && isAssignmentTarget(accessNode) && getObjectFlags(objectType) & 32 /* Mapped */ && getMappedTypeModifiers(objectType) & 1 /* IncludeReadonly */) {
|
|
77541
|
-
|
|
77556
|
+
error2(accessNode, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
|
|
77542
77557
|
}
|
|
77543
77558
|
return type;
|
|
77544
77559
|
}
|
|
@@ -77551,12 +77566,12 @@ ${lanes.join("\n")}
|
|
|
77551
77566
|
if (propertyName) {
|
|
77552
77567
|
const propertySymbol = forEachType(apparentObjectType, (t) => getPropertyOfType(t, propertyName));
|
|
77553
77568
|
if (propertySymbol && getDeclarationModifierFlagsFromSymbol(propertySymbol) & 24 /* NonPublicAccessibilityModifier */) {
|
|
77554
|
-
|
|
77569
|
+
error2(accessNode, Diagnostics.Private_or_protected_member_0_cannot_be_accessed_on_a_type_parameter, unescapeLeadingUnderscores(propertyName));
|
|
77555
77570
|
return errorType;
|
|
77556
77571
|
}
|
|
77557
77572
|
}
|
|
77558
77573
|
}
|
|
77559
|
-
|
|
77574
|
+
error2(accessNode, Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType));
|
|
77560
77575
|
return errorType;
|
|
77561
77576
|
}
|
|
77562
77577
|
function checkIndexedAccessType(node) {
|
|
@@ -77612,7 +77627,7 @@ ${lanes.join("\n")}
|
|
|
77612
77627
|
if (!areTypeParametersIdentical(declarations, [typeParameter], (decl) => [decl])) {
|
|
77613
77628
|
const name = symbolToString(symbol);
|
|
77614
77629
|
for (const declaration of declarations) {
|
|
77615
|
-
|
|
77630
|
+
error2(declaration.name, Diagnostics.All_declarations_of_0_must_have_identical_constraints, name);
|
|
77616
77631
|
}
|
|
77617
77632
|
}
|
|
77618
77633
|
}
|
|
@@ -77683,13 +77698,13 @@ ${lanes.join("\n")}
|
|
|
77683
77698
|
forEach(overloads, (o) => {
|
|
77684
77699
|
const deviation = getEffectiveDeclarationFlags(o, flagsToCheck2) ^ canonicalFlags;
|
|
77685
77700
|
if (deviation & 1 /* Export */) {
|
|
77686
|
-
|
|
77701
|
+
error2(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_exported_or_non_exported);
|
|
77687
77702
|
} else if (deviation & 2 /* Ambient */) {
|
|
77688
|
-
|
|
77703
|
+
error2(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_ambient_or_non_ambient);
|
|
77689
77704
|
} else if (deviation & (8 /* Private */ | 16 /* Protected */)) {
|
|
77690
|
-
|
|
77705
|
+
error2(getNameOfDeclaration(o) || o, Diagnostics.Overload_signatures_must_all_be_public_private_or_protected);
|
|
77691
77706
|
} else if (deviation & 256 /* Abstract */) {
|
|
77692
|
-
|
|
77707
|
+
error2(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_abstract_or_non_abstract);
|
|
77693
77708
|
}
|
|
77694
77709
|
});
|
|
77695
77710
|
}
|
|
@@ -77700,7 +77715,7 @@ ${lanes.join("\n")}
|
|
|
77700
77715
|
forEach(overloads, (o) => {
|
|
77701
77716
|
const deviation = hasQuestionToken(o) !== canonicalHasQuestionToken;
|
|
77702
77717
|
if (deviation) {
|
|
77703
|
-
|
|
77718
|
+
error2(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_optional_or_required);
|
|
77704
77719
|
}
|
|
77705
77720
|
});
|
|
77706
77721
|
}
|
|
@@ -77739,24 +77754,24 @@ ${lanes.join("\n")}
|
|
|
77739
77754
|
const reportError = (node.kind === 173 /* MethodDeclaration */ || node.kind === 172 /* MethodSignature */) && isStatic(node) !== isStatic(subsequentNode);
|
|
77740
77755
|
if (reportError) {
|
|
77741
77756
|
const diagnostic = isStatic(node) ? Diagnostics.Function_overload_must_be_static : Diagnostics.Function_overload_must_not_be_static;
|
|
77742
|
-
|
|
77757
|
+
error2(errorNode2, diagnostic);
|
|
77743
77758
|
}
|
|
77744
77759
|
return;
|
|
77745
77760
|
}
|
|
77746
77761
|
if (nodeIsPresent(subsequentNode.body)) {
|
|
77747
|
-
|
|
77762
|
+
error2(errorNode2, Diagnostics.Function_implementation_name_must_be_0, declarationNameToString(node.name));
|
|
77748
77763
|
return;
|
|
77749
77764
|
}
|
|
77750
77765
|
}
|
|
77751
77766
|
}
|
|
77752
77767
|
const errorNode = node.name || node;
|
|
77753
77768
|
if (isConstructor) {
|
|
77754
|
-
|
|
77769
|
+
error2(errorNode, Diagnostics.Constructor_implementation_is_missing);
|
|
77755
77770
|
} else {
|
|
77756
77771
|
if (hasSyntacticModifier(node, 256 /* Abstract */)) {
|
|
77757
|
-
|
|
77772
|
+
error2(errorNode, Diagnostics.All_declarations_of_an_abstract_method_must_be_consecutive);
|
|
77758
77773
|
} else {
|
|
77759
|
-
|
|
77774
|
+
error2(errorNode, Diagnostics.Function_implementation_is_missing_or_not_immediately_following_the_declaration);
|
|
77760
77775
|
}
|
|
77761
77776
|
}
|
|
77762
77777
|
}
|
|
@@ -77819,12 +77834,12 @@ ${lanes.join("\n")}
|
|
|
77819
77834
|
}
|
|
77820
77835
|
if (multipleConstructorImplementation) {
|
|
77821
77836
|
forEach(functionDeclarations, (declaration) => {
|
|
77822
|
-
|
|
77837
|
+
error2(declaration, Diagnostics.Multiple_constructor_implementations_are_not_allowed);
|
|
77823
77838
|
});
|
|
77824
77839
|
}
|
|
77825
77840
|
if (duplicateFunctionDeclaration) {
|
|
77826
77841
|
forEach(functionDeclarations, (declaration) => {
|
|
77827
|
-
|
|
77842
|
+
error2(getNameOfDeclaration(declaration) || declaration, Diagnostics.Duplicate_function_implementation);
|
|
77828
77843
|
});
|
|
77829
77844
|
}
|
|
77830
77845
|
if (hasNonAmbientClass && !isConstructor && symbol.flags & 16 /* Function */ && declarations) {
|
|
@@ -77833,7 +77848,7 @@ ${lanes.join("\n")}
|
|
|
77833
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;
|
|
77834
77849
|
if (diagnostic) {
|
|
77835
77850
|
addRelatedInfo(
|
|
77836
|
-
|
|
77851
|
+
error2(getNameOfDeclaration(declaration) || declaration, diagnostic, symbolName(symbol)),
|
|
77837
77852
|
...relatedDiagnostics
|
|
77838
77853
|
);
|
|
77839
77854
|
}
|
|
@@ -77854,7 +77869,7 @@ ${lanes.join("\n")}
|
|
|
77854
77869
|
if (!isImplementationCompatibleWithOverload(bodySignature, signature)) {
|
|
77855
77870
|
const errorNode = signature.declaration && isJSDocSignature(signature.declaration) ? signature.declaration.parent.tagName : signature.declaration;
|
|
77856
77871
|
addRelatedInfo(
|
|
77857
|
-
|
|
77872
|
+
error2(errorNode, Diagnostics.This_overload_signature_is_not_compatible_with_its_implementation_signature),
|
|
77858
77873
|
createDiagnosticForNode(bodyDeclaration, Diagnostics.The_implementation_signature_is_declared_here)
|
|
77859
77874
|
);
|
|
77860
77875
|
break;
|
|
@@ -77901,9 +77916,9 @@ ${lanes.join("\n")}
|
|
|
77901
77916
|
const declarationSpaces = getDeclarationSpaces(d);
|
|
77902
77917
|
const name = getNameOfDeclaration(d);
|
|
77903
77918
|
if (declarationSpaces & commonDeclarationSpacesForDefaultAndNonDefault) {
|
|
77904
|
-
|
|
77919
|
+
error2(name, Diagnostics.Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead, declarationNameToString(name));
|
|
77905
77920
|
} else if (declarationSpaces & commonDeclarationSpacesForExportsAndLocals) {
|
|
77906
|
-
|
|
77921
|
+
error2(name, Diagnostics.Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local, declarationNameToString(name));
|
|
77907
77922
|
}
|
|
77908
77923
|
}
|
|
77909
77924
|
}
|
|
@@ -77983,7 +77998,7 @@ ${lanes.join("\n")}
|
|
|
77983
77998
|
const thenSignatures = thenFunction ? getSignaturesOfType(thenFunction, 0 /* Call */) : emptyArray;
|
|
77984
77999
|
if (thenSignatures.length === 0) {
|
|
77985
78000
|
if (errorNode) {
|
|
77986
|
-
|
|
78001
|
+
error2(errorNode, Diagnostics.A_promise_must_have_a_then_method);
|
|
77987
78002
|
}
|
|
77988
78003
|
return void 0;
|
|
77989
78004
|
}
|
|
@@ -78003,7 +78018,7 @@ ${lanes.join("\n")}
|
|
|
78003
78018
|
thisTypeForErrorOut.value = thisTypeForError;
|
|
78004
78019
|
}
|
|
78005
78020
|
if (errorNode) {
|
|
78006
|
-
|
|
78021
|
+
error2(errorNode, Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1, typeToString(type), typeToString(thisTypeForError));
|
|
78007
78022
|
}
|
|
78008
78023
|
return void 0;
|
|
78009
78024
|
}
|
|
@@ -78014,7 +78029,7 @@ ${lanes.join("\n")}
|
|
|
78014
78029
|
const onfulfilledParameterSignatures = getSignaturesOfType(onfulfilledParameterType, 0 /* Call */);
|
|
78015
78030
|
if (onfulfilledParameterSignatures.length === 0) {
|
|
78016
78031
|
if (errorNode) {
|
|
78017
|
-
|
|
78032
|
+
error2(errorNode, Diagnostics.The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback);
|
|
78018
78033
|
}
|
|
78019
78034
|
return void 0;
|
|
78020
78035
|
}
|
|
@@ -78095,7 +78110,7 @@ ${lanes.join("\n")}
|
|
|
78095
78110
|
if (type.flags & 1048576 /* Union */) {
|
|
78096
78111
|
if (awaitedTypeStack.lastIndexOf(type.id) >= 0) {
|
|
78097
78112
|
if (errorNode) {
|
|
78098
|
-
|
|
78113
|
+
error2(errorNode, Diagnostics.Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method);
|
|
78099
78114
|
}
|
|
78100
78115
|
return void 0;
|
|
78101
78116
|
}
|
|
@@ -78118,7 +78133,7 @@ ${lanes.join("\n")}
|
|
|
78118
78133
|
if (promisedType) {
|
|
78119
78134
|
if (type.id === promisedType.id || awaitedTypeStack.lastIndexOf(promisedType.id) >= 0) {
|
|
78120
78135
|
if (errorNode) {
|
|
78121
|
-
|
|
78136
|
+
error2(errorNode, Diagnostics.Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method);
|
|
78122
78137
|
}
|
|
78123
78138
|
return void 0;
|
|
78124
78139
|
}
|
|
@@ -78155,7 +78170,7 @@ ${lanes.join("\n")}
|
|
|
78155
78170
|
true
|
|
78156
78171
|
);
|
|
78157
78172
|
if (globalPromiseType !== emptyGenericType && !isReferenceToType2(returnType, globalPromiseType)) {
|
|
78158
|
-
|
|
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));
|
|
78159
78174
|
return;
|
|
78160
78175
|
}
|
|
78161
78176
|
} else {
|
|
@@ -78165,7 +78180,7 @@ ${lanes.join("\n")}
|
|
|
78165
78180
|
}
|
|
78166
78181
|
const promiseConstructorName = getEntityNameFromTypeNode(returnTypeNode);
|
|
78167
78182
|
if (promiseConstructorName === void 0) {
|
|
78168
|
-
|
|
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));
|
|
78169
78184
|
return;
|
|
78170
78185
|
}
|
|
78171
78186
|
const promiseConstructorSymbol = resolveEntityName(
|
|
@@ -78180,9 +78195,9 @@ ${lanes.join("\n")}
|
|
|
78180
78195
|
/*reportErrors*/
|
|
78181
78196
|
false
|
|
78182
78197
|
)) {
|
|
78183
|
-
|
|
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);
|
|
78184
78199
|
} else {
|
|
78185
|
-
|
|
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));
|
|
78186
78201
|
}
|
|
78187
78202
|
return;
|
|
78188
78203
|
}
|
|
@@ -78191,7 +78206,7 @@ ${lanes.join("\n")}
|
|
|
78191
78206
|
true
|
|
78192
78207
|
);
|
|
78193
78208
|
if (globalPromiseConstructorLikeType === emptyObjectType) {
|
|
78194
|
-
|
|
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));
|
|
78195
78210
|
return;
|
|
78196
78211
|
}
|
|
78197
78212
|
if (!checkTypeAssignableTo(
|
|
@@ -78205,7 +78220,7 @@ ${lanes.join("\n")}
|
|
|
78205
78220
|
const rootName = promiseConstructorName && getFirstIdentifier(promiseConstructorName);
|
|
78206
78221
|
const collidingSymbol = getSymbol2(node.locals, rootName.escapedText, 111551 /* Value */);
|
|
78207
78222
|
if (collidingSymbol) {
|
|
78208
|
-
|
|
78223
|
+
error2(
|
|
78209
78224
|
collidingSymbol.valueDeclaration,
|
|
78210
78225
|
Diagnostics.Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions,
|
|
78211
78226
|
idText(rootName),
|
|
@@ -78318,7 +78333,7 @@ ${lanes.join("\n")}
|
|
|
78318
78333
|
if (canCollectSymbolAliasAccessabilityData && symbolIsValue(rootSymbol) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol)) && !getTypeOnlyAliasDeclaration(rootSymbol)) {
|
|
78319
78334
|
markAliasSymbolAsReferenced(rootSymbol);
|
|
78320
78335
|
} else if (forDecoratorMetadata && getIsolatedModules(compilerOptions) && getEmitModuleKind(compilerOptions) >= 5 /* ES2015 */ && !symbolIsValue(rootSymbol) && !some(rootSymbol.declarations, isTypeOnlyImportOrExportDeclaration)) {
|
|
78321
|
-
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);
|
|
78322
78337
|
const aliasDeclaration = find(rootSymbol.declarations || emptyArray, isAliasSymbolDeclaration2);
|
|
78323
78338
|
if (aliasDeclaration) {
|
|
78324
78339
|
addRelatedInfo(diag2, createDiagnosticForNode(aliasDeclaration, Diagnostics._0_was_imported_here, idText(rootName)));
|
|
@@ -78466,7 +78481,7 @@ ${lanes.join("\n")}
|
|
|
78466
78481
|
}
|
|
78467
78482
|
function checkJSDocTypeAliasTag(node) {
|
|
78468
78483
|
if (!node.typeExpression) {
|
|
78469
|
-
|
|
78484
|
+
error2(node.name, Diagnostics.JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags);
|
|
78470
78485
|
}
|
|
78471
78486
|
if (node.name) {
|
|
78472
78487
|
checkTypeNameIsReserved(node.name, Diagnostics.Type_alias_name_cannot_be_0);
|
|
@@ -78491,7 +78506,7 @@ ${lanes.join("\n")}
|
|
|
78491
78506
|
if (length(tags) > 1) {
|
|
78492
78507
|
for (let i = 1; i < length(tags); i++) {
|
|
78493
78508
|
const tagName = tags[i].tagName;
|
|
78494
|
-
|
|
78509
|
+
error2(tagName, Diagnostics._0_tag_already_specified, idText(tagName));
|
|
78495
78510
|
}
|
|
78496
78511
|
}
|
|
78497
78512
|
}
|
|
@@ -78523,33 +78538,33 @@ ${lanes.join("\n")}
|
|
|
78523
78538
|
function checkJSDocImplementsTag(node) {
|
|
78524
78539
|
const classLike = getEffectiveJSDocHost(node);
|
|
78525
78540
|
if (!classLike || !isClassDeclaration(classLike) && !isClassExpression(classLike)) {
|
|
78526
|
-
|
|
78541
|
+
error2(classLike, Diagnostics.JSDoc_0_is_not_attached_to_a_class, idText(node.tagName));
|
|
78527
78542
|
}
|
|
78528
78543
|
}
|
|
78529
78544
|
function checkJSDocAugmentsTag(node) {
|
|
78530
78545
|
const classLike = getEffectiveJSDocHost(node);
|
|
78531
78546
|
if (!classLike || !isClassDeclaration(classLike) && !isClassExpression(classLike)) {
|
|
78532
|
-
|
|
78547
|
+
error2(classLike, Diagnostics.JSDoc_0_is_not_attached_to_a_class, idText(node.tagName));
|
|
78533
78548
|
return;
|
|
78534
78549
|
}
|
|
78535
78550
|
const augmentsTags = getJSDocTags(classLike).filter(isJSDocAugmentsTag);
|
|
78536
78551
|
Debug.assert(augmentsTags.length > 0);
|
|
78537
78552
|
if (augmentsTags.length > 1) {
|
|
78538
|
-
|
|
78553
|
+
error2(augmentsTags[1], Diagnostics.Class_declarations_cannot_have_more_than_one_augments_or_extends_tag);
|
|
78539
78554
|
}
|
|
78540
78555
|
const name = getIdentifierFromEntityNameExpression(node.class.expression);
|
|
78541
78556
|
const extend2 = getClassExtendsHeritageElement(classLike);
|
|
78542
78557
|
if (extend2) {
|
|
78543
78558
|
const className = getIdentifierFromEntityNameExpression(extend2.expression);
|
|
78544
78559
|
if (className && name.escapedText !== className.escapedText) {
|
|
78545
|
-
|
|
78560
|
+
error2(name, Diagnostics.JSDoc_0_1_does_not_match_the_extends_2_clause, idText(node.tagName), idText(name), idText(className));
|
|
78546
78561
|
}
|
|
78547
78562
|
}
|
|
78548
78563
|
}
|
|
78549
78564
|
function checkJSDocAccessibilityModifiers(node) {
|
|
78550
78565
|
const host2 = getJSDocHost(node);
|
|
78551
78566
|
if (host2 && isPrivateIdentifierClassElementDeclaration(host2)) {
|
|
78552
|
-
|
|
78567
|
+
error2(node, Diagnostics.An_accessibility_modifier_cannot_be_used_with_a_private_identifier);
|
|
78553
78568
|
}
|
|
78554
78569
|
}
|
|
78555
78570
|
function getIdentifierFromEntityNameExpression(node) {
|
|
@@ -78591,7 +78606,7 @@ ${lanes.join("\n")}
|
|
|
78591
78606
|
if (isInJSFile(node)) {
|
|
78592
78607
|
const typeTag = getJSDocTypeTag(node);
|
|
78593
78608
|
if (typeTag && typeTag.typeExpression && !getContextualCallSignature(getTypeFromTypeNode(typeTag.typeExpression), node)) {
|
|
78594
|
-
|
|
78609
|
+
error2(typeTag.typeExpression.type, Diagnostics.The_type_of_a_function_declaration_must_match_the_function_s_signature);
|
|
78595
78610
|
}
|
|
78596
78611
|
}
|
|
78597
78612
|
function checkFunctionOrMethodDeclarationDiagnostics() {
|
|
@@ -78915,9 +78930,9 @@ ${lanes.join("\n")}
|
|
|
78915
78930
|
if (getNodeCheckFlags(current) & 4 /* CaptureThis */) {
|
|
78916
78931
|
const isDeclaration2 = node.kind !== 80 /* Identifier */;
|
|
78917
78932
|
if (isDeclaration2) {
|
|
78918
|
-
|
|
78933
|
+
error2(getNameOfDeclaration(node), Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference);
|
|
78919
78934
|
} else {
|
|
78920
|
-
|
|
78935
|
+
error2(node, Diagnostics.Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference);
|
|
78921
78936
|
}
|
|
78922
78937
|
return true;
|
|
78923
78938
|
}
|
|
@@ -78929,9 +78944,9 @@ ${lanes.join("\n")}
|
|
|
78929
78944
|
if (getNodeCheckFlags(current) & 8 /* CaptureNewTarget */) {
|
|
78930
78945
|
const isDeclaration2 = node.kind !== 80 /* Identifier */;
|
|
78931
78946
|
if (isDeclaration2) {
|
|
78932
|
-
|
|
78947
|
+
error2(getNameOfDeclaration(node), Diagnostics.Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference);
|
|
78933
78948
|
} else {
|
|
78934
|
-
|
|
78949
|
+
error2(node, Diagnostics.Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference);
|
|
78935
78950
|
}
|
|
78936
78951
|
return true;
|
|
78937
78952
|
}
|
|
@@ -79069,7 +79084,7 @@ ${lanes.join("\n")}
|
|
|
79069
79084
|
const namesShareScope = container && (container.kind === 240 /* Block */ && isFunctionLike(container.parent) || container.kind === 267 /* ModuleBlock */ || container.kind === 266 /* ModuleDeclaration */ || container.kind === 311 /* SourceFile */);
|
|
79070
79085
|
if (!namesShareScope) {
|
|
79071
79086
|
const name = symbolToString(localDeclarationSymbol);
|
|
79072
|
-
|
|
79087
|
+
error2(node, Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name);
|
|
79073
79088
|
}
|
|
79074
79089
|
}
|
|
79075
79090
|
}
|
|
@@ -79140,7 +79155,7 @@ ${lanes.join("\n")}
|
|
|
79140
79155
|
forEach(node.name.elements, checkSourceElement);
|
|
79141
79156
|
}
|
|
79142
79157
|
if (isParameter(node) && node.initializer && nodeIsMissing(getContainingFunction(node).body)) {
|
|
79143
|
-
|
|
79158
|
+
error2(node, Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation);
|
|
79144
79159
|
return;
|
|
79145
79160
|
}
|
|
79146
79161
|
if (isBindingPattern(node.name)) {
|
|
@@ -79192,7 +79207,7 @@ ${lanes.join("\n")}
|
|
|
79192
79207
|
}
|
|
79193
79208
|
if (symbol.declarations && symbol.declarations.length > 1) {
|
|
79194
79209
|
if (some(symbol.declarations, (d) => d !== node && isVariableLike(d) && !areDeclarationFlagsIdentical(d, node))) {
|
|
79195
|
-
|
|
79210
|
+
error2(node.name, Diagnostics.All_declarations_of_0_must_have_identical_modifiers, declarationNameToString(node.name));
|
|
79196
79211
|
}
|
|
79197
79212
|
}
|
|
79198
79213
|
} else {
|
|
@@ -79211,7 +79226,7 @@ ${lanes.join("\n")}
|
|
|
79211
79226
|
);
|
|
79212
79227
|
}
|
|
79213
79228
|
if (symbol.valueDeclaration && !areDeclarationFlagsIdentical(node, symbol.valueDeclaration)) {
|
|
79214
|
-
|
|
79229
|
+
error2(node.name, Diagnostics.All_declarations_of_0_must_have_identical_modifiers, declarationNameToString(node.name));
|
|
79215
79230
|
}
|
|
79216
79231
|
}
|
|
79217
79232
|
if (node.kind !== 171 /* PropertyDeclaration */ && node.kind !== 170 /* PropertySignature */) {
|
|
@@ -79226,7 +79241,7 @@ ${lanes.join("\n")}
|
|
|
79226
79241
|
const nextDeclarationName = getNameOfDeclaration(nextDeclaration);
|
|
79227
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;
|
|
79228
79243
|
const declName = declarationNameToString(nextDeclarationName);
|
|
79229
|
-
const err =
|
|
79244
|
+
const err = error2(
|
|
79230
79245
|
nextDeclarationName,
|
|
79231
79246
|
message,
|
|
79232
79247
|
declName,
|
|
@@ -79276,7 +79291,7 @@ ${lanes.join("\n")}
|
|
|
79276
79291
|
checkTestingKnownTruthyCallableOrAwaitableType(node.expression, type, node.thenStatement);
|
|
79277
79292
|
checkSourceElement(node.thenStatement);
|
|
79278
79293
|
if (node.thenStatement.kind === 241 /* EmptyStatement */) {
|
|
79279
|
-
|
|
79294
|
+
error2(node.thenStatement, Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement);
|
|
79280
79295
|
}
|
|
79281
79296
|
checkSourceElement(node.elseStatement);
|
|
79282
79297
|
}
|
|
@@ -79326,7 +79341,7 @@ ${lanes.join("\n")}
|
|
|
79326
79341
|
getTypeNameForErrorDisplay(type)
|
|
79327
79342
|
);
|
|
79328
79343
|
} else {
|
|
79329
|
-
|
|
79344
|
+
error2(location, Diagnostics.This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_instead);
|
|
79330
79345
|
}
|
|
79331
79346
|
}
|
|
79332
79347
|
}
|
|
@@ -79392,7 +79407,7 @@ ${lanes.join("\n")}
|
|
|
79392
79407
|
}
|
|
79393
79408
|
function checkTruthinessOfType(type, node) {
|
|
79394
79409
|
if (type.flags & 16384 /* Void */) {
|
|
79395
|
-
|
|
79410
|
+
error2(node, Diagnostics.An_expression_of_type_void_cannot_be_tested_for_truthiness);
|
|
79396
79411
|
}
|
|
79397
79412
|
return type;
|
|
79398
79413
|
}
|
|
@@ -79466,16 +79481,16 @@ ${lanes.join("\n")}
|
|
|
79466
79481
|
if (node.initializer.kind === 260 /* VariableDeclarationList */) {
|
|
79467
79482
|
const variable = node.initializer.declarations[0];
|
|
79468
79483
|
if (variable && isBindingPattern(variable.name)) {
|
|
79469
|
-
|
|
79484
|
+
error2(variable.name, Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern);
|
|
79470
79485
|
}
|
|
79471
79486
|
checkForInOrForOfVariableDeclaration(node);
|
|
79472
79487
|
} else {
|
|
79473
79488
|
const varExpr = node.initializer;
|
|
79474
79489
|
const leftType = checkExpression(varExpr);
|
|
79475
79490
|
if (varExpr.kind === 208 /* ArrayLiteralExpression */ || varExpr.kind === 209 /* ObjectLiteralExpression */) {
|
|
79476
|
-
|
|
79491
|
+
error2(varExpr, Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern);
|
|
79477
79492
|
} else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) {
|
|
79478
|
-
|
|
79493
|
+
error2(varExpr, Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any);
|
|
79479
79494
|
} else {
|
|
79480
79495
|
checkReferenceExpression(
|
|
79481
79496
|
varExpr,
|
|
@@ -79485,7 +79500,7 @@ ${lanes.join("\n")}
|
|
|
79485
79500
|
}
|
|
79486
79501
|
}
|
|
79487
79502
|
if (rightType === neverType || !isTypeAssignableToKind(rightType, 67108864 /* NonPrimitive */ | 58982400 /* InstantiableNonPrimitive */)) {
|
|
79488
|
-
|
|
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));
|
|
79489
79504
|
}
|
|
79490
79505
|
checkSourceElement(node.statement);
|
|
79491
79506
|
if (node.locals) {
|
|
@@ -79556,7 +79571,7 @@ ${lanes.join("\n")}
|
|
|
79556
79571
|
if (hasStringConstituent) {
|
|
79557
79572
|
if (languageVersion < 1 /* ES5 */) {
|
|
79558
79573
|
if (errorNode) {
|
|
79559
|
-
|
|
79574
|
+
error2(errorNode, Diagnostics.Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher);
|
|
79560
79575
|
reportedError = true;
|
|
79561
79576
|
}
|
|
79562
79577
|
}
|
|
@@ -80016,7 +80031,7 @@ ${lanes.join("\n")}
|
|
|
80016
80031
|
errorOutputContainer.errors ?? (errorOutputContainer.errors = []);
|
|
80017
80032
|
errorOutputContainer.errors.push(createDiagnosticForNode(errorNode, diagnostic, methodName));
|
|
80018
80033
|
} else {
|
|
80019
|
-
|
|
80034
|
+
error2(errorNode, diagnostic, methodName);
|
|
80020
80035
|
}
|
|
80021
80036
|
}
|
|
80022
80037
|
return methodName === "next" ? noIterationTypes : void 0;
|
|
@@ -80071,7 +80086,7 @@ ${lanes.join("\n")}
|
|
|
80071
80086
|
errorOutputContainer.errors ?? (errorOutputContainer.errors = []);
|
|
80072
80087
|
errorOutputContainer.errors.push(createDiagnosticForNode(errorNode, resolver.mustHaveAValueDiagnostic, methodName));
|
|
80073
80088
|
} else {
|
|
80074
|
-
|
|
80089
|
+
error2(errorNode, resolver.mustHaveAValueDiagnostic, methodName);
|
|
80075
80090
|
}
|
|
80076
80091
|
}
|
|
80077
80092
|
yieldType = anyType;
|
|
@@ -80157,11 +80172,11 @@ ${lanes.join("\n")}
|
|
|
80157
80172
|
const exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType;
|
|
80158
80173
|
if (container.kind === 177 /* SetAccessor */) {
|
|
80159
80174
|
if (node.expression) {
|
|
80160
|
-
|
|
80175
|
+
error2(node, Diagnostics.Setters_cannot_return_a_value);
|
|
80161
80176
|
}
|
|
80162
80177
|
} else if (container.kind === 175 /* Constructor */) {
|
|
80163
80178
|
if (node.expression && !checkTypeAssignableToAndOptionallyElaborate(exprType, returnType, node, node.expression)) {
|
|
80164
|
-
|
|
80179
|
+
error2(node, Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class);
|
|
80165
80180
|
}
|
|
80166
80181
|
} else if (getReturnTypeFromAnnotation(container)) {
|
|
80167
80182
|
const unwrappedReturnType = unwrapReturnType(returnType, functionFlags) ?? returnType;
|
|
@@ -80177,7 +80192,7 @@ ${lanes.join("\n")}
|
|
|
80177
80192
|
}
|
|
80178
80193
|
}
|
|
80179
80194
|
} else if (container.kind !== 175 /* Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeUndefinedVoidOrAny(container, returnType)) {
|
|
80180
|
-
|
|
80195
|
+
error2(node, Diagnostics.Not_all_code_paths_return_a_value);
|
|
80181
80196
|
}
|
|
80182
80197
|
}
|
|
80183
80198
|
function checkWithStatement(node) {
|
|
@@ -80213,7 +80228,7 @@ ${lanes.join("\n")}
|
|
|
80213
80228
|
}
|
|
80214
80229
|
forEach(clause.statements, checkSourceElement);
|
|
80215
80230
|
if (compilerOptions.noFallthroughCasesInSwitch && clause.fallthroughFlowNode && isReachableFlowNode(clause.fallthroughFlowNode)) {
|
|
80216
|
-
|
|
80231
|
+
error2(clause, Diagnostics.Fallthrough_case_in_switch);
|
|
80217
80232
|
}
|
|
80218
80233
|
function createLazyCaseClauseDiagnostics(clause2) {
|
|
80219
80234
|
return () => {
|
|
@@ -80363,7 +80378,7 @@ ${lanes.join("\n")}
|
|
|
80363
80378
|
const localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfDeclaration(info.declaration)) === type.symbol ? info.declaration : void 0;
|
|
80364
80379
|
const errorNode = localCheckDeclaration || localIndexDeclaration || (interfaceDeclaration && !some(getBaseTypes(type), (base) => !!getIndexInfoOfType(base, checkInfo.keyType) && !!getIndexTypeOfType(base, info.keyType)) ? interfaceDeclaration : void 0);
|
|
80365
80380
|
if (errorNode && !isTypeAssignableTo(checkInfo.type, info.type)) {
|
|
80366
|
-
|
|
80381
|
+
error2(
|
|
80367
80382
|
errorNode,
|
|
80368
80383
|
Diagnostics._0_index_type_1_is_not_assignable_to_2_index_type_3,
|
|
80369
80384
|
typeToString(checkInfo.keyType),
|
|
@@ -80386,12 +80401,12 @@ ${lanes.join("\n")}
|
|
|
80386
80401
|
case "symbol":
|
|
80387
80402
|
case "void":
|
|
80388
80403
|
case "object":
|
|
80389
|
-
|
|
80404
|
+
error2(name, message, name.escapedText);
|
|
80390
80405
|
}
|
|
80391
80406
|
}
|
|
80392
80407
|
function checkClassNameCollisionWithObject(name) {
|
|
80393
80408
|
if (languageVersion >= 1 /* ES5 */ && name.escapedText === "Object" && (moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(name).impliedNodeFormat === 1 /* CommonJS */)) {
|
|
80394
|
-
|
|
80409
|
+
error2(name, Diagnostics.Class_name_cannot_be_Object_when_targeting_ES5_with_module_0, ModuleKind[moduleKind]);
|
|
80395
80410
|
}
|
|
80396
80411
|
}
|
|
80397
80412
|
function checkUnmatchedJSDocParameters(node) {
|
|
@@ -80414,7 +80429,7 @@ ${lanes.join("\n")}
|
|
|
80414
80429
|
const lastJSDocParamIndex = jsdocParameters.length - 1;
|
|
80415
80430
|
const lastJSDocParam = jsdocParameters[lastJSDocParamIndex];
|
|
80416
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))) {
|
|
80417
|
-
|
|
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));
|
|
80418
80433
|
}
|
|
80419
80434
|
} else {
|
|
80420
80435
|
forEach(jsdocParameters, ({ name, isNameFirst }, index) => {
|
|
@@ -80423,7 +80438,7 @@ ${lanes.join("\n")}
|
|
|
80423
80438
|
}
|
|
80424
80439
|
if (isQualifiedName(name)) {
|
|
80425
80440
|
if (isJs) {
|
|
80426
|
-
|
|
80441
|
+
error2(name, Diagnostics.Qualified_name_0_is_not_allowed_without_a_leading_param_object_1, entityNameToString(name), entityNameToString(name.left));
|
|
80427
80442
|
}
|
|
80428
80443
|
} else {
|
|
80429
80444
|
if (!isNameFirst) {
|
|
@@ -80448,11 +80463,11 @@ ${lanes.join("\n")}
|
|
|
80448
80463
|
seenDefault = true;
|
|
80449
80464
|
checkTypeParametersNotReferenced(node.default, typeParameterDeclarations, i);
|
|
80450
80465
|
} else if (seenDefault) {
|
|
80451
|
-
|
|
80466
|
+
error2(node, Diagnostics.Required_type_parameters_may_not_follow_optional_type_parameters);
|
|
80452
80467
|
}
|
|
80453
80468
|
for (let j = 0; j < i; j++) {
|
|
80454
80469
|
if (typeParameterDeclarations[j].symbol === node.symbol) {
|
|
80455
|
-
|
|
80470
|
+
error2(node.name, Diagnostics.Duplicate_identifier_0, declarationNameToString(node.name));
|
|
80456
80471
|
}
|
|
80457
80472
|
}
|
|
80458
80473
|
};
|
|
@@ -80466,7 +80481,7 @@ ${lanes.join("\n")}
|
|
|
80466
80481
|
if (type.flags & 262144 /* TypeParameter */) {
|
|
80467
80482
|
for (let i = index; i < typeParameters.length; i++) {
|
|
80468
80483
|
if (type.symbol === getSymbolOfDeclaration(typeParameters[i])) {
|
|
80469
|
-
|
|
80484
|
+
error2(node, Diagnostics.Type_parameter_defaults_can_only_reference_previously_declared_type_parameters);
|
|
80470
80485
|
}
|
|
80471
80486
|
}
|
|
80472
80487
|
}
|
|
@@ -80489,7 +80504,7 @@ ${lanes.join("\n")}
|
|
|
80489
80504
|
if (!areTypeParametersIdentical(declarations, type.localTypeParameters, getEffectiveTypeParameterDeclarations)) {
|
|
80490
80505
|
const name = symbolToString(symbol);
|
|
80491
80506
|
for (const declaration of declarations) {
|
|
80492
|
-
|
|
80507
|
+
error2(declaration.name, Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, name);
|
|
80493
80508
|
}
|
|
80494
80509
|
}
|
|
80495
80510
|
}
|
|
@@ -80660,18 +80675,18 @@ ${lanes.join("\n")}
|
|
|
80660
80675
|
}
|
|
80661
80676
|
if (baseConstructorType.flags & 8650752 /* TypeVariable */) {
|
|
80662
80677
|
if (!isMixinConstructorType(staticType)) {
|
|
80663
|
-
|
|
80678
|
+
error2(node.name || node, Diagnostics.A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any);
|
|
80664
80679
|
} else {
|
|
80665
80680
|
const constructSignatures = getSignaturesOfType(baseConstructorType, 1 /* Construct */);
|
|
80666
80681
|
if (constructSignatures.some((signature) => signature.flags & 4 /* Abstract */) && !hasSyntacticModifier(node, 256 /* Abstract */)) {
|
|
80667
|
-
|
|
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);
|
|
80668
80683
|
}
|
|
80669
80684
|
}
|
|
80670
80685
|
}
|
|
80671
80686
|
if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32 /* Class */) && !(baseConstructorType.flags & 8650752 /* TypeVariable */)) {
|
|
80672
80687
|
const constructors = getInstantiatedConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments, baseTypeNode);
|
|
80673
80688
|
if (forEach(constructors, (sig) => !isJSConstructor(sig.declaration) && !isTypeIdenticalTo(getReturnTypeOfSignature(sig), baseType))) {
|
|
80674
|
-
|
|
80689
|
+
error2(baseTypeNode.expression, Diagnostics.Base_constructors_must_all_have_the_same_return_type);
|
|
80675
80690
|
}
|
|
80676
80691
|
}
|
|
80677
80692
|
checkKindsOfPropertyMemberOverrides(type, baseType);
|
|
@@ -80683,7 +80698,7 @@ ${lanes.join("\n")}
|
|
|
80683
80698
|
if (implementedTypeNodes) {
|
|
80684
80699
|
for (const typeRefNode of implementedTypeNodes) {
|
|
80685
80700
|
if (!isEntityNameExpression(typeRefNode.expression) || isOptionalChain(typeRefNode.expression)) {
|
|
80686
|
-
|
|
80701
|
+
error2(typeRefNode.expression, Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments);
|
|
80687
80702
|
}
|
|
80688
80703
|
checkTypeReferenceNode(typeRefNode);
|
|
80689
80704
|
addLazyDiagnostic(createImplementsDiagnostics(typeRefNode));
|
|
@@ -80716,7 +80731,7 @@ ${lanes.join("\n")}
|
|
|
80716
80731
|
issueMemberSpecificError(node, typeWithThis, baseWithThis, genericDiag);
|
|
80717
80732
|
}
|
|
80718
80733
|
} else {
|
|
80719
|
-
|
|
80734
|
+
error2(typeRefNode, Diagnostics.A_class_can_only_implement_an_object_type_or_intersection_of_object_types_with_statically_known_members);
|
|
80720
80735
|
}
|
|
80721
80736
|
}
|
|
80722
80737
|
};
|
|
@@ -80794,12 +80809,12 @@ ${lanes.join("\n")}
|
|
|
80794
80809
|
if (prop && !baseProp && memberHasOverrideModifier) {
|
|
80795
80810
|
if (errorNode) {
|
|
80796
80811
|
const suggestion = getSuggestedSymbolForNonexistentClassMember(memberName, baseType);
|
|
80797
|
-
suggestion ?
|
|
80812
|
+
suggestion ? error2(
|
|
80798
80813
|
errorNode,
|
|
80799
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,
|
|
80800
80815
|
baseClassName,
|
|
80801
80816
|
symbolToString(suggestion)
|
|
80802
|
-
) :
|
|
80817
|
+
) : error2(
|
|
80803
80818
|
errorNode,
|
|
80804
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,
|
|
80805
80820
|
baseClassName
|
|
@@ -80814,12 +80829,12 @@ ${lanes.join("\n")}
|
|
|
80814
80829
|
if (!baseHasAbstract) {
|
|
80815
80830
|
if (errorNode) {
|
|
80816
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;
|
|
80817
|
-
|
|
80832
|
+
error2(errorNode, diag2, baseClassName);
|
|
80818
80833
|
}
|
|
80819
80834
|
return 1 /* NeedsOverride */;
|
|
80820
80835
|
} else if (memberHasAbstractModifier && baseHasAbstract) {
|
|
80821
80836
|
if (errorNode) {
|
|
80822
|
-
|
|
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);
|
|
80823
80838
|
}
|
|
80824
80839
|
return 1 /* NeedsOverride */;
|
|
80825
80840
|
}
|
|
@@ -80827,7 +80842,7 @@ ${lanes.join("\n")}
|
|
|
80827
80842
|
} else if (memberHasOverrideModifier) {
|
|
80828
80843
|
if (errorNode) {
|
|
80829
80844
|
const className = typeToString(type);
|
|
80830
|
-
|
|
80845
|
+
error2(
|
|
80831
80846
|
errorNode,
|
|
80832
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,
|
|
80833
80848
|
className
|
|
@@ -80880,7 +80895,7 @@ ${lanes.join("\n")}
|
|
|
80880
80895
|
if (declaration && hasEffectiveModifier(declaration, 8 /* Private */)) {
|
|
80881
80896
|
const typeClassDeclaration = getClassLikeDeclarationOfSymbol(type.symbol);
|
|
80882
80897
|
if (!isNodeWithinClass(node, typeClassDeclaration)) {
|
|
80883
|
-
|
|
80898
|
+
error2(node, Diagnostics.Cannot_extend_a_class_0_Class_constructor_is_marked_as_private, getFullyQualifiedName(type.symbol));
|
|
80884
80899
|
}
|
|
80885
80900
|
}
|
|
80886
80901
|
}
|
|
@@ -80949,7 +80964,7 @@ ${lanes.join("\n")}
|
|
|
80949
80964
|
}
|
|
80950
80965
|
}
|
|
80951
80966
|
if (!inheritedAbstractMemberNotImplementedError) {
|
|
80952
|
-
inheritedAbstractMemberNotImplementedError =
|
|
80967
|
+
inheritedAbstractMemberNotImplementedError = error2(
|
|
80953
80968
|
derivedClassDecl,
|
|
80954
80969
|
Diagnostics.Non_abstract_class_0_does_not_implement_all_abstract_members_of_1,
|
|
80955
80970
|
typeToString(type),
|
|
@@ -80995,7 +81010,7 @@ ${lanes.join("\n")}
|
|
|
80995
81010
|
const overriddenInstanceAccessor = basePropertyFlags === 4 /* Property */ && derivedPropertyFlags !== 4 /* Property */;
|
|
80996
81011
|
if (overriddenInstanceProperty || overriddenInstanceAccessor) {
|
|
80997
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;
|
|
80998
|
-
|
|
81013
|
+
error2(getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage2, symbolToString(base), typeToString(baseType), typeToString(type));
|
|
80999
81014
|
} else if (useDefineForClassFields) {
|
|
81000
81015
|
const uninitialized = (_c = derived.declarations) == null ? void 0 : _c.find((d) => d.kind === 171 /* PropertyDeclaration */ && !d.initializer);
|
|
81001
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 */)))) {
|
|
@@ -81003,7 +81018,7 @@ ${lanes.join("\n")}
|
|
|
81003
81018
|
const propName = uninitialized.name;
|
|
81004
81019
|
if (uninitialized.exclamationToken || !constructor || !isIdentifier(propName) || !strictNullChecks || !isPropertyInitializedInConstructor(propName, type, constructor)) {
|
|
81005
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;
|
|
81006
|
-
|
|
81021
|
+
error2(getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage2, symbolToString(base), typeToString(baseType));
|
|
81007
81022
|
}
|
|
81008
81023
|
}
|
|
81009
81024
|
}
|
|
@@ -81020,7 +81035,7 @@ ${lanes.join("\n")}
|
|
|
81020
81035
|
} else {
|
|
81021
81036
|
errorMessage = Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function;
|
|
81022
81037
|
}
|
|
81023
|
-
|
|
81038
|
+
error2(getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type));
|
|
81024
81039
|
}
|
|
81025
81040
|
}
|
|
81026
81041
|
}
|
|
@@ -81099,7 +81114,7 @@ ${lanes.join("\n")}
|
|
|
81099
81114
|
const type = getTypeOfSymbol(getSymbolOfDeclaration(member));
|
|
81100
81115
|
if (!(type.flags & 3 /* AnyOrUnknown */ || containsUndefinedType(type))) {
|
|
81101
81116
|
if (!constructor || !isPropertyInitializedInConstructor(propName, type, constructor)) {
|
|
81102
|
-
|
|
81117
|
+
error2(member.name, Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor, declarationNameToString(propName));
|
|
81103
81118
|
}
|
|
81104
81119
|
}
|
|
81105
81120
|
}
|
|
@@ -81156,7 +81171,7 @@ ${lanes.join("\n")}
|
|
|
81156
81171
|
});
|
|
81157
81172
|
forEach(getInterfaceBaseTypeNodes(node), (heritageElement) => {
|
|
81158
81173
|
if (!isEntityNameExpression(heritageElement.expression) || isOptionalChain(heritageElement.expression)) {
|
|
81159
|
-
|
|
81174
|
+
error2(heritageElement.expression, Diagnostics.An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments);
|
|
81160
81175
|
}
|
|
81161
81176
|
checkTypeReferenceNode(heritageElement);
|
|
81162
81177
|
});
|
|
@@ -81173,7 +81188,7 @@ ${lanes.join("\n")}
|
|
|
81173
81188
|
checkTypeParameters(node.typeParameters);
|
|
81174
81189
|
if (node.type.kind === 141 /* IntrinsicKeyword */) {
|
|
81175
81190
|
if (!intrinsicTypeKinds.has(node.name.escapedText) || length(node.typeParameters) !== 1) {
|
|
81176
|
-
|
|
81191
|
+
error2(node.type, Diagnostics.The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types);
|
|
81177
81192
|
}
|
|
81178
81193
|
} else {
|
|
81179
81194
|
checkSourceElement(node.type);
|
|
@@ -81194,11 +81209,11 @@ ${lanes.join("\n")}
|
|
|
81194
81209
|
}
|
|
81195
81210
|
function computeMemberValue(member, autoValue) {
|
|
81196
81211
|
if (isComputedNonLiteralName(member.name)) {
|
|
81197
|
-
|
|
81212
|
+
error2(member.name, Diagnostics.Computed_property_names_are_not_allowed_in_enums);
|
|
81198
81213
|
} else {
|
|
81199
81214
|
const text = getTextOfPropertyName(member.name);
|
|
81200
81215
|
if (isNumericLiteralName(text) && !isInfinityOrNaNString(text)) {
|
|
81201
|
-
|
|
81216
|
+
error2(member.name, Diagnostics.An_enum_member_cannot_have_a_numeric_name);
|
|
81202
81217
|
}
|
|
81203
81218
|
}
|
|
81204
81219
|
if (member.initializer) {
|
|
@@ -81210,7 +81225,7 @@ ${lanes.join("\n")}
|
|
|
81210
81225
|
if (autoValue !== void 0) {
|
|
81211
81226
|
return autoValue;
|
|
81212
81227
|
}
|
|
81213
|
-
|
|
81228
|
+
error2(member.name, Diagnostics.Enum_member_must_have_initializer);
|
|
81214
81229
|
return void 0;
|
|
81215
81230
|
}
|
|
81216
81231
|
function computeConstantValue(member) {
|
|
@@ -81219,12 +81234,12 @@ ${lanes.join("\n")}
|
|
|
81219
81234
|
const value = evaluate(initializer, member);
|
|
81220
81235
|
if (value !== void 0) {
|
|
81221
81236
|
if (isConstEnum && typeof value === "number" && !isFinite(value)) {
|
|
81222
|
-
|
|
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);
|
|
81223
81238
|
}
|
|
81224
81239
|
} else if (isConstEnum) {
|
|
81225
|
-
|
|
81240
|
+
error2(initializer, Diagnostics.const_enum_member_initializers_must_be_constant_expressions);
|
|
81226
81241
|
} else if (member.parent.flags & 16777216 /* Ambient */) {
|
|
81227
|
-
|
|
81242
|
+
error2(initializer, Diagnostics.In_ambient_enum_declarations_member_initializer_must_be_constant_expression);
|
|
81228
81243
|
} else {
|
|
81229
81244
|
checkTypeAssignableTo(checkExpression(initializer), numberType, initializer, Diagnostics.Type_0_is_not_assignable_to_type_1_as_required_for_computed_enum_member_values);
|
|
81230
81245
|
}
|
|
@@ -81338,11 +81353,11 @@ ${lanes.join("\n")}
|
|
|
81338
81353
|
function evaluateEnumMember(expr, symbol, location) {
|
|
81339
81354
|
const declaration = symbol.valueDeclaration;
|
|
81340
81355
|
if (!declaration || declaration === location) {
|
|
81341
|
-
|
|
81356
|
+
error2(expr, Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(symbol));
|
|
81342
81357
|
return void 0;
|
|
81343
81358
|
}
|
|
81344
81359
|
if (!isBlockScopedNameDeclaredBeforeUse(declaration, location)) {
|
|
81345
|
-
|
|
81360
|
+
error2(expr, Diagnostics.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums);
|
|
81346
81361
|
return 0;
|
|
81347
81362
|
}
|
|
81348
81363
|
return getEnumMemberValue(declaration);
|
|
@@ -81375,7 +81390,7 @@ ${lanes.join("\n")}
|
|
|
81375
81390
|
const enumIsConst = isEnumConst(node);
|
|
81376
81391
|
forEach(enumSymbol.declarations, (decl) => {
|
|
81377
81392
|
if (isEnumDeclaration(decl) && isEnumConst(decl) !== enumIsConst) {
|
|
81378
|
-
|
|
81393
|
+
error2(getNameOfDeclaration(decl), Diagnostics.Enum_declarations_must_all_be_const_or_non_const);
|
|
81379
81394
|
}
|
|
81380
81395
|
});
|
|
81381
81396
|
}
|
|
@@ -81391,7 +81406,7 @@ ${lanes.join("\n")}
|
|
|
81391
81406
|
const firstEnumMember = enumDeclaration.members[0];
|
|
81392
81407
|
if (!firstEnumMember.initializer) {
|
|
81393
81408
|
if (seenEnumMissingInitialInitializer) {
|
|
81394
|
-
|
|
81409
|
+
error2(firstEnumMember.name, Diagnostics.In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element);
|
|
81395
81410
|
} else {
|
|
81396
81411
|
seenEnumMissingInitialInitializer = true;
|
|
81397
81412
|
}
|
|
@@ -81401,7 +81416,7 @@ ${lanes.join("\n")}
|
|
|
81401
81416
|
}
|
|
81402
81417
|
function checkEnumMember(node) {
|
|
81403
81418
|
if (isPrivateIdentifier(node.name)) {
|
|
81404
|
-
|
|
81419
|
+
error2(node, Diagnostics.An_enum_member_cannot_be_named_with_a_private_identifier);
|
|
81405
81420
|
}
|
|
81406
81421
|
if (node.initializer) {
|
|
81407
81422
|
checkExpression(node.initializer);
|
|
@@ -81442,7 +81457,7 @@ ${lanes.join("\n")}
|
|
|
81442
81457
|
const isGlobalAugmentation = isGlobalScopeAugmentation(node);
|
|
81443
81458
|
const inAmbientContext = node.flags & 16777216 /* Ambient */;
|
|
81444
81459
|
if (isGlobalAugmentation && !inAmbientContext) {
|
|
81445
|
-
|
|
81460
|
+
error2(node.name, Diagnostics.Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context);
|
|
81446
81461
|
}
|
|
81447
81462
|
const isAmbientExternalModule = isAmbientModule(node);
|
|
81448
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;
|
|
@@ -81461,15 +81476,15 @@ ${lanes.join("\n")}
|
|
|
81461
81476
|
const symbol = getSymbolOfDeclaration(node);
|
|
81462
81477
|
if (symbol.flags & 512 /* ValueModule */ && !inAmbientContext && isInstantiatedModule(node, shouldPreserveConstEnums(compilerOptions))) {
|
|
81463
81478
|
if (getIsolatedModules(compilerOptions) && !getSourceFileOfNode(node).externalModuleIndicator) {
|
|
81464
|
-
|
|
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);
|
|
81465
81480
|
}
|
|
81466
81481
|
if (((_a = symbol.declarations) == null ? void 0 : _a.length) > 1) {
|
|
81467
81482
|
const firstNonAmbientClassOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol);
|
|
81468
81483
|
if (firstNonAmbientClassOrFunc) {
|
|
81469
81484
|
if (getSourceFileOfNode(node) !== getSourceFileOfNode(firstNonAmbientClassOrFunc)) {
|
|
81470
|
-
|
|
81485
|
+
error2(node.name, Diagnostics.A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged);
|
|
81471
81486
|
} else if (node.pos < firstNonAmbientClassOrFunc.pos) {
|
|
81472
|
-
|
|
81487
|
+
error2(node.name, Diagnostics.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged);
|
|
81473
81488
|
}
|
|
81474
81489
|
}
|
|
81475
81490
|
const mergedClass = getDeclarationOfKind(symbol, 262 /* ClassDeclaration */);
|
|
@@ -81480,7 +81495,7 @@ ${lanes.join("\n")}
|
|
|
81480
81495
|
if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 311 /* SourceFile */ && (moduleKind === 1 /* CommonJS */ || node.parent.impliedNodeFormat === 1 /* CommonJS */)) {
|
|
81481
81496
|
const exportModifier = (_b = node.modifiers) == null ? void 0 : _b.find((m) => m.kind === 95 /* ExportKeyword */);
|
|
81482
81497
|
if (exportModifier) {
|
|
81483
|
-
|
|
81498
|
+
error2(exportModifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
|
81484
81499
|
}
|
|
81485
81500
|
}
|
|
81486
81501
|
}
|
|
@@ -81494,15 +81509,15 @@ ${lanes.join("\n")}
|
|
|
81494
81509
|
}
|
|
81495
81510
|
} else if (isGlobalSourceFile(node.parent)) {
|
|
81496
81511
|
if (isGlobalAugmentation) {
|
|
81497
|
-
|
|
81512
|
+
error2(node.name, Diagnostics.Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations);
|
|
81498
81513
|
} else if (isExternalModuleNameRelative(getTextOfIdentifierOrLiteral(node.name))) {
|
|
81499
|
-
|
|
81514
|
+
error2(node.name, Diagnostics.Ambient_module_declaration_cannot_specify_relative_module_name);
|
|
81500
81515
|
}
|
|
81501
81516
|
} else {
|
|
81502
81517
|
if (isGlobalAugmentation) {
|
|
81503
|
-
|
|
81518
|
+
error2(node.name, Diagnostics.Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations);
|
|
81504
81519
|
} else {
|
|
81505
|
-
|
|
81520
|
+
error2(node.name, Diagnostics.Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces);
|
|
81506
81521
|
}
|
|
81507
81522
|
}
|
|
81508
81523
|
}
|
|
@@ -81569,17 +81584,17 @@ ${lanes.join("\n")}
|
|
|
81569
81584
|
return false;
|
|
81570
81585
|
}
|
|
81571
81586
|
if (!isStringLiteral(moduleName)) {
|
|
81572
|
-
|
|
81587
|
+
error2(moduleName, Diagnostics.String_literal_expected);
|
|
81573
81588
|
return false;
|
|
81574
81589
|
}
|
|
81575
81590
|
const inAmbientExternalModule = node.parent.kind === 267 /* ModuleBlock */ && isAmbientModule(node.parent.parent);
|
|
81576
81591
|
if (node.parent.kind !== 311 /* SourceFile */ && !inAmbientExternalModule) {
|
|
81577
|
-
|
|
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);
|
|
81578
81593
|
return false;
|
|
81579
81594
|
}
|
|
81580
81595
|
if (inAmbientExternalModule && isExternalModuleNameRelative(moduleName.text)) {
|
|
81581
81596
|
if (!isTopLevelInExternalModuleAugmentation(node)) {
|
|
81582
|
-
|
|
81597
|
+
error2(node, Diagnostics.Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name);
|
|
81583
81598
|
return false;
|
|
81584
81599
|
}
|
|
81585
81600
|
}
|
|
@@ -81588,7 +81603,7 @@ ${lanes.join("\n")}
|
|
|
81588
81603
|
for (const clause of node.assertClause.elements) {
|
|
81589
81604
|
if (!isStringLiteral(clause.value)) {
|
|
81590
81605
|
hasError = true;
|
|
81591
|
-
|
|
81606
|
+
error2(clause.value, Diagnostics.Import_assertion_values_must_be_string_literal_expressions);
|
|
81592
81607
|
}
|
|
81593
81608
|
}
|
|
81594
81609
|
return !hasError;
|
|
@@ -81605,7 +81620,7 @@ ${lanes.join("\n")}
|
|
|
81605
81620
|
const errorNode = isImportOrExportSpecifier(node) ? node.propertyName || node.name : isNamedDeclaration(node) ? node.name : node;
|
|
81606
81621
|
Debug.assert(node.kind !== 279 /* NamespaceExport */);
|
|
81607
81622
|
if (node.kind === 280 /* ExportSpecifier */) {
|
|
81608
|
-
const diag2 =
|
|
81623
|
+
const diag2 = error2(errorNode, Diagnostics.Types_cannot_appear_in_export_declarations_in_JavaScript_files);
|
|
81609
81624
|
const alreadyExportedSymbol = (_b = (_a = getSourceFileOfNode(node).symbol) == null ? void 0 : _a.exports) == null ? void 0 : _b.get((node.propertyName || node.name).escapedText);
|
|
81610
81625
|
if (alreadyExportedSymbol === target) {
|
|
81611
81626
|
const exportingDeclaration = (_c = alreadyExportedSymbol.declarations) == null ? void 0 : _c.find(isJSDocNode);
|
|
@@ -81622,7 +81637,7 @@ ${lanes.join("\n")}
|
|
|
81622
81637
|
const importDeclaration = findAncestor(node, or(isImportDeclaration, isImportEqualsDeclaration));
|
|
81623
81638
|
const moduleSpecifier = (importDeclaration && ((_d = tryGetModuleSpecifierFromDeclaration(importDeclaration)) == null ? void 0 : _d.text)) ?? "...";
|
|
81624
81639
|
const importedIdentifier = unescapeLeadingUnderscores(isIdentifier(errorNode) ? errorNode.escapedText : symbol.escapedName);
|
|
81625
|
-
|
|
81640
|
+
error2(
|
|
81626
81641
|
errorNode,
|
|
81627
81642
|
Diagnostics._0_is_a_type_and_cannot_be_imported_in_JavaScript_files_Use_1_in_a_JSDoc_type_annotation,
|
|
81628
81643
|
importedIdentifier,
|
|
@@ -81635,7 +81650,7 @@ ${lanes.join("\n")}
|
|
|
81635
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);
|
|
81636
81651
|
if (targetFlags & excludedMeanings) {
|
|
81637
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;
|
|
81638
|
-
|
|
81653
|
+
error2(node, message, symbolToString(symbol));
|
|
81639
81654
|
}
|
|
81640
81655
|
if (getIsolatedModules(compilerOptions) && !isTypeOnlyImportOrExportDeclaration(node) && !(node.flags & 16777216 /* Ambient */)) {
|
|
81641
81656
|
const typeOnlyAlias = getTypeOnlyAliasDeclaration(symbol);
|
|
@@ -81650,20 +81665,20 @@ ${lanes.join("\n")}
|
|
|
81650
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;
|
|
81651
81666
|
const name = idText(node.kind === 275 /* ImportSpecifier */ ? node.propertyName || node.name : node.name);
|
|
81652
81667
|
addTypeOnlyDeclarationRelatedInfo(
|
|
81653
|
-
|
|
81668
|
+
error2(node, message, name),
|
|
81654
81669
|
isType ? void 0 : typeOnlyAlias,
|
|
81655
81670
|
name
|
|
81656
81671
|
);
|
|
81657
81672
|
}
|
|
81658
81673
|
if (isType && node.kind === 270 /* ImportEqualsDeclaration */ && hasEffectiveModifier(node, 1 /* Export */)) {
|
|
81659
|
-
|
|
81674
|
+
error2(node, Diagnostics.Cannot_use_export_import_on_a_type_or_type_only_namespace_when_0_is_enabled, isolatedModulesLikeFlagName);
|
|
81660
81675
|
}
|
|
81661
81676
|
break;
|
|
81662
81677
|
}
|
|
81663
81678
|
case 280 /* ExportSpecifier */: {
|
|
81664
81679
|
if (compilerOptions.verbatimModuleSyntax || getSourceFileOfNode(typeOnlyAlias) !== getSourceFileOfNode(node)) {
|
|
81665
81680
|
const name = idText(node.propertyName || node.name);
|
|
81666
|
-
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);
|
|
81667
81682
|
addTypeOnlyDeclarationRelatedInfo(diagnostic, isType ? void 0 : typeOnlyAlias, name);
|
|
81668
81683
|
break;
|
|
81669
81684
|
}
|
|
@@ -81671,7 +81686,7 @@ ${lanes.join("\n")}
|
|
|
81671
81686
|
}
|
|
81672
81687
|
}
|
|
81673
81688
|
if (compilerOptions.verbatimModuleSyntax && node.kind !== 270 /* ImportEqualsDeclaration */ && !isInJSFile(node) && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) {
|
|
81674
|
-
|
|
81689
|
+
error2(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
|
81675
81690
|
}
|
|
81676
81691
|
}
|
|
81677
81692
|
if (isImportSpecifier(node)) {
|
|
@@ -81793,7 +81808,7 @@ ${lanes.join("\n")}
|
|
|
81793
81808
|
if (targetFlags & 111551 /* Value */) {
|
|
81794
81809
|
const moduleName = getFirstIdentifier(node.moduleReference);
|
|
81795
81810
|
if (!(resolveEntityName(moduleName, 111551 /* Value */ | 1920 /* Namespace */).flags & 1920 /* Namespace */)) {
|
|
81796
|
-
|
|
81811
|
+
error2(moduleName, Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name, declarationNameToString(moduleName));
|
|
81797
81812
|
}
|
|
81798
81813
|
}
|
|
81799
81814
|
if (targetFlags & 788968 /* Type */) {
|
|
@@ -81827,12 +81842,12 @@ ${lanes.join("\n")}
|
|
|
81827
81842
|
const inAmbientExternalModule = node.parent.kind === 267 /* ModuleBlock */ && isAmbientModule(node.parent.parent);
|
|
81828
81843
|
const inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 267 /* ModuleBlock */ && !node.moduleSpecifier && node.flags & 16777216 /* Ambient */;
|
|
81829
81844
|
if (node.parent.kind !== 311 /* SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) {
|
|
81830
|
-
|
|
81845
|
+
error2(node, Diagnostics.Export_declarations_are_not_permitted_in_a_namespace);
|
|
81831
81846
|
}
|
|
81832
81847
|
} else {
|
|
81833
81848
|
const moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier);
|
|
81834
81849
|
if (moduleSymbol && hasExportAssignmentSymbol(moduleSymbol)) {
|
|
81835
|
-
|
|
81850
|
+
error2(node.moduleSpecifier, Diagnostics.Module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol));
|
|
81836
81851
|
} else if (node.exportClause) {
|
|
81837
81852
|
checkAliasSymbol(node.exportClause);
|
|
81838
81853
|
}
|
|
@@ -81893,7 +81908,7 @@ ${lanes.join("\n")}
|
|
|
81893
81908
|
}
|
|
81894
81909
|
for (const statement of sourceFile.statements) {
|
|
81895
81910
|
if (canConvertImportDeclarationToTypeOnly(statement) || canConvertImportEqualsDeclarationToTypeOnly(statement)) {
|
|
81896
|
-
|
|
81911
|
+
error2(
|
|
81897
81912
|
statement,
|
|
81898
81913
|
Diagnostics.This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error
|
|
81899
81914
|
);
|
|
@@ -81923,7 +81938,7 @@ ${lanes.join("\n")}
|
|
|
81923
81938
|
true
|
|
81924
81939
|
);
|
|
81925
81940
|
if (symbol && (symbol === undefinedSymbol || symbol === globalThisSymbol || symbol.declarations && isGlobalSourceFile(getDeclarationContainer(symbol.declarations[0])))) {
|
|
81926
|
-
|
|
81941
|
+
error2(exportedName, Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, idText(exportedName));
|
|
81927
81942
|
} else {
|
|
81928
81943
|
if (!node.isTypeOnly && !node.parent.parent.isTypeOnly) {
|
|
81929
81944
|
markExportAsReferenced(node);
|
|
@@ -81947,9 +81962,9 @@ ${lanes.join("\n")}
|
|
|
81947
81962
|
const container = node.parent.kind === 311 /* SourceFile */ ? node.parent : node.parent.parent;
|
|
81948
81963
|
if (container.kind === 266 /* ModuleDeclaration */ && !isAmbientModule(container)) {
|
|
81949
81964
|
if (node.isExportEquals) {
|
|
81950
|
-
|
|
81965
|
+
error2(node, Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace);
|
|
81951
81966
|
} else {
|
|
81952
|
-
|
|
81967
|
+
error2(node, Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module);
|
|
81953
81968
|
}
|
|
81954
81969
|
return;
|
|
81955
81970
|
}
|
|
@@ -81977,14 +81992,14 @@ ${lanes.join("\n")}
|
|
|
81977
81992
|
if (getAllSymbolFlags(sym) & 111551 /* Value */) {
|
|
81978
81993
|
checkExpressionCached(id);
|
|
81979
81994
|
if (!isIllegalExportDefaultInCJS && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax && getTypeOnlyAliasDeclaration(sym, 111551 /* Value */)) {
|
|
81980
|
-
|
|
81995
|
+
error2(
|
|
81981
81996
|
id,
|
|
81982
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,
|
|
81983
81998
|
idText(id)
|
|
81984
81999
|
);
|
|
81985
82000
|
}
|
|
81986
82001
|
} else if (!isIllegalExportDefaultInCJS && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax) {
|
|
81987
|
-
|
|
82002
|
+
error2(
|
|
81988
82003
|
id,
|
|
81989
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,
|
|
81990
82005
|
idText(id)
|
|
@@ -82004,7 +82019,7 @@ ${lanes.join("\n")}
|
|
|
82004
82019
|
checkExpressionCached(node.expression);
|
|
82005
82020
|
}
|
|
82006
82021
|
if (isIllegalExportDefaultInCJS) {
|
|
82007
|
-
|
|
82022
|
+
error2(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
|
82008
82023
|
}
|
|
82009
82024
|
checkExternalModuleExports(container);
|
|
82010
82025
|
if (node.flags & 16777216 /* Ambient */ && !isEntityNameExpression(node.expression)) {
|
|
@@ -82029,7 +82044,7 @@ ${lanes.join("\n")}
|
|
|
82029
82044
|
if (exportEqualsSymbol && hasExportedMembers(moduleSymbol)) {
|
|
82030
82045
|
const declaration = getDeclarationOfAliasSymbol(exportEqualsSymbol) || exportEqualsSymbol.valueDeclaration;
|
|
82031
82046
|
if (declaration && !isTopLevelInExternalModuleAugmentation(declaration) && !isInJSFile(declaration)) {
|
|
82032
|
-
|
|
82047
|
+
error2(declaration, Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements);
|
|
82033
82048
|
}
|
|
82034
82049
|
}
|
|
82035
82050
|
const exports = getExportsOfModule(moduleSymbol);
|
|
@@ -82295,16 +82310,16 @@ ${lanes.join("\n")}
|
|
|
82295
82310
|
const { parent: parent2 } = node;
|
|
82296
82311
|
if (isParameter(parent2) && isJSDocFunctionType(parent2.parent)) {
|
|
82297
82312
|
if (last(parent2.parent.parameters) !== parent2) {
|
|
82298
|
-
|
|
82313
|
+
error2(node, Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list);
|
|
82299
82314
|
}
|
|
82300
82315
|
return;
|
|
82301
82316
|
}
|
|
82302
82317
|
if (!isJSDocTypeExpression(parent2)) {
|
|
82303
|
-
|
|
82318
|
+
error2(node, Diagnostics.JSDoc_may_only_appear_in_the_last_parameter_of_a_signature);
|
|
82304
82319
|
}
|
|
82305
82320
|
const paramTag = node.parent.parent;
|
|
82306
82321
|
if (!isJSDocParameterTag(paramTag)) {
|
|
82307
|
-
|
|
82322
|
+
error2(node, Diagnostics.JSDoc_may_only_appear_in_the_last_parameter_of_a_signature);
|
|
82308
82323
|
return;
|
|
82309
82324
|
}
|
|
82310
82325
|
const param = getParameterSymbolFromJSDoc(paramTag);
|
|
@@ -82313,7 +82328,7 @@ ${lanes.join("\n")}
|
|
|
82313
82328
|
}
|
|
82314
82329
|
const host2 = getHostSignatureFromJSDoc(paramTag);
|
|
82315
82330
|
if (!host2 || last(host2.parameters).symbol !== param) {
|
|
82316
|
-
|
|
82331
|
+
error2(node, Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list);
|
|
82317
82332
|
}
|
|
82318
82333
|
}
|
|
82319
82334
|
function getTypeFromJSDocVariadicType(node) {
|
|
@@ -84150,18 +84165,18 @@ ${lanes.join("\n")}
|
|
|
84150
84165
|
requestedExternalEmitHelperNames.add(name);
|
|
84151
84166
|
const symbol = resolveSymbol(getSymbol2(getExportsOfModule(helpersModule), escapeLeadingUnderscores(name), 111551 /* Value */));
|
|
84152
84167
|
if (!symbol) {
|
|
84153
|
-
|
|
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);
|
|
84154
84169
|
} else if (helper & 524288 /* ClassPrivateFieldGet */) {
|
|
84155
84170
|
if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 3)) {
|
|
84156
|
-
|
|
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);
|
|
84157
84172
|
}
|
|
84158
84173
|
} else if (helper & 1048576 /* ClassPrivateFieldSet */) {
|
|
84159
84174
|
if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 4)) {
|
|
84160
|
-
|
|
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);
|
|
84161
84176
|
}
|
|
84162
84177
|
} else if (helper & 1024 /* SpreadArray */) {
|
|
84163
84178
|
if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 2)) {
|
|
84164
|
-
|
|
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);
|
|
84165
84180
|
}
|
|
84166
84181
|
}
|
|
84167
84182
|
}
|
|
@@ -84268,7 +84283,7 @@ ${lanes.join("\n")}
|
|
|
84268
84283
|
const sourceFile = getSourceFileOfNode(modifier);
|
|
84269
84284
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
84270
84285
|
addRelatedInfo(
|
|
84271
|
-
|
|
84286
|
+
error2(modifier, Diagnostics.Decorators_may_not_appear_after_export_or_export_default_if_they_also_appear_before_export),
|
|
84272
84287
|
createDiagnosticForNode(firstDecorator, Diagnostics.Decorator_used_before_export_here)
|
|
84273
84288
|
);
|
|
84274
84289
|
return true;
|
|
@@ -84661,12 +84676,12 @@ ${lanes.join("\n")}
|
|
|
84661
84676
|
if (length(nonSimpleParameters)) {
|
|
84662
84677
|
forEach(nonSimpleParameters, (parameter) => {
|
|
84663
84678
|
addRelatedInfo(
|
|
84664
|
-
|
|
84679
|
+
error2(parameter, Diagnostics.This_parameter_is_not_allowed_with_use_strict_directive),
|
|
84665
84680
|
createDiagnosticForNode(useStrictDirective, Diagnostics.use_strict_directive_used_here)
|
|
84666
84681
|
);
|
|
84667
84682
|
});
|
|
84668
84683
|
const diagnostics2 = nonSimpleParameters.map((parameter, index) => index === 0 ? createDiagnosticForNode(parameter, Diagnostics.Non_simple_parameter_declared_here) : createDiagnosticForNode(parameter, Diagnostics.and_here));
|
|
84669
|
-
addRelatedInfo(
|
|
84684
|
+
addRelatedInfo(error2(useStrictDirective, Diagnostics.use_strict_directive_cannot_be_used_with_non_simple_parameter_list), ...diagnostics2);
|
|
84670
84685
|
return true;
|
|
84671
84686
|
}
|
|
84672
84687
|
}
|
|
@@ -87573,13 +87588,13 @@ ${lanes.join("\n")}
|
|
|
87573
87588
|
let sourceLine = 0;
|
|
87574
87589
|
let sourceCharacter = 0;
|
|
87575
87590
|
let nameIndex = 0;
|
|
87576
|
-
let
|
|
87591
|
+
let error2;
|
|
87577
87592
|
return {
|
|
87578
87593
|
get pos() {
|
|
87579
87594
|
return pos;
|
|
87580
87595
|
},
|
|
87581
87596
|
get error() {
|
|
87582
|
-
return
|
|
87597
|
+
return error2;
|
|
87583
87598
|
},
|
|
87584
87599
|
get state() {
|
|
87585
87600
|
return captureMapping(
|
|
@@ -87664,8 +87679,8 @@ ${lanes.join("\n")}
|
|
|
87664
87679
|
return { value: void 0, done: true };
|
|
87665
87680
|
}
|
|
87666
87681
|
function setError(message) {
|
|
87667
|
-
if (
|
|
87668
|
-
|
|
87682
|
+
if (error2 === void 0) {
|
|
87683
|
+
error2 = message;
|
|
87669
87684
|
}
|
|
87670
87685
|
}
|
|
87671
87686
|
function setErrorAndStopIterating(message) {
|
|
@@ -87673,7 +87688,7 @@ ${lanes.join("\n")}
|
|
|
87673
87688
|
return stopIterating();
|
|
87674
87689
|
}
|
|
87675
87690
|
function hasReportedError() {
|
|
87676
|
-
return
|
|
87691
|
+
return error2 !== void 0;
|
|
87677
87692
|
}
|
|
87678
87693
|
function isSourceMappingSegmentEnd() {
|
|
87679
87694
|
return pos === mappings.length || mappings.charCodeAt(pos) === 44 /* comma */ || mappings.charCodeAt(pos) === 59 /* semicolon */;
|
|
@@ -117373,13 +117388,13 @@ ${lanes.join("\n")}
|
|
|
117373
117388
|
sourceFileOptions,
|
|
117374
117389
|
/*onError*/
|
|
117375
117390
|
void 0,
|
|
117376
|
-
shouldCreateNewSourceFile
|
|
117391
|
+
shouldCreateNewSourceFile
|
|
117377
117392
|
) : host.getSourceFile(
|
|
117378
117393
|
oldSourceFile.fileName,
|
|
117379
117394
|
sourceFileOptions,
|
|
117380
117395
|
/*onError*/
|
|
117381
117396
|
void 0,
|
|
117382
|
-
shouldCreateNewSourceFile
|
|
117397
|
+
shouldCreateNewSourceFile
|
|
117383
117398
|
);
|
|
117384
117399
|
if (!newSourceFile) {
|
|
117385
117400
|
return 0 /* Not */;
|
|
@@ -118335,7 +118350,7 @@ ${lanes.join("\n")}
|
|
|
118335
118350
|
return typeof result === "object" ? { ...result, languageVersion, setExternalModuleIndicator: setExternalModuleIndicator2 } : { languageVersion, impliedNodeFormat: result, setExternalModuleIndicator: setExternalModuleIndicator2 };
|
|
118336
118351
|
}
|
|
118337
118352
|
function findSourceFileWorker(fileName, isDefaultLib, ignoreNoDefaultLib, reason, packageId) {
|
|
118338
|
-
var _a2
|
|
118353
|
+
var _a2;
|
|
118339
118354
|
const path = toPath3(fileName);
|
|
118340
118355
|
if (useSourceOfProjectReferenceRedirect) {
|
|
118341
118356
|
let source = getSourceOfProjectReferenceRedirect(path);
|
|
@@ -118414,7 +118429,7 @@ ${lanes.join("\n")}
|
|
|
118414
118429
|
Diagnostics.Cannot_read_file_0_Colon_1,
|
|
118415
118430
|
[fileName, hostErrorMessage]
|
|
118416
118431
|
),
|
|
118417
|
-
shouldCreateNewSourceFile
|
|
118432
|
+
shouldCreateNewSourceFile
|
|
118418
118433
|
);
|
|
118419
118434
|
if (packageId) {
|
|
118420
118435
|
const packageIdKey = packageIdToString(packageId);
|
|
@@ -118439,7 +118454,7 @@ ${lanes.join("\n")}
|
|
|
118439
118454
|
file.path = path;
|
|
118440
118455
|
file.resolvedPath = toPath3(fileName);
|
|
118441
118456
|
file.originalFileName = originalFileName;
|
|
118442
|
-
file.packageJsonLocations = ((
|
|
118457
|
+
file.packageJsonLocations = ((_a2 = sourceFileOptions.packageJsonLocations) == null ? void 0 : _a2.length) ? sourceFileOptions.packageJsonLocations : void 0;
|
|
118443
118458
|
file.packageJsonScope = sourceFileOptions.packageJsonScope;
|
|
118444
118459
|
addFileIncludeReason(file, reason);
|
|
118445
118460
|
if (host.useCaseSensitiveFileNames()) {
|
|
@@ -122846,17 +122861,17 @@ ${lanes.join("\n")}
|
|
|
122846
122861
|
function getWatchErrorSummaryDiagnosticMessage(errorCount) {
|
|
122847
122862
|
return errorCount === 1 ? Diagnostics.Found_1_error_Watching_for_file_changes : Diagnostics.Found_0_errors_Watching_for_file_changes;
|
|
122848
122863
|
}
|
|
122849
|
-
function prettyPathForFileError(
|
|
122850
|
-
const line = formatColorAndReset(":" +
|
|
122851
|
-
if (pathIsAbsolute(
|
|
122864
|
+
function prettyPathForFileError(error2, cwd) {
|
|
122865
|
+
const line = formatColorAndReset(":" + error2.line, "\x1B[90m" /* Grey */);
|
|
122866
|
+
if (pathIsAbsolute(error2.fileName) && pathIsAbsolute(cwd)) {
|
|
122852
122867
|
return getRelativePathFromDirectory(
|
|
122853
122868
|
cwd,
|
|
122854
|
-
|
|
122869
|
+
error2.fileName,
|
|
122855
122870
|
/*ignoreCase*/
|
|
122856
122871
|
false
|
|
122857
122872
|
) + line;
|
|
122858
122873
|
}
|
|
122859
|
-
return
|
|
122874
|
+
return error2.fileName + line;
|
|
122860
122875
|
}
|
|
122861
122876
|
function getErrorSummaryText(errorCount, filesInError, newLine, host) {
|
|
122862
122877
|
if (errorCount === 0)
|
|
@@ -123737,7 +123752,8 @@ ${lanes.join("\n")}
|
|
|
123737
123752
|
if (isFileMissingOnHost(hostSourceFile)) {
|
|
123738
123753
|
return void 0;
|
|
123739
123754
|
}
|
|
123740
|
-
|
|
123755
|
+
const impliedNodeFormat = typeof languageVersionOrOptions === "object" ? languageVersionOrOptions.impliedNodeFormat : void 0;
|
|
123756
|
+
if (hostSourceFile === void 0 || shouldCreateNewSourceFile || isFilePresenceUnknownOnHost(hostSourceFile) || hostSourceFile.sourceFile.impliedNodeFormat !== impliedNodeFormat) {
|
|
123741
123757
|
const sourceFile = getNewSourceFile(fileName, languageVersionOrOptions, onError);
|
|
123742
123758
|
if (hostSourceFile) {
|
|
123743
123759
|
if (sourceFile) {
|
|
@@ -131712,13 +131728,6 @@ ${lanes.join("\n")}
|
|
|
131712
131728
|
}
|
|
131713
131729
|
}
|
|
131714
131730
|
}
|
|
131715
|
-
function getLanguageServiceRefCounts(path, scriptKind) {
|
|
131716
|
-
return arrayFrom(buckets.entries(), ([key, bucket]) => {
|
|
131717
|
-
const bucketEntry = bucket.get(path);
|
|
131718
|
-
const entry = bucketEntry && getDocumentRegistryEntry(bucketEntry, scriptKind);
|
|
131719
|
-
return [key, entry && entry.languageServiceRefCount];
|
|
131720
|
-
});
|
|
131721
|
-
}
|
|
131722
131731
|
return {
|
|
131723
131732
|
acquireDocument,
|
|
131724
131733
|
acquireDocumentWithKey,
|
|
@@ -131726,9 +131735,10 @@ ${lanes.join("\n")}
|
|
|
131726
131735
|
updateDocumentWithKey,
|
|
131727
131736
|
releaseDocument,
|
|
131728
131737
|
releaseDocumentWithKey,
|
|
131729
|
-
|
|
131738
|
+
getKeyForCompilationSettings,
|
|
131739
|
+
getDocumentRegistryBucketKeyWithMode,
|
|
131730
131740
|
reportStats,
|
|
131731
|
-
|
|
131741
|
+
getBuckets: () => buckets
|
|
131732
131742
|
};
|
|
131733
131743
|
}
|
|
131734
131744
|
function getKeyForCompilationSettings(settings) {
|
|
@@ -134967,6 +134977,9 @@ ${lanes.join("\n")}
|
|
|
134967
134977
|
});
|
|
134968
134978
|
|
|
134969
134979
|
// src/services/refactors/moveToFile.ts
|
|
134980
|
+
function error(notApplicableReason) {
|
|
134981
|
+
return { edits: [], renameFilename: void 0, renameLocation: void 0, notApplicableReason };
|
|
134982
|
+
}
|
|
134970
134983
|
function doChange4(context, oldFile, targetFile, program, toMove, changes, host, preferences) {
|
|
134971
134984
|
const checker = program.getTypeChecker();
|
|
134972
134985
|
const usage = getUsageInfo(oldFile, toMove.all, checker);
|
|
@@ -135849,13 +135862,17 @@ ${lanes.join("\n")}
|
|
|
135849
135862
|
getEditsForAction: function getRefactorEditsToMoveToFile(context, actionName2, interactiveRefactorArguments) {
|
|
135850
135863
|
Debug.assert(actionName2 === refactorNameForMoveToFile, "Wrong refactor invoked");
|
|
135851
135864
|
const statements = Debug.checkDefined(getStatementsToMove(context));
|
|
135865
|
+
const { host, program } = context;
|
|
135852
135866
|
Debug.assert(interactiveRefactorArguments, "No interactive refactor arguments available");
|
|
135853
135867
|
const targetFile = interactiveRefactorArguments.targetFile;
|
|
135854
135868
|
if (hasJSFileExtension(targetFile) || hasTSFileExtension(targetFile)) {
|
|
135855
|
-
|
|
135869
|
+
if (host.fileExists(targetFile) && program.getSourceFile(targetFile) === void 0) {
|
|
135870
|
+
return error(getLocaleSpecificMessage(Diagnostics.Cannot_move_statements_to_the_selected_file));
|
|
135871
|
+
}
|
|
135872
|
+
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange4(context, context.file, interactiveRefactorArguments.targetFile, program, statements, t, context.host, context.preferences));
|
|
135856
135873
|
return { edits, renameFilename: void 0, renameLocation: void 0 };
|
|
135857
135874
|
}
|
|
135858
|
-
return
|
|
135875
|
+
return error(getLocaleSpecificMessage(Diagnostics.Cannot_move_to_file_selected_file_is_invalid));
|
|
135859
135876
|
}
|
|
135860
135877
|
});
|
|
135861
135878
|
}
|
|
@@ -136236,25 +136253,25 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
136236
136253
|
const possibleActions = [];
|
|
136237
136254
|
const errors = [];
|
|
136238
136255
|
if (refactorKindBeginsWith(toNamedFunctionAction.kind, kind)) {
|
|
136239
|
-
const
|
|
136240
|
-
if (
|
|
136241
|
-
errors.push({ ...toNamedFunctionAction, notApplicableReason:
|
|
136256
|
+
const error2 = selectedVariableDeclaration || isArrowFunction(func) && isVariableDeclaration(func.parent) ? void 0 : getLocaleSpecificMessage(Diagnostics.Could_not_convert_to_named_function);
|
|
136257
|
+
if (error2) {
|
|
136258
|
+
errors.push({ ...toNamedFunctionAction, notApplicableReason: error2 });
|
|
136242
136259
|
} else {
|
|
136243
136260
|
possibleActions.push(toNamedFunctionAction);
|
|
136244
136261
|
}
|
|
136245
136262
|
}
|
|
136246
136263
|
if (refactorKindBeginsWith(toAnonymousFunctionAction.kind, kind)) {
|
|
136247
|
-
const
|
|
136248
|
-
if (
|
|
136249
|
-
errors.push({ ...toAnonymousFunctionAction, notApplicableReason:
|
|
136264
|
+
const error2 = !selectedVariableDeclaration && isArrowFunction(func) ? void 0 : getLocaleSpecificMessage(Diagnostics.Could_not_convert_to_anonymous_function);
|
|
136265
|
+
if (error2) {
|
|
136266
|
+
errors.push({ ...toAnonymousFunctionAction, notApplicableReason: error2 });
|
|
136250
136267
|
} else {
|
|
136251
136268
|
possibleActions.push(toAnonymousFunctionAction);
|
|
136252
136269
|
}
|
|
136253
136270
|
}
|
|
136254
136271
|
if (refactorKindBeginsWith(toArrowFunctionAction.kind, kind)) {
|
|
136255
|
-
const
|
|
136256
|
-
if (
|
|
136257
|
-
errors.push({ ...toArrowFunctionAction, notApplicableReason:
|
|
136272
|
+
const error2 = isFunctionExpression(func) ? void 0 : getLocaleSpecificMessage(Diagnostics.Could_not_convert_to_arrow_function);
|
|
136273
|
+
if (error2) {
|
|
136274
|
+
errors.push({ ...toArrowFunctionAction, notApplicableReason: error2 });
|
|
136258
136275
|
} else {
|
|
136259
136276
|
possibleActions.push(toArrowFunctionAction);
|
|
136260
136277
|
}
|
|
@@ -137597,11 +137614,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
137597
137614
|
}
|
|
137598
137615
|
return infos.length ? infos : emptyArray;
|
|
137599
137616
|
function getStringError(errors) {
|
|
137600
|
-
let
|
|
137601
|
-
if (typeof
|
|
137602
|
-
|
|
137617
|
+
let error2 = errors[0].messageText;
|
|
137618
|
+
if (typeof error2 !== "string") {
|
|
137619
|
+
error2 = error2.messageText;
|
|
137603
137620
|
}
|
|
137604
|
-
return
|
|
137621
|
+
return error2;
|
|
137605
137622
|
}
|
|
137606
137623
|
}
|
|
137607
137624
|
function getRefactorEditsToExtractSymbol(context, actionName2) {
|
|
@@ -139845,9 +139862,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
139845
139862
|
function getValidSourceFile(fileName) {
|
|
139846
139863
|
const sourceFile = program.getSourceFile(fileName);
|
|
139847
139864
|
if (!sourceFile) {
|
|
139848
|
-
const
|
|
139849
|
-
|
|
139850
|
-
throw
|
|
139865
|
+
const error2 = new Error(`Could not find source file: '${fileName}'.`);
|
|
139866
|
+
error2.ProgramFiles = program.getSourceFiles().map((f) => f.fileName);
|
|
139867
|
+
throw error2;
|
|
139851
139868
|
}
|
|
139852
139869
|
return sourceFile;
|
|
139853
139870
|
}
|
|
@@ -140080,14 +140097,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
140080
140097
|
}
|
|
140081
140098
|
}
|
|
140082
140099
|
function cleanupSemanticCache() {
|
|
140083
|
-
program = void 0;
|
|
140084
|
-
}
|
|
140085
|
-
function dispose() {
|
|
140086
140100
|
if (program) {
|
|
140087
140101
|
const key = documentRegistry.getKeyForCompilationSettings(program.getCompilerOptions());
|
|
140088
140102
|
forEach(program.getSourceFiles(), (f) => documentRegistry.releaseDocumentWithKey(f.resolvedPath, key, f.scriptKind, f.impliedNodeFormat));
|
|
140089
140103
|
program = void 0;
|
|
140090
140104
|
}
|
|
140105
|
+
}
|
|
140106
|
+
function dispose() {
|
|
140107
|
+
cleanupSemanticCache();
|
|
140091
140108
|
host = void 0;
|
|
140092
140109
|
}
|
|
140093
140110
|
function getSyntacticDiagnostics(fileName) {
|
|
@@ -143743,9 +143760,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
143743
143760
|
return { fixName: fixName8, description: description3, changes, fixId: fixId52, fixAllDescription, commands: command ? [command] : void 0 };
|
|
143744
143761
|
}
|
|
143745
143762
|
function registerCodeFix(reg) {
|
|
143746
|
-
for (const
|
|
143763
|
+
for (const error2 of reg.errorCodes) {
|
|
143747
143764
|
errorCodeToFixesArray = void 0;
|
|
143748
|
-
errorCodeToFixes.add(String(
|
|
143765
|
+
errorCodeToFixes.add(String(error2), reg);
|
|
143749
143766
|
}
|
|
143750
143767
|
if (reg.fixIds) {
|
|
143751
143768
|
for (const fixId52 of reg.fixIds) {
|
|
@@ -153982,8 +153999,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153982
153999
|
return [createCodeFixAction(fixId48, changes, Diagnostics.Split_into_two_separate_import_declarations, fixId48, Diagnostics.Split_all_invalid_type_only_imports)];
|
|
153983
154000
|
}
|
|
153984
154001
|
},
|
|
153985
|
-
getAllCodeActions: (context) => codeFixAll(context, errorCodes60, (changes,
|
|
153986
|
-
splitTypeOnlyImport(changes, getImportDeclaration2(context.sourceFile,
|
|
154002
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes60, (changes, error2) => {
|
|
154003
|
+
splitTypeOnlyImport(changes, getImportDeclaration2(context.sourceFile, error2), context);
|
|
153987
154004
|
})
|
|
153988
154005
|
});
|
|
153989
154006
|
}
|
|
@@ -162780,7 +162797,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
162780
162797
|
if (length(oldImportDecls) === 0) {
|
|
162781
162798
|
return;
|
|
162782
162799
|
}
|
|
162783
|
-
|
|
162800
|
+
setEmitFlags(oldImportDecls[0], 1024 /* NoLeadingComments */);
|
|
162784
162801
|
const oldImportGroups = shouldCombine ? group(oldImportDecls, (importDecl) => getExternalModuleName2(importDecl.moduleSpecifier)) : [oldImportDecls];
|
|
162785
162802
|
const sortedImportGroups = shouldSort ? stableSort(oldImportGroups, (group1, group2) => compareModuleSpecifiersWorker(group1[0].moduleSpecifier, group2[0].moduleSpecifier, comparer)) : oldImportGroups;
|
|
162786
162803
|
const newImportDecls = flatMap(sortedImportGroups, (importGroup) => getExternalModuleName2(importGroup[0].moduleSpecifier) || importGroup[0].moduleSpecifier === void 0 ? coalesce(importGroup) : importGroup);
|
|
@@ -167992,11 +168009,11 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
167992
168009
|
if (index >= sorted.length) {
|
|
167993
168010
|
return false;
|
|
167994
168011
|
}
|
|
167995
|
-
const
|
|
167996
|
-
if (r.end <=
|
|
168012
|
+
const error2 = sorted[index];
|
|
168013
|
+
if (r.end <= error2.start) {
|
|
167997
168014
|
return false;
|
|
167998
168015
|
}
|
|
167999
|
-
if (startEndOverlapsWithStartEnd(r.pos, r.end,
|
|
168016
|
+
if (startEndOverlapsWithStartEnd(r.pos, r.end, error2.start, error2.start + error2.length)) {
|
|
168000
168017
|
return true;
|
|
168001
168018
|
}
|
|
168002
168019
|
index++;
|
|
@@ -169517,11 +169534,11 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
169517
169534
|
function getTypeScriptVersion() {
|
|
169518
169535
|
return typeScriptVersion2 ?? (typeScriptVersion2 = new Version(version));
|
|
169519
169536
|
}
|
|
169520
|
-
function formatDeprecationMessage(name,
|
|
169521
|
-
let deprecationMessage =
|
|
169537
|
+
function formatDeprecationMessage(name, error2, errorAfter, since, message) {
|
|
169538
|
+
let deprecationMessage = error2 ? "DeprecationError: " : "DeprecationWarning: ";
|
|
169522
169539
|
deprecationMessage += `'${name}' `;
|
|
169523
169540
|
deprecationMessage += since ? `has been deprecated since v${since}` : "is deprecated";
|
|
169524
|
-
deprecationMessage +=
|
|
169541
|
+
deprecationMessage += error2 ? " and can no longer be used." : errorAfter ? ` and will no longer be usable after v${errorAfter}.` : ".";
|
|
169525
169542
|
deprecationMessage += message ? ` ${formatStringFromArgs(message, [name], 0)}` : "";
|
|
169526
169543
|
return deprecationMessage;
|
|
169527
169544
|
}
|
|
@@ -169559,9 +169576,9 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
169559
169576
|
const errorAfter = typeof options.errorAfter === "string" ? new Version(options.errorAfter) : options.errorAfter;
|
|
169560
169577
|
const warnAfter = typeof options.warnAfter === "string" ? new Version(options.warnAfter) : options.warnAfter;
|
|
169561
169578
|
const since = typeof options.since === "string" ? new Version(options.since) : options.since ?? warnAfter;
|
|
169562
|
-
const
|
|
169579
|
+
const error2 = options.error || errorAfter && version2.compareTo(errorAfter) >= 0;
|
|
169563
169580
|
const warn = !warnAfter || version2.compareTo(warnAfter) >= 0;
|
|
169564
|
-
return
|
|
169581
|
+
return error2 ? createErrorDeprecation(name, errorAfter, since, options.message) : warn ? createWarningDeprecation(name, errorAfter, since, options.message) : noop;
|
|
169565
169582
|
}
|
|
169566
169583
|
function wrapFunction(deprecation, func) {
|
|
169567
169584
|
return function() {
|
|
@@ -170934,6 +170951,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
170934
170951
|
isDiagnosticWithLocation: () => isDiagnosticWithLocation,
|
|
170935
170952
|
isDiskPathRoot: () => isDiskPathRoot,
|
|
170936
170953
|
isDoStatement: () => isDoStatement,
|
|
170954
|
+
isDocumentRegistryEntry: () => isDocumentRegistryEntry,
|
|
170937
170955
|
isDotDotDotToken: () => isDotDotDotToken,
|
|
170938
170956
|
isDottedName: () => isDottedName,
|
|
170939
170957
|
isDynamicName: () => isDynamicName,
|