typescript 5.2.0-dev.20230606 → 5.2.0-dev.20230607
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tsc.js +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/tsserver.js
CHANGED
|
@@ -1285,6 +1285,7 @@ __export(server_exports, {
|
|
|
1285
1285
|
isDiagnosticWithLocation: () => isDiagnosticWithLocation,
|
|
1286
1286
|
isDiskPathRoot: () => isDiskPathRoot,
|
|
1287
1287
|
isDoStatement: () => isDoStatement,
|
|
1288
|
+
isDocumentRegistryEntry: () => isDocumentRegistryEntry,
|
|
1288
1289
|
isDotDotDotToken: () => isDotDotDotToken,
|
|
1289
1290
|
isDottedName: () => isDottedName,
|
|
1290
1291
|
isDynamicName: () => isDynamicName,
|
|
@@ -2304,7 +2305,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2304
2305
|
|
|
2305
2306
|
// src/compiler/corePublic.ts
|
|
2306
2307
|
var versionMajorMinor = "5.2";
|
|
2307
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2308
|
+
var version = `${versionMajorMinor}.0-dev.20230607`;
|
|
2308
2309
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2309
2310
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2310
2311
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -4005,10 +4006,10 @@ var Debug;
|
|
|
4005
4006
|
}
|
|
4006
4007
|
Debug2.log = log;
|
|
4007
4008
|
((_log) => {
|
|
4008
|
-
function
|
|
4009
|
+
function error2(s) {
|
|
4009
4010
|
logMessage(1 /* Error */, s);
|
|
4010
4011
|
}
|
|
4011
|
-
_log.error =
|
|
4012
|
+
_log.error = error2;
|
|
4012
4013
|
function warn(s) {
|
|
4013
4014
|
logMessage(2 /* Warning */, s);
|
|
4014
4015
|
}
|
|
@@ -4282,6 +4283,15 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
|
|
|
4282
4283
|
);
|
|
4283
4284
|
}
|
|
4284
4285
|
Debug2.formatSnippetKind = formatSnippetKind;
|
|
4286
|
+
function formatScriptKind(kind) {
|
|
4287
|
+
return formatEnum(
|
|
4288
|
+
kind,
|
|
4289
|
+
ScriptKind,
|
|
4290
|
+
/*isFlags*/
|
|
4291
|
+
false
|
|
4292
|
+
);
|
|
4293
|
+
}
|
|
4294
|
+
Debug2.formatScriptKind = formatScriptKind;
|
|
4285
4295
|
function formatNodeFlags(flags) {
|
|
4286
4296
|
return formatEnum(
|
|
4287
4297
|
flags,
|
|
@@ -6920,16 +6930,16 @@ var NewLineKind = /* @__PURE__ */ ((NewLineKind3) => {
|
|
|
6920
6930
|
NewLineKind3[NewLineKind3["LineFeed"] = 1] = "LineFeed";
|
|
6921
6931
|
return NewLineKind3;
|
|
6922
6932
|
})(NewLineKind || {});
|
|
6923
|
-
var ScriptKind = /* @__PURE__ */ ((
|
|
6924
|
-
|
|
6925
|
-
|
|
6926
|
-
|
|
6927
|
-
|
|
6928
|
-
|
|
6929
|
-
|
|
6930
|
-
|
|
6931
|
-
|
|
6932
|
-
return
|
|
6933
|
+
var ScriptKind = /* @__PURE__ */ ((ScriptKind7) => {
|
|
6934
|
+
ScriptKind7[ScriptKind7["Unknown"] = 0] = "Unknown";
|
|
6935
|
+
ScriptKind7[ScriptKind7["JS"] = 1] = "JS";
|
|
6936
|
+
ScriptKind7[ScriptKind7["JSX"] = 2] = "JSX";
|
|
6937
|
+
ScriptKind7[ScriptKind7["TS"] = 3] = "TS";
|
|
6938
|
+
ScriptKind7[ScriptKind7["TSX"] = 4] = "TSX";
|
|
6939
|
+
ScriptKind7[ScriptKind7["External"] = 5] = "External";
|
|
6940
|
+
ScriptKind7[ScriptKind7["JSON"] = 6] = "JSON";
|
|
6941
|
+
ScriptKind7[ScriptKind7["Deferred"] = 7] = "Deferred";
|
|
6942
|
+
return ScriptKind7;
|
|
6933
6943
|
})(ScriptKind || {});
|
|
6934
6944
|
var ScriptTarget = /* @__PURE__ */ ((ScriptTarget11) => {
|
|
6935
6945
|
ScriptTarget11[ScriptTarget11["ES3"] = 0] = "ES3";
|
|
@@ -8459,8 +8469,8 @@ var sys = (() => {
|
|
|
8459
8469
|
try {
|
|
8460
8470
|
const modulePath = resolveJSModule(moduleName, baseDir, nodeSystem);
|
|
8461
8471
|
return { module: require(modulePath), modulePath, error: void 0 };
|
|
8462
|
-
} catch (
|
|
8463
|
-
return { module: void 0, modulePath: void 0, error };
|
|
8472
|
+
} catch (error2) {
|
|
8473
|
+
return { module: void 0, modulePath: void 0, error: error2 };
|
|
8464
8474
|
}
|
|
8465
8475
|
}
|
|
8466
8476
|
};
|
|
@@ -11216,6 +11226,7 @@ var Diagnostics = {
|
|
|
11216
11226
|
Use_import_type: diag(95180, 3 /* Message */, "Use_import_type_95180", "Use 'import type'"),
|
|
11217
11227
|
Use_type_0: diag(95181, 3 /* Message */, "Use_type_0_95181", "Use 'type {0}'"),
|
|
11218
11228
|
Fix_all_with_type_only_imports: diag(95182, 3 /* Message */, "Fix_all_with_type_only_imports_95182", "Fix all with type-only imports"),
|
|
11229
|
+
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"),
|
|
11219
11230
|
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."),
|
|
11220
11231
|
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'."),
|
|
11221
11232
|
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?"),
|
|
@@ -11691,9 +11702,9 @@ function isConflictMarkerTrivia(text, pos) {
|
|
|
11691
11702
|
}
|
|
11692
11703
|
return false;
|
|
11693
11704
|
}
|
|
11694
|
-
function scanConflictMarkerTrivia(text, pos,
|
|
11695
|
-
if (
|
|
11696
|
-
|
|
11705
|
+
function scanConflictMarkerTrivia(text, pos, error2) {
|
|
11706
|
+
if (error2) {
|
|
11707
|
+
error2(Diagnostics.Merge_conflict_marker_encountered, pos, mergeConflictMarkerLength);
|
|
11697
11708
|
}
|
|
11698
11709
|
const ch = text.charCodeAt(pos);
|
|
11699
11710
|
const len = text.length;
|
|
@@ -11990,7 +12001,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
11990
12001
|
});
|
|
11991
12002
|
}
|
|
11992
12003
|
return scanner2;
|
|
11993
|
-
function
|
|
12004
|
+
function error2(message, errPos = pos, length3, arg0) {
|
|
11994
12005
|
if (onError) {
|
|
11995
12006
|
const oldPos = pos;
|
|
11996
12007
|
pos = errPos;
|
|
@@ -12014,9 +12025,9 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12014
12025
|
} else {
|
|
12015
12026
|
tokenFlags |= 16384 /* ContainsInvalidSeparator */;
|
|
12016
12027
|
if (isPreviousTokenSeparator) {
|
|
12017
|
-
|
|
12028
|
+
error2(Diagnostics.Multiple_consecutive_numeric_separators_are_not_permitted, pos, 1);
|
|
12018
12029
|
} else {
|
|
12019
|
-
|
|
12030
|
+
error2(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1);
|
|
12020
12031
|
}
|
|
12021
12032
|
}
|
|
12022
12033
|
pos++;
|
|
@@ -12033,7 +12044,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12033
12044
|
}
|
|
12034
12045
|
if (text.charCodeAt(pos - 1) === 95 /* _ */) {
|
|
12035
12046
|
tokenFlags |= 16384 /* ContainsInvalidSeparator */;
|
|
12036
|
-
|
|
12047
|
+
error2(Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1);
|
|
12037
12048
|
}
|
|
12038
12049
|
return result + text.substring(start3, pos);
|
|
12039
12050
|
}
|
|
@@ -12044,7 +12055,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12044
12055
|
pos++;
|
|
12045
12056
|
if (text.charCodeAt(pos) === 95 /* _ */) {
|
|
12046
12057
|
tokenFlags |= 512 /* ContainsSeparator */ | 16384 /* ContainsInvalidSeparator */;
|
|
12047
|
-
|
|
12058
|
+
error2(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1);
|
|
12048
12059
|
pos--;
|
|
12049
12060
|
mainFragment = scanNumberFragment();
|
|
12050
12061
|
} else if (!scanDigits()) {
|
|
@@ -12059,7 +12070,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12059
12070
|
const literal = (withMinus ? "-" : "") + "0o" + (+tokenValue).toString(8);
|
|
12060
12071
|
if (withMinus)
|
|
12061
12072
|
start3--;
|
|
12062
|
-
|
|
12073
|
+
error2(Diagnostics.Octal_literals_are_not_allowed_Use_the_syntax_0, start3, pos - start3, literal);
|
|
12063
12074
|
return { type: 9 /* NumericLiteral */, value: tokenValue };
|
|
12064
12075
|
}
|
|
12065
12076
|
} else {
|
|
@@ -12080,7 +12091,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12080
12091
|
const preNumericPart = pos;
|
|
12081
12092
|
const finalFragment = scanNumberFragment();
|
|
12082
12093
|
if (!finalFragment) {
|
|
12083
|
-
|
|
12094
|
+
error2(Diagnostics.Digit_expected);
|
|
12084
12095
|
} else {
|
|
12085
12096
|
scientificFragment = text.substring(end2, preNumericPart) + finalFragment;
|
|
12086
12097
|
end2 = pos;
|
|
@@ -12099,7 +12110,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12099
12110
|
result = text.substring(start3, end2);
|
|
12100
12111
|
}
|
|
12101
12112
|
if (tokenFlags & 8192 /* ContainsLeadingZero */) {
|
|
12102
|
-
|
|
12113
|
+
error2(Diagnostics.Decimals_with_leading_zeros_are_not_allowed, start3, end2 - start3);
|
|
12103
12114
|
return { type: 9 /* NumericLiteral */, value: "" + +result };
|
|
12104
12115
|
}
|
|
12105
12116
|
if (decimalFragment !== void 0 || tokenFlags & 16 /* Scientific */) {
|
|
@@ -12124,12 +12135,12 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12124
12135
|
const { length: length3 } = scanIdentifierParts();
|
|
12125
12136
|
if (length3 === 1 && text[identifierStart] === "n") {
|
|
12126
12137
|
if (isScientific) {
|
|
12127
|
-
|
|
12138
|
+
error2(Diagnostics.A_bigint_literal_cannot_use_exponential_notation, numericStart, identifierStart - numericStart + 1);
|
|
12128
12139
|
} else {
|
|
12129
|
-
|
|
12140
|
+
error2(Diagnostics.A_bigint_literal_must_be_an_integer, numericStart, identifierStart - numericStart + 1);
|
|
12130
12141
|
}
|
|
12131
12142
|
} else {
|
|
12132
|
-
|
|
12143
|
+
error2(Diagnostics.An_identifier_or_keyword_cannot_immediately_follow_a_numeric_literal, identifierStart, length3);
|
|
12133
12144
|
pos = identifierStart;
|
|
12134
12145
|
}
|
|
12135
12146
|
}
|
|
@@ -12176,9 +12187,9 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12176
12187
|
allowSeparator = false;
|
|
12177
12188
|
isPreviousTokenSeparator = true;
|
|
12178
12189
|
} else if (isPreviousTokenSeparator) {
|
|
12179
|
-
|
|
12190
|
+
error2(Diagnostics.Multiple_consecutive_numeric_separators_are_not_permitted, pos, 1);
|
|
12180
12191
|
} else {
|
|
12181
|
-
|
|
12192
|
+
error2(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1);
|
|
12182
12193
|
}
|
|
12183
12194
|
pos++;
|
|
12184
12195
|
continue;
|
|
@@ -12197,7 +12208,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12197
12208
|
valueChars = [];
|
|
12198
12209
|
}
|
|
12199
12210
|
if (text.charCodeAt(pos - 1) === 95 /* _ */) {
|
|
12200
|
-
|
|
12211
|
+
error2(Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1);
|
|
12201
12212
|
}
|
|
12202
12213
|
return String.fromCharCode(...valueChars);
|
|
12203
12214
|
}
|
|
@@ -12210,7 +12221,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12210
12221
|
if (pos >= end) {
|
|
12211
12222
|
result += text.substring(start3, pos);
|
|
12212
12223
|
tokenFlags |= 4 /* Unterminated */;
|
|
12213
|
-
|
|
12224
|
+
error2(Diagnostics.Unterminated_string_literal);
|
|
12214
12225
|
break;
|
|
12215
12226
|
}
|
|
12216
12227
|
const ch = text.charCodeAt(pos);
|
|
@@ -12231,7 +12242,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12231
12242
|
if (isLineBreak(ch) && !jsxAttributeString) {
|
|
12232
12243
|
result += text.substring(start3, pos);
|
|
12233
12244
|
tokenFlags |= 4 /* Unterminated */;
|
|
12234
|
-
|
|
12245
|
+
error2(Diagnostics.Unterminated_string_literal);
|
|
12235
12246
|
break;
|
|
12236
12247
|
}
|
|
12237
12248
|
pos++;
|
|
@@ -12248,7 +12259,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12248
12259
|
if (pos >= end) {
|
|
12249
12260
|
contents += text.substring(start3, pos);
|
|
12250
12261
|
tokenFlags |= 4 /* Unterminated */;
|
|
12251
|
-
|
|
12262
|
+
error2(Diagnostics.Unterminated_template_literal);
|
|
12252
12263
|
resultingToken = startedWithBacktick ? 15 /* NoSubstitutionTemplateLiteral */ : 18 /* TemplateTail */;
|
|
12253
12264
|
break;
|
|
12254
12265
|
}
|
|
@@ -12291,7 +12302,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12291
12302
|
const start3 = pos;
|
|
12292
12303
|
pos++;
|
|
12293
12304
|
if (pos >= end) {
|
|
12294
|
-
|
|
12305
|
+
error2(Diagnostics.Unexpected_end_of_text);
|
|
12295
12306
|
return "";
|
|
12296
12307
|
}
|
|
12297
12308
|
const ch = text.charCodeAt(pos);
|
|
@@ -12317,7 +12328,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12317
12328
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
12318
12329
|
if (shouldEmitInvalidEscapeError) {
|
|
12319
12330
|
const code = parseInt(text.substring(start3 + 1, pos), 8);
|
|
12320
|
-
|
|
12331
|
+
error2(Diagnostics.Octal_escape_sequences_are_not_allowed_Use_the_syntax_0, start3, pos - start3, "\\x" + padLeft(code.toString(16), 2, "0"));
|
|
12321
12332
|
return String.fromCharCode(code);
|
|
12322
12333
|
}
|
|
12323
12334
|
return text.substring(start3, pos);
|
|
@@ -12325,7 +12336,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12325
12336
|
case 57 /* _9 */:
|
|
12326
12337
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
12327
12338
|
if (shouldEmitInvalidEscapeError) {
|
|
12328
|
-
|
|
12339
|
+
error2(Diagnostics.Escape_sequence_0_is_not_allowed, start3, pos - start3, text.substring(start3, pos));
|
|
12329
12340
|
return String.fromCharCode(ch);
|
|
12330
12341
|
}
|
|
12331
12342
|
return text.substring(start3, pos);
|
|
@@ -12357,28 +12368,28 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12357
12368
|
if (escapedValue < 0) {
|
|
12358
12369
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
12359
12370
|
if (shouldEmitInvalidEscapeError) {
|
|
12360
|
-
|
|
12371
|
+
error2(Diagnostics.Hexadecimal_digit_expected);
|
|
12361
12372
|
}
|
|
12362
12373
|
return text.substring(start3, pos);
|
|
12363
12374
|
}
|
|
12364
12375
|
if (!isCodePoint(escapedValue)) {
|
|
12365
12376
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
12366
12377
|
if (shouldEmitInvalidEscapeError) {
|
|
12367
|
-
|
|
12378
|
+
error2(Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive);
|
|
12368
12379
|
}
|
|
12369
12380
|
return text.substring(start3, pos);
|
|
12370
12381
|
}
|
|
12371
12382
|
if (pos >= end) {
|
|
12372
12383
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
12373
12384
|
if (shouldEmitInvalidEscapeError) {
|
|
12374
|
-
|
|
12385
|
+
error2(Diagnostics.Unexpected_end_of_text);
|
|
12375
12386
|
}
|
|
12376
12387
|
return text.substring(start3, pos);
|
|
12377
12388
|
}
|
|
12378
12389
|
if (text.charCodeAt(pos) !== 125 /* closeBrace */) {
|
|
12379
12390
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
12380
12391
|
if (shouldEmitInvalidEscapeError) {
|
|
12381
|
-
|
|
12392
|
+
error2(Diagnostics.Unterminated_Unicode_escape_sequence);
|
|
12382
12393
|
}
|
|
12383
12394
|
return text.substring(start3, pos);
|
|
12384
12395
|
}
|
|
@@ -12390,7 +12401,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12390
12401
|
if (!(pos < end && isHexDigit(text.charCodeAt(pos)))) {
|
|
12391
12402
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
12392
12403
|
if (shouldEmitInvalidEscapeError) {
|
|
12393
|
-
|
|
12404
|
+
error2(Diagnostics.Hexadecimal_digit_expected);
|
|
12394
12405
|
}
|
|
12395
12406
|
return text.substring(start3, pos);
|
|
12396
12407
|
}
|
|
@@ -12402,7 +12413,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12402
12413
|
if (!(pos < end && isHexDigit(text.charCodeAt(pos)))) {
|
|
12403
12414
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
12404
12415
|
if (shouldEmitInvalidEscapeError) {
|
|
12405
|
-
|
|
12416
|
+
error2(Diagnostics.Hexadecimal_digit_expected);
|
|
12406
12417
|
}
|
|
12407
12418
|
return text.substring(start3, pos);
|
|
12408
12419
|
}
|
|
@@ -12430,19 +12441,19 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12430
12441
|
const escapedValue = escapedValueString ? parseInt(escapedValueString, 16) : -1;
|
|
12431
12442
|
let isInvalidExtendedEscape = false;
|
|
12432
12443
|
if (escapedValue < 0) {
|
|
12433
|
-
|
|
12444
|
+
error2(Diagnostics.Hexadecimal_digit_expected);
|
|
12434
12445
|
isInvalidExtendedEscape = true;
|
|
12435
12446
|
} else if (escapedValue > 1114111) {
|
|
12436
|
-
|
|
12447
|
+
error2(Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive);
|
|
12437
12448
|
isInvalidExtendedEscape = true;
|
|
12438
12449
|
}
|
|
12439
12450
|
if (pos >= end) {
|
|
12440
|
-
|
|
12451
|
+
error2(Diagnostics.Unexpected_end_of_text);
|
|
12441
12452
|
isInvalidExtendedEscape = true;
|
|
12442
12453
|
} else if (text.charCodeAt(pos) === 125 /* closeBrace */) {
|
|
12443
12454
|
pos++;
|
|
12444
12455
|
} else {
|
|
12445
|
-
|
|
12456
|
+
error2(Diagnostics.Unterminated_Unicode_escape_sequence);
|
|
12446
12457
|
isInvalidExtendedEscape = true;
|
|
12447
12458
|
}
|
|
12448
12459
|
if (isInvalidExtendedEscape) {
|
|
@@ -12536,9 +12547,9 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12536
12547
|
separatorAllowed = false;
|
|
12537
12548
|
isPreviousTokenSeparator = true;
|
|
12538
12549
|
} else if (isPreviousTokenSeparator) {
|
|
12539
|
-
|
|
12550
|
+
error2(Diagnostics.Multiple_consecutive_numeric_separators_are_not_permitted, pos, 1);
|
|
12540
12551
|
} else {
|
|
12541
|
-
|
|
12552
|
+
error2(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1);
|
|
12542
12553
|
}
|
|
12543
12554
|
pos++;
|
|
12544
12555
|
continue;
|
|
@@ -12552,7 +12563,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12552
12563
|
isPreviousTokenSeparator = false;
|
|
12553
12564
|
}
|
|
12554
12565
|
if (text.charCodeAt(pos - 1) === 95 /* _ */) {
|
|
12555
|
-
|
|
12566
|
+
error2(Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1);
|
|
12556
12567
|
}
|
|
12557
12568
|
return value;
|
|
12558
12569
|
}
|
|
@@ -12582,7 +12593,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12582
12593
|
const ch = codePointAt(text, pos);
|
|
12583
12594
|
if (pos === 0) {
|
|
12584
12595
|
if (ch === 65533 /* replacementCharacter */) {
|
|
12585
|
-
|
|
12596
|
+
error2(Diagnostics.File_appears_to_be_binary);
|
|
12586
12597
|
pos = end;
|
|
12587
12598
|
return token = 8 /* NonTextFileMarkerTrivia */;
|
|
12588
12599
|
}
|
|
@@ -12773,7 +12784,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12773
12784
|
}
|
|
12774
12785
|
commentDirectives = appendIfCommentDirective(commentDirectives, text.slice(lastLineStart, pos), commentDirectiveRegExMultiLine, lastLineStart);
|
|
12775
12786
|
if (!commentClosed) {
|
|
12776
|
-
|
|
12787
|
+
error2(Diagnostics.Asterisk_Slash_expected);
|
|
12777
12788
|
}
|
|
12778
12789
|
if (skipTrivia2) {
|
|
12779
12790
|
continue;
|
|
@@ -12798,7 +12809,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12798
12809
|
true
|
|
12799
12810
|
);
|
|
12800
12811
|
if (!tokenValue) {
|
|
12801
|
-
|
|
12812
|
+
error2(Diagnostics.Hexadecimal_digit_expected);
|
|
12802
12813
|
tokenValue = "0";
|
|
12803
12814
|
}
|
|
12804
12815
|
tokenValue = "0x" + tokenValue;
|
|
@@ -12811,7 +12822,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12811
12822
|
2
|
|
12812
12823
|
);
|
|
12813
12824
|
if (!tokenValue) {
|
|
12814
|
-
|
|
12825
|
+
error2(Diagnostics.Binary_digit_expected);
|
|
12815
12826
|
tokenValue = "0";
|
|
12816
12827
|
}
|
|
12817
12828
|
tokenValue = "0b" + tokenValue;
|
|
@@ -12824,7 +12835,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12824
12835
|
8
|
|
12825
12836
|
);
|
|
12826
12837
|
if (!tokenValue) {
|
|
12827
|
-
|
|
12838
|
+
error2(Diagnostics.Octal_digit_expected);
|
|
12828
12839
|
tokenValue = "0";
|
|
12829
12840
|
}
|
|
12830
12841
|
tokenValue = "0o" + tokenValue;
|
|
@@ -12850,7 +12861,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12850
12861
|
return token = 27 /* SemicolonToken */;
|
|
12851
12862
|
case 60 /* lessThan */:
|
|
12852
12863
|
if (isConflictMarkerTrivia(text, pos)) {
|
|
12853
|
-
pos = scanConflictMarkerTrivia(text, pos,
|
|
12864
|
+
pos = scanConflictMarkerTrivia(text, pos, error2);
|
|
12854
12865
|
if (skipTrivia2) {
|
|
12855
12866
|
continue;
|
|
12856
12867
|
} else {
|
|
@@ -12873,7 +12884,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12873
12884
|
return token = 30 /* LessThanToken */;
|
|
12874
12885
|
case 61 /* equals */:
|
|
12875
12886
|
if (isConflictMarkerTrivia(text, pos)) {
|
|
12876
|
-
pos = scanConflictMarkerTrivia(text, pos,
|
|
12887
|
+
pos = scanConflictMarkerTrivia(text, pos, error2);
|
|
12877
12888
|
if (skipTrivia2) {
|
|
12878
12889
|
continue;
|
|
12879
12890
|
} else {
|
|
@@ -12893,7 +12904,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12893
12904
|
return token = 64 /* EqualsToken */;
|
|
12894
12905
|
case 62 /* greaterThan */:
|
|
12895
12906
|
if (isConflictMarkerTrivia(text, pos)) {
|
|
12896
|
-
pos = scanConflictMarkerTrivia(text, pos,
|
|
12907
|
+
pos = scanConflictMarkerTrivia(text, pos, error2);
|
|
12897
12908
|
if (skipTrivia2) {
|
|
12898
12909
|
continue;
|
|
12899
12910
|
} else {
|
|
@@ -12931,7 +12942,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12931
12942
|
return token = 19 /* OpenBraceToken */;
|
|
12932
12943
|
case 124 /* bar */:
|
|
12933
12944
|
if (isConflictMarkerTrivia(text, pos)) {
|
|
12934
|
-
pos = scanConflictMarkerTrivia(text, pos,
|
|
12945
|
+
pos = scanConflictMarkerTrivia(text, pos, error2);
|
|
12935
12946
|
if (skipTrivia2) {
|
|
12936
12947
|
continue;
|
|
12937
12948
|
} else {
|
|
@@ -12973,12 +12984,12 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12973
12984
|
tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts();
|
|
12974
12985
|
return token = getIdentifierToken();
|
|
12975
12986
|
}
|
|
12976
|
-
|
|
12987
|
+
error2(Diagnostics.Invalid_character);
|
|
12977
12988
|
pos++;
|
|
12978
12989
|
return token = 0 /* Unknown */;
|
|
12979
12990
|
case 35 /* hash */:
|
|
12980
12991
|
if (pos !== 0 && text[pos + 1] === "!") {
|
|
12981
|
-
|
|
12992
|
+
error2(Diagnostics.can_only_be_used_at_the_start_of_a_file);
|
|
12982
12993
|
pos++;
|
|
12983
12994
|
return token = 0 /* Unknown */;
|
|
12984
12995
|
}
|
|
@@ -13006,7 +13017,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13006
13017
|
scanIdentifier(charAfterHash, languageVersion);
|
|
13007
13018
|
} else {
|
|
13008
13019
|
tokenValue = "#";
|
|
13009
|
-
|
|
13020
|
+
error2(Diagnostics.Invalid_character, pos++, charSize(ch));
|
|
13010
13021
|
}
|
|
13011
13022
|
return token = 81 /* PrivateIdentifier */;
|
|
13012
13023
|
default:
|
|
@@ -13022,7 +13033,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13022
13033
|
continue;
|
|
13023
13034
|
}
|
|
13024
13035
|
const size = charSize(ch);
|
|
13025
|
-
|
|
13036
|
+
error2(Diagnostics.Invalid_character, pos, size);
|
|
13026
13037
|
pos += size;
|
|
13027
13038
|
return token = 0 /* Unknown */;
|
|
13028
13039
|
}
|
|
@@ -13088,13 +13099,13 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13088
13099
|
while (true) {
|
|
13089
13100
|
if (p >= end) {
|
|
13090
13101
|
tokenFlags |= 4 /* Unterminated */;
|
|
13091
|
-
|
|
13102
|
+
error2(Diagnostics.Unterminated_regular_expression_literal);
|
|
13092
13103
|
break;
|
|
13093
13104
|
}
|
|
13094
13105
|
const ch = text.charCodeAt(p);
|
|
13095
13106
|
if (isLineBreak(ch)) {
|
|
13096
13107
|
tokenFlags |= 4 /* Unterminated */;
|
|
13097
|
-
|
|
13108
|
+
error2(Diagnostics.Unterminated_regular_expression_literal);
|
|
13098
13109
|
break;
|
|
13099
13110
|
}
|
|
13100
13111
|
if (inEscape) {
|
|
@@ -13206,16 +13217,16 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13206
13217
|
}
|
|
13207
13218
|
if (char === 60 /* lessThan */) {
|
|
13208
13219
|
if (isConflictMarkerTrivia(text, pos)) {
|
|
13209
|
-
pos = scanConflictMarkerTrivia(text, pos,
|
|
13220
|
+
pos = scanConflictMarkerTrivia(text, pos, error2);
|
|
13210
13221
|
return token = 7 /* ConflictMarkerTrivia */;
|
|
13211
13222
|
}
|
|
13212
13223
|
break;
|
|
13213
13224
|
}
|
|
13214
13225
|
if (char === 62 /* greaterThan */) {
|
|
13215
|
-
|
|
13226
|
+
error2(Diagnostics.Unexpected_token_Did_you_mean_or_gt, pos, 1);
|
|
13216
13227
|
}
|
|
13217
13228
|
if (char === 125 /* closeBrace */) {
|
|
13218
|
-
|
|
13229
|
+
error2(Diagnostics.Unexpected_token_Did_you_mean_or_rbrace, pos, 1);
|
|
13219
13230
|
}
|
|
13220
13231
|
if (isLineBreak(char) && firstNonWhitespace === 0) {
|
|
13221
13232
|
firstNonWhitespace = -1;
|
|
@@ -40112,8 +40123,8 @@ function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, exis
|
|
|
40112
40123
|
const fileName = configFileName || "tsconfig.json";
|
|
40113
40124
|
const diagnosticMessage = Diagnostics.The_files_list_in_config_file_0_is_empty;
|
|
40114
40125
|
const nodeValue = forEachTsConfigPropArray(sourceFile, "files", (property) => property.initializer);
|
|
40115
|
-
const
|
|
40116
|
-
errors.push(
|
|
40126
|
+
const error2 = createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, nodeValue, diagnosticMessage, fileName);
|
|
40127
|
+
errors.push(error2);
|
|
40117
40128
|
} else {
|
|
40118
40129
|
createCompilerDiagnosticOnlyIfJson(Diagnostics.The_files_list_in_config_file_0_is_empty, configFileName || "tsconfig.json");
|
|
40119
40130
|
}
|
|
@@ -40220,8 +40231,8 @@ function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, exis
|
|
|
40220
40231
|
}
|
|
40221
40232
|
}
|
|
40222
40233
|
}
|
|
40223
|
-
function isErrorNoInputFiles(
|
|
40224
|
-
return
|
|
40234
|
+
function isErrorNoInputFiles(error2) {
|
|
40235
|
+
return error2.code === Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2.code;
|
|
40225
40236
|
}
|
|
40226
40237
|
function getErrorForNoInputFiles({ includeSpecs, excludeSpecs }, configFileName) {
|
|
40227
40238
|
return createCompilerDiagnostic(
|
|
@@ -40242,7 +40253,7 @@ function updateErrorForNoInputFiles(fileNames, configFileName, configFileSpecs,
|
|
|
40242
40253
|
if (shouldReportNoInputFiles(fileNames, canJsonReportNoInutFiles)) {
|
|
40243
40254
|
configParseDiagnostics.push(getErrorForNoInputFiles(configFileSpecs, configFileName));
|
|
40244
40255
|
} else {
|
|
40245
|
-
filterMutate(configParseDiagnostics, (
|
|
40256
|
+
filterMutate(configParseDiagnostics, (error2) => !isErrorNoInputFiles(error2));
|
|
40246
40257
|
}
|
|
40247
40258
|
return existingErrors !== configParseDiagnostics.length;
|
|
40248
40259
|
}
|
|
@@ -41386,7 +41397,7 @@ function compilerOptionValueToString(value) {
|
|
|
41386
41397
|
return str + "}";
|
|
41387
41398
|
}
|
|
41388
41399
|
function getKeyForCompilerOptions(options, affectingOptionDeclarations) {
|
|
41389
|
-
return affectingOptionDeclarations.map((option) => compilerOptionValueToString(getCompilerOptionValue(options, option))).join("|") +
|
|
41400
|
+
return affectingOptionDeclarations.map((option) => compilerOptionValueToString(getCompilerOptionValue(options, option))).join("|") + `|${options.pathsBasePath}`;
|
|
41390
41401
|
}
|
|
41391
41402
|
function createCacheWithRedirects(ownOptions) {
|
|
41392
41403
|
const redirectsMap = /* @__PURE__ */ new Map();
|
|
@@ -48319,14 +48330,14 @@ function createTypeChecker(host) {
|
|
|
48319
48330
|
}
|
|
48320
48331
|
}
|
|
48321
48332
|
function errorSkippedOn(key, location, message, ...args) {
|
|
48322
|
-
const diagnostic =
|
|
48333
|
+
const diagnostic = error2(location, message, ...args);
|
|
48323
48334
|
diagnostic.skippedOn = key;
|
|
48324
48335
|
return diagnostic;
|
|
48325
48336
|
}
|
|
48326
48337
|
function createError(location, message, ...args) {
|
|
48327
48338
|
return location ? createDiagnosticForNode(location, message, ...args) : createCompilerDiagnostic(message, ...args);
|
|
48328
48339
|
}
|
|
48329
|
-
function
|
|
48340
|
+
function error2(location, message, ...args) {
|
|
48330
48341
|
const diagnostic = createError(location, message, ...args);
|
|
48331
48342
|
diagnostics.add(diagnostic);
|
|
48332
48343
|
return diagnostic;
|
|
@@ -48350,7 +48361,7 @@ function createTypeChecker(host) {
|
|
|
48350
48361
|
addErrorOrSuggestion(isError, "message" in message ? createDiagnosticForNode(location, message, ...args) : createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(location), location, message));
|
|
48351
48362
|
}
|
|
48352
48363
|
function errorAndMaybeSuggestAwait(location, maybeMissingAwait, message, ...args) {
|
|
48353
|
-
const diagnostic =
|
|
48364
|
+
const diagnostic = error2(location, message, ...args);
|
|
48354
48365
|
if (maybeMissingAwait) {
|
|
48355
48366
|
const related = createDiagnosticForNode(location, Diagnostics.Did_you_forget_to_use_await);
|
|
48356
48367
|
addRelatedInfo(diagnostic, related);
|
|
@@ -48496,7 +48507,7 @@ function createTypeChecker(host) {
|
|
|
48496
48507
|
}
|
|
48497
48508
|
} else if (target.flags & 1024 /* NamespaceModule */) {
|
|
48498
48509
|
if (target !== globalThisSymbol) {
|
|
48499
|
-
|
|
48510
|
+
error2(
|
|
48500
48511
|
source.declarations && getNameOfDeclaration(source.declarations[0]),
|
|
48501
48512
|
Diagnostics.Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity,
|
|
48502
48513
|
symbolToString(target)
|
|
@@ -48626,7 +48637,7 @@ function createTypeChecker(host) {
|
|
|
48626
48637
|
mergeSymbol(mainModule, moduleAugmentation.symbol);
|
|
48627
48638
|
}
|
|
48628
48639
|
} else {
|
|
48629
|
-
|
|
48640
|
+
error2(moduleName, Diagnostics.Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity, moduleName.text);
|
|
48630
48641
|
}
|
|
48631
48642
|
}
|
|
48632
48643
|
}
|
|
@@ -48953,7 +48964,7 @@ function createTypeChecker(host) {
|
|
|
48953
48964
|
case 265 /* EnumDeclaration */:
|
|
48954
48965
|
if (result = lookup(((_c = getSymbolOfDeclaration(location)) == null ? void 0 : _c.exports) || emptySymbols, name, meaning & 8 /* EnumMember */)) {
|
|
48955
48966
|
if (nameNotFoundMessage && getIsolatedModules(compilerOptions) && !(location.flags & 16777216 /* Ambient */) && getSourceFileOfNode(location) !== getSourceFileOfNode(result.valueDeclaration)) {
|
|
48956
|
-
|
|
48967
|
+
error2(
|
|
48957
48968
|
errorLocation,
|
|
48958
48969
|
Diagnostics.Cannot_access_0_from_another_file_without_qualification_when_1_is_enabled_Use_2_instead,
|
|
48959
48970
|
unescapeLeadingUnderscores(name),
|
|
@@ -48985,7 +48996,7 @@ function createTypeChecker(host) {
|
|
|
48985
48996
|
}
|
|
48986
48997
|
if (lastLocation && isStatic(lastLocation)) {
|
|
48987
48998
|
if (nameNotFoundMessage) {
|
|
48988
|
-
|
|
48999
|
+
error2(errorLocation, Diagnostics.Static_members_cannot_reference_class_type_parameters);
|
|
48989
49000
|
}
|
|
48990
49001
|
return void 0;
|
|
48991
49002
|
}
|
|
@@ -49004,7 +49015,7 @@ function createTypeChecker(host) {
|
|
|
49004
49015
|
const container = location.parent.parent;
|
|
49005
49016
|
if (isClassLike(container) && (result = lookup(getSymbolOfDeclaration(container).members, name, meaning & 788968 /* Type */))) {
|
|
49006
49017
|
if (nameNotFoundMessage) {
|
|
49007
|
-
|
|
49018
|
+
error2(errorLocation, Diagnostics.Base_class_expressions_cannot_reference_class_type_parameters);
|
|
49008
49019
|
}
|
|
49009
49020
|
return void 0;
|
|
49010
49021
|
}
|
|
@@ -49015,7 +49026,7 @@ function createTypeChecker(host) {
|
|
|
49015
49026
|
if (isClassLike(grandparent) || grandparent.kind === 263 /* InterfaceDeclaration */) {
|
|
49016
49027
|
if (result = lookup(getSymbolOfDeclaration(grandparent).members, name, meaning & 788968 /* Type */)) {
|
|
49017
49028
|
if (nameNotFoundMessage) {
|
|
49018
|
-
|
|
49029
|
+
error2(errorLocation, Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);
|
|
49019
49030
|
}
|
|
49020
49031
|
return void 0;
|
|
49021
49032
|
}
|
|
@@ -49126,7 +49137,7 @@ function createTypeChecker(host) {
|
|
|
49126
49137
|
}
|
|
49127
49138
|
function checkAndReportErrorForInvalidInitializer() {
|
|
49128
49139
|
if (propertyWithInvalidInitializer && !(useDefineForClassFields && getEmitScriptTarget(compilerOptions) >= 9 /* ES2022 */)) {
|
|
49129
|
-
|
|
49140
|
+
error2(
|
|
49130
49141
|
errorLocation,
|
|
49131
49142
|
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,
|
|
49132
49143
|
declarationNameToString(propertyWithInvalidInitializer.name),
|
|
@@ -49146,7 +49157,7 @@ function createTypeChecker(host) {
|
|
|
49146
49157
|
if (nameArg) {
|
|
49147
49158
|
suggestedLib = getSuggestedLibForNonExistentName(nameArg);
|
|
49148
49159
|
if (suggestedLib) {
|
|
49149
|
-
|
|
49160
|
+
error2(errorLocation, nameNotFoundMessage, diagnosticName(nameArg), suggestedLib);
|
|
49150
49161
|
}
|
|
49151
49162
|
}
|
|
49152
49163
|
if (!suggestedLib && getSpellingSuggestions && suggestionCount < maximumSuggestionCount) {
|
|
@@ -49175,7 +49186,7 @@ function createTypeChecker(host) {
|
|
|
49175
49186
|
}
|
|
49176
49187
|
}
|
|
49177
49188
|
if (!suggestion && !suggestedLib && nameArg) {
|
|
49178
|
-
|
|
49189
|
+
error2(errorLocation, nameNotFoundMessage, diagnosticName(nameArg));
|
|
49179
49190
|
}
|
|
49180
49191
|
suggestionCount++;
|
|
49181
49192
|
}
|
|
@@ -49203,9 +49214,9 @@ function createTypeChecker(host) {
|
|
|
49203
49214
|
const candidate = getMergedSymbol(getLateBoundSymbol(result));
|
|
49204
49215
|
const root = getRootDeclaration(associatedDeclarationForContainingInitializerOrBindingName);
|
|
49205
49216
|
if (candidate === getSymbolOfDeclaration(associatedDeclarationForContainingInitializerOrBindingName)) {
|
|
49206
|
-
|
|
49217
|
+
error2(errorLocation, Diagnostics.Parameter_0_cannot_reference_itself, declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name));
|
|
49207
49218
|
} else if (candidate.valueDeclaration && candidate.valueDeclaration.pos > associatedDeclarationForContainingInitializerOrBindingName.pos && root.parent.locals && lookup(root.parent.locals, candidate.escapedName, meaning) === candidate) {
|
|
49208
|
-
|
|
49219
|
+
error2(errorLocation, Diagnostics.Parameter_0_cannot_reference_identifier_1_declared_after_it, declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name), declarationNameToString(errorLocation));
|
|
49209
49220
|
}
|
|
49210
49221
|
}
|
|
49211
49222
|
if (result && errorLocation && meaning & 111551 /* Value */ && result.flags & 2097152 /* Alias */ && !(result.flags & 111551 /* Value */) && !isValidTypeOnlyAliasUseSite(errorLocation)) {
|
|
@@ -49214,7 +49225,7 @@ function createTypeChecker(host) {
|
|
|
49214
49225
|
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;
|
|
49215
49226
|
const unescapedName = unescapeLeadingUnderscores(name);
|
|
49216
49227
|
addTypeOnlyDeclarationRelatedInfo(
|
|
49217
|
-
|
|
49228
|
+
error2(errorLocation, message, unescapedName),
|
|
49218
49229
|
typeOnlyDeclaration,
|
|
49219
49230
|
unescapedName
|
|
49220
49231
|
);
|
|
@@ -49297,13 +49308,13 @@ function createTypeChecker(host) {
|
|
|
49297
49308
|
}
|
|
49298
49309
|
const constructorType = getTypeOfSymbol(classSymbol);
|
|
49299
49310
|
if (getPropertyOfType(constructorType, name)) {
|
|
49300
|
-
|
|
49311
|
+
error2(errorLocation, Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0, diagnosticName(nameArg), symbolToString(classSymbol));
|
|
49301
49312
|
return true;
|
|
49302
49313
|
}
|
|
49303
49314
|
if (location === container && !isStatic(location)) {
|
|
49304
49315
|
const instanceType = getDeclaredTypeOfSymbol(classSymbol).thisType;
|
|
49305
49316
|
if (getPropertyOfType(instanceType, name)) {
|
|
49306
|
-
|
|
49317
|
+
error2(errorLocation, Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0, diagnosticName(nameArg));
|
|
49307
49318
|
return true;
|
|
49308
49319
|
}
|
|
49309
49320
|
}
|
|
@@ -49320,7 +49331,7 @@ function createTypeChecker(host) {
|
|
|
49320
49331
|
/*ignoreErrors*/
|
|
49321
49332
|
true
|
|
49322
49333
|
)) {
|
|
49323
|
-
|
|
49334
|
+
error2(errorLocation, Diagnostics.Cannot_extend_an_interface_0_Did_you_mean_implements, getTextOfNode(expression));
|
|
49324
49335
|
return true;
|
|
49325
49336
|
}
|
|
49326
49337
|
return false;
|
|
@@ -49359,7 +49370,7 @@ function createTypeChecker(host) {
|
|
|
49359
49370
|
const propName = parent2.right.escapedText;
|
|
49360
49371
|
const propType = getPropertyOfType(getDeclaredTypeOfSymbol(symbol), propName);
|
|
49361
49372
|
if (propType) {
|
|
49362
|
-
|
|
49373
|
+
error2(
|
|
49363
49374
|
parent2,
|
|
49364
49375
|
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,
|
|
49365
49376
|
unescapeLeadingUnderscores(name),
|
|
@@ -49368,7 +49379,7 @@ function createTypeChecker(host) {
|
|
|
49368
49379
|
return true;
|
|
49369
49380
|
}
|
|
49370
49381
|
}
|
|
49371
|
-
|
|
49382
|
+
error2(errorLocation, Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here, unescapeLeadingUnderscores(name));
|
|
49372
49383
|
return true;
|
|
49373
49384
|
}
|
|
49374
49385
|
}
|
|
@@ -49388,7 +49399,7 @@ function createTypeChecker(host) {
|
|
|
49388
49399
|
false
|
|
49389
49400
|
));
|
|
49390
49401
|
if (symbol && !(symbol.flags & 1920 /* Namespace */)) {
|
|
49391
|
-
|
|
49402
|
+
error2(errorLocation, Diagnostics._0_refers_to_a_value_but_is_being_used_as_a_type_here_Did_you_mean_typeof_0, unescapeLeadingUnderscores(name));
|
|
49392
49403
|
return true;
|
|
49393
49404
|
}
|
|
49394
49405
|
}
|
|
@@ -49399,7 +49410,7 @@ function createTypeChecker(host) {
|
|
|
49399
49410
|
}
|
|
49400
49411
|
function checkAndReportErrorForExportingPrimitiveType(errorLocation, name) {
|
|
49401
49412
|
if (isPrimitiveTypeName(name) && errorLocation.parent.kind === 280 /* ExportSpecifier */) {
|
|
49402
|
-
|
|
49413
|
+
error2(errorLocation, Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, name);
|
|
49403
49414
|
return true;
|
|
49404
49415
|
}
|
|
49405
49416
|
return false;
|
|
@@ -49408,9 +49419,9 @@ function createTypeChecker(host) {
|
|
|
49408
49419
|
if (meaning & 111551 /* Value */) {
|
|
49409
49420
|
if (isPrimitiveTypeName(name)) {
|
|
49410
49421
|
if (isExtendedByInterface(errorLocation)) {
|
|
49411
|
-
|
|
49422
|
+
error2(errorLocation, Diagnostics.An_interface_cannot_extend_a_primitive_type_like_0_an_interface_can_only_extend_named_types_and_classes, unescapeLeadingUnderscores(name));
|
|
49412
49423
|
} else {
|
|
49413
|
-
|
|
49424
|
+
error2(errorLocation, Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, unescapeLeadingUnderscores(name));
|
|
49414
49425
|
}
|
|
49415
49426
|
return true;
|
|
49416
49427
|
}
|
|
@@ -49429,11 +49440,11 @@ function createTypeChecker(host) {
|
|
|
49429
49440
|
if (symbol && allFlags !== void 0 && !(allFlags & 111551 /* Value */)) {
|
|
49430
49441
|
const rawName = unescapeLeadingUnderscores(name);
|
|
49431
49442
|
if (isES2015OrLaterConstructorName(name)) {
|
|
49432
|
-
|
|
49443
|
+
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);
|
|
49433
49444
|
} else if (maybeMappedType(errorLocation, symbol)) {
|
|
49434
|
-
|
|
49445
|
+
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");
|
|
49435
49446
|
} else {
|
|
49436
|
-
|
|
49447
|
+
error2(errorLocation, Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, rawName);
|
|
49437
49448
|
}
|
|
49438
49449
|
return true;
|
|
49439
49450
|
}
|
|
@@ -49489,7 +49500,7 @@ function createTypeChecker(host) {
|
|
|
49489
49500
|
false
|
|
49490
49501
|
));
|
|
49491
49502
|
if (symbol) {
|
|
49492
|
-
|
|
49503
|
+
error2(
|
|
49493
49504
|
errorLocation,
|
|
49494
49505
|
Diagnostics.Cannot_use_namespace_0_as_a_value,
|
|
49495
49506
|
unescapeLeadingUnderscores(name)
|
|
@@ -49509,7 +49520,7 @@ function createTypeChecker(host) {
|
|
|
49509
49520
|
false
|
|
49510
49521
|
));
|
|
49511
49522
|
if (symbol) {
|
|
49512
|
-
|
|
49523
|
+
error2(errorLocation, Diagnostics.Cannot_use_namespace_0_as_a_type, unescapeLeadingUnderscores(name));
|
|
49513
49524
|
return true;
|
|
49514
49525
|
}
|
|
49515
49526
|
}
|
|
@@ -49530,11 +49541,11 @@ function createTypeChecker(host) {
|
|
|
49530
49541
|
let diagnosticMessage;
|
|
49531
49542
|
const declarationName = declarationNameToString(getNameOfDeclaration(declaration));
|
|
49532
49543
|
if (result.flags & 2 /* BlockScopedVariable */) {
|
|
49533
|
-
diagnosticMessage =
|
|
49544
|
+
diagnosticMessage = error2(errorLocation, Diagnostics.Block_scoped_variable_0_used_before_its_declaration, declarationName);
|
|
49534
49545
|
} else if (result.flags & 32 /* Class */) {
|
|
49535
|
-
diagnosticMessage =
|
|
49546
|
+
diagnosticMessage = error2(errorLocation, Diagnostics.Class_0_used_before_its_declaration, declarationName);
|
|
49536
49547
|
} else if (result.flags & 256 /* RegularEnum */) {
|
|
49537
|
-
diagnosticMessage =
|
|
49548
|
+
diagnosticMessage = error2(errorLocation, Diagnostics.Enum_0_used_before_its_declaration, declarationName);
|
|
49538
49549
|
}
|
|
49539
49550
|
if (diagnosticMessage) {
|
|
49540
49551
|
addRelatedInfo(
|
|
@@ -49609,7 +49620,7 @@ function createTypeChecker(host) {
|
|
|
49609
49620
|
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;
|
|
49610
49621
|
const relatedMessage = isExport ? Diagnostics._0_was_exported_here : Diagnostics._0_was_imported_here;
|
|
49611
49622
|
const name = typeOnlyDeclaration.kind === 277 /* ExportDeclaration */ ? "*" : unescapeLeadingUnderscores(typeOnlyDeclaration.name.escapedText);
|
|
49612
|
-
addRelatedInfo(
|
|
49623
|
+
addRelatedInfo(error2(node.moduleReference, message), createDiagnosticForNode(typeOnlyDeclaration, relatedMessage, name));
|
|
49613
49624
|
}
|
|
49614
49625
|
}
|
|
49615
49626
|
function resolveExportByName(moduleSymbol, name, sourceNode, dontResolveAlias) {
|
|
@@ -49714,7 +49725,7 @@ function createTypeChecker(host) {
|
|
|
49714
49725
|
const compilerOptionName = moduleKind >= 5 /* ES2015 */ ? "allowSyntheticDefaultImports" : "esModuleInterop";
|
|
49715
49726
|
const exportEqualsSymbol = moduleSymbol.exports.get("export=" /* ExportEquals */);
|
|
49716
49727
|
const exportAssignment = exportEqualsSymbol.valueDeclaration;
|
|
49717
|
-
const err =
|
|
49728
|
+
const err = error2(node.name, Diagnostics.Module_0_can_only_be_default_imported_using_the_1_flag, symbolToString(moduleSymbol), compilerOptionName);
|
|
49718
49729
|
if (exportAssignment) {
|
|
49719
49730
|
addRelatedInfo(err, createDiagnosticForNode(
|
|
49720
49731
|
exportAssignment,
|
|
@@ -49767,14 +49778,14 @@ function createTypeChecker(host) {
|
|
|
49767
49778
|
function reportNonDefaultExport(moduleSymbol, node) {
|
|
49768
49779
|
var _a, _b, _c;
|
|
49769
49780
|
if ((_a = moduleSymbol.exports) == null ? void 0 : _a.has(node.symbol.escapedName)) {
|
|
49770
|
-
|
|
49781
|
+
error2(
|
|
49771
49782
|
node.name,
|
|
49772
49783
|
Diagnostics.Module_0_has_no_default_export_Did_you_mean_to_use_import_1_from_0_instead,
|
|
49773
49784
|
symbolToString(moduleSymbol),
|
|
49774
49785
|
symbolToString(node.symbol)
|
|
49775
49786
|
);
|
|
49776
49787
|
} else {
|
|
49777
|
-
const diagnostic =
|
|
49788
|
+
const diagnostic = error2(node.name, Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol));
|
|
49778
49789
|
const exportStar = (_b = moduleSymbol.exports) == null ? void 0 : _b.get("__export" /* ExportStar */);
|
|
49779
49790
|
if (exportStar) {
|
|
49780
49791
|
const defaultExport = (_c = exportStar.declarations) == null ? void 0 : _c.find((decl) => {
|
|
@@ -49925,7 +49936,7 @@ function createTypeChecker(host) {
|
|
|
49925
49936
|
const suggestion = getSuggestedSymbolForNonexistentModule(name, targetSymbol);
|
|
49926
49937
|
if (suggestion !== void 0) {
|
|
49927
49938
|
const suggestionName = symbolToString(suggestion);
|
|
49928
|
-
const diagnostic =
|
|
49939
|
+
const diagnostic = error2(name, Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, moduleName, declarationName, suggestionName);
|
|
49929
49940
|
if (suggestion.valueDeclaration) {
|
|
49930
49941
|
addRelatedInfo(
|
|
49931
49942
|
diagnostic,
|
|
@@ -49934,7 +49945,7 @@ function createTypeChecker(host) {
|
|
|
49934
49945
|
}
|
|
49935
49946
|
} else {
|
|
49936
49947
|
if ((_a = moduleSymbol.exports) == null ? void 0 : _a.has("default" /* Default */)) {
|
|
49937
|
-
|
|
49948
|
+
error2(
|
|
49938
49949
|
name,
|
|
49939
49950
|
Diagnostics.Module_0_has_no_exported_member_1_Did_you_mean_to_use_import_1_from_0_instead,
|
|
49940
49951
|
moduleName,
|
|
@@ -49952,10 +49963,10 @@ function createTypeChecker(host) {
|
|
|
49952
49963
|
if (localSymbol) {
|
|
49953
49964
|
const exportedEqualsSymbol = exports == null ? void 0 : exports.get("export=" /* ExportEquals */);
|
|
49954
49965
|
if (exportedEqualsSymbol) {
|
|
49955
|
-
getSymbolIfSameReference(exportedEqualsSymbol, localSymbol) ? reportInvalidImportEqualsExportMember(node, name, declarationName, moduleName) :
|
|
49966
|
+
getSymbolIfSameReference(exportedEqualsSymbol, localSymbol) ? reportInvalidImportEqualsExportMember(node, name, declarationName, moduleName) : error2(name, Diagnostics.Module_0_has_no_exported_member_1, moduleName, declarationName);
|
|
49956
49967
|
} else {
|
|
49957
49968
|
const exportedSymbol = exports ? find(symbolsToArray(exports), (symbol) => !!getSymbolIfSameReference(symbol, localSymbol)) : void 0;
|
|
49958
|
-
const diagnostic = exportedSymbol ?
|
|
49969
|
+
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);
|
|
49959
49970
|
if (localSymbol.declarations) {
|
|
49960
49971
|
addRelatedInfo(
|
|
49961
49972
|
diagnostic,
|
|
@@ -49964,20 +49975,20 @@ function createTypeChecker(host) {
|
|
|
49964
49975
|
}
|
|
49965
49976
|
}
|
|
49966
49977
|
} else {
|
|
49967
|
-
|
|
49978
|
+
error2(name, Diagnostics.Module_0_has_no_exported_member_1, moduleName, declarationName);
|
|
49968
49979
|
}
|
|
49969
49980
|
}
|
|
49970
49981
|
function reportInvalidImportEqualsExportMember(node, name, declarationName, moduleName) {
|
|
49971
49982
|
if (moduleKind >= 5 /* ES2015 */) {
|
|
49972
49983
|
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;
|
|
49973
|
-
|
|
49984
|
+
error2(name, message, declarationName);
|
|
49974
49985
|
} else {
|
|
49975
49986
|
if (isInJSFile(node)) {
|
|
49976
49987
|
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;
|
|
49977
|
-
|
|
49988
|
+
error2(name, message, declarationName);
|
|
49978
49989
|
} else {
|
|
49979
49990
|
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;
|
|
49980
|
-
|
|
49991
|
+
error2(name, message, declarationName, declarationName, moduleName);
|
|
49981
49992
|
}
|
|
49982
49993
|
}
|
|
49983
49994
|
}
|
|
@@ -50147,7 +50158,7 @@ function createTypeChecker(host) {
|
|
|
50147
50158
|
if (links.aliasTarget === resolvingSymbol) {
|
|
50148
50159
|
links.aliasTarget = target || unknownSymbol;
|
|
50149
50160
|
} else {
|
|
50150
|
-
|
|
50161
|
+
error2(node, Diagnostics.Circular_definition_of_import_alias_0, symbolToString(symbol));
|
|
50151
50162
|
}
|
|
50152
50163
|
} else if (links.aliasTarget === resolvingSymbol) {
|
|
50153
50164
|
links.aliasTarget = unknownSymbol;
|
|
@@ -50383,13 +50394,13 @@ function createTypeChecker(host) {
|
|
|
50383
50394
|
const declarationName = declarationNameToString(right);
|
|
50384
50395
|
const suggestionForNonexistentModule = getSuggestedSymbolForNonexistentModule(right, namespace);
|
|
50385
50396
|
if (suggestionForNonexistentModule) {
|
|
50386
|
-
|
|
50397
|
+
error2(right, Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, namespaceName, declarationName, symbolToString(suggestionForNonexistentModule));
|
|
50387
50398
|
return void 0;
|
|
50388
50399
|
}
|
|
50389
50400
|
const containingQualifiedName = isQualifiedName(name) && getContainingQualifiedNameNode(name);
|
|
50390
50401
|
const canSuggestTypeof = globalObjectType && meaning & 788968 /* Type */ && containingQualifiedName && !isTypeOfExpression(containingQualifiedName.parent) && tryGetQualifiedNameAsValue(containingQualifiedName);
|
|
50391
50402
|
if (canSuggestTypeof) {
|
|
50392
|
-
|
|
50403
|
+
error2(
|
|
50393
50404
|
containingQualifiedName,
|
|
50394
50405
|
Diagnostics._0_refers_to_a_value_but_is_being_used_as_a_type_here_Did_you_mean_typeof_0,
|
|
50395
50406
|
entityNameToString(containingQualifiedName)
|
|
@@ -50399,7 +50410,7 @@ function createTypeChecker(host) {
|
|
|
50399
50410
|
if (meaning & 1920 /* Namespace */ && isQualifiedName(name.parent)) {
|
|
50400
50411
|
const exportedTypeSymbol = getMergedSymbol(getSymbol2(getExportsOfSymbol(namespace), right.escapedText, 788968 /* Type */));
|
|
50401
50412
|
if (exportedTypeSymbol) {
|
|
50402
|
-
|
|
50413
|
+
error2(
|
|
50403
50414
|
name.parent.right,
|
|
50404
50415
|
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,
|
|
50405
50416
|
symbolToString(exportedTypeSymbol),
|
|
@@ -50408,7 +50419,7 @@ function createTypeChecker(host) {
|
|
|
50408
50419
|
return void 0;
|
|
50409
50420
|
}
|
|
50410
50421
|
}
|
|
50411
|
-
|
|
50422
|
+
error2(right, Diagnostics.Namespace_0_has_no_exported_member_1, namespaceName, declarationName);
|
|
50412
50423
|
}
|
|
50413
50424
|
return void 0;
|
|
50414
50425
|
}
|
|
@@ -50513,7 +50524,7 @@ function createTypeChecker(host) {
|
|
|
50513
50524
|
if (startsWith(moduleReference, "@types/")) {
|
|
50514
50525
|
const diag2 = Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
|
|
50515
50526
|
const withoutAtTypePrefix = removePrefix(moduleReference, "@types/");
|
|
50516
|
-
|
|
50527
|
+
error2(errorNode, diag2, withoutAtTypePrefix, moduleReference);
|
|
50517
50528
|
}
|
|
50518
50529
|
const ambientModule = tryFindAmbientModule(
|
|
50519
50530
|
moduleReference,
|
|
@@ -50532,12 +50543,12 @@ function createTypeChecker(host) {
|
|
|
50532
50543
|
const sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName);
|
|
50533
50544
|
if (sourceFile) {
|
|
50534
50545
|
if (resolutionDiagnostic) {
|
|
50535
|
-
|
|
50546
|
+
error2(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
|
|
50536
50547
|
}
|
|
50537
50548
|
if (resolvedModule.resolvedUsingTsExtension && isDeclarationFileName(moduleReference)) {
|
|
50538
50549
|
const importOrExport = ((_g = findAncestor(location, isImportDeclaration)) == null ? void 0 : _g.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
|
|
50539
50550
|
if (importOrExport && !importOrExport.isTypeOnly || findAncestor(location, isImportCall)) {
|
|
50540
|
-
|
|
50551
|
+
error2(
|
|
50541
50552
|
errorNode,
|
|
50542
50553
|
Diagnostics.A_declaration_file_cannot_be_imported_without_import_type_Did_you_mean_to_import_an_implementation_file_0_instead,
|
|
50543
50554
|
getSuggestedImportSource(Debug.checkDefined(tryExtractTSExtension(moduleReference)))
|
|
@@ -50545,7 +50556,7 @@ function createTypeChecker(host) {
|
|
|
50545
50556
|
}
|
|
50546
50557
|
} else if (resolvedModule.resolvedUsingTsExtension && !shouldAllowImportingTsExtension(compilerOptions, currentSourceFile.fileName)) {
|
|
50547
50558
|
const tsExtension = Debug.checkDefined(tryExtractTSExtension(moduleReference));
|
|
50548
|
-
|
|
50559
|
+
error2(errorNode, Diagnostics.An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled, tsExtension);
|
|
50549
50560
|
}
|
|
50550
50561
|
if (sourceFile.symbol) {
|
|
50551
50562
|
if (resolvedModule.isExternalLibraryImport && !resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
|
|
@@ -50565,7 +50576,7 @@ function createTypeChecker(host) {
|
|
|
50565
50576
|
const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (_h = overrideClauseHost.assertions) == null ? void 0 : _h.assertClause : overrideClauseHost == null ? void 0 : overrideClauseHost.assertClause;
|
|
50566
50577
|
if (isSyncImport && sourceFile.impliedNodeFormat === 99 /* ESNext */ && !getResolutionModeOverrideForClause(overrideClause)) {
|
|
50567
50578
|
if (findAncestor(location, isImportEqualsDeclaration)) {
|
|
50568
|
-
|
|
50579
|
+
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);
|
|
50569
50580
|
} else {
|
|
50570
50581
|
let diagnosticDetails;
|
|
50571
50582
|
const ext = tryGetExtensionFromPath2(currentSourceFile.fileName);
|
|
@@ -50617,7 +50628,7 @@ function createTypeChecker(host) {
|
|
|
50617
50628
|
return getMergedSymbol(sourceFile.symbol);
|
|
50618
50629
|
}
|
|
50619
50630
|
if (moduleNotFoundError) {
|
|
50620
|
-
|
|
50631
|
+
error2(errorNode, Diagnostics.File_0_is_not_a_module, sourceFile.fileName);
|
|
50621
50632
|
}
|
|
50622
50633
|
return void 0;
|
|
50623
50634
|
}
|
|
@@ -50634,7 +50645,7 @@ function createTypeChecker(host) {
|
|
|
50634
50645
|
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) {
|
|
50635
50646
|
if (isForAugmentation) {
|
|
50636
50647
|
const diag2 = Diagnostics.Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented;
|
|
50637
|
-
|
|
50648
|
+
error2(errorNode, diag2, moduleReference, resolvedModule.resolvedFileName);
|
|
50638
50649
|
} else {
|
|
50639
50650
|
errorOnImplicitAnyModule(
|
|
50640
50651
|
/*isError*/
|
|
@@ -50652,31 +50663,31 @@ function createTypeChecker(host) {
|
|
|
50652
50663
|
if (resolvedModule) {
|
|
50653
50664
|
const redirect = host.getProjectReferenceRedirect(resolvedModule.resolvedFileName);
|
|
50654
50665
|
if (redirect) {
|
|
50655
|
-
|
|
50666
|
+
error2(errorNode, Diagnostics.Output_file_0_has_not_been_built_from_source_file_1, redirect, resolvedModule.resolvedFileName);
|
|
50656
50667
|
return void 0;
|
|
50657
50668
|
}
|
|
50658
50669
|
}
|
|
50659
50670
|
if (resolutionDiagnostic) {
|
|
50660
|
-
|
|
50671
|
+
error2(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
|
|
50661
50672
|
} else {
|
|
50662
50673
|
const isExtensionlessRelativePathImport = pathIsRelative(moduleReference) && !hasExtension(moduleReference);
|
|
50663
50674
|
const resolutionIsNode16OrNext = moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */;
|
|
50664
50675
|
if (!getResolveJsonModule(compilerOptions) && fileExtensionIs(moduleReference, ".json" /* Json */) && moduleResolutionKind !== 1 /* Classic */ && hasJsonModuleEmitEnabled(compilerOptions)) {
|
|
50665
|
-
|
|
50676
|
+
error2(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
50666
50677
|
} else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
|
|
50667
50678
|
const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
|
|
50668
50679
|
const suggestedExt = (_i = suggestedExtensions.find(([actualExt, _importExt]) => host.fileExists(absoluteRef + actualExt))) == null ? void 0 : _i[1];
|
|
50669
50680
|
if (suggestedExt) {
|
|
50670
|
-
|
|
50681
|
+
error2(
|
|
50671
50682
|
errorNode,
|
|
50672
50683
|
Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0,
|
|
50673
50684
|
moduleReference + suggestedExt
|
|
50674
50685
|
);
|
|
50675
50686
|
} else {
|
|
50676
|
-
|
|
50687
|
+
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);
|
|
50677
50688
|
}
|
|
50678
50689
|
} else {
|
|
50679
|
-
|
|
50690
|
+
error2(errorNode, moduleNotFoundError, moduleReference);
|
|
50680
50691
|
}
|
|
50681
50692
|
}
|
|
50682
50693
|
}
|
|
@@ -50742,7 +50753,7 @@ function createTypeChecker(host) {
|
|
|
50742
50753
|
if (!dontResolveAlias && symbol) {
|
|
50743
50754
|
if (!suppressInteropError && !(symbol.flags & (1536 /* Module */ | 3 /* Variable */)) && !getDeclarationOfKind(symbol, 311 /* SourceFile */)) {
|
|
50744
50755
|
const compilerOptionName = moduleKind >= 5 /* ES2015 */ ? "allowSyntheticDefaultImports" : "esModuleInterop";
|
|
50745
|
-
|
|
50756
|
+
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);
|
|
50746
50757
|
return symbol;
|
|
50747
50758
|
}
|
|
50748
50759
|
const referenceParent = referencingLocation.parent;
|
|
@@ -51126,7 +51137,7 @@ function createTypeChecker(host) {
|
|
|
51126
51137
|
function createIntrinsicType(kind, intrinsicName, objectFlags = 0 /* None */) {
|
|
51127
51138
|
const type = createType(kind);
|
|
51128
51139
|
type.intrinsicName = intrinsicName;
|
|
51129
|
-
type.objectFlags = objectFlags
|
|
51140
|
+
type.objectFlags = objectFlags | 524288 /* CouldContainTypeVariablesComputed */ | 2097152 /* IsGenericTypeComputed */ | 33554432 /* IsUnknownLikeUnionComputed */ | 16777216 /* IsNeverIntersectionComputed */;
|
|
51130
51141
|
return type;
|
|
51131
51142
|
}
|
|
51132
51143
|
function createObjectType(objectFlags, symbol) {
|
|
@@ -55569,7 +55580,7 @@ function createTypeChecker(host) {
|
|
|
55569
55580
|
if (declaration.dotDotDotToken) {
|
|
55570
55581
|
parentType = getReducedType(parentType);
|
|
55571
55582
|
if (parentType.flags & 2 /* Unknown */ || !isValidSpreadType(parentType)) {
|
|
55572
|
-
|
|
55583
|
+
error2(declaration, Diagnostics.Rest_types_may_only_be_created_from_object_types);
|
|
55573
55584
|
return errorType;
|
|
55574
55585
|
}
|
|
55575
55586
|
const literalMembers = [];
|
|
@@ -55802,7 +55813,7 @@ function createTypeChecker(host) {
|
|
|
55802
55813
|
reference.flowNode = staticBlock.returnFlowNode;
|
|
55803
55814
|
const flowType = getFlowTypeOfProperty(reference, symbol);
|
|
55804
55815
|
if (noImplicitAny && (flowType === autoType || flowType === autoArrayType)) {
|
|
55805
|
-
|
|
55816
|
+
error2(symbol.valueDeclaration, Diagnostics.Member_0_implicitly_has_an_1_type, symbolToString(symbol), typeToString(flowType));
|
|
55806
55817
|
}
|
|
55807
55818
|
if (everyType(flowType, isNullableType)) {
|
|
55808
55819
|
continue;
|
|
@@ -55818,7 +55829,7 @@ function createTypeChecker(host) {
|
|
|
55818
55829
|
reference.flowNode = constructor.returnFlowNode;
|
|
55819
55830
|
const flowType = getFlowTypeOfProperty(reference, symbol);
|
|
55820
55831
|
if (noImplicitAny && (flowType === autoType || flowType === autoArrayType)) {
|
|
55821
|
-
|
|
55832
|
+
error2(symbol.valueDeclaration, Diagnostics.Member_0_implicitly_has_an_1_type, symbolToString(symbol), typeToString(flowType));
|
|
55822
55833
|
}
|
|
55823
55834
|
return everyType(flowType, isNullableType) ? void 0 : convertAutoToAny(flowType);
|
|
55824
55835
|
}
|
|
@@ -55993,11 +56004,11 @@ function createTypeChecker(host) {
|
|
|
55993
56004
|
const unescapedName = unescapeLeadingUnderscores(s.escapedName);
|
|
55994
56005
|
const exportedMemberName = ((_a = tryCast(exportedMember.valueDeclaration, isNamedDeclaration)) == null ? void 0 : _a.name) || exportedMember.valueDeclaration;
|
|
55995
56006
|
addRelatedInfo(
|
|
55996
|
-
|
|
56007
|
+
error2(s.valueDeclaration, Diagnostics.Duplicate_identifier_0, unescapedName),
|
|
55997
56008
|
createDiagnosticForNode(exportedMemberName, Diagnostics._0_was_also_declared_here, unescapedName)
|
|
55998
56009
|
);
|
|
55999
56010
|
addRelatedInfo(
|
|
56000
|
-
|
|
56011
|
+
error2(exportedMemberName, Diagnostics.Duplicate_identifier_0, unescapedName),
|
|
56001
56012
|
createDiagnosticForNode(s.valueDeclaration, Diagnostics._0_was_also_declared_here, unescapedName)
|
|
56002
56013
|
);
|
|
56003
56014
|
}
|
|
@@ -56352,13 +56363,13 @@ function createTypeChecker(host) {
|
|
|
56352
56363
|
}
|
|
56353
56364
|
if (!popTypeResolution()) {
|
|
56354
56365
|
if (getAnnotatedAccessorTypeNode(getter)) {
|
|
56355
|
-
|
|
56366
|
+
error2(getter, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol));
|
|
56356
56367
|
} else if (getAnnotatedAccessorTypeNode(setter)) {
|
|
56357
|
-
|
|
56368
|
+
error2(setter, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol));
|
|
56358
56369
|
} else if (getAnnotatedAccessorTypeNode(accessor)) {
|
|
56359
|
-
|
|
56370
|
+
error2(setter, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol));
|
|
56360
56371
|
} else if (getter && noImplicitAny) {
|
|
56361
|
-
|
|
56372
|
+
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));
|
|
56362
56373
|
}
|
|
56363
56374
|
type = anyType;
|
|
56364
56375
|
}
|
|
@@ -56376,7 +56387,7 @@ function createTypeChecker(host) {
|
|
|
56376
56387
|
let writeType = getAnnotatedAccessorType(setter);
|
|
56377
56388
|
if (!popTypeResolution()) {
|
|
56378
56389
|
if (getAnnotatedAccessorTypeNode(setter)) {
|
|
56379
|
-
|
|
56390
|
+
error2(setter, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol));
|
|
56380
56391
|
}
|
|
56381
56392
|
writeType = anyType;
|
|
56382
56393
|
}
|
|
@@ -56469,7 +56480,7 @@ function createTypeChecker(host) {
|
|
|
56469
56480
|
function reportCircularityError(symbol) {
|
|
56470
56481
|
const declaration = symbol.valueDeclaration;
|
|
56471
56482
|
if (getEffectiveTypeAnnotationNode(declaration)) {
|
|
56472
|
-
|
|
56483
|
+
error2(
|
|
56473
56484
|
symbol.valueDeclaration,
|
|
56474
56485
|
Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation,
|
|
56475
56486
|
symbolToString(symbol)
|
|
@@ -56477,7 +56488,7 @@ function createTypeChecker(host) {
|
|
|
56477
56488
|
return errorType;
|
|
56478
56489
|
}
|
|
56479
56490
|
if (noImplicitAny && (declaration.kind !== 168 /* Parameter */ || declaration.initializer)) {
|
|
56480
|
-
|
|
56491
|
+
error2(
|
|
56481
56492
|
symbol.valueDeclaration,
|
|
56482
56493
|
Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer,
|
|
56483
56494
|
symbolToString(symbol)
|
|
@@ -56722,11 +56733,11 @@ function createTypeChecker(host) {
|
|
|
56722
56733
|
resolveStructuredTypeMembers(baseConstructorType);
|
|
56723
56734
|
}
|
|
56724
56735
|
if (!popTypeResolution()) {
|
|
56725
|
-
|
|
56736
|
+
error2(type.symbol.valueDeclaration, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_base_expression, symbolToString(type.symbol));
|
|
56726
56737
|
return type.resolvedBaseConstructorType = errorType;
|
|
56727
56738
|
}
|
|
56728
56739
|
if (!(baseConstructorType.flags & 1 /* Any */) && baseConstructorType !== nullWideningType && !isConstructorType(baseConstructorType)) {
|
|
56729
|
-
const err =
|
|
56740
|
+
const err = error2(baseTypeNode.expression, Diagnostics.Type_0_is_not_a_constructor_function_type, typeToString(baseConstructorType));
|
|
56730
56741
|
if (baseConstructorType.flags & 262144 /* TypeParameter */) {
|
|
56731
56742
|
const constraint = getConstraintFromTypeParameter(baseConstructorType);
|
|
56732
56743
|
let ctorReturn = unknownType;
|
|
@@ -56768,7 +56779,7 @@ function createTypeChecker(host) {
|
|
|
56768
56779
|
return resolvedImplementsTypes;
|
|
56769
56780
|
}
|
|
56770
56781
|
function reportCircularBaseType(node, type) {
|
|
56771
|
-
|
|
56782
|
+
error2(node, Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(
|
|
56772
56783
|
type,
|
|
56773
56784
|
/*enclosingDeclaration*/
|
|
56774
56785
|
void 0,
|
|
@@ -56822,7 +56833,7 @@ function createTypeChecker(host) {
|
|
|
56822
56833
|
} else {
|
|
56823
56834
|
const constructors = getInstantiatedConstructorsForTypeArguments(baseConstructorType, baseTypeNode.typeArguments, baseTypeNode);
|
|
56824
56835
|
if (!constructors.length) {
|
|
56825
|
-
|
|
56836
|
+
error2(baseTypeNode.expression, Diagnostics.No_base_constructor_has_the_specified_number_of_type_arguments);
|
|
56826
56837
|
return type.resolvedBaseTypes = emptyArray;
|
|
56827
56838
|
}
|
|
56828
56839
|
baseType = getReturnTypeOfSignature(constructors[0]);
|
|
@@ -56842,7 +56853,7 @@ function createTypeChecker(host) {
|
|
|
56842
56853
|
return type.resolvedBaseTypes = emptyArray;
|
|
56843
56854
|
}
|
|
56844
56855
|
if (type === reducedBaseType || hasBaseType(reducedBaseType, type)) {
|
|
56845
|
-
|
|
56856
|
+
error2(
|
|
56846
56857
|
type.symbol.valueDeclaration,
|
|
56847
56858
|
Diagnostics.Type_0_recursively_references_itself_as_a_base_type,
|
|
56848
56859
|
typeToString(
|
|
@@ -56896,7 +56907,7 @@ function createTypeChecker(host) {
|
|
|
56896
56907
|
reportCircularBaseType(declaration, type);
|
|
56897
56908
|
}
|
|
56898
56909
|
} else {
|
|
56899
|
-
|
|
56910
|
+
error2(node, Diagnostics.An_interface_can_only_extend_an_object_type_or_intersection_of_object_types_with_statically_known_members);
|
|
56900
56911
|
}
|
|
56901
56912
|
}
|
|
56902
56913
|
}
|
|
@@ -56982,9 +56993,9 @@ function createTypeChecker(host) {
|
|
|
56982
56993
|
} else {
|
|
56983
56994
|
type = errorType;
|
|
56984
56995
|
if (declaration.kind === 346 /* JSDocEnumTag */) {
|
|
56985
|
-
|
|
56996
|
+
error2(declaration.typeExpression.type, Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
|
|
56986
56997
|
} else {
|
|
56987
|
-
|
|
56998
|
+
error2(isNamedDeclaration(declaration) ? declaration.name || declaration : declaration, Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
|
|
56988
56999
|
}
|
|
56989
57000
|
}
|
|
56990
57001
|
links.declaredType = type;
|
|
@@ -57233,8 +57244,8 @@ function createTypeChecker(host) {
|
|
|
57233
57244
|
if (lateSymbol.flags & getExcludedSymbolFlags(symbolFlags) || earlySymbol) {
|
|
57234
57245
|
const declarations = earlySymbol ? concatenate(earlySymbol.declarations, lateSymbol.declarations) : lateSymbol.declarations;
|
|
57235
57246
|
const name = !(type.flags & 8192 /* UniqueESSymbol */) && unescapeLeadingUnderscores(memberName) || declarationNameToString(declName);
|
|
57236
|
-
forEach(declarations, (declaration) =>
|
|
57237
|
-
|
|
57247
|
+
forEach(declarations, (declaration) => error2(getNameOfDeclaration(declaration) || declaration, Diagnostics.Property_0_was_also_declared_here, name));
|
|
57248
|
+
error2(declName || decl, Diagnostics.Duplicate_property_0, name);
|
|
57238
57249
|
lateSymbol = createSymbol(0 /* None */, memberName, 4096 /* Late */);
|
|
57239
57250
|
}
|
|
57240
57251
|
lateSymbol.links.nameType = type;
|
|
@@ -58080,7 +58091,7 @@ function createTypeChecker(host) {
|
|
|
58080
58091
|
true
|
|
58081
58092
|
) : symbol.links.checkFlags & 524288 /* StripOptional */ ? removeMissingOrUndefinedType(propType) : propType;
|
|
58082
58093
|
if (!popTypeResolution()) {
|
|
58083
|
-
|
|
58094
|
+
error2(currentNode, Diagnostics.Type_of_property_0_circularly_references_itself_in_mapped_type_1, symbolToString(symbol), typeToString(mappedType));
|
|
58084
58095
|
type = errorType;
|
|
58085
58096
|
}
|
|
58086
58097
|
symbol.links.type = type;
|
|
@@ -58406,7 +58417,7 @@ function createTypeChecker(host) {
|
|
|
58406
58417
|
if (t.flags & 262144 /* TypeParameter */) {
|
|
58407
58418
|
const errorNode = getConstraintDeclaration(t);
|
|
58408
58419
|
if (errorNode) {
|
|
58409
|
-
const diagnostic =
|
|
58420
|
+
const diagnostic = error2(errorNode, Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(t));
|
|
58410
58421
|
if (currentNode && !isNodeDescendantOf(errorNode, currentNode) && !isNodeDescendantOf(currentNode, errorNode)) {
|
|
58411
58422
|
addRelatedInfo(diagnostic, createDiagnosticForNode(currentNode, Diagnostics.Circularity_originates_in_type_at_this_location));
|
|
58412
58423
|
}
|
|
@@ -59256,14 +59267,14 @@ function createTypeChecker(host) {
|
|
|
59256
59267
|
if (signature.declaration) {
|
|
59257
59268
|
const typeNode = getEffectiveReturnTypeNode(signature.declaration);
|
|
59258
59269
|
if (typeNode) {
|
|
59259
|
-
|
|
59270
|
+
error2(typeNode, Diagnostics.Return_type_annotation_circularly_references_itself);
|
|
59260
59271
|
} else if (noImplicitAny) {
|
|
59261
59272
|
const declaration = signature.declaration;
|
|
59262
59273
|
const name = getNameOfDeclaration(declaration);
|
|
59263
59274
|
if (name) {
|
|
59264
|
-
|
|
59275
|
+
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));
|
|
59265
59276
|
} else {
|
|
59266
|
-
|
|
59277
|
+
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);
|
|
59267
59278
|
}
|
|
59268
59279
|
}
|
|
59269
59280
|
}
|
|
@@ -59607,7 +59618,7 @@ function createTypeChecker(host) {
|
|
|
59607
59618
|
type.resolvedTypeArguments = type.mapper ? instantiateTypes(typeArguments, type.mapper) : typeArguments;
|
|
59608
59619
|
} else {
|
|
59609
59620
|
type.resolvedTypeArguments = ((_b = type.target.localTypeParameters) == null ? void 0 : _b.map(() => errorType)) || emptyArray;
|
|
59610
|
-
|
|
59621
|
+
error2(
|
|
59611
59622
|
type.node || currentNode,
|
|
59612
59623
|
type.target.symbol ? Diagnostics.Type_arguments_for_0_circularly_reference_themselves : Diagnostics.Tuple_type_arguments_circularly_reference_themselves,
|
|
59613
59624
|
type.target.symbol && symbolToString(type.target.symbol)
|
|
@@ -59636,7 +59647,7 @@ function createTypeChecker(host) {
|
|
|
59636
59647
|
void 0,
|
|
59637
59648
|
2 /* WriteArrayAsGenericType */
|
|
59638
59649
|
);
|
|
59639
|
-
|
|
59650
|
+
error2(node, diag2, typeStr, minTypeArgumentCount, typeParameters.length);
|
|
59640
59651
|
if (!isJs) {
|
|
59641
59652
|
return errorType;
|
|
59642
59653
|
}
|
|
@@ -59692,7 +59703,7 @@ function createTypeChecker(host) {
|
|
|
59692
59703
|
const numTypeArguments = length(node.typeArguments);
|
|
59693
59704
|
const minTypeArgumentCount = getMinTypeArgumentCount(typeParameters);
|
|
59694
59705
|
if (numTypeArguments < minTypeArgumentCount || numTypeArguments > typeParameters.length) {
|
|
59695
|
-
|
|
59706
|
+
error2(
|
|
59696
59707
|
node,
|
|
59697
59708
|
minTypeArgumentCount === typeParameters.length ? Diagnostics.Generic_type_0_requires_1_type_argument_s : Diagnostics.Generic_type_0_requires_between_1_and_2_type_arguments,
|
|
59698
59709
|
symbolToString(symbol),
|
|
@@ -59868,7 +59879,7 @@ function createTypeChecker(host) {
|
|
|
59868
59879
|
}
|
|
59869
59880
|
function checkNoTypeArguments(node, symbol) {
|
|
59870
59881
|
if (node.typeArguments) {
|
|
59871
|
-
|
|
59882
|
+
error2(node, Diagnostics.Type_0_is_not_generic, symbol ? symbolToString(symbol) : node.typeName ? declarationNameToString(node.typeName) : anon);
|
|
59872
59883
|
return false;
|
|
59873
59884
|
}
|
|
59874
59885
|
return true;
|
|
@@ -60000,11 +60011,11 @@ function createTypeChecker(host) {
|
|
|
60000
60011
|
}
|
|
60001
60012
|
const type = getDeclaredTypeOfSymbol(symbol);
|
|
60002
60013
|
if (!(type.flags & 524288 /* Object */)) {
|
|
60003
|
-
|
|
60014
|
+
error2(getTypeDeclaration(symbol), Diagnostics.Global_type_0_must_be_a_class_or_interface_type, symbolName(symbol));
|
|
60004
60015
|
return arity ? emptyGenericType : emptyObjectType;
|
|
60005
60016
|
}
|
|
60006
60017
|
if (length(type.typeParameters) !== arity) {
|
|
60007
|
-
|
|
60018
|
+
error2(getTypeDeclaration(symbol), Diagnostics.Global_type_0_must_have_1_type_parameter_s, symbolName(symbol), arity);
|
|
60008
60019
|
return arity ? emptyGenericType : emptyObjectType;
|
|
60009
60020
|
}
|
|
60010
60021
|
return type;
|
|
@@ -60021,7 +60032,7 @@ function createTypeChecker(host) {
|
|
|
60021
60032
|
getDeclaredTypeOfSymbol(symbol);
|
|
60022
60033
|
if (length(getSymbolLinks(symbol).typeParameters) !== arity) {
|
|
60023
60034
|
const decl = symbol.declarations && find(symbol.declarations, isTypeAliasDeclaration);
|
|
60024
|
-
|
|
60035
|
+
error2(decl, Diagnostics.Global_type_0_must_have_1_type_parameter_s, symbolName(symbol), arity);
|
|
60025
60036
|
return void 0;
|
|
60026
60037
|
}
|
|
60027
60038
|
}
|
|
@@ -60566,7 +60577,7 @@ function createTypeChecker(host) {
|
|
|
60566
60577
|
} else if (isTupleType(type)) {
|
|
60567
60578
|
const elements = getElementTypes(type);
|
|
60568
60579
|
if (elements.length + expandedTypes.length >= 1e4) {
|
|
60569
|
-
|
|
60580
|
+
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);
|
|
60570
60581
|
return errorType;
|
|
60571
60582
|
}
|
|
60572
60583
|
forEach(elements, (t, n) => {
|
|
@@ -60731,7 +60742,7 @@ function createTypeChecker(host) {
|
|
|
60731
60742
|
const estimatedCount = count / (len - i) * len;
|
|
60732
60743
|
if (estimatedCount > 1e6) {
|
|
60733
60744
|
(_a = tracing) == null ? void 0 : _a.instant(tracing.Phase.CheckTypes, "removeSubtypes_DepthLimit", { typeIds: types.map((t) => t.id) });
|
|
60734
|
-
|
|
60745
|
+
error2(currentNode, Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent);
|
|
60735
60746
|
return void 0;
|
|
60736
60747
|
}
|
|
60737
60748
|
}
|
|
@@ -61140,7 +61151,7 @@ function createTypeChecker(host) {
|
|
|
61140
61151
|
const size = getCrossProductUnionSize(types);
|
|
61141
61152
|
if (size >= 1e5) {
|
|
61142
61153
|
(_a = tracing) == null ? void 0 : _a.instant(tracing.Phase.CheckTypes, "checkCrossProductUnion_DepthLimit", { typeIds: types.map((t) => t.id), size });
|
|
61143
|
-
|
|
61154
|
+
error2(currentNode, Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent);
|
|
61144
61155
|
return false;
|
|
61145
61156
|
}
|
|
61146
61157
|
return true;
|
|
@@ -61512,7 +61523,7 @@ function createTypeChecker(host) {
|
|
|
61512
61523
|
if (accessExpression) {
|
|
61513
61524
|
markPropertyAsReferenced(prop, accessExpression, isSelfTypeAccess(accessExpression.expression, objectType.symbol));
|
|
61514
61525
|
if (isAssignmentToReadonlyEntity(accessExpression, prop, getAssignmentTargetKind(accessExpression))) {
|
|
61515
|
-
|
|
61526
|
+
error2(accessExpression.argumentExpression, Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, symbolToString(prop));
|
|
61516
61527
|
return void 0;
|
|
61517
61528
|
}
|
|
61518
61529
|
if (accessFlags & 8 /* CacheSymbol */) {
|
|
@@ -61531,10 +61542,10 @@ function createTypeChecker(host) {
|
|
|
61531
61542
|
const indexNode = getIndexNodeForAccessExpression(accessNode);
|
|
61532
61543
|
if (isTupleType(objectType)) {
|
|
61533
61544
|
if (index < 0) {
|
|
61534
|
-
|
|
61545
|
+
error2(indexNode, Diagnostics.A_tuple_type_cannot_be_indexed_with_a_negative_value);
|
|
61535
61546
|
return undefinedType;
|
|
61536
61547
|
}
|
|
61537
|
-
|
|
61548
|
+
error2(
|
|
61538
61549
|
indexNode,
|
|
61539
61550
|
Diagnostics.Tuple_type_0_of_length_1_has_no_element_at_index_2,
|
|
61540
61551
|
typeToString(objectType),
|
|
@@ -61542,7 +61553,7 @@ function createTypeChecker(host) {
|
|
|
61542
61553
|
unescapeLeadingUnderscores(propName)
|
|
61543
61554
|
);
|
|
61544
61555
|
} else {
|
|
61545
|
-
|
|
61556
|
+
error2(indexNode, Diagnostics.Property_0_does_not_exist_on_type_1, unescapeLeadingUnderscores(propName), typeToString(objectType));
|
|
61546
61557
|
}
|
|
61547
61558
|
}
|
|
61548
61559
|
if (index >= 0) {
|
|
@@ -61562,13 +61573,13 @@ function createTypeChecker(host) {
|
|
|
61562
61573
|
if (indexInfo) {
|
|
61563
61574
|
if (accessFlags & 2 /* NoIndexSignatures */ && indexInfo.keyType !== numberType) {
|
|
61564
61575
|
if (accessExpression) {
|
|
61565
|
-
|
|
61576
|
+
error2(accessExpression, Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(originalObjectType));
|
|
61566
61577
|
}
|
|
61567
61578
|
return void 0;
|
|
61568
61579
|
}
|
|
61569
61580
|
if (accessNode && indexInfo.keyType === stringType && !isTypeAssignableToKind(indexType, 4 /* String */ | 8 /* Number */)) {
|
|
61570
61581
|
const indexNode = getIndexNodeForAccessExpression(accessNode);
|
|
61571
|
-
|
|
61582
|
+
error2(indexNode, Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType));
|
|
61572
61583
|
return accessFlags & 1 /* IncludeUndefined */ ? getUnionType([indexInfo.type, missingType]) : indexInfo.type;
|
|
61573
61584
|
}
|
|
61574
61585
|
errorIfWritingToReadonlyIndex(indexInfo);
|
|
@@ -61596,23 +61607,23 @@ function createTypeChecker(host) {
|
|
|
61596
61607
|
}
|
|
61597
61608
|
}
|
|
61598
61609
|
if (objectType.symbol === globalThisSymbol && propName !== void 0 && globalThisSymbol.exports.has(propName) && globalThisSymbol.exports.get(propName).flags & 418 /* BlockScoped */) {
|
|
61599
|
-
|
|
61610
|
+
error2(accessExpression, Diagnostics.Property_0_does_not_exist_on_type_1, unescapeLeadingUnderscores(propName), typeToString(objectType));
|
|
61600
61611
|
} else if (noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors && !(accessFlags & 128 /* SuppressNoImplicitAnyError */)) {
|
|
61601
61612
|
if (propName !== void 0 && typeHasStaticProperty(propName, objectType)) {
|
|
61602
61613
|
const typeName = typeToString(objectType);
|
|
61603
|
-
|
|
61614
|
+
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) + "]");
|
|
61604
61615
|
} else if (getIndexTypeOfType(objectType, numberType)) {
|
|
61605
|
-
|
|
61616
|
+
error2(accessExpression.argumentExpression, Diagnostics.Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number);
|
|
61606
61617
|
} else {
|
|
61607
61618
|
let suggestion;
|
|
61608
61619
|
if (propName !== void 0 && (suggestion = getSuggestionForNonexistentProperty(propName, objectType))) {
|
|
61609
61620
|
if (suggestion !== void 0) {
|
|
61610
|
-
|
|
61621
|
+
error2(accessExpression.argumentExpression, Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2, propName, typeToString(objectType), suggestion);
|
|
61611
61622
|
}
|
|
61612
61623
|
} else {
|
|
61613
61624
|
const suggestion2 = getSuggestionForNonexistentIndexSignature(objectType, accessExpression, indexType);
|
|
61614
61625
|
if (suggestion2 !== void 0) {
|
|
61615
|
-
|
|
61626
|
+
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);
|
|
61616
61627
|
} else {
|
|
61617
61628
|
let errorInfo;
|
|
61618
61629
|
if (indexType.flags & 1024 /* EnumLiteral */) {
|
|
@@ -61677,11 +61688,11 @@ function createTypeChecker(host) {
|
|
|
61677
61688
|
if (accessNode) {
|
|
61678
61689
|
const indexNode = getIndexNodeForAccessExpression(accessNode);
|
|
61679
61690
|
if (indexType.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */)) {
|
|
61680
|
-
|
|
61691
|
+
error2(indexNode, Diagnostics.Property_0_does_not_exist_on_type_1, "" + indexType.value, typeToString(objectType));
|
|
61681
61692
|
} else if (indexType.flags & (4 /* String */ | 8 /* Number */)) {
|
|
61682
|
-
|
|
61693
|
+
error2(indexNode, Diagnostics.Type_0_has_no_matching_index_signature_for_type_1, typeToString(objectType), typeToString(indexType));
|
|
61683
61694
|
} else {
|
|
61684
|
-
|
|
61695
|
+
error2(indexNode, Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType));
|
|
61685
61696
|
}
|
|
61686
61697
|
}
|
|
61687
61698
|
if (isTypeAny(indexType)) {
|
|
@@ -61690,7 +61701,7 @@ function createTypeChecker(host) {
|
|
|
61690
61701
|
return void 0;
|
|
61691
61702
|
function errorIfWritingToReadonlyIndex(indexInfo) {
|
|
61692
61703
|
if (indexInfo && indexInfo.isReadonly && accessExpression && (isAssignmentTarget(accessExpression) || isDeleteTarget(accessExpression))) {
|
|
61693
|
-
|
|
61704
|
+
error2(accessExpression, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
|
|
61694
61705
|
}
|
|
61695
61706
|
}
|
|
61696
61707
|
}
|
|
@@ -61915,7 +61926,7 @@ function createTypeChecker(host) {
|
|
|
61915
61926
|
let tailCount = 0;
|
|
61916
61927
|
while (true) {
|
|
61917
61928
|
if (tailCount === 1e3) {
|
|
61918
|
-
|
|
61929
|
+
error2(currentNode, Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
|
|
61919
61930
|
return errorType;
|
|
61920
61931
|
}
|
|
61921
61932
|
const checkType = instantiateType(getActualTypeVariable(root.checkType), mapper);
|
|
@@ -62093,7 +62104,7 @@ function createTypeChecker(host) {
|
|
|
62093
62104
|
const links = getNodeLinks(node);
|
|
62094
62105
|
if (!links.resolvedType) {
|
|
62095
62106
|
if (!isLiteralImportTypeNode(node)) {
|
|
62096
|
-
|
|
62107
|
+
error2(node.argument, Diagnostics.String_literal_expected);
|
|
62097
62108
|
links.resolvedSymbol = unknownSymbol;
|
|
62098
62109
|
return links.resolvedType = errorType;
|
|
62099
62110
|
}
|
|
@@ -62127,7 +62138,7 @@ function createTypeChecker(host) {
|
|
|
62127
62138
|
const symbolFromModule = node.isTypeOf ? void 0 : getSymbol2(getExportsOfSymbol(mergedResolvedSymbol), current.escapedText, meaning);
|
|
62128
62139
|
const next = symbolFromModule ?? symbolFromVariable;
|
|
62129
62140
|
if (!next) {
|
|
62130
|
-
|
|
62141
|
+
error2(current, Diagnostics.Namespace_0_has_no_exported_member_1, getFullyQualifiedName(currentNamespace), declarationNameToString(current));
|
|
62131
62142
|
return links.resolvedType = errorType;
|
|
62132
62143
|
}
|
|
62133
62144
|
getNodeLinks(current).resolvedSymbol = next;
|
|
@@ -62140,7 +62151,7 @@ function createTypeChecker(host) {
|
|
|
62140
62151
|
links.resolvedType = resolveImportSymbolType(node, links, moduleSymbol, targetMeaning);
|
|
62141
62152
|
} else {
|
|
62142
62153
|
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;
|
|
62143
|
-
|
|
62154
|
+
error2(node, errorMessage, node.argument.literal.text);
|
|
62144
62155
|
links.resolvedSymbol = unknownSymbol;
|
|
62145
62156
|
links.resolvedType = errorType;
|
|
62146
62157
|
}
|
|
@@ -62418,7 +62429,7 @@ function createTypeChecker(host) {
|
|
|
62418
62429
|
if (isJSConstructor(container) && isNodeDescendantOf(node, container.body)) {
|
|
62419
62430
|
return getDeclaredTypeOfClassOrInterface(getSymbolOfDeclaration(container)).thisType;
|
|
62420
62431
|
}
|
|
62421
|
-
|
|
62432
|
+
error2(node, Diagnostics.A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface);
|
|
62422
62433
|
return errorType;
|
|
62423
62434
|
}
|
|
62424
62435
|
function getTypeFromThisTypeNode(node) {
|
|
@@ -62747,13 +62758,18 @@ function createTypeChecker(host) {
|
|
|
62747
62758
|
if (!result) {
|
|
62748
62759
|
const newMapper = createTypeMapper(typeParameters, typeArguments);
|
|
62749
62760
|
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);
|
|
62750
|
-
|
|
62761
|
+
target.instantiations.set(id, result);
|
|
62762
|
+
const resultObjectFlags = getObjectFlags(result);
|
|
62763
|
+
if (result.flags & 138117121 /* ObjectFlagsType */ && !(resultObjectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
|
|
62751
62764
|
const resultCouldContainTypeVariables = some(typeArguments, couldContainTypeVariables);
|
|
62752
|
-
if (!(result
|
|
62753
|
-
|
|
62765
|
+
if (!(getObjectFlags(result) & 524288 /* CouldContainTypeVariablesComputed */)) {
|
|
62766
|
+
if (resultObjectFlags & (32 /* Mapped */ | 16 /* Anonymous */ | 4 /* Reference */)) {
|
|
62767
|
+
result.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (resultCouldContainTypeVariables ? 1048576 /* CouldContainTypeVariables */ : 0);
|
|
62768
|
+
} else {
|
|
62769
|
+
result.objectFlags |= !resultCouldContainTypeVariables ? 524288 /* CouldContainTypeVariablesComputed */ : 0;
|
|
62770
|
+
}
|
|
62754
62771
|
}
|
|
62755
62772
|
}
|
|
62756
|
-
target.instantiations.set(id, result);
|
|
62757
62773
|
}
|
|
62758
62774
|
return result;
|
|
62759
62775
|
}
|
|
@@ -62938,7 +62954,7 @@ function createTypeChecker(host) {
|
|
|
62938
62954
|
}
|
|
62939
62955
|
if (instantiationDepth === 100 || instantiationCount >= 5e6) {
|
|
62940
62956
|
(_a = tracing) == null ? void 0 : _a.instant(tracing.Phase.CheckTypes, "instantiateType_DepthLimit", { typeId: type.id, instantiationDepth, instantiationCount });
|
|
62941
|
-
|
|
62957
|
+
error2(currentNode, Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
|
|
62942
62958
|
return errorType;
|
|
62943
62959
|
}
|
|
62944
62960
|
totalInstantiationCount++;
|
|
@@ -63558,7 +63574,7 @@ function createTypeChecker(host) {
|
|
|
63558
63574
|
result = elaborateIterableOrArrayLikeTargetElementwise(children, realSource, arrayLikeTargetParts, relation, containingMessageChain, errorOutputContainer) || result;
|
|
63559
63575
|
} else if (!isTypeRelatedTo(getIndexedAccessType(source, childrenNameType), childrenTargetType, relation)) {
|
|
63560
63576
|
result = true;
|
|
63561
|
-
const diag2 =
|
|
63577
|
+
const diag2 = error2(
|
|
63562
63578
|
containingElement.openingElement.tagName,
|
|
63563
63579
|
Diagnostics.This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided,
|
|
63564
63580
|
childrenPropName,
|
|
@@ -63586,7 +63602,7 @@ function createTypeChecker(host) {
|
|
|
63586
63602
|
}
|
|
63587
63603
|
} else if (!isTypeRelatedTo(getIndexedAccessType(source, childrenNameType), childrenTargetType, relation)) {
|
|
63588
63604
|
result = true;
|
|
63589
|
-
const diag2 =
|
|
63605
|
+
const diag2 = error2(
|
|
63590
63606
|
containingElement.openingElement.tagName,
|
|
63591
63607
|
Diagnostics.This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_provided,
|
|
63592
63608
|
childrenPropName,
|
|
@@ -64091,7 +64107,7 @@ function createTypeChecker(host) {
|
|
|
64091
64107
|
}
|
|
64092
64108
|
if (overflow) {
|
|
64093
64109
|
(_a = tracing) == null ? void 0 : _a.instant(tracing.Phase.CheckTypes, "checkTypeRelatedTo_DepthLimit", { sourceId: source.id, targetId: target.id, depth: sourceDepth, targetDepth });
|
|
64094
|
-
const diag2 =
|
|
64110
|
+
const diag2 = error2(errorNode || currentNode, Diagnostics.Excessive_stack_depth_comparing_types_0_and_1, typeToString(source), typeToString(target));
|
|
64095
64111
|
if (errorOutputContainer) {
|
|
64096
64112
|
(errorOutputContainer.errors || (errorOutputContainer.errors = [])).push(diag2);
|
|
64097
64113
|
}
|
|
@@ -67207,7 +67223,7 @@ function createTypeChecker(host) {
|
|
|
67207
67223
|
const t = getTypeOfSymbol(p);
|
|
67208
67224
|
if (getObjectFlags(t) & 65536 /* ContainsWideningType */) {
|
|
67209
67225
|
if (!reportWideningErrorsInType(t)) {
|
|
67210
|
-
|
|
67226
|
+
error2(p.valueDeclaration, Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, symbolToString(p), typeToString(getWidenedType(t)));
|
|
67211
67227
|
}
|
|
67212
67228
|
errorReported = true;
|
|
67213
67229
|
}
|
|
@@ -67257,11 +67273,11 @@ function createTypeChecker(host) {
|
|
|
67257
67273
|
}
|
|
67258
67274
|
break;
|
|
67259
67275
|
case 323 /* JSDocFunctionType */:
|
|
67260
|
-
|
|
67276
|
+
error2(declaration, Diagnostics.Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString);
|
|
67261
67277
|
return;
|
|
67262
67278
|
case 329 /* JSDocSignature */:
|
|
67263
67279
|
if (noImplicitAny && isJSDocOverloadTag(declaration.parent)) {
|
|
67264
|
-
|
|
67280
|
+
error2(declaration.parent.tagName, Diagnostics.This_overload_implicitly_returns_the_type_0_because_it_lacks_a_return_type_annotation, typeAsString);
|
|
67265
67281
|
}
|
|
67266
67282
|
return;
|
|
67267
67283
|
case 261 /* FunctionDeclaration */:
|
|
@@ -67273,9 +67289,9 @@ function createTypeChecker(host) {
|
|
|
67273
67289
|
case 218 /* ArrowFunction */:
|
|
67274
67290
|
if (noImplicitAny && !declaration.name) {
|
|
67275
67291
|
if (wideningKind === 3 /* GeneratorYield */) {
|
|
67276
|
-
|
|
67292
|
+
error2(declaration, Diagnostics.Generator_implicitly_has_yield_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type_annotation, typeAsString);
|
|
67277
67293
|
} else {
|
|
67278
|
-
|
|
67294
|
+
error2(declaration, Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString);
|
|
67279
67295
|
}
|
|
67280
67296
|
return;
|
|
67281
67297
|
}
|
|
@@ -67283,7 +67299,7 @@ function createTypeChecker(host) {
|
|
|
67283
67299
|
break;
|
|
67284
67300
|
case 199 /* MappedType */:
|
|
67285
67301
|
if (noImplicitAny) {
|
|
67286
|
-
|
|
67302
|
+
error2(declaration, Diagnostics.Mapped_object_type_implicitly_has_an_any_template_type);
|
|
67287
67303
|
}
|
|
67288
67304
|
return;
|
|
67289
67305
|
default:
|
|
@@ -70561,15 +70577,15 @@ function createTypeChecker(host) {
|
|
|
70561
70577
|
}
|
|
70562
70578
|
if (symbol === argumentsSymbol) {
|
|
70563
70579
|
if (isInPropertyInitializerOrClassStaticBlock(node)) {
|
|
70564
|
-
|
|
70580
|
+
error2(node, Diagnostics.arguments_cannot_be_referenced_in_property_initializers);
|
|
70565
70581
|
return errorType;
|
|
70566
70582
|
}
|
|
70567
70583
|
const container = getContainingFunction(node);
|
|
70568
70584
|
if (languageVersion < 2 /* ES2015 */) {
|
|
70569
70585
|
if (container.kind === 218 /* ArrowFunction */) {
|
|
70570
|
-
|
|
70586
|
+
error2(node, Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression);
|
|
70571
70587
|
} else if (hasSyntacticModifier(container, 512 /* Async */)) {
|
|
70572
|
-
|
|
70588
|
+
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);
|
|
70573
70589
|
}
|
|
70574
70590
|
}
|
|
70575
70591
|
getNodeLinks(container).flags |= 512 /* CaptureArguments */;
|
|
@@ -70627,14 +70643,14 @@ function createTypeChecker(host) {
|
|
|
70627
70643
|
if (assignmentKind) {
|
|
70628
70644
|
if (!(localOrExportSymbol.flags & 3 /* Variable */) && !(isInJSFile(node) && localOrExportSymbol.flags & 512 /* ValueModule */)) {
|
|
70629
70645
|
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;
|
|
70630
|
-
|
|
70646
|
+
error2(node, assignmentError, symbolToString(symbol));
|
|
70631
70647
|
return errorType;
|
|
70632
70648
|
}
|
|
70633
70649
|
if (isReadonlySymbol(localOrExportSymbol)) {
|
|
70634
70650
|
if (localOrExportSymbol.flags & 3 /* Variable */) {
|
|
70635
|
-
|
|
70651
|
+
error2(node, Diagnostics.Cannot_assign_to_0_because_it_is_a_constant, symbolToString(symbol));
|
|
70636
70652
|
} else {
|
|
70637
|
-
|
|
70653
|
+
error2(node, Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, symbolToString(symbol));
|
|
70638
70654
|
}
|
|
70639
70655
|
return errorType;
|
|
70640
70656
|
}
|
|
@@ -70670,13 +70686,13 @@ function createTypeChecker(host) {
|
|
|
70670
70686
|
if (!isEvolvingArrayOperationTarget(node) && (type === autoType || type === autoArrayType)) {
|
|
70671
70687
|
if (flowType === autoType || flowType === autoArrayType) {
|
|
70672
70688
|
if (noImplicitAny) {
|
|
70673
|
-
|
|
70674
|
-
|
|
70689
|
+
error2(getNameOfDeclaration(declaration), Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined, symbolToString(symbol), typeToString(flowType));
|
|
70690
|
+
error2(node, Diagnostics.Variable_0_implicitly_has_an_1_type, symbolToString(symbol), typeToString(flowType));
|
|
70675
70691
|
}
|
|
70676
70692
|
return convertAutoToAny(flowType);
|
|
70677
70693
|
}
|
|
70678
70694
|
} else if (!assumeInitialized && !containsUndefinedType(type) && containsUndefinedType(flowType)) {
|
|
70679
|
-
|
|
70695
|
+
error2(node, Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol));
|
|
70680
70696
|
return type;
|
|
70681
70697
|
}
|
|
70682
70698
|
return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType;
|
|
@@ -70806,13 +70822,13 @@ function createTypeChecker(host) {
|
|
|
70806
70822
|
/*noCacheCheck*/
|
|
70807
70823
|
false
|
|
70808
70824
|
)) {
|
|
70809
|
-
|
|
70825
|
+
error2(node, diagnosticMessage);
|
|
70810
70826
|
}
|
|
70811
70827
|
}
|
|
70812
70828
|
}
|
|
70813
70829
|
function checkThisInStaticClassFieldInitializerInDecoratedClass(thisExpression, container) {
|
|
70814
70830
|
if (isPropertyDeclaration(container) && hasStaticModifier(container) && legacyDecorators && container.initializer && textRangeContainsPositionInclusive(container.initializer, thisExpression.pos) && hasDecorators(container.parent)) {
|
|
70815
|
-
|
|
70831
|
+
error2(thisExpression, Diagnostics.Cannot_use_this_in_a_static_property_initializer_of_a_decorated_class);
|
|
70816
70832
|
}
|
|
70817
70833
|
}
|
|
70818
70834
|
function checkThisExpression(node) {
|
|
@@ -70853,18 +70869,18 @@ function createTypeChecker(host) {
|
|
|
70853
70869
|
}
|
|
70854
70870
|
checkThisInStaticClassFieldInitializerInDecoratedClass(node, container);
|
|
70855
70871
|
if (thisInComputedPropertyName) {
|
|
70856
|
-
|
|
70872
|
+
error2(node, Diagnostics.this_cannot_be_referenced_in_a_computed_property_name);
|
|
70857
70873
|
} else {
|
|
70858
70874
|
switch (container.kind) {
|
|
70859
70875
|
case 266 /* ModuleDeclaration */:
|
|
70860
|
-
|
|
70876
|
+
error2(node, Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body);
|
|
70861
70877
|
break;
|
|
70862
70878
|
case 265 /* EnumDeclaration */:
|
|
70863
|
-
|
|
70879
|
+
error2(node, Diagnostics.this_cannot_be_referenced_in_current_location);
|
|
70864
70880
|
break;
|
|
70865
70881
|
case 175 /* Constructor */:
|
|
70866
70882
|
if (isInConstructorArgumentInitializer(node, container)) {
|
|
70867
|
-
|
|
70883
|
+
error2(node, Diagnostics.this_cannot_be_referenced_in_constructor_arguments);
|
|
70868
70884
|
}
|
|
70869
70885
|
break;
|
|
70870
70886
|
}
|
|
@@ -70881,9 +70897,9 @@ function createTypeChecker(host) {
|
|
|
70881
70897
|
if (noImplicitThis) {
|
|
70882
70898
|
const globalThisType2 = getTypeOfSymbol(globalThisSymbol);
|
|
70883
70899
|
if (type === globalThisType2 && capturedByArrowFunction) {
|
|
70884
|
-
|
|
70900
|
+
error2(node, Diagnostics.The_containing_arrow_function_captures_the_global_value_of_this);
|
|
70885
70901
|
} else if (!type) {
|
|
70886
|
-
const diag2 =
|
|
70902
|
+
const diag2 = error2(node, Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation);
|
|
70887
70903
|
if (!isSourceFile(container)) {
|
|
70888
70904
|
const outsideThis = tryGetThisTypeAt(container);
|
|
70889
70905
|
if (outsideThis && outsideThis !== globalThisType2) {
|
|
@@ -71012,13 +71028,13 @@ function createTypeChecker(host) {
|
|
|
71012
71028
|
if (!container || !isLegalUsageOfSuperExpression(container)) {
|
|
71013
71029
|
const current = findAncestor(node, (n) => n === container ? "quit" : n.kind === 166 /* ComputedPropertyName */);
|
|
71014
71030
|
if (current && current.kind === 166 /* ComputedPropertyName */) {
|
|
71015
|
-
|
|
71031
|
+
error2(node, Diagnostics.super_cannot_be_referenced_in_a_computed_property_name);
|
|
71016
71032
|
} else if (isCallExpression2) {
|
|
71017
|
-
|
|
71033
|
+
error2(node, Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors);
|
|
71018
71034
|
} else if (!container || !container.parent || !(isClassLike(container.parent) || container.parent.kind === 209 /* ObjectLiteralExpression */)) {
|
|
71019
|
-
|
|
71035
|
+
error2(node, Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions);
|
|
71020
71036
|
} else {
|
|
71021
|
-
|
|
71037
|
+
error2(node, Diagnostics.super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class);
|
|
71022
71038
|
}
|
|
71023
71039
|
return errorType;
|
|
71024
71040
|
}
|
|
@@ -71050,7 +71066,7 @@ function createTypeChecker(host) {
|
|
|
71050
71066
|
}
|
|
71051
71067
|
if (container.parent.kind === 209 /* ObjectLiteralExpression */) {
|
|
71052
71068
|
if (languageVersion < 2 /* ES2015 */) {
|
|
71053
|
-
|
|
71069
|
+
error2(node, Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher);
|
|
71054
71070
|
return errorType;
|
|
71055
71071
|
} else {
|
|
71056
71072
|
return anyType;
|
|
@@ -71058,7 +71074,7 @@ function createTypeChecker(host) {
|
|
|
71058
71074
|
}
|
|
71059
71075
|
const classLikeDeclaration = container.parent;
|
|
71060
71076
|
if (!getClassExtendsHeritageElement(classLikeDeclaration)) {
|
|
71061
|
-
|
|
71077
|
+
error2(node, Diagnostics.super_can_only_be_referenced_in_a_derived_class);
|
|
71062
71078
|
return errorType;
|
|
71063
71079
|
}
|
|
71064
71080
|
const classType = getDeclaredTypeOfSymbol(getSymbolOfDeclaration(classLikeDeclaration));
|
|
@@ -71067,7 +71083,7 @@ function createTypeChecker(host) {
|
|
|
71067
71083
|
return errorType;
|
|
71068
71084
|
}
|
|
71069
71085
|
if (container.kind === 175 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) {
|
|
71070
|
-
|
|
71086
|
+
error2(node, Diagnostics.super_cannot_be_referenced_in_constructor_arguments);
|
|
71071
71087
|
return errorType;
|
|
71072
71088
|
}
|
|
71073
71089
|
return nodeCheckFlag === 32 /* SuperStatic */ ? getBaseConstructorTypeOfClass(classType) : getTypeWithThisArgument(baseClassType, classType.thisType);
|
|
@@ -72023,7 +72039,7 @@ function createTypeChecker(host) {
|
|
|
72023
72039
|
let attributesType = forcedLookupLocation === void 0 ? getTypeOfFirstParameterOfSignatureWithFallback(sig, unknownType) : forcedLookupLocation === "" ? getReturnTypeOfSignature(sig) : getJsxPropsTypeForSignatureFromMember(sig, forcedLookupLocation);
|
|
72024
72040
|
if (!attributesType) {
|
|
72025
72041
|
if (!!forcedLookupLocation && !!length(context.attributes.properties)) {
|
|
72026
|
-
|
|
72042
|
+
error2(context, Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, unescapeLeadingUnderscores(forcedLookupLocation));
|
|
72027
72043
|
}
|
|
72028
72044
|
return unknownType;
|
|
72029
72045
|
}
|
|
@@ -72331,7 +72347,7 @@ function createTypeChecker(host) {
|
|
|
72331
72347
|
}
|
|
72332
72348
|
}
|
|
72333
72349
|
if (links.resolvedType.flags & 98304 /* Nullable */ || !isTypeAssignableToKind(links.resolvedType, 402653316 /* StringLike */ | 296 /* NumberLike */ | 12288 /* ESSymbolLike */) && !isTypeAssignableTo(links.resolvedType, stringNumberSymbolType)) {
|
|
72334
|
-
|
|
72350
|
+
error2(node, Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any);
|
|
72335
72351
|
}
|
|
72336
72352
|
}
|
|
72337
72353
|
return links.resolvedType;
|
|
@@ -72440,7 +72456,7 @@ function createTypeChecker(host) {
|
|
|
72440
72456
|
if (impliedProp) {
|
|
72441
72457
|
prop.flags |= impliedProp.flags & 16777216 /* Optional */;
|
|
72442
72458
|
} else if (!compilerOptions.suppressExcessPropertyErrors && !getIndexInfoOfType(contextualType, stringType)) {
|
|
72443
|
-
|
|
72459
|
+
error2(
|
|
72444
72460
|
memberDecl.name,
|
|
72445
72461
|
Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1,
|
|
72446
72462
|
symbolToString(member),
|
|
@@ -72487,7 +72503,7 @@ function createTypeChecker(host) {
|
|
|
72487
72503
|
}
|
|
72488
72504
|
spread = getSpreadType(spread, mergedType, node.symbol, objectFlags, inConstContext);
|
|
72489
72505
|
} else {
|
|
72490
|
-
|
|
72506
|
+
error2(memberDecl, Diagnostics.Spread_types_may_only_be_created_from_object_types);
|
|
72491
72507
|
spread = errorType;
|
|
72492
72508
|
}
|
|
72493
72509
|
continue;
|
|
@@ -72527,7 +72543,7 @@ function createTypeChecker(host) {
|
|
|
72527
72543
|
for (const prop of getPropertiesOfType(contextualType)) {
|
|
72528
72544
|
if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) {
|
|
72529
72545
|
if (!(prop.flags & 16777216 /* Optional */)) {
|
|
72530
|
-
|
|
72546
|
+
error2(
|
|
72531
72547
|
prop.valueDeclaration || ((_a = tryCast(prop, isTransientSymbol)) == null ? void 0 : _a.links.bindingElement),
|
|
72532
72548
|
Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value
|
|
72533
72549
|
);
|
|
@@ -72602,7 +72618,7 @@ function createTypeChecker(host) {
|
|
|
72602
72618
|
checkJsxOpeningLikeElementOrOpeningFragment(node.openingFragment);
|
|
72603
72619
|
const nodeSourceFile = getSourceFileOfNode(node);
|
|
72604
72620
|
if (getJSXTransformEnabled(compilerOptions) && (compilerOptions.jsxFactory || nodeSourceFile.pragmas.has("jsx")) && !compilerOptions.jsxFragmentFactory && !nodeSourceFile.pragmas.has("jsxfrag")) {
|
|
72605
|
-
|
|
72621
|
+
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);
|
|
72606
72622
|
}
|
|
72607
72623
|
checkJsxChildren(node);
|
|
72608
72624
|
return getJsxElementTypeAt(node) || anyType;
|
|
@@ -72689,7 +72705,7 @@ function createTypeChecker(host) {
|
|
|
72689
72705
|
checkSpreadPropOverrides(exprType, allAttributesTable, attributeDecl);
|
|
72690
72706
|
}
|
|
72691
72707
|
} else {
|
|
72692
|
-
|
|
72708
|
+
error2(attributeDecl.expression, Diagnostics.Spread_types_may_only_be_created_from_object_types);
|
|
72693
72709
|
typeToIntersect = typeToIntersect ? getIntersectionType([typeToIntersect, exprType]) : exprType;
|
|
72694
72710
|
}
|
|
72695
72711
|
}
|
|
@@ -72711,7 +72727,7 @@ function createTypeChecker(host) {
|
|
|
72711
72727
|
const childrenTypes = checkJsxChildren(parent2, checkMode);
|
|
72712
72728
|
if (!hasSpreadAnyType && jsxChildrenPropertyName && jsxChildrenPropertyName !== "") {
|
|
72713
72729
|
if (explicitlySpecifyChildrenAttribute) {
|
|
72714
|
-
|
|
72730
|
+
error2(attributes, Diagnostics._0_are_specified_twice_The_attribute_named_0_will_be_overwritten, unescapeLeadingUnderscores(jsxChildrenPropertyName));
|
|
72715
72731
|
}
|
|
72716
72732
|
const contextualType2 = getApparentTypeOfContextualType(
|
|
72717
72733
|
openingLikeElement.attributes,
|
|
@@ -72778,7 +72794,7 @@ function createTypeChecker(host) {
|
|
|
72778
72794
|
if (!(right.flags & 16777216 /* Optional */)) {
|
|
72779
72795
|
const left = props.get(right.escapedName);
|
|
72780
72796
|
if (left) {
|
|
72781
|
-
const diagnostic =
|
|
72797
|
+
const diagnostic = error2(left.valueDeclaration, Diagnostics._0_is_specified_more_than_once_so_this_usage_will_be_overwritten, unescapeLeadingUnderscores(left.escapedName));
|
|
72782
72798
|
addRelatedInfo(diagnostic, createDiagnosticForNode(spread, Diagnostics.This_spread_always_overwrites_this_property));
|
|
72783
72799
|
}
|
|
72784
72800
|
}
|
|
@@ -72810,11 +72826,11 @@ function createTypeChecker(host) {
|
|
|
72810
72826
|
links.jsxFlags |= 2 /* IntrinsicIndexedElement */;
|
|
72811
72827
|
return links.resolvedSymbol = intrinsicElementsType.symbol;
|
|
72812
72828
|
}
|
|
72813
|
-
|
|
72829
|
+
error2(node, Diagnostics.Property_0_does_not_exist_on_type_1, intrinsicTagNameToString(node.tagName), "JSX." + JsxNames.IntrinsicElements);
|
|
72814
72830
|
return links.resolvedSymbol = unknownSymbol;
|
|
72815
72831
|
} else {
|
|
72816
72832
|
if (noImplicitAny) {
|
|
72817
|
-
|
|
72833
|
+
error2(node, Diagnostics.JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists, unescapeLeadingUnderscores(JsxNames.IntrinsicElements));
|
|
72818
72834
|
}
|
|
72819
72835
|
return links.resolvedSymbol = unknownSymbol;
|
|
72820
72836
|
}
|
|
@@ -72897,7 +72913,7 @@ function createTypeChecker(host) {
|
|
|
72897
72913
|
} else if (propertiesOfJsxElementAttribPropInterface.length === 1) {
|
|
72898
72914
|
return propertiesOfJsxElementAttribPropInterface[0].escapedName;
|
|
72899
72915
|
} else if (propertiesOfJsxElementAttribPropInterface.length > 1 && jsxElementAttribPropInterfaceSym.declarations) {
|
|
72900
|
-
|
|
72916
|
+
error2(jsxElementAttribPropInterfaceSym.declarations[0], Diagnostics.The_global_type_JSX_0_may_not_have_more_than_one_property, unescapeLeadingUnderscores(nameOfAttribPropContainer));
|
|
72901
72917
|
}
|
|
72902
72918
|
}
|
|
72903
72919
|
return void 0;
|
|
@@ -72920,7 +72936,7 @@ function createTypeChecker(host) {
|
|
|
72920
72936
|
} else if (elementType.flags & 128 /* StringLiteral */) {
|
|
72921
72937
|
const intrinsicType = getIntrinsicAttributesTypeFromStringLiteralType(elementType, caller);
|
|
72922
72938
|
if (!intrinsicType) {
|
|
72923
|
-
|
|
72939
|
+
error2(caller, Diagnostics.Property_0_does_not_exist_on_type_1, elementType.value, "JSX." + JsxNames.IntrinsicElements);
|
|
72924
72940
|
return emptyArray;
|
|
72925
72941
|
} else {
|
|
72926
72942
|
const fakeSignature = createSignatureForJSXIntrinsic(caller, intrinsicType);
|
|
@@ -73046,11 +73062,11 @@ function createTypeChecker(host) {
|
|
|
73046
73062
|
}
|
|
73047
73063
|
function checkJsxPreconditions(errorNode) {
|
|
73048
73064
|
if ((compilerOptions.jsx || 0 /* None */) === 0 /* None */) {
|
|
73049
|
-
|
|
73065
|
+
error2(errorNode, Diagnostics.Cannot_use_JSX_unless_the_jsx_flag_is_provided);
|
|
73050
73066
|
}
|
|
73051
73067
|
if (getJsxElementTypeAt(errorNode) === void 0) {
|
|
73052
73068
|
if (noImplicitAny) {
|
|
73053
|
-
|
|
73069
|
+
error2(errorNode, Diagnostics.JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist);
|
|
73054
73070
|
}
|
|
73055
73071
|
}
|
|
73056
73072
|
}
|
|
@@ -73142,7 +73158,7 @@ function createTypeChecker(host) {
|
|
|
73142
73158
|
if (node.expression) {
|
|
73143
73159
|
const type = checkExpression(node.expression, checkMode);
|
|
73144
73160
|
if (node.dotDotDotToken && type !== anyType && !isArrayType(type)) {
|
|
73145
|
-
|
|
73161
|
+
error2(node, Diagnostics.JSX_spread_child_must_be_an_array_type);
|
|
73146
73162
|
}
|
|
73147
73163
|
return type;
|
|
73148
73164
|
} else {
|
|
@@ -73171,14 +73187,14 @@ function createTypeChecker(host) {
|
|
|
73171
73187
|
if (languageVersion < 2 /* ES2015 */) {
|
|
73172
73188
|
if (symbolHasNonMethodDeclaration(prop)) {
|
|
73173
73189
|
if (errorNode) {
|
|
73174
|
-
|
|
73190
|
+
error2(errorNode, Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword);
|
|
73175
73191
|
}
|
|
73176
73192
|
return false;
|
|
73177
73193
|
}
|
|
73178
73194
|
}
|
|
73179
73195
|
if (flags & 256 /* Abstract */) {
|
|
73180
73196
|
if (errorNode) {
|
|
73181
|
-
|
|
73197
|
+
error2(
|
|
73182
73198
|
errorNode,
|
|
73183
73199
|
Diagnostics.Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression,
|
|
73184
73200
|
symbolToString(prop),
|
|
@@ -73192,7 +73208,7 @@ function createTypeChecker(host) {
|
|
|
73192
73208
|
const declaringClassDeclaration = getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop));
|
|
73193
73209
|
if (declaringClassDeclaration && isNodeUsedDuringClassInitialization(location)) {
|
|
73194
73210
|
if (errorNode) {
|
|
73195
|
-
|
|
73211
|
+
error2(
|
|
73196
73212
|
errorNode,
|
|
73197
73213
|
Diagnostics.Abstract_property_0_in_class_1_cannot_be_accessed_in_the_constructor,
|
|
73198
73214
|
symbolToString(prop),
|
|
@@ -73209,7 +73225,7 @@ function createTypeChecker(host) {
|
|
|
73209
73225
|
const declaringClassDeclaration = getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop));
|
|
73210
73226
|
if (!isNodeWithinClass(location, declaringClassDeclaration)) {
|
|
73211
73227
|
if (errorNode) {
|
|
73212
|
-
|
|
73228
|
+
error2(
|
|
73213
73229
|
errorNode,
|
|
73214
73230
|
Diagnostics.Property_0_is_private_and_only_accessible_within_class_1,
|
|
73215
73231
|
symbolToString(prop),
|
|
@@ -73232,7 +73248,7 @@ function createTypeChecker(host) {
|
|
|
73232
73248
|
enclosingClass = enclosingClass && isClassDerivedFromDeclaringClasses(enclosingClass, prop, writing);
|
|
73233
73249
|
if (flags & 32 /* Static */ || !enclosingClass) {
|
|
73234
73250
|
if (errorNode) {
|
|
73235
|
-
|
|
73251
|
+
error2(
|
|
73236
73252
|
errorNode,
|
|
73237
73253
|
Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses,
|
|
73238
73254
|
symbolToString(prop),
|
|
@@ -73250,7 +73266,7 @@ function createTypeChecker(host) {
|
|
|
73250
73266
|
}
|
|
73251
73267
|
if (!containingType || !hasBaseType(containingType, enclosingClass)) {
|
|
73252
73268
|
if (errorNode) {
|
|
73253
|
-
|
|
73269
|
+
error2(
|
|
73254
73270
|
errorNode,
|
|
73255
73271
|
Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1_This_is_an_instance_of_class_2,
|
|
73256
73272
|
symbolToString(prop),
|
|
@@ -73298,28 +73314,28 @@ function createTypeChecker(host) {
|
|
|
73298
73314
|
function reportObjectPossiblyNullOrUndefinedError(node, facts) {
|
|
73299
73315
|
const nodeText2 = isEntityNameExpression(node) ? entityNameToString(node) : void 0;
|
|
73300
73316
|
if (node.kind === 106 /* NullKeyword */) {
|
|
73301
|
-
|
|
73317
|
+
error2(node, Diagnostics.The_value_0_cannot_be_used_here, "null");
|
|
73302
73318
|
return;
|
|
73303
73319
|
}
|
|
73304
73320
|
if (nodeText2 !== void 0 && nodeText2.length < 100) {
|
|
73305
73321
|
if (isIdentifier(node) && nodeText2 === "undefined") {
|
|
73306
|
-
|
|
73322
|
+
error2(node, Diagnostics.The_value_0_cannot_be_used_here, "undefined");
|
|
73307
73323
|
return;
|
|
73308
73324
|
}
|
|
73309
|
-
|
|
73325
|
+
error2(
|
|
73310
73326
|
node,
|
|
73311
73327
|
facts & 16777216 /* IsUndefined */ ? facts & 33554432 /* IsNull */ ? Diagnostics._0_is_possibly_null_or_undefined : Diagnostics._0_is_possibly_undefined : Diagnostics._0_is_possibly_null,
|
|
73312
73328
|
nodeText2
|
|
73313
73329
|
);
|
|
73314
73330
|
} else {
|
|
73315
|
-
|
|
73331
|
+
error2(
|
|
73316
73332
|
node,
|
|
73317
73333
|
facts & 16777216 /* IsUndefined */ ? facts & 33554432 /* IsNull */ ? Diagnostics.Object_is_possibly_null_or_undefined : Diagnostics.Object_is_possibly_undefined : Diagnostics.Object_is_possibly_null
|
|
73318
73334
|
);
|
|
73319
73335
|
}
|
|
73320
73336
|
}
|
|
73321
73337
|
function reportCannotInvokePossiblyNullOrUndefinedError(node, facts) {
|
|
73322
|
-
|
|
73338
|
+
error2(
|
|
73323
73339
|
node,
|
|
73324
73340
|
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
|
|
73325
73341
|
);
|
|
@@ -73329,11 +73345,11 @@ function createTypeChecker(host) {
|
|
|
73329
73345
|
if (isEntityNameExpression(node)) {
|
|
73330
73346
|
const nodeText2 = entityNameToString(node);
|
|
73331
73347
|
if (nodeText2.length < 100) {
|
|
73332
|
-
|
|
73348
|
+
error2(node, Diagnostics._0_is_of_type_unknown, nodeText2);
|
|
73333
73349
|
return errorType;
|
|
73334
73350
|
}
|
|
73335
73351
|
}
|
|
73336
|
-
|
|
73352
|
+
error2(node, Diagnostics.Object_is_of_type_unknown);
|
|
73337
73353
|
return errorType;
|
|
73338
73354
|
}
|
|
73339
73355
|
const facts = getTypeFacts(type);
|
|
@@ -73353,15 +73369,15 @@ function createTypeChecker(host) {
|
|
|
73353
73369
|
if (isEntityNameExpression(node)) {
|
|
73354
73370
|
const nodeText2 = entityNameToString(node);
|
|
73355
73371
|
if (isIdentifier(node) && nodeText2 === "undefined") {
|
|
73356
|
-
|
|
73372
|
+
error2(node, Diagnostics.The_value_0_cannot_be_used_here, nodeText2);
|
|
73357
73373
|
return nonNullType;
|
|
73358
73374
|
}
|
|
73359
73375
|
if (nodeText2.length < 100) {
|
|
73360
|
-
|
|
73376
|
+
error2(node, Diagnostics._0_is_possibly_undefined, nodeText2);
|
|
73361
73377
|
return nonNullType;
|
|
73362
73378
|
}
|
|
73363
73379
|
}
|
|
73364
|
-
|
|
73380
|
+
error2(node, Diagnostics.Object_is_possibly_undefined);
|
|
73365
73381
|
}
|
|
73366
73382
|
return nonNullType;
|
|
73367
73383
|
}
|
|
@@ -73456,7 +73472,7 @@ function createTypeChecker(host) {
|
|
|
73456
73472
|
const lexicalClass = getContainingClass(lexicalValueDecl);
|
|
73457
73473
|
Debug.assert(!!lexicalClass);
|
|
73458
73474
|
if (findAncestor(lexicalClass, (n) => typeClass === n)) {
|
|
73459
|
-
const diagnostic =
|
|
73475
|
+
const diagnostic = error2(
|
|
73460
73476
|
right,
|
|
73461
73477
|
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,
|
|
73462
73478
|
diagName,
|
|
@@ -73478,7 +73494,7 @@ function createTypeChecker(host) {
|
|
|
73478
73494
|
return true;
|
|
73479
73495
|
}
|
|
73480
73496
|
}
|
|
73481
|
-
|
|
73497
|
+
error2(
|
|
73482
73498
|
right,
|
|
73483
73499
|
Diagnostics.Property_0_is_not_accessible_outside_class_1_because_it_has_a_private_identifier,
|
|
73484
73500
|
diagName,
|
|
@@ -73531,7 +73547,7 @@ function createTypeChecker(host) {
|
|
|
73531
73547
|
} else {
|
|
73532
73548
|
const isSetonlyAccessor = prop && prop.flags & 65536 /* SetAccessor */ && !(prop.flags & 32768 /* GetAccessor */);
|
|
73533
73549
|
if (isSetonlyAccessor && assignmentKind !== 1 /* Definite */) {
|
|
73534
|
-
|
|
73550
|
+
error2(node, Diagnostics.Private_accessor_was_defined_without_a_getter);
|
|
73535
73551
|
}
|
|
73536
73552
|
}
|
|
73537
73553
|
} else {
|
|
@@ -73568,9 +73584,9 @@ function createTypeChecker(host) {
|
|
|
73568
73584
|
}
|
|
73569
73585
|
if (leftType.symbol === globalThisSymbol) {
|
|
73570
73586
|
if (globalThisSymbol.exports.has(right.escapedText) && globalThisSymbol.exports.get(right.escapedText).flags & 418 /* BlockScoped */) {
|
|
73571
|
-
|
|
73587
|
+
error2(right, Diagnostics.Property_0_does_not_exist_on_type_1, unescapeLeadingUnderscores(right.escapedText), typeToString(leftType));
|
|
73572
73588
|
} else if (noImplicitAny) {
|
|
73573
|
-
|
|
73589
|
+
error2(right, Diagnostics.Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature, typeToString(leftType));
|
|
73574
73590
|
}
|
|
73575
73591
|
return anyType;
|
|
73576
73592
|
}
|
|
@@ -73580,11 +73596,11 @@ function createTypeChecker(host) {
|
|
|
73580
73596
|
return errorType;
|
|
73581
73597
|
}
|
|
73582
73598
|
if (indexInfo.isReadonly && (isAssignmentTarget(node) || isDeleteTarget(node))) {
|
|
73583
|
-
|
|
73599
|
+
error2(node, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(apparentType));
|
|
73584
73600
|
}
|
|
73585
73601
|
propType = compilerOptions.noUncheckedIndexedAccess && !isAssignmentTarget(node) ? getUnionType([indexInfo.type, missingType]) : indexInfo.type;
|
|
73586
73602
|
if (compilerOptions.noPropertyAccessFromIndexSignature && isPropertyAccessExpression(node)) {
|
|
73587
|
-
|
|
73603
|
+
error2(right, Diagnostics.Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0, unescapeLeadingUnderscores(right.escapedText));
|
|
73588
73604
|
}
|
|
73589
73605
|
if (indexInfo.declaration && getCombinedNodeFlags(indexInfo.declaration) & 268435456 /* Deprecated */) {
|
|
73590
73606
|
addDeprecatedSuggestion(right, [indexInfo.declaration], right.escapedText);
|
|
@@ -73599,7 +73615,7 @@ function createTypeChecker(host) {
|
|
|
73599
73615
|
getNodeLinks(node).resolvedSymbol = prop;
|
|
73600
73616
|
checkPropertyAccessibility(node, left.kind === 108 /* SuperKeyword */, isWriteAccess(node), apparentType, prop);
|
|
73601
73617
|
if (isAssignmentToReadonlyEntity(node, prop, assignmentKind)) {
|
|
73602
|
-
|
|
73618
|
+
error2(right, Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, idText(right));
|
|
73603
73619
|
return errorType;
|
|
73604
73620
|
}
|
|
73605
73621
|
propType = isThisPropertyAccessInConstructor(node, prop) ? autoType : writeOnly || isWriteOnlyAccess(node) ? getWriteTypeOfSymbol(prop) : getTypeOfSymbol(prop);
|
|
@@ -73644,7 +73660,7 @@ function createTypeChecker(host) {
|
|
|
73644
73660
|
}
|
|
73645
73661
|
const flowType = getFlowTypeOfReference(node, propType, assumeUninitialized ? getOptionalType(propType) : propType);
|
|
73646
73662
|
if (assumeUninitialized && !containsUndefinedType(propType) && containsUndefinedType(flowType)) {
|
|
73647
|
-
|
|
73663
|
+
error2(errorNode, Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(prop));
|
|
73648
73664
|
return propType;
|
|
73649
73665
|
}
|
|
73650
73666
|
return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType;
|
|
@@ -73657,9 +73673,9 @@ function createTypeChecker(host) {
|
|
|
73657
73673
|
let diagnosticMessage;
|
|
73658
73674
|
const declarationName = idText(right);
|
|
73659
73675
|
if (isInPropertyInitializerOrClassStaticBlock(node) && !isOptionalPropertyDeclaration(valueDeclaration) && !(isAccessExpression(node) && isAccessExpression(node.expression)) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right) && !(isMethodDeclaration(valueDeclaration) && getCombinedModifierFlags(valueDeclaration) & 32 /* Static */) && (compilerOptions.useDefineForClassFields || !isPropertyDeclaredInAncestorClass(prop))) {
|
|
73660
|
-
diagnosticMessage =
|
|
73676
|
+
diagnosticMessage = error2(right, Diagnostics.Property_0_is_used_before_its_initialization, declarationName);
|
|
73661
73677
|
} else if (valueDeclaration.kind === 262 /* ClassDeclaration */ && node.parent.kind !== 182 /* TypeReference */ && !(valueDeclaration.flags & 16777216 /* Ambient */) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) {
|
|
73662
|
-
diagnosticMessage =
|
|
73678
|
+
diagnosticMessage = error2(right, Diagnostics.Class_0_used_before_its_declaration, declarationName);
|
|
73663
73679
|
}
|
|
73664
73680
|
if (diagnosticMessage) {
|
|
73665
73681
|
addRelatedInfo(
|
|
@@ -74037,7 +74053,7 @@ function createTypeChecker(host) {
|
|
|
74037
74053
|
return objectType;
|
|
74038
74054
|
}
|
|
74039
74055
|
if (isConstEnumObjectType(objectType) && !isStringLiteralLike(indexExpression)) {
|
|
74040
|
-
|
|
74056
|
+
error2(indexExpression, Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal);
|
|
74041
74057
|
return errorType;
|
|
74042
74058
|
}
|
|
74043
74059
|
const effectiveIndexType = isForInVariableForNumericPropertyNames(indexExpression) ? numberType : indexType;
|
|
@@ -74744,7 +74760,7 @@ function createTypeChecker(host) {
|
|
|
74744
74760
|
if (isVoidPromiseError && isInJSFile(node)) {
|
|
74745
74761
|
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);
|
|
74746
74762
|
}
|
|
74747
|
-
const
|
|
74763
|
+
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;
|
|
74748
74764
|
if (min2 < args.length && args.length < max) {
|
|
74749
74765
|
if (headMessage) {
|
|
74750
74766
|
let chain = chainDiagnosticMessages(
|
|
@@ -74765,14 +74781,14 @@ function createTypeChecker(host) {
|
|
|
74765
74781
|
let chain = chainDiagnosticMessages(
|
|
74766
74782
|
/*details*/
|
|
74767
74783
|
void 0,
|
|
74768
|
-
|
|
74784
|
+
error3,
|
|
74769
74785
|
parameterRange,
|
|
74770
74786
|
args.length
|
|
74771
74787
|
);
|
|
74772
74788
|
chain = chainDiagnosticMessages(chain, headMessage);
|
|
74773
74789
|
diagnostic = getDiagnosticForCallNode(node, chain);
|
|
74774
74790
|
} else {
|
|
74775
|
-
diagnostic = getDiagnosticForCallNode(node,
|
|
74791
|
+
diagnostic = getDiagnosticForCallNode(node, error3, parameterRange, args.length);
|
|
74776
74792
|
}
|
|
74777
74793
|
const parameter = (_a = closestSignature == null ? void 0 : closestSignature.declaration) == null ? void 0 : _a.parameters[closestSignature.thisParameter ? args.length + 1 : args.length];
|
|
74778
74794
|
if (parameter) {
|
|
@@ -74793,14 +74809,14 @@ function createTypeChecker(host) {
|
|
|
74793
74809
|
let chain = chainDiagnosticMessages(
|
|
74794
74810
|
/*details*/
|
|
74795
74811
|
void 0,
|
|
74796
|
-
|
|
74812
|
+
error3,
|
|
74797
74813
|
parameterRange,
|
|
74798
74814
|
args.length
|
|
74799
74815
|
);
|
|
74800
74816
|
chain = chainDiagnosticMessages(chain, headMessage);
|
|
74801
74817
|
return createDiagnosticForNodeArrayFromMessageChain(getSourceFileOfNode(node), errorSpan, chain);
|
|
74802
74818
|
}
|
|
74803
|
-
return createDiagnosticForNodeArray(getSourceFileOfNode(node), errorSpan,
|
|
74819
|
+
return createDiagnosticForNodeArray(getSourceFileOfNode(node), errorSpan, error3, parameterRange, args.length);
|
|
74804
74820
|
}
|
|
74805
74821
|
}
|
|
74806
74822
|
function getTypeArgumentArityError(node, signatures, typeArguments, headMessage) {
|
|
@@ -75282,13 +75298,13 @@ function createTypeChecker(host) {
|
|
|
75282
75298
|
const numConstructSignatures = getSignaturesOfType(apparentType, 1 /* Construct */).length;
|
|
75283
75299
|
if (isUntypedFunctionCall(funcType, apparentType, callSignatures.length, numConstructSignatures)) {
|
|
75284
75300
|
if (!isErrorType(funcType) && node.typeArguments) {
|
|
75285
|
-
|
|
75301
|
+
error2(node, Diagnostics.Untyped_function_calls_may_not_accept_type_arguments);
|
|
75286
75302
|
}
|
|
75287
75303
|
return resolveUntypedCall(node);
|
|
75288
75304
|
}
|
|
75289
75305
|
if (!callSignatures.length) {
|
|
75290
75306
|
if (numConstructSignatures) {
|
|
75291
|
-
|
|
75307
|
+
error2(node, Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new, typeToString(funcType));
|
|
75292
75308
|
} else {
|
|
75293
75309
|
let relatedInformation;
|
|
75294
75310
|
if (node.arguments.length === 1) {
|
|
@@ -75311,7 +75327,7 @@ function createTypeChecker(host) {
|
|
|
75311
75327
|
return resolvingSignature;
|
|
75312
75328
|
}
|
|
75313
75329
|
if (callSignatures.some((sig) => isInJSFile(sig.declaration) && !!getJSDocClassTag(sig.declaration))) {
|
|
75314
|
-
|
|
75330
|
+
error2(node, Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new, typeToString(funcType));
|
|
75315
75331
|
return resolveErrorCall(node);
|
|
75316
75332
|
}
|
|
75317
75333
|
return resolveCall(node, callSignatures, candidatesOutArray, checkMode, callChainFlags);
|
|
@@ -75326,7 +75342,7 @@ function createTypeChecker(host) {
|
|
|
75326
75342
|
if (node.arguments && languageVersion < 1 /* ES5 */) {
|
|
75327
75343
|
const spreadIndex = getSpreadArgumentIndex(node.arguments);
|
|
75328
75344
|
if (spreadIndex >= 0) {
|
|
75329
|
-
|
|
75345
|
+
error2(node.arguments[spreadIndex], Diagnostics.Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher);
|
|
75330
75346
|
}
|
|
75331
75347
|
}
|
|
75332
75348
|
let expressionType = checkNonNullExpression(node.expression);
|
|
@@ -75339,7 +75355,7 @@ function createTypeChecker(host) {
|
|
|
75339
75355
|
}
|
|
75340
75356
|
if (isTypeAny(expressionType)) {
|
|
75341
75357
|
if (node.typeArguments) {
|
|
75342
|
-
|
|
75358
|
+
error2(node, Diagnostics.Untyped_function_calls_may_not_accept_type_arguments);
|
|
75343
75359
|
}
|
|
75344
75360
|
return resolveUntypedCall(node);
|
|
75345
75361
|
}
|
|
@@ -75349,12 +75365,12 @@ function createTypeChecker(host) {
|
|
|
75349
75365
|
return resolveErrorCall(node);
|
|
75350
75366
|
}
|
|
75351
75367
|
if (someSignature(constructSignatures, (signature) => !!(signature.flags & 4 /* Abstract */))) {
|
|
75352
|
-
|
|
75368
|
+
error2(node, Diagnostics.Cannot_create_an_instance_of_an_abstract_class);
|
|
75353
75369
|
return resolveErrorCall(node);
|
|
75354
75370
|
}
|
|
75355
75371
|
const valueDecl = expressionType.symbol && getClassLikeDeclarationOfSymbol(expressionType.symbol);
|
|
75356
75372
|
if (valueDecl && hasSyntacticModifier(valueDecl, 256 /* Abstract */)) {
|
|
75357
|
-
|
|
75373
|
+
error2(node, Diagnostics.Cannot_create_an_instance_of_an_abstract_class);
|
|
75358
75374
|
return resolveErrorCall(node);
|
|
75359
75375
|
}
|
|
75360
75376
|
return resolveCall(node, constructSignatures, candidatesOutArray, checkMode, 0 /* None */);
|
|
@@ -75364,10 +75380,10 @@ function createTypeChecker(host) {
|
|
|
75364
75380
|
const signature = resolveCall(node, callSignatures, candidatesOutArray, checkMode, 0 /* None */);
|
|
75365
75381
|
if (!noImplicitAny) {
|
|
75366
75382
|
if (signature.declaration && !isJSConstructor(signature.declaration) && getReturnTypeOfSignature(signature) !== voidType) {
|
|
75367
|
-
|
|
75383
|
+
error2(node, Diagnostics.Only_a_void_function_can_be_called_with_the_new_keyword);
|
|
75368
75384
|
}
|
|
75369
75385
|
if (getThisTypeOfSignature(signature) === voidType) {
|
|
75370
|
-
|
|
75386
|
+
error2(node, Diagnostics.A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void);
|
|
75371
75387
|
}
|
|
75372
75388
|
}
|
|
75373
75389
|
return signature;
|
|
@@ -75431,10 +75447,10 @@ function createTypeChecker(host) {
|
|
|
75431
75447
|
}
|
|
75432
75448
|
}
|
|
75433
75449
|
if (modifiers & 8 /* Private */) {
|
|
75434
|
-
|
|
75450
|
+
error2(node, Diagnostics.Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration, typeToString(declaringClass));
|
|
75435
75451
|
}
|
|
75436
75452
|
if (modifiers & 16 /* Protected */) {
|
|
75437
|
-
|
|
75453
|
+
error2(node, Diagnostics.Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration, typeToString(declaringClass));
|
|
75438
75454
|
}
|
|
75439
75455
|
return false;
|
|
75440
75456
|
}
|
|
@@ -75596,7 +75612,7 @@ function createTypeChecker(host) {
|
|
|
75596
75612
|
/*includeTrivia*/
|
|
75597
75613
|
false
|
|
75598
75614
|
);
|
|
75599
|
-
|
|
75615
|
+
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);
|
|
75600
75616
|
return resolveErrorCall(node);
|
|
75601
75617
|
}
|
|
75602
75618
|
const headMessage = getDiagnosticHeadMessageForDecoratorResolution(node);
|
|
@@ -75686,7 +75702,7 @@ function createTypeChecker(host) {
|
|
|
75686
75702
|
return resolveUntypedCall(node);
|
|
75687
75703
|
}
|
|
75688
75704
|
if (signatures.length === 0) {
|
|
75689
|
-
|
|
75705
|
+
error2(node.tagName, Diagnostics.JSX_element_type_0_does_not_have_any_construct_or_call_signatures, getTextOfNode(node.tagName));
|
|
75690
75706
|
return resolveErrorCall(node);
|
|
75691
75707
|
}
|
|
75692
75708
|
return resolveCall(node, signatures, candidatesOutArray, checkMode, 0 /* None */);
|
|
@@ -75846,7 +75862,7 @@ function createTypeChecker(host) {
|
|
|
75846
75862
|
const declaration = signature.declaration;
|
|
75847
75863
|
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)) {
|
|
75848
75864
|
if (noImplicitAny) {
|
|
75849
|
-
|
|
75865
|
+
error2(node, Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type);
|
|
75850
75866
|
}
|
|
75851
75867
|
return anyType;
|
|
75852
75868
|
}
|
|
@@ -75860,9 +75876,9 @@ function createTypeChecker(host) {
|
|
|
75860
75876
|
}
|
|
75861
75877
|
if (node.kind === 212 /* CallExpression */ && !node.questionDotToken && node.parent.kind === 243 /* ExpressionStatement */ && returnType.flags & 16384 /* Void */ && getTypePredicateOfSignature(signature)) {
|
|
75862
75878
|
if (!isDottedName(node.expression)) {
|
|
75863
|
-
|
|
75879
|
+
error2(node.expression, Diagnostics.Assertions_require_the_call_target_to_be_an_identifier_or_qualified_name);
|
|
75864
75880
|
} else if (!getEffectsSignature(node)) {
|
|
75865
|
-
const diagnostic =
|
|
75881
|
+
const diagnostic = error2(node.expression, Diagnostics.Assertions_require_every_name_in_the_call_target_to_be_declared_with_an_explicit_type_annotation);
|
|
75866
75882
|
getTypeOfDottedName(node.expression, diagnostic);
|
|
75867
75883
|
}
|
|
75868
75884
|
}
|
|
@@ -75951,7 +75967,7 @@ function createTypeChecker(host) {
|
|
|
75951
75967
|
checkExpressionCached(node.arguments[i]);
|
|
75952
75968
|
}
|
|
75953
75969
|
if (specifierType.flags & 32768 /* Undefined */ || specifierType.flags & 65536 /* Null */ || !isTypeAssignableTo(specifierType, stringType)) {
|
|
75954
|
-
|
|
75970
|
+
error2(specifier, Diagnostics.Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0, typeToString(specifierType));
|
|
75955
75971
|
}
|
|
75956
75972
|
if (optionsType) {
|
|
75957
75973
|
const importCallOptionsType = getGlobalImportCallOptionsType(
|
|
@@ -76125,7 +76141,7 @@ function createTypeChecker(host) {
|
|
|
76125
76141
|
const exprType = checkExpression(expression, checkMode);
|
|
76126
76142
|
if (isConstTypeReference(type)) {
|
|
76127
76143
|
if (!isValidConstAssertionArgument(expression)) {
|
|
76128
|
-
|
|
76144
|
+
error2(expression, Diagnostics.A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array_or_object_literals);
|
|
76129
76145
|
}
|
|
76130
76146
|
return getRegularTypeOfLiteralType(exprType);
|
|
76131
76147
|
}
|
|
@@ -76186,7 +76202,7 @@ function createTypeChecker(host) {
|
|
|
76186
76202
|
if (node.kind === 232 /* ExpressionWithTypeArguments */) {
|
|
76187
76203
|
const parent2 = walkUpParenthesizedExpressions(node.parent);
|
|
76188
76204
|
if (parent2.kind === 225 /* BinaryExpression */ && parent2.operatorToken.kind === 104 /* InstanceOfKeyword */ && isNodeDescendantOf(node, parent2.right)) {
|
|
76189
|
-
|
|
76205
|
+
error2(node, Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_not_be_an_instantiation_expression);
|
|
76190
76206
|
}
|
|
76191
76207
|
}
|
|
76192
76208
|
const exprType = node.kind === 232 /* ExpressionWithTypeArguments */ ? checkExpression(node.expression) : isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName);
|
|
@@ -76301,7 +76317,7 @@ function createTypeChecker(host) {
|
|
|
76301
76317
|
function checkNewTargetMetaProperty(node) {
|
|
76302
76318
|
const container = getNewTargetContainer(node);
|
|
76303
76319
|
if (!container) {
|
|
76304
|
-
|
|
76320
|
+
error2(node, Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target");
|
|
76305
76321
|
return errorType;
|
|
76306
76322
|
} else if (container.kind === 175 /* Constructor */) {
|
|
76307
76323
|
const symbol = getSymbolOfDeclaration(container.parent);
|
|
@@ -76314,10 +76330,10 @@ function createTypeChecker(host) {
|
|
|
76314
76330
|
function checkImportMetaProperty(node) {
|
|
76315
76331
|
if (moduleKind === 100 /* Node16 */ || moduleKind === 199 /* NodeNext */) {
|
|
76316
76332
|
if (getSourceFileOfNode(node).impliedNodeFormat !== 99 /* ESNext */) {
|
|
76317
|
-
|
|
76333
|
+
error2(node, Diagnostics.The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output);
|
|
76318
76334
|
}
|
|
76319
76335
|
} else if (moduleKind < 6 /* ES2020 */ && moduleKind !== 4 /* System */) {
|
|
76320
|
-
|
|
76336
|
+
error2(node, Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_or_nodenext);
|
|
76321
76337
|
}
|
|
76322
76338
|
const file = getSourceFileOfNode(node);
|
|
76323
76339
|
Debug.assert(!!(file.flags & 4194304 /* PossiblyContainsImportMeta */), "Containing file is missing import meta node flag.");
|
|
@@ -76874,13 +76890,13 @@ function createTypeChecker(host) {
|
|
|
76874
76890
|
function createPromiseReturnType(func, promisedType) {
|
|
76875
76891
|
const promiseType = createPromiseType(promisedType);
|
|
76876
76892
|
if (promiseType === unknownType) {
|
|
76877
|
-
|
|
76893
|
+
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);
|
|
76878
76894
|
return errorType;
|
|
76879
76895
|
} else if (!getGlobalPromiseConstructorSymbol(
|
|
76880
76896
|
/*reportErrors*/
|
|
76881
76897
|
true
|
|
76882
76898
|
)) {
|
|
76883
|
-
|
|
76899
|
+
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);
|
|
76884
76900
|
}
|
|
76885
76901
|
return promiseType;
|
|
76886
76902
|
}
|
|
@@ -77176,11 +77192,11 @@ function createTypeChecker(host) {
|
|
|
77176
77192
|
const hasExplicitReturn = func.flags & 512 /* HasExplicitReturn */;
|
|
77177
77193
|
const errorNode = getEffectiveReturnTypeNode(func) || func;
|
|
77178
77194
|
if (type && type.flags & 131072 /* Never */) {
|
|
77179
|
-
|
|
77195
|
+
error2(errorNode, Diagnostics.A_function_returning_never_cannot_have_a_reachable_end_point);
|
|
77180
77196
|
} else if (type && !hasExplicitReturn) {
|
|
77181
|
-
|
|
77197
|
+
error2(errorNode, Diagnostics.A_function_whose_declared_type_is_neither_undefined_void_nor_any_must_return_a_value);
|
|
77182
77198
|
} else if (type && strictNullChecks && !isTypeAssignableTo(undefinedType, type)) {
|
|
77183
|
-
|
|
77199
|
+
error2(errorNode, Diagnostics.Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined);
|
|
77184
77200
|
} else if (compilerOptions.noImplicitReturns) {
|
|
77185
77201
|
if (!type) {
|
|
77186
77202
|
if (!hasExplicitReturn) {
|
|
@@ -77191,7 +77207,7 @@ function createTypeChecker(host) {
|
|
|
77191
77207
|
return;
|
|
77192
77208
|
}
|
|
77193
77209
|
}
|
|
77194
|
-
|
|
77210
|
+
error2(errorNode, Diagnostics.Not_all_code_paths_return_a_value);
|
|
77195
77211
|
}
|
|
77196
77212
|
}
|
|
77197
77213
|
}
|
|
@@ -77391,11 +77407,11 @@ function createTypeChecker(host) {
|
|
|
77391
77407
|
function checkReferenceExpression(expr, invalidReferenceMessage, invalidOptionalChainMessage) {
|
|
77392
77408
|
const node = skipOuterExpressions(expr, 6 /* Assertions */ | 1 /* Parentheses */);
|
|
77393
77409
|
if (node.kind !== 80 /* Identifier */ && !isAccessExpression(node)) {
|
|
77394
|
-
|
|
77410
|
+
error2(expr, invalidReferenceMessage);
|
|
77395
77411
|
return false;
|
|
77396
77412
|
}
|
|
77397
77413
|
if (node.flags & 32 /* OptionalChain */) {
|
|
77398
|
-
|
|
77414
|
+
error2(expr, invalidOptionalChainMessage);
|
|
77399
77415
|
return false;
|
|
77400
77416
|
}
|
|
77401
77417
|
return true;
|
|
@@ -77404,17 +77420,17 @@ function createTypeChecker(host) {
|
|
|
77404
77420
|
checkExpression(node.expression);
|
|
77405
77421
|
const expr = skipParentheses(node.expression);
|
|
77406
77422
|
if (!isAccessExpression(expr)) {
|
|
77407
|
-
|
|
77423
|
+
error2(expr, Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference);
|
|
77408
77424
|
return booleanType;
|
|
77409
77425
|
}
|
|
77410
77426
|
if (isPropertyAccessExpression(expr) && isPrivateIdentifier(expr.name)) {
|
|
77411
|
-
|
|
77427
|
+
error2(expr, Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_private_identifier);
|
|
77412
77428
|
}
|
|
77413
77429
|
const links = getNodeLinks(expr);
|
|
77414
77430
|
const symbol = getExportSymbolOfValueSymbolIfExported(links.resolvedSymbol);
|
|
77415
77431
|
if (symbol) {
|
|
77416
77432
|
if (isReadonlySymbol(symbol)) {
|
|
77417
|
-
|
|
77433
|
+
error2(expr, Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_read_only_property);
|
|
77418
77434
|
}
|
|
77419
77435
|
checkDeleteExpressionMustBeOptional(expr, symbol);
|
|
77420
77436
|
}
|
|
@@ -77423,7 +77439,7 @@ function createTypeChecker(host) {
|
|
|
77423
77439
|
function checkDeleteExpressionMustBeOptional(expr, symbol) {
|
|
77424
77440
|
const type = getTypeOfSymbol(symbol);
|
|
77425
77441
|
if (strictNullChecks && !(type.flags & (3 /* AnyOrUnknown */ | 131072 /* Never */)) && !(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ : getTypeFacts(type) & 16777216 /* IsUndefined */)) {
|
|
77426
|
-
|
|
77442
|
+
error2(expr, Diagnostics.The_operand_of_a_delete_operator_must_be_optional);
|
|
77427
77443
|
}
|
|
77428
77444
|
}
|
|
77429
77445
|
function checkTypeOfExpression(node) {
|
|
@@ -77437,7 +77453,7 @@ function createTypeChecker(host) {
|
|
|
77437
77453
|
function checkAwaitExpressionGrammar(node) {
|
|
77438
77454
|
const container = getContainingFunctionOrClassStaticBlock(node);
|
|
77439
77455
|
if (container && isClassStaticBlockDeclaration(container)) {
|
|
77440
|
-
|
|
77456
|
+
error2(node, Diagnostics.Await_expression_cannot_be_used_inside_a_class_static_block);
|
|
77441
77457
|
} else if (!(node.flags & 32768 /* AwaitContext */)) {
|
|
77442
77458
|
if (isInTopLevelContext(node)) {
|
|
77443
77459
|
const sourceFile = getSourceFileOfNode(node);
|
|
@@ -77496,7 +77512,7 @@ function createTypeChecker(host) {
|
|
|
77496
77512
|
}
|
|
77497
77513
|
}
|
|
77498
77514
|
if (isInParameterInitializerBeforeContainingFunction(node)) {
|
|
77499
|
-
|
|
77515
|
+
error2(node, Diagnostics.await_expressions_cannot_be_used_in_a_parameter_initializer);
|
|
77500
77516
|
}
|
|
77501
77517
|
}
|
|
77502
77518
|
function checkAwaitExpression(node) {
|
|
@@ -77546,11 +77562,11 @@ function createTypeChecker(host) {
|
|
|
77546
77562
|
case 55 /* TildeToken */:
|
|
77547
77563
|
checkNonNullType(operandType, node.operand);
|
|
77548
77564
|
if (maybeTypeOfKindConsideringBaseConstraint(operandType, 12288 /* ESSymbolLike */)) {
|
|
77549
|
-
|
|
77565
|
+
error2(node.operand, Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, tokenToString(node.operator));
|
|
77550
77566
|
}
|
|
77551
77567
|
if (node.operator === 40 /* PlusToken */) {
|
|
77552
77568
|
if (maybeTypeOfKindConsideringBaseConstraint(operandType, 2112 /* BigIntLike */)) {
|
|
77553
|
-
|
|
77569
|
+
error2(node.operand, Diagnostics.Operator_0_cannot_be_applied_to_type_1, tokenToString(node.operator), typeToString(getBaseTypeOfLiteralType(operandType)));
|
|
77554
77570
|
}
|
|
77555
77571
|
return numberType;
|
|
77556
77572
|
}
|
|
@@ -77646,10 +77662,10 @@ function createTypeChecker(host) {
|
|
|
77646
77662
|
return silentNeverType;
|
|
77647
77663
|
}
|
|
77648
77664
|
if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 402784252 /* Primitive */)) {
|
|
77649
|
-
|
|
77665
|
+
error2(left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
|
|
77650
77666
|
}
|
|
77651
77667
|
if (!(isTypeAny(rightType) || typeHasCallOrConstructSignatures(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
|
|
77652
|
-
|
|
77668
|
+
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);
|
|
77653
77669
|
}
|
|
77654
77670
|
return booleanType;
|
|
77655
77671
|
}
|
|
@@ -77678,7 +77694,7 @@ function createTypeChecker(host) {
|
|
|
77678
77694
|
}
|
|
77679
77695
|
if (checkTypeAssignableTo(checkNonNullType(rightType, right), nonPrimitiveType, right)) {
|
|
77680
77696
|
if (hasEmptyObjectIntersection(rightType)) {
|
|
77681
|
-
|
|
77697
|
+
error2(right, Diagnostics.Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator, typeToString(rightType));
|
|
77682
77698
|
}
|
|
77683
77699
|
}
|
|
77684
77700
|
return booleanType;
|
|
@@ -77720,7 +77736,7 @@ function createTypeChecker(host) {
|
|
|
77720
77736
|
return checkDestructuringAssignment(property.kind === 303 /* ShorthandPropertyAssignment */ ? property : property.initializer, type);
|
|
77721
77737
|
} else if (property.kind === 304 /* SpreadAssignment */) {
|
|
77722
77738
|
if (propertyIndex < properties.length - 1) {
|
|
77723
|
-
|
|
77739
|
+
error2(property, Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern);
|
|
77724
77740
|
} else {
|
|
77725
77741
|
if (languageVersion < 99 /* ESNext */) {
|
|
77726
77742
|
checkExternalEmitHelpers(property, 4 /* Rest */);
|
|
@@ -77738,7 +77754,7 @@ function createTypeChecker(host) {
|
|
|
77738
77754
|
return checkDestructuringAssignment(property.expression, type);
|
|
77739
77755
|
}
|
|
77740
77756
|
} else {
|
|
77741
|
-
|
|
77757
|
+
error2(property, Diagnostics.Property_assignment_expected);
|
|
77742
77758
|
}
|
|
77743
77759
|
}
|
|
77744
77760
|
function checkArrayLiteralAssignment(node, sourceType, checkMode) {
|
|
@@ -77773,11 +77789,11 @@ function createTypeChecker(host) {
|
|
|
77773
77789
|
return checkDestructuringAssignment(element, elementType, checkMode);
|
|
77774
77790
|
}
|
|
77775
77791
|
if (elementIndex < elements.length - 1) {
|
|
77776
|
-
|
|
77792
|
+
error2(element, Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern);
|
|
77777
77793
|
} else {
|
|
77778
77794
|
const restExpression = element.expression;
|
|
77779
77795
|
if (restExpression.kind === 225 /* BinaryExpression */ && restExpression.operatorToken.kind === 64 /* EqualsToken */) {
|
|
77780
|
-
|
|
77796
|
+
error2(restExpression.operatorToken, Diagnostics.A_rest_element_cannot_have_an_initializer);
|
|
77781
77797
|
} else {
|
|
77782
77798
|
checkGrammarForDisallowedTrailingComma(node.elements, Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma);
|
|
77783
77799
|
const type = everyType(sourceType, isTupleType) ? mapType(sourceType, (t) => sliceTupleType(t, elementIndex)) : createArrayType(elementType);
|
|
@@ -77818,9 +77834,9 @@ function createTypeChecker(host) {
|
|
|
77818
77834
|
}
|
|
77819
77835
|
function checkReferenceAssignment(target, sourceType, checkMode) {
|
|
77820
77836
|
const targetType = checkExpression(target, checkMode);
|
|
77821
|
-
const
|
|
77837
|
+
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;
|
|
77822
77838
|
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;
|
|
77823
|
-
if (checkReferenceExpression(target,
|
|
77839
|
+
if (checkReferenceExpression(target, error3, optionalError)) {
|
|
77824
77840
|
checkTypeAssignableToAndOptionallyElaborate(sourceType, targetType, target, target);
|
|
77825
77841
|
}
|
|
77826
77842
|
if (isPrivateIdentifierPropertyAccessExpression(target)) {
|
|
@@ -78061,7 +78077,7 @@ function createTypeChecker(host) {
|
|
|
78061
78077
|
rightType = checkNonNullType(rightType, right);
|
|
78062
78078
|
let suggestedOperator;
|
|
78063
78079
|
if (leftType.flags & 528 /* BooleanLike */ && rightType.flags & 528 /* BooleanLike */ && (suggestedOperator = getSuggestedBooleanOperator(operatorToken.kind)) !== void 0) {
|
|
78064
|
-
|
|
78080
|
+
error2(errorNode || operatorToken, Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, tokenToString(operatorToken.kind), tokenToString(suggestedOperator));
|
|
78065
78081
|
return numberType;
|
|
78066
78082
|
} else {
|
|
78067
78083
|
const leftOk = checkArithmeticOperandType(
|
|
@@ -78091,7 +78107,7 @@ function createTypeChecker(host) {
|
|
|
78091
78107
|
case 43 /* AsteriskAsteriskToken */:
|
|
78092
78108
|
case 68 /* AsteriskAsteriskEqualsToken */:
|
|
78093
78109
|
if (languageVersion < 3 /* ES2016 */) {
|
|
78094
|
-
|
|
78110
|
+
error2(errorNode, Diagnostics.Exponentiation_cannot_be_performed_on_bigint_values_unless_the_target_option_is_set_to_es2016_or_later);
|
|
78095
78111
|
}
|
|
78096
78112
|
}
|
|
78097
78113
|
resultType2 = bigintType;
|
|
@@ -78189,7 +78205,7 @@ function createTypeChecker(host) {
|
|
|
78189
78205
|
if (!(checkMode && checkMode & 256 /* TypeOnly */)) {
|
|
78190
78206
|
if (isLiteralExpressionOfObject(left) || isLiteralExpressionOfObject(right)) {
|
|
78191
78207
|
const eqType = operator === 35 /* EqualsEqualsToken */ || operator === 37 /* EqualsEqualsEqualsToken */;
|
|
78192
|
-
|
|
78208
|
+
error2(errorNode, Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true");
|
|
78193
78209
|
}
|
|
78194
78210
|
checkNaNEquality(errorNode, operator, left, right);
|
|
78195
78211
|
reportOperatorErrorUnless((left2, right2) => isTypeEqualityComparableTo(left2, right2) || isTypeEqualityComparableTo(right2, left2));
|
|
@@ -78246,7 +78262,7 @@ function createTypeChecker(host) {
|
|
|
78246
78262
|
return textSpanContainsPosition(diag2, start2);
|
|
78247
78263
|
});
|
|
78248
78264
|
if (!isInDiag2657)
|
|
78249
|
-
|
|
78265
|
+
error2(left, Diagnostics.Left_side_of_comma_operator_is_unused_and_has_no_side_effects);
|
|
78250
78266
|
}
|
|
78251
78267
|
return rightType;
|
|
78252
78268
|
default:
|
|
@@ -78286,7 +78302,7 @@ function createTypeChecker(host) {
|
|
|
78286
78302
|
function checkForDisallowedESSymbolOperand(operator2) {
|
|
78287
78303
|
const offendingSymbolOperand = maybeTypeOfKindConsideringBaseConstraint(leftType, 12288 /* ESSymbolLike */) ? left : maybeTypeOfKindConsideringBaseConstraint(rightType, 12288 /* ESSymbolLike */) ? right : void 0;
|
|
78288
78304
|
if (offendingSymbolOperand) {
|
|
78289
|
-
|
|
78305
|
+
error2(offendingSymbolOperand, Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, tokenToString(operator2));
|
|
78290
78306
|
return false;
|
|
78291
78307
|
}
|
|
78292
78308
|
return true;
|
|
@@ -78407,7 +78423,7 @@ function createTypeChecker(host) {
|
|
|
78407
78423
|
const isLeftNaN = isGlobalNaN(skipParentheses(left2));
|
|
78408
78424
|
const isRightNaN = isGlobalNaN(skipParentheses(right2));
|
|
78409
78425
|
if (isLeftNaN || isRightNaN) {
|
|
78410
|
-
const err =
|
|
78426
|
+
const err = error2(
|
|
78411
78427
|
errorNode2,
|
|
78412
78428
|
Diagnostics.This_condition_will_always_return_0,
|
|
78413
78429
|
tokenToString(operator2 === 37 /* EqualsEqualsEqualsToken */ || operator2 === 35 /* EqualsEqualsToken */ ? 97 /* FalseKeyword */ : 112 /* TrueKeyword */)
|
|
@@ -78488,7 +78504,7 @@ function createTypeChecker(host) {
|
|
|
78488
78504
|
void 0
|
|
78489
78505
|
);
|
|
78490
78506
|
if (!contextualType || isTypeAny(contextualType)) {
|
|
78491
|
-
|
|
78507
|
+
error2(node, Diagnostics.yield_expression_implicitly_results_in_an_any_type_because_its_containing_generator_lacks_a_return_type_annotation);
|
|
78492
78508
|
}
|
|
78493
78509
|
}
|
|
78494
78510
|
});
|
|
@@ -78499,7 +78515,7 @@ function createTypeChecker(host) {
|
|
|
78499
78515
|
grammarErrorOnFirstToken(node, Diagnostics.A_yield_expression_is_only_allowed_in_a_generator_body);
|
|
78500
78516
|
}
|
|
78501
78517
|
if (isInParameterInitializerBeforeContainingFunction(node)) {
|
|
78502
|
-
|
|
78518
|
+
error2(node, Diagnostics.yield_expressions_cannot_be_used_in_a_parameter_initializer);
|
|
78503
78519
|
}
|
|
78504
78520
|
}
|
|
78505
78521
|
}
|
|
@@ -78520,7 +78536,7 @@ function createTypeChecker(host) {
|
|
|
78520
78536
|
for (const span of node.templateSpans) {
|
|
78521
78537
|
const type = checkExpression(span.expression);
|
|
78522
78538
|
if (maybeTypeOfKindConsideringBaseConstraint(type, 12288 /* ESSymbolLike */)) {
|
|
78523
|
-
|
|
78539
|
+
error2(span.expression, Diagnostics.Implicit_conversion_of_a_symbol_to_a_string_will_fail_at_runtime_Consider_wrapping_this_expression_in_String);
|
|
78524
78540
|
}
|
|
78525
78541
|
texts.push(span.literal.text);
|
|
78526
78542
|
types.push(isTypeAssignableTo(type, templateConstraintType) ? type : stringType);
|
|
@@ -78916,13 +78932,13 @@ function createTypeChecker(host) {
|
|
|
78916
78932
|
function checkConstEnumAccess(node, type) {
|
|
78917
78933
|
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 */;
|
|
78918
78934
|
if (!ok) {
|
|
78919
|
-
|
|
78935
|
+
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);
|
|
78920
78936
|
}
|
|
78921
78937
|
if (getIsolatedModules(compilerOptions)) {
|
|
78922
78938
|
Debug.assert(!!(type.symbol.flags & 128 /* ConstEnum */));
|
|
78923
78939
|
const constEnumDeclaration = type.symbol.valueDeclaration;
|
|
78924
78940
|
if (constEnumDeclaration.flags & 16777216 /* Ambient */ && !isValidTypeOnlyAliasUseSite(node)) {
|
|
78925
|
-
|
|
78941
|
+
error2(node, Diagnostics.Cannot_access_ambient_const_enums_when_0_is_enabled, isolatedModulesLikeFlagName);
|
|
78926
78942
|
}
|
|
78927
78943
|
}
|
|
78928
78944
|
}
|
|
@@ -79063,7 +79079,7 @@ function createTypeChecker(host) {
|
|
|
79063
79079
|
const typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfDeclaration(node));
|
|
79064
79080
|
getBaseConstraintOfType(typeParameter);
|
|
79065
79081
|
if (!hasNonCircularTypeParameterDefault(typeParameter)) {
|
|
79066
|
-
|
|
79082
|
+
error2(node.default, Diagnostics.Type_parameter_0_has_a_circular_default, typeToString(typeParameter));
|
|
79067
79083
|
}
|
|
79068
79084
|
const constraintType = getConstraintOfTypeParameter(typeParameter);
|
|
79069
79085
|
const defaultType = getDefaultFromTypeParameter(typeParameter);
|
|
@@ -79081,7 +79097,7 @@ function createTypeChecker(host) {
|
|
|
79081
79097
|
if (modifiers) {
|
|
79082
79098
|
const symbol = getSymbolOfDeclaration(node.parent);
|
|
79083
79099
|
if (isTypeAliasDeclaration(node.parent) && !(getObjectFlags(getDeclaredTypeOfSymbol(symbol)) & (16 /* Anonymous */ | 32 /* Mapped */))) {
|
|
79084
|
-
|
|
79100
|
+
error2(node, Diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types);
|
|
79085
79101
|
} else if (modifiers === 32768 /* In */ || modifiers === 65536 /* Out */) {
|
|
79086
79102
|
(_a = tracing) == null ? void 0 : _a.push(tracing.Phase.CheckTypes, "checkTypeParameterDeferred", { parent: getTypeId(getDeclaredTypeOfSymbol(symbol)), id: getTypeId(typeParameter) });
|
|
79087
79103
|
const source = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSubTypeForCheck : markerSuperTypeForCheck);
|
|
@@ -79101,37 +79117,37 @@ function createTypeChecker(host) {
|
|
|
79101
79117
|
const func = getContainingFunction(node);
|
|
79102
79118
|
if (hasSyntacticModifier(node, 16476 /* ParameterPropertyModifier */)) {
|
|
79103
79119
|
if (!(func.kind === 175 /* Constructor */ && nodeIsPresent(func.body))) {
|
|
79104
|
-
|
|
79120
|
+
error2(node, Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation);
|
|
79105
79121
|
}
|
|
79106
79122
|
if (func.kind === 175 /* Constructor */ && isIdentifier(node.name) && node.name.escapedText === "constructor") {
|
|
79107
|
-
|
|
79123
|
+
error2(node.name, Diagnostics.constructor_cannot_be_used_as_a_parameter_property_name);
|
|
79108
79124
|
}
|
|
79109
79125
|
}
|
|
79110
79126
|
if (!node.initializer && isOptionalDeclaration(node) && isBindingPattern(node.name) && func.body) {
|
|
79111
|
-
|
|
79127
|
+
error2(node, Diagnostics.A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature);
|
|
79112
79128
|
}
|
|
79113
79129
|
if (node.name && isIdentifier(node.name) && (node.name.escapedText === "this" || node.name.escapedText === "new")) {
|
|
79114
79130
|
if (func.parameters.indexOf(node) !== 0) {
|
|
79115
|
-
|
|
79131
|
+
error2(node, Diagnostics.A_0_parameter_must_be_the_first_parameter, node.name.escapedText);
|
|
79116
79132
|
}
|
|
79117
79133
|
if (func.kind === 175 /* Constructor */ || func.kind === 179 /* ConstructSignature */ || func.kind === 184 /* ConstructorType */) {
|
|
79118
|
-
|
|
79134
|
+
error2(node, Diagnostics.A_constructor_cannot_have_a_this_parameter);
|
|
79119
79135
|
}
|
|
79120
79136
|
if (func.kind === 218 /* ArrowFunction */) {
|
|
79121
|
-
|
|
79137
|
+
error2(node, Diagnostics.An_arrow_function_cannot_have_a_this_parameter);
|
|
79122
79138
|
}
|
|
79123
79139
|
if (func.kind === 176 /* GetAccessor */ || func.kind === 177 /* SetAccessor */) {
|
|
79124
|
-
|
|
79140
|
+
error2(node, Diagnostics.get_and_set_accessors_cannot_declare_this_parameters);
|
|
79125
79141
|
}
|
|
79126
79142
|
}
|
|
79127
79143
|
if (node.dotDotDotToken && !isBindingPattern(node.name) && !isTypeAssignableTo(getReducedType(getTypeOfSymbol(node.symbol)), anyReadonlyArrayType)) {
|
|
79128
|
-
|
|
79144
|
+
error2(node, Diagnostics.A_rest_parameter_must_be_of_an_array_type);
|
|
79129
79145
|
}
|
|
79130
79146
|
}
|
|
79131
79147
|
function checkTypePredicate(node) {
|
|
79132
79148
|
const parent2 = getTypePredicateParent(node);
|
|
79133
79149
|
if (!parent2) {
|
|
79134
|
-
|
|
79150
|
+
error2(node, Diagnostics.A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods);
|
|
79135
79151
|
return;
|
|
79136
79152
|
}
|
|
79137
79153
|
const signature = getSignatureFromDeclaration(parent2);
|
|
@@ -79146,7 +79162,7 @@ function createTypeChecker(host) {
|
|
|
79146
79162
|
} else {
|
|
79147
79163
|
if (typePredicate.parameterIndex >= 0) {
|
|
79148
79164
|
if (signatureHasRestParameter(signature) && typePredicate.parameterIndex === signature.parameters.length - 1) {
|
|
79149
|
-
|
|
79165
|
+
error2(parameterName, Diagnostics.A_type_predicate_cannot_reference_a_rest_parameter);
|
|
79150
79166
|
} else {
|
|
79151
79167
|
if (typePredicate.type) {
|
|
79152
79168
|
const leadingError = () => chainDiagnosticMessages(
|
|
@@ -79173,7 +79189,7 @@ function createTypeChecker(host) {
|
|
|
79173
79189
|
}
|
|
79174
79190
|
}
|
|
79175
79191
|
if (!hasReportedError) {
|
|
79176
|
-
|
|
79192
|
+
error2(node.parameterName, Diagnostics.Cannot_find_parameter_0, typePredicate.parameterName);
|
|
79177
79193
|
}
|
|
79178
79194
|
}
|
|
79179
79195
|
}
|
|
@@ -79200,7 +79216,7 @@ function createTypeChecker(host) {
|
|
|
79200
79216
|
}
|
|
79201
79217
|
const name = element.name;
|
|
79202
79218
|
if (name.kind === 80 /* Identifier */ && name.escapedText === predicateVariableName) {
|
|
79203
|
-
|
|
79219
|
+
error2(
|
|
79204
79220
|
predicateVariableNode,
|
|
79205
79221
|
Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern,
|
|
79206
79222
|
predicateVariableName
|
|
@@ -79248,10 +79264,10 @@ function createTypeChecker(host) {
|
|
|
79248
79264
|
if (noImplicitAny && !returnTypeNode) {
|
|
79249
79265
|
switch (node.kind) {
|
|
79250
79266
|
case 179 /* ConstructSignature */:
|
|
79251
|
-
|
|
79267
|
+
error2(node, Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type);
|
|
79252
79268
|
break;
|
|
79253
79269
|
case 178 /* CallSignature */:
|
|
79254
|
-
|
|
79270
|
+
error2(node, Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type);
|
|
79255
79271
|
break;
|
|
79256
79272
|
}
|
|
79257
79273
|
}
|
|
@@ -79260,7 +79276,7 @@ function createTypeChecker(host) {
|
|
|
79260
79276
|
if ((functionFlags2 & (4 /* Invalid */ | 1 /* Generator */)) === 1 /* Generator */) {
|
|
79261
79277
|
const returnType = getTypeFromTypeNode(returnTypeNode);
|
|
79262
79278
|
if (returnType === voidType) {
|
|
79263
|
-
|
|
79279
|
+
error2(returnTypeNode, Diagnostics.A_generator_cannot_have_a_void_type_annotation);
|
|
79264
79280
|
} else {
|
|
79265
79281
|
const generatorYieldType = getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || anyType;
|
|
79266
79282
|
const generatorReturnType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || generatorYieldType;
|
|
@@ -79320,16 +79336,16 @@ function createTypeChecker(host) {
|
|
|
79320
79336
|
const prev = names.get(name);
|
|
79321
79337
|
if (prev) {
|
|
79322
79338
|
if ((prev & 16 /* PrivateStatic */) !== (meaning & 16 /* PrivateStatic */)) {
|
|
79323
|
-
|
|
79339
|
+
error2(location, Diagnostics.Duplicate_identifier_0_Static_and_instance_elements_cannot_share_the_same_private_name, getTextOfNode(location));
|
|
79324
79340
|
} else {
|
|
79325
79341
|
const prevIsMethod = !!(prev & 8 /* Method */);
|
|
79326
79342
|
const isMethod = !!(meaning & 8 /* Method */);
|
|
79327
79343
|
if (prevIsMethod || isMethod) {
|
|
79328
79344
|
if (prevIsMethod !== isMethod) {
|
|
79329
|
-
|
|
79345
|
+
error2(location, Diagnostics.Duplicate_identifier_0, getTextOfNode(location));
|
|
79330
79346
|
}
|
|
79331
79347
|
} else if (prev & meaning & ~16 /* PrivateStatic */) {
|
|
79332
|
-
|
|
79348
|
+
error2(location, Diagnostics.Duplicate_identifier_0, getTextOfNode(location));
|
|
79333
79349
|
} else {
|
|
79334
79350
|
names.set(name, prev | meaning);
|
|
79335
79351
|
}
|
|
@@ -79356,7 +79372,7 @@ function createTypeChecker(host) {
|
|
|
79356
79372
|
case "prototype":
|
|
79357
79373
|
const message = Diagnostics.Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1;
|
|
79358
79374
|
const className = getNameOfSymbolAsWritten(getSymbolOfDeclaration(node));
|
|
79359
|
-
|
|
79375
|
+
error2(memberNameNode, message, memberName, className);
|
|
79360
79376
|
break;
|
|
79361
79377
|
}
|
|
79362
79378
|
}
|
|
@@ -79380,8 +79396,8 @@ function createTypeChecker(host) {
|
|
|
79380
79396
|
continue;
|
|
79381
79397
|
}
|
|
79382
79398
|
if (names.get(memberName)) {
|
|
79383
|
-
|
|
79384
|
-
|
|
79399
|
+
error2(getNameOfDeclaration(member.symbol.valueDeclaration), Diagnostics.Duplicate_identifier_0, memberName);
|
|
79400
|
+
error2(member.name, Diagnostics.Duplicate_identifier_0, memberName);
|
|
79385
79401
|
} else {
|
|
79386
79402
|
names.set(memberName, true);
|
|
79387
79403
|
}
|
|
@@ -79413,7 +79429,7 @@ function createTypeChecker(host) {
|
|
|
79413
79429
|
indexSignatureMap.forEach((entry) => {
|
|
79414
79430
|
if (entry.declarations.length > 1) {
|
|
79415
79431
|
for (const declaration of entry.declarations) {
|
|
79416
|
-
|
|
79432
|
+
error2(declaration, Diagnostics.Duplicate_index_signature_for_type_0, typeToString(entry.type));
|
|
79417
79433
|
}
|
|
79418
79434
|
}
|
|
79419
79435
|
});
|
|
@@ -79425,12 +79441,12 @@ function createTypeChecker(host) {
|
|
|
79425
79441
|
checkVariableLikeDeclaration(node);
|
|
79426
79442
|
setNodeLinksForPrivateIdentifierScope(node);
|
|
79427
79443
|
if (hasSyntacticModifier(node, 256 /* Abstract */) && node.kind === 171 /* PropertyDeclaration */ && node.initializer) {
|
|
79428
|
-
|
|
79444
|
+
error2(node, Diagnostics.Property_0_cannot_have_an_initializer_because_it_is_marked_abstract, declarationNameToString(node.name));
|
|
79429
79445
|
}
|
|
79430
79446
|
}
|
|
79431
79447
|
function checkPropertySignature(node) {
|
|
79432
79448
|
if (isPrivateIdentifier(node.name)) {
|
|
79433
|
-
|
|
79449
|
+
error2(node, Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);
|
|
79434
79450
|
}
|
|
79435
79451
|
return checkPropertyDeclaration(node);
|
|
79436
79452
|
}
|
|
@@ -79438,14 +79454,14 @@ function createTypeChecker(host) {
|
|
|
79438
79454
|
if (!checkGrammarMethod(node))
|
|
79439
79455
|
checkGrammarComputedPropertyName(node.name);
|
|
79440
79456
|
if (isMethodDeclaration(node) && node.asteriskToken && isIdentifier(node.name) && idText(node.name) === "constructor") {
|
|
79441
|
-
|
|
79457
|
+
error2(node.name, Diagnostics.Class_constructor_may_not_be_a_generator);
|
|
79442
79458
|
}
|
|
79443
79459
|
checkFunctionOrMethodDeclaration(node);
|
|
79444
79460
|
if (hasSyntacticModifier(node, 256 /* Abstract */) && node.kind === 173 /* MethodDeclaration */ && node.body) {
|
|
79445
|
-
|
|
79461
|
+
error2(node, Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, declarationNameToString(node.name));
|
|
79446
79462
|
}
|
|
79447
79463
|
if (isPrivateIdentifier(node.name) && !getContainingClass(node)) {
|
|
79448
|
-
|
|
79464
|
+
error2(node, Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);
|
|
79449
79465
|
}
|
|
79450
79466
|
setNodeLinksForPrivateIdentifierScope(node);
|
|
79451
79467
|
}
|
|
@@ -79496,12 +79512,12 @@ function createTypeChecker(host) {
|
|
|
79496
79512
|
const superCall = findFirstSuperCall(node.body);
|
|
79497
79513
|
if (superCall) {
|
|
79498
79514
|
if (classExtendsNull) {
|
|
79499
|
-
|
|
79515
|
+
error2(superCall, Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null);
|
|
79500
79516
|
}
|
|
79501
79517
|
const superCallShouldBeRootLevel = (getEmitScriptTarget(compilerOptions) !== 99 /* ESNext */ || !useDefineForClassFields) && (some(node.parent.members, isInstancePropertyWithInitializerOrPrivateIdentifierProperty) || some(node.parameters, (p) => hasSyntacticModifier(p, 16476 /* ParameterPropertyModifier */)));
|
|
79502
79518
|
if (superCallShouldBeRootLevel) {
|
|
79503
79519
|
if (!superCallIsRootLevelInConstructor(superCall, node.body)) {
|
|
79504
|
-
|
|
79520
|
+
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);
|
|
79505
79521
|
} else {
|
|
79506
79522
|
let superCallStatement;
|
|
79507
79523
|
for (const statement of node.body.statements) {
|
|
@@ -79514,12 +79530,12 @@ function createTypeChecker(host) {
|
|
|
79514
79530
|
}
|
|
79515
79531
|
}
|
|
79516
79532
|
if (superCallStatement === void 0) {
|
|
79517
|
-
|
|
79533
|
+
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);
|
|
79518
79534
|
}
|
|
79519
79535
|
}
|
|
79520
79536
|
}
|
|
79521
79537
|
} else if (!classExtendsNull) {
|
|
79522
|
-
|
|
79538
|
+
error2(node, Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call);
|
|
79523
79539
|
}
|
|
79524
79540
|
}
|
|
79525
79541
|
}
|
|
@@ -79539,7 +79555,7 @@ function createTypeChecker(host) {
|
|
|
79539
79555
|
}
|
|
79540
79556
|
function checkAccessorDeclaration(node) {
|
|
79541
79557
|
if (isIdentifier(node.name) && idText(node.name) === "constructor" && isClassLike(node.parent)) {
|
|
79542
|
-
|
|
79558
|
+
error2(node.name, Diagnostics.Class_constructor_may_not_be_an_accessor);
|
|
79543
79559
|
}
|
|
79544
79560
|
addLazyDiagnostic(checkAccessorDeclarationDiagnostics);
|
|
79545
79561
|
checkSourceElement(node.body);
|
|
@@ -79552,7 +79568,7 @@ function createTypeChecker(host) {
|
|
|
79552
79568
|
if (node.kind === 176 /* GetAccessor */) {
|
|
79553
79569
|
if (!(node.flags & 16777216 /* Ambient */) && nodeIsPresent(node.body) && node.flags & 256 /* HasImplicitReturn */) {
|
|
79554
79570
|
if (!(node.flags & 512 /* HasExplicitReturn */)) {
|
|
79555
|
-
|
|
79571
|
+
error2(node.name, Diagnostics.A_get_accessor_must_return_a_value);
|
|
79556
79572
|
}
|
|
79557
79573
|
}
|
|
79558
79574
|
}
|
|
@@ -79568,12 +79584,12 @@ function createTypeChecker(host) {
|
|
|
79568
79584
|
const getterFlags = getEffectiveModifierFlags(getter);
|
|
79569
79585
|
const setterFlags = getEffectiveModifierFlags(setter);
|
|
79570
79586
|
if ((getterFlags & 256 /* Abstract */) !== (setterFlags & 256 /* Abstract */)) {
|
|
79571
|
-
|
|
79572
|
-
|
|
79587
|
+
error2(getter.name, Diagnostics.Accessors_must_both_be_abstract_or_non_abstract);
|
|
79588
|
+
error2(setter.name, Diagnostics.Accessors_must_both_be_abstract_or_non_abstract);
|
|
79573
79589
|
}
|
|
79574
79590
|
if (getterFlags & 16 /* Protected */ && !(setterFlags & (16 /* Protected */ | 8 /* Private */)) || getterFlags & 8 /* Private */ && !(setterFlags & 8 /* Private */)) {
|
|
79575
|
-
|
|
79576
|
-
|
|
79591
|
+
error2(getter.name, Diagnostics.A_get_accessor_must_be_at_least_as_accessible_as_the_setter);
|
|
79592
|
+
error2(setter.name, Diagnostics.A_get_accessor_must_be_at_least_as_accessible_as_the_setter);
|
|
79577
79593
|
}
|
|
79578
79594
|
}
|
|
79579
79595
|
}
|
|
@@ -79711,7 +79727,7 @@ function createTypeChecker(host) {
|
|
|
79711
79727
|
if (flags & 8 /* Variadic */) {
|
|
79712
79728
|
const type = getTypeFromTypeNode(e.type);
|
|
79713
79729
|
if (!isArrayLikeType(type)) {
|
|
79714
|
-
|
|
79730
|
+
error2(e, Diagnostics.A_rest_element_type_must_be_an_array_type);
|
|
79715
79731
|
break;
|
|
79716
79732
|
}
|
|
79717
79733
|
if (isArrayType(type) || isTupleType(type) && type.target.combinedFlags & 4 /* Rest */) {
|
|
@@ -79749,7 +79765,7 @@ function createTypeChecker(host) {
|
|
|
79749
79765
|
const indexType = type.indexType;
|
|
79750
79766
|
if (isTypeAssignableTo(indexType, getIndexType(objectType, 0 /* None */))) {
|
|
79751
79767
|
if (accessNode.kind === 211 /* ElementAccessExpression */ && isAssignmentTarget(accessNode) && getObjectFlags(objectType) & 32 /* Mapped */ && getMappedTypeModifiers(objectType) & 1 /* IncludeReadonly */) {
|
|
79752
|
-
|
|
79768
|
+
error2(accessNode, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
|
|
79753
79769
|
}
|
|
79754
79770
|
return type;
|
|
79755
79771
|
}
|
|
@@ -79762,12 +79778,12 @@ function createTypeChecker(host) {
|
|
|
79762
79778
|
if (propertyName) {
|
|
79763
79779
|
const propertySymbol = forEachType(apparentObjectType, (t) => getPropertyOfType(t, propertyName));
|
|
79764
79780
|
if (propertySymbol && getDeclarationModifierFlagsFromSymbol(propertySymbol) & 24 /* NonPublicAccessibilityModifier */) {
|
|
79765
|
-
|
|
79781
|
+
error2(accessNode, Diagnostics.Private_or_protected_member_0_cannot_be_accessed_on_a_type_parameter, unescapeLeadingUnderscores(propertyName));
|
|
79766
79782
|
return errorType;
|
|
79767
79783
|
}
|
|
79768
79784
|
}
|
|
79769
79785
|
}
|
|
79770
|
-
|
|
79786
|
+
error2(accessNode, Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType));
|
|
79771
79787
|
return errorType;
|
|
79772
79788
|
}
|
|
79773
79789
|
function checkIndexedAccessType(node) {
|
|
@@ -79823,7 +79839,7 @@ function createTypeChecker(host) {
|
|
|
79823
79839
|
if (!areTypeParametersIdentical(declarations, [typeParameter], (decl) => [decl])) {
|
|
79824
79840
|
const name = symbolToString(symbol);
|
|
79825
79841
|
for (const declaration of declarations) {
|
|
79826
|
-
|
|
79842
|
+
error2(declaration.name, Diagnostics.All_declarations_of_0_must_have_identical_constraints, name);
|
|
79827
79843
|
}
|
|
79828
79844
|
}
|
|
79829
79845
|
}
|
|
@@ -79894,13 +79910,13 @@ function createTypeChecker(host) {
|
|
|
79894
79910
|
forEach(overloads, (o) => {
|
|
79895
79911
|
const deviation = getEffectiveDeclarationFlags(o, flagsToCheck2) ^ canonicalFlags;
|
|
79896
79912
|
if (deviation & 1 /* Export */) {
|
|
79897
|
-
|
|
79913
|
+
error2(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_exported_or_non_exported);
|
|
79898
79914
|
} else if (deviation & 2 /* Ambient */) {
|
|
79899
|
-
|
|
79915
|
+
error2(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_ambient_or_non_ambient);
|
|
79900
79916
|
} else if (deviation & (8 /* Private */ | 16 /* Protected */)) {
|
|
79901
|
-
|
|
79917
|
+
error2(getNameOfDeclaration(o) || o, Diagnostics.Overload_signatures_must_all_be_public_private_or_protected);
|
|
79902
79918
|
} else if (deviation & 256 /* Abstract */) {
|
|
79903
|
-
|
|
79919
|
+
error2(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_abstract_or_non_abstract);
|
|
79904
79920
|
}
|
|
79905
79921
|
});
|
|
79906
79922
|
}
|
|
@@ -79911,7 +79927,7 @@ function createTypeChecker(host) {
|
|
|
79911
79927
|
forEach(overloads, (o) => {
|
|
79912
79928
|
const deviation = hasQuestionToken(o) !== canonicalHasQuestionToken;
|
|
79913
79929
|
if (deviation) {
|
|
79914
|
-
|
|
79930
|
+
error2(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_optional_or_required);
|
|
79915
79931
|
}
|
|
79916
79932
|
});
|
|
79917
79933
|
}
|
|
@@ -79950,24 +79966,24 @@ function createTypeChecker(host) {
|
|
|
79950
79966
|
const reportError = (node.kind === 173 /* MethodDeclaration */ || node.kind === 172 /* MethodSignature */) && isStatic(node) !== isStatic(subsequentNode);
|
|
79951
79967
|
if (reportError) {
|
|
79952
79968
|
const diagnostic = isStatic(node) ? Diagnostics.Function_overload_must_be_static : Diagnostics.Function_overload_must_not_be_static;
|
|
79953
|
-
|
|
79969
|
+
error2(errorNode2, diagnostic);
|
|
79954
79970
|
}
|
|
79955
79971
|
return;
|
|
79956
79972
|
}
|
|
79957
79973
|
if (nodeIsPresent(subsequentNode.body)) {
|
|
79958
|
-
|
|
79974
|
+
error2(errorNode2, Diagnostics.Function_implementation_name_must_be_0, declarationNameToString(node.name));
|
|
79959
79975
|
return;
|
|
79960
79976
|
}
|
|
79961
79977
|
}
|
|
79962
79978
|
}
|
|
79963
79979
|
const errorNode = node.name || node;
|
|
79964
79980
|
if (isConstructor) {
|
|
79965
|
-
|
|
79981
|
+
error2(errorNode, Diagnostics.Constructor_implementation_is_missing);
|
|
79966
79982
|
} else {
|
|
79967
79983
|
if (hasSyntacticModifier(node, 256 /* Abstract */)) {
|
|
79968
|
-
|
|
79984
|
+
error2(errorNode, Diagnostics.All_declarations_of_an_abstract_method_must_be_consecutive);
|
|
79969
79985
|
} else {
|
|
79970
|
-
|
|
79986
|
+
error2(errorNode, Diagnostics.Function_implementation_is_missing_or_not_immediately_following_the_declaration);
|
|
79971
79987
|
}
|
|
79972
79988
|
}
|
|
79973
79989
|
}
|
|
@@ -80030,12 +80046,12 @@ function createTypeChecker(host) {
|
|
|
80030
80046
|
}
|
|
80031
80047
|
if (multipleConstructorImplementation) {
|
|
80032
80048
|
forEach(functionDeclarations, (declaration) => {
|
|
80033
|
-
|
|
80049
|
+
error2(declaration, Diagnostics.Multiple_constructor_implementations_are_not_allowed);
|
|
80034
80050
|
});
|
|
80035
80051
|
}
|
|
80036
80052
|
if (duplicateFunctionDeclaration) {
|
|
80037
80053
|
forEach(functionDeclarations, (declaration) => {
|
|
80038
|
-
|
|
80054
|
+
error2(getNameOfDeclaration(declaration) || declaration, Diagnostics.Duplicate_function_implementation);
|
|
80039
80055
|
});
|
|
80040
80056
|
}
|
|
80041
80057
|
if (hasNonAmbientClass && !isConstructor && symbol.flags & 16 /* Function */ && declarations) {
|
|
@@ -80044,7 +80060,7 @@ function createTypeChecker(host) {
|
|
|
80044
80060
|
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;
|
|
80045
80061
|
if (diagnostic) {
|
|
80046
80062
|
addRelatedInfo(
|
|
80047
|
-
|
|
80063
|
+
error2(getNameOfDeclaration(declaration) || declaration, diagnostic, symbolName(symbol)),
|
|
80048
80064
|
...relatedDiagnostics
|
|
80049
80065
|
);
|
|
80050
80066
|
}
|
|
@@ -80065,7 +80081,7 @@ function createTypeChecker(host) {
|
|
|
80065
80081
|
if (!isImplementationCompatibleWithOverload(bodySignature, signature)) {
|
|
80066
80082
|
const errorNode = signature.declaration && isJSDocSignature(signature.declaration) ? signature.declaration.parent.tagName : signature.declaration;
|
|
80067
80083
|
addRelatedInfo(
|
|
80068
|
-
|
|
80084
|
+
error2(errorNode, Diagnostics.This_overload_signature_is_not_compatible_with_its_implementation_signature),
|
|
80069
80085
|
createDiagnosticForNode(bodyDeclaration, Diagnostics.The_implementation_signature_is_declared_here)
|
|
80070
80086
|
);
|
|
80071
80087
|
break;
|
|
@@ -80112,9 +80128,9 @@ function createTypeChecker(host) {
|
|
|
80112
80128
|
const declarationSpaces = getDeclarationSpaces(d);
|
|
80113
80129
|
const name = getNameOfDeclaration(d);
|
|
80114
80130
|
if (declarationSpaces & commonDeclarationSpacesForDefaultAndNonDefault) {
|
|
80115
|
-
|
|
80131
|
+
error2(name, Diagnostics.Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead, declarationNameToString(name));
|
|
80116
80132
|
} else if (declarationSpaces & commonDeclarationSpacesForExportsAndLocals) {
|
|
80117
|
-
|
|
80133
|
+
error2(name, Diagnostics.Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local, declarationNameToString(name));
|
|
80118
80134
|
}
|
|
80119
80135
|
}
|
|
80120
80136
|
}
|
|
@@ -80194,7 +80210,7 @@ function createTypeChecker(host) {
|
|
|
80194
80210
|
const thenSignatures = thenFunction ? getSignaturesOfType(thenFunction, 0 /* Call */) : emptyArray;
|
|
80195
80211
|
if (thenSignatures.length === 0) {
|
|
80196
80212
|
if (errorNode) {
|
|
80197
|
-
|
|
80213
|
+
error2(errorNode, Diagnostics.A_promise_must_have_a_then_method);
|
|
80198
80214
|
}
|
|
80199
80215
|
return void 0;
|
|
80200
80216
|
}
|
|
@@ -80214,7 +80230,7 @@ function createTypeChecker(host) {
|
|
|
80214
80230
|
thisTypeForErrorOut.value = thisTypeForError;
|
|
80215
80231
|
}
|
|
80216
80232
|
if (errorNode) {
|
|
80217
|
-
|
|
80233
|
+
error2(errorNode, Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1, typeToString(type), typeToString(thisTypeForError));
|
|
80218
80234
|
}
|
|
80219
80235
|
return void 0;
|
|
80220
80236
|
}
|
|
@@ -80225,7 +80241,7 @@ function createTypeChecker(host) {
|
|
|
80225
80241
|
const onfulfilledParameterSignatures = getSignaturesOfType(onfulfilledParameterType, 0 /* Call */);
|
|
80226
80242
|
if (onfulfilledParameterSignatures.length === 0) {
|
|
80227
80243
|
if (errorNode) {
|
|
80228
|
-
|
|
80244
|
+
error2(errorNode, Diagnostics.The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback);
|
|
80229
80245
|
}
|
|
80230
80246
|
return void 0;
|
|
80231
80247
|
}
|
|
@@ -80306,7 +80322,7 @@ function createTypeChecker(host) {
|
|
|
80306
80322
|
if (type.flags & 1048576 /* Union */) {
|
|
80307
80323
|
if (awaitedTypeStack.lastIndexOf(type.id) >= 0) {
|
|
80308
80324
|
if (errorNode) {
|
|
80309
|
-
|
|
80325
|
+
error2(errorNode, Diagnostics.Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method);
|
|
80310
80326
|
}
|
|
80311
80327
|
return void 0;
|
|
80312
80328
|
}
|
|
@@ -80329,7 +80345,7 @@ function createTypeChecker(host) {
|
|
|
80329
80345
|
if (promisedType) {
|
|
80330
80346
|
if (type.id === promisedType.id || awaitedTypeStack.lastIndexOf(promisedType.id) >= 0) {
|
|
80331
80347
|
if (errorNode) {
|
|
80332
|
-
|
|
80348
|
+
error2(errorNode, Diagnostics.Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method);
|
|
80333
80349
|
}
|
|
80334
80350
|
return void 0;
|
|
80335
80351
|
}
|
|
@@ -80366,7 +80382,7 @@ function createTypeChecker(host) {
|
|
|
80366
80382
|
true
|
|
80367
80383
|
);
|
|
80368
80384
|
if (globalPromiseType !== emptyGenericType && !isReferenceToType2(returnType, globalPromiseType)) {
|
|
80369
|
-
|
|
80385
|
+
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));
|
|
80370
80386
|
return;
|
|
80371
80387
|
}
|
|
80372
80388
|
} else {
|
|
@@ -80376,7 +80392,7 @@ function createTypeChecker(host) {
|
|
|
80376
80392
|
}
|
|
80377
80393
|
const promiseConstructorName = getEntityNameFromTypeNode(returnTypeNode);
|
|
80378
80394
|
if (promiseConstructorName === void 0) {
|
|
80379
|
-
|
|
80395
|
+
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));
|
|
80380
80396
|
return;
|
|
80381
80397
|
}
|
|
80382
80398
|
const promiseConstructorSymbol = resolveEntityName(
|
|
@@ -80391,9 +80407,9 @@ function createTypeChecker(host) {
|
|
|
80391
80407
|
/*reportErrors*/
|
|
80392
80408
|
false
|
|
80393
80409
|
)) {
|
|
80394
|
-
|
|
80410
|
+
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);
|
|
80395
80411
|
} else {
|
|
80396
|
-
|
|
80412
|
+
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));
|
|
80397
80413
|
}
|
|
80398
80414
|
return;
|
|
80399
80415
|
}
|
|
@@ -80402,7 +80418,7 @@ function createTypeChecker(host) {
|
|
|
80402
80418
|
true
|
|
80403
80419
|
);
|
|
80404
80420
|
if (globalPromiseConstructorLikeType === emptyObjectType) {
|
|
80405
|
-
|
|
80421
|
+
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));
|
|
80406
80422
|
return;
|
|
80407
80423
|
}
|
|
80408
80424
|
if (!checkTypeAssignableTo(
|
|
@@ -80416,7 +80432,7 @@ function createTypeChecker(host) {
|
|
|
80416
80432
|
const rootName = promiseConstructorName && getFirstIdentifier(promiseConstructorName);
|
|
80417
80433
|
const collidingSymbol = getSymbol2(node.locals, rootName.escapedText, 111551 /* Value */);
|
|
80418
80434
|
if (collidingSymbol) {
|
|
80419
|
-
|
|
80435
|
+
error2(
|
|
80420
80436
|
collidingSymbol.valueDeclaration,
|
|
80421
80437
|
Diagnostics.Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions,
|
|
80422
80438
|
idText(rootName),
|
|
@@ -80529,7 +80545,7 @@ function createTypeChecker(host) {
|
|
|
80529
80545
|
if (canCollectSymbolAliasAccessabilityData && symbolIsValue(rootSymbol) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol)) && !getTypeOnlyAliasDeclaration(rootSymbol)) {
|
|
80530
80546
|
markAliasSymbolAsReferenced(rootSymbol);
|
|
80531
80547
|
} else if (forDecoratorMetadata && getIsolatedModules(compilerOptions) && getEmitModuleKind(compilerOptions) >= 5 /* ES2015 */ && !symbolIsValue(rootSymbol) && !some(rootSymbol.declarations, isTypeOnlyImportOrExportDeclaration)) {
|
|
80532
|
-
const diag2 =
|
|
80548
|
+
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);
|
|
80533
80549
|
const aliasDeclaration = find(rootSymbol.declarations || emptyArray, isAliasSymbolDeclaration2);
|
|
80534
80550
|
if (aliasDeclaration) {
|
|
80535
80551
|
addRelatedInfo(diag2, createDiagnosticForNode(aliasDeclaration, Diagnostics._0_was_imported_here, idText(rootName)));
|
|
@@ -80677,7 +80693,7 @@ function createTypeChecker(host) {
|
|
|
80677
80693
|
}
|
|
80678
80694
|
function checkJSDocTypeAliasTag(node) {
|
|
80679
80695
|
if (!node.typeExpression) {
|
|
80680
|
-
|
|
80696
|
+
error2(node.name, Diagnostics.JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags);
|
|
80681
80697
|
}
|
|
80682
80698
|
if (node.name) {
|
|
80683
80699
|
checkTypeNameIsReserved(node.name, Diagnostics.Type_alias_name_cannot_be_0);
|
|
@@ -80702,7 +80718,7 @@ function createTypeChecker(host) {
|
|
|
80702
80718
|
if (length(tags) > 1) {
|
|
80703
80719
|
for (let i = 1; i < length(tags); i++) {
|
|
80704
80720
|
const tagName = tags[i].tagName;
|
|
80705
|
-
|
|
80721
|
+
error2(tagName, Diagnostics._0_tag_already_specified, idText(tagName));
|
|
80706
80722
|
}
|
|
80707
80723
|
}
|
|
80708
80724
|
}
|
|
@@ -80734,33 +80750,33 @@ function createTypeChecker(host) {
|
|
|
80734
80750
|
function checkJSDocImplementsTag(node) {
|
|
80735
80751
|
const classLike = getEffectiveJSDocHost(node);
|
|
80736
80752
|
if (!classLike || !isClassDeclaration(classLike) && !isClassExpression(classLike)) {
|
|
80737
|
-
|
|
80753
|
+
error2(classLike, Diagnostics.JSDoc_0_is_not_attached_to_a_class, idText(node.tagName));
|
|
80738
80754
|
}
|
|
80739
80755
|
}
|
|
80740
80756
|
function checkJSDocAugmentsTag(node) {
|
|
80741
80757
|
const classLike = getEffectiveJSDocHost(node);
|
|
80742
80758
|
if (!classLike || !isClassDeclaration(classLike) && !isClassExpression(classLike)) {
|
|
80743
|
-
|
|
80759
|
+
error2(classLike, Diagnostics.JSDoc_0_is_not_attached_to_a_class, idText(node.tagName));
|
|
80744
80760
|
return;
|
|
80745
80761
|
}
|
|
80746
80762
|
const augmentsTags = getJSDocTags(classLike).filter(isJSDocAugmentsTag);
|
|
80747
80763
|
Debug.assert(augmentsTags.length > 0);
|
|
80748
80764
|
if (augmentsTags.length > 1) {
|
|
80749
|
-
|
|
80765
|
+
error2(augmentsTags[1], Diagnostics.Class_declarations_cannot_have_more_than_one_augments_or_extends_tag);
|
|
80750
80766
|
}
|
|
80751
80767
|
const name = getIdentifierFromEntityNameExpression(node.class.expression);
|
|
80752
80768
|
const extend2 = getClassExtendsHeritageElement(classLike);
|
|
80753
80769
|
if (extend2) {
|
|
80754
80770
|
const className = getIdentifierFromEntityNameExpression(extend2.expression);
|
|
80755
80771
|
if (className && name.escapedText !== className.escapedText) {
|
|
80756
|
-
|
|
80772
|
+
error2(name, Diagnostics.JSDoc_0_1_does_not_match_the_extends_2_clause, idText(node.tagName), idText(name), idText(className));
|
|
80757
80773
|
}
|
|
80758
80774
|
}
|
|
80759
80775
|
}
|
|
80760
80776
|
function checkJSDocAccessibilityModifiers(node) {
|
|
80761
80777
|
const host2 = getJSDocHost(node);
|
|
80762
80778
|
if (host2 && isPrivateIdentifierClassElementDeclaration(host2)) {
|
|
80763
|
-
|
|
80779
|
+
error2(node, Diagnostics.An_accessibility_modifier_cannot_be_used_with_a_private_identifier);
|
|
80764
80780
|
}
|
|
80765
80781
|
}
|
|
80766
80782
|
function getIdentifierFromEntityNameExpression(node) {
|
|
@@ -80802,7 +80818,7 @@ function createTypeChecker(host) {
|
|
|
80802
80818
|
if (isInJSFile(node)) {
|
|
80803
80819
|
const typeTag = getJSDocTypeTag(node);
|
|
80804
80820
|
if (typeTag && typeTag.typeExpression && !getContextualCallSignature(getTypeFromTypeNode(typeTag.typeExpression), node)) {
|
|
80805
|
-
|
|
80821
|
+
error2(typeTag.typeExpression.type, Diagnostics.The_type_of_a_function_declaration_must_match_the_function_s_signature);
|
|
80806
80822
|
}
|
|
80807
80823
|
}
|
|
80808
80824
|
function checkFunctionOrMethodDeclarationDiagnostics() {
|
|
@@ -81126,9 +81142,9 @@ function createTypeChecker(host) {
|
|
|
81126
81142
|
if (getNodeCheckFlags(current) & 4 /* CaptureThis */) {
|
|
81127
81143
|
const isDeclaration2 = node.kind !== 80 /* Identifier */;
|
|
81128
81144
|
if (isDeclaration2) {
|
|
81129
|
-
|
|
81145
|
+
error2(getNameOfDeclaration(node), Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference);
|
|
81130
81146
|
} else {
|
|
81131
|
-
|
|
81147
|
+
error2(node, Diagnostics.Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference);
|
|
81132
81148
|
}
|
|
81133
81149
|
return true;
|
|
81134
81150
|
}
|
|
@@ -81140,9 +81156,9 @@ function createTypeChecker(host) {
|
|
|
81140
81156
|
if (getNodeCheckFlags(current) & 8 /* CaptureNewTarget */) {
|
|
81141
81157
|
const isDeclaration2 = node.kind !== 80 /* Identifier */;
|
|
81142
81158
|
if (isDeclaration2) {
|
|
81143
|
-
|
|
81159
|
+
error2(getNameOfDeclaration(node), Diagnostics.Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference);
|
|
81144
81160
|
} else {
|
|
81145
|
-
|
|
81161
|
+
error2(node, Diagnostics.Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference);
|
|
81146
81162
|
}
|
|
81147
81163
|
return true;
|
|
81148
81164
|
}
|
|
@@ -81280,7 +81296,7 @@ function createTypeChecker(host) {
|
|
|
81280
81296
|
const namesShareScope = container && (container.kind === 240 /* Block */ && isFunctionLike(container.parent) || container.kind === 267 /* ModuleBlock */ || container.kind === 266 /* ModuleDeclaration */ || container.kind === 311 /* SourceFile */);
|
|
81281
81297
|
if (!namesShareScope) {
|
|
81282
81298
|
const name = symbolToString(localDeclarationSymbol);
|
|
81283
|
-
|
|
81299
|
+
error2(node, Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name);
|
|
81284
81300
|
}
|
|
81285
81301
|
}
|
|
81286
81302
|
}
|
|
@@ -81351,7 +81367,7 @@ function createTypeChecker(host) {
|
|
|
81351
81367
|
forEach(node.name.elements, checkSourceElement);
|
|
81352
81368
|
}
|
|
81353
81369
|
if (isParameter(node) && node.initializer && nodeIsMissing(getContainingFunction(node).body)) {
|
|
81354
|
-
|
|
81370
|
+
error2(node, Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation);
|
|
81355
81371
|
return;
|
|
81356
81372
|
}
|
|
81357
81373
|
if (isBindingPattern(node.name)) {
|
|
@@ -81403,7 +81419,7 @@ function createTypeChecker(host) {
|
|
|
81403
81419
|
}
|
|
81404
81420
|
if (symbol.declarations && symbol.declarations.length > 1) {
|
|
81405
81421
|
if (some(symbol.declarations, (d) => d !== node && isVariableLike(d) && !areDeclarationFlagsIdentical(d, node))) {
|
|
81406
|
-
|
|
81422
|
+
error2(node.name, Diagnostics.All_declarations_of_0_must_have_identical_modifiers, declarationNameToString(node.name));
|
|
81407
81423
|
}
|
|
81408
81424
|
}
|
|
81409
81425
|
} else {
|
|
@@ -81422,7 +81438,7 @@ function createTypeChecker(host) {
|
|
|
81422
81438
|
);
|
|
81423
81439
|
}
|
|
81424
81440
|
if (symbol.valueDeclaration && !areDeclarationFlagsIdentical(node, symbol.valueDeclaration)) {
|
|
81425
|
-
|
|
81441
|
+
error2(node.name, Diagnostics.All_declarations_of_0_must_have_identical_modifiers, declarationNameToString(node.name));
|
|
81426
81442
|
}
|
|
81427
81443
|
}
|
|
81428
81444
|
if (node.kind !== 171 /* PropertyDeclaration */ && node.kind !== 170 /* PropertySignature */) {
|
|
@@ -81437,7 +81453,7 @@ function createTypeChecker(host) {
|
|
|
81437
81453
|
const nextDeclarationName = getNameOfDeclaration(nextDeclaration);
|
|
81438
81454
|
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;
|
|
81439
81455
|
const declName = declarationNameToString(nextDeclarationName);
|
|
81440
|
-
const err =
|
|
81456
|
+
const err = error2(
|
|
81441
81457
|
nextDeclarationName,
|
|
81442
81458
|
message,
|
|
81443
81459
|
declName,
|
|
@@ -81487,7 +81503,7 @@ function createTypeChecker(host) {
|
|
|
81487
81503
|
checkTestingKnownTruthyCallableOrAwaitableType(node.expression, type, node.thenStatement);
|
|
81488
81504
|
checkSourceElement(node.thenStatement);
|
|
81489
81505
|
if (node.thenStatement.kind === 241 /* EmptyStatement */) {
|
|
81490
|
-
|
|
81506
|
+
error2(node.thenStatement, Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement);
|
|
81491
81507
|
}
|
|
81492
81508
|
checkSourceElement(node.elseStatement);
|
|
81493
81509
|
}
|
|
@@ -81537,7 +81553,7 @@ function createTypeChecker(host) {
|
|
|
81537
81553
|
getTypeNameForErrorDisplay(type)
|
|
81538
81554
|
);
|
|
81539
81555
|
} else {
|
|
81540
|
-
|
|
81556
|
+
error2(location, Diagnostics.This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_instead);
|
|
81541
81557
|
}
|
|
81542
81558
|
}
|
|
81543
81559
|
}
|
|
@@ -81603,7 +81619,7 @@ function createTypeChecker(host) {
|
|
|
81603
81619
|
}
|
|
81604
81620
|
function checkTruthinessOfType(type, node) {
|
|
81605
81621
|
if (type.flags & 16384 /* Void */) {
|
|
81606
|
-
|
|
81622
|
+
error2(node, Diagnostics.An_expression_of_type_void_cannot_be_tested_for_truthiness);
|
|
81607
81623
|
}
|
|
81608
81624
|
return type;
|
|
81609
81625
|
}
|
|
@@ -81677,16 +81693,16 @@ function createTypeChecker(host) {
|
|
|
81677
81693
|
if (node.initializer.kind === 260 /* VariableDeclarationList */) {
|
|
81678
81694
|
const variable = node.initializer.declarations[0];
|
|
81679
81695
|
if (variable && isBindingPattern(variable.name)) {
|
|
81680
|
-
|
|
81696
|
+
error2(variable.name, Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern);
|
|
81681
81697
|
}
|
|
81682
81698
|
checkForInOrForOfVariableDeclaration(node);
|
|
81683
81699
|
} else {
|
|
81684
81700
|
const varExpr = node.initializer;
|
|
81685
81701
|
const leftType = checkExpression(varExpr);
|
|
81686
81702
|
if (varExpr.kind === 208 /* ArrayLiteralExpression */ || varExpr.kind === 209 /* ObjectLiteralExpression */) {
|
|
81687
|
-
|
|
81703
|
+
error2(varExpr, Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern);
|
|
81688
81704
|
} else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) {
|
|
81689
|
-
|
|
81705
|
+
error2(varExpr, Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any);
|
|
81690
81706
|
} else {
|
|
81691
81707
|
checkReferenceExpression(
|
|
81692
81708
|
varExpr,
|
|
@@ -81696,7 +81712,7 @@ function createTypeChecker(host) {
|
|
|
81696
81712
|
}
|
|
81697
81713
|
}
|
|
81698
81714
|
if (rightType === neverType || !isTypeAssignableToKind(rightType, 67108864 /* NonPrimitive */ | 58982400 /* InstantiableNonPrimitive */)) {
|
|
81699
|
-
|
|
81715
|
+
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));
|
|
81700
81716
|
}
|
|
81701
81717
|
checkSourceElement(node.statement);
|
|
81702
81718
|
if (node.locals) {
|
|
@@ -81767,7 +81783,7 @@ function createTypeChecker(host) {
|
|
|
81767
81783
|
if (hasStringConstituent) {
|
|
81768
81784
|
if (languageVersion < 1 /* ES5 */) {
|
|
81769
81785
|
if (errorNode) {
|
|
81770
|
-
|
|
81786
|
+
error2(errorNode, Diagnostics.Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher);
|
|
81771
81787
|
reportedError = true;
|
|
81772
81788
|
}
|
|
81773
81789
|
}
|
|
@@ -82227,7 +82243,7 @@ function createTypeChecker(host) {
|
|
|
82227
82243
|
errorOutputContainer.errors ?? (errorOutputContainer.errors = []);
|
|
82228
82244
|
errorOutputContainer.errors.push(createDiagnosticForNode(errorNode, diagnostic, methodName));
|
|
82229
82245
|
} else {
|
|
82230
|
-
|
|
82246
|
+
error2(errorNode, diagnostic, methodName);
|
|
82231
82247
|
}
|
|
82232
82248
|
}
|
|
82233
82249
|
return methodName === "next" ? noIterationTypes : void 0;
|
|
@@ -82282,7 +82298,7 @@ function createTypeChecker(host) {
|
|
|
82282
82298
|
errorOutputContainer.errors ?? (errorOutputContainer.errors = []);
|
|
82283
82299
|
errorOutputContainer.errors.push(createDiagnosticForNode(errorNode, resolver.mustHaveAValueDiagnostic, methodName));
|
|
82284
82300
|
} else {
|
|
82285
|
-
|
|
82301
|
+
error2(errorNode, resolver.mustHaveAValueDiagnostic, methodName);
|
|
82286
82302
|
}
|
|
82287
82303
|
}
|
|
82288
82304
|
yieldType = anyType;
|
|
@@ -82368,11 +82384,11 @@ function createTypeChecker(host) {
|
|
|
82368
82384
|
const exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType;
|
|
82369
82385
|
if (container.kind === 177 /* SetAccessor */) {
|
|
82370
82386
|
if (node.expression) {
|
|
82371
|
-
|
|
82387
|
+
error2(node, Diagnostics.Setters_cannot_return_a_value);
|
|
82372
82388
|
}
|
|
82373
82389
|
} else if (container.kind === 175 /* Constructor */) {
|
|
82374
82390
|
if (node.expression && !checkTypeAssignableToAndOptionallyElaborate(exprType, returnType, node, node.expression)) {
|
|
82375
|
-
|
|
82391
|
+
error2(node, Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class);
|
|
82376
82392
|
}
|
|
82377
82393
|
} else if (getReturnTypeFromAnnotation(container)) {
|
|
82378
82394
|
const unwrappedReturnType = unwrapReturnType(returnType, functionFlags) ?? returnType;
|
|
@@ -82388,7 +82404,7 @@ function createTypeChecker(host) {
|
|
|
82388
82404
|
}
|
|
82389
82405
|
}
|
|
82390
82406
|
} else if (container.kind !== 175 /* Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeUndefinedVoidOrAny(container, returnType)) {
|
|
82391
|
-
|
|
82407
|
+
error2(node, Diagnostics.Not_all_code_paths_return_a_value);
|
|
82392
82408
|
}
|
|
82393
82409
|
}
|
|
82394
82410
|
function checkWithStatement(node) {
|
|
@@ -82424,7 +82440,7 @@ function createTypeChecker(host) {
|
|
|
82424
82440
|
}
|
|
82425
82441
|
forEach(clause.statements, checkSourceElement);
|
|
82426
82442
|
if (compilerOptions.noFallthroughCasesInSwitch && clause.fallthroughFlowNode && isReachableFlowNode(clause.fallthroughFlowNode)) {
|
|
82427
|
-
|
|
82443
|
+
error2(clause, Diagnostics.Fallthrough_case_in_switch);
|
|
82428
82444
|
}
|
|
82429
82445
|
function createLazyCaseClauseDiagnostics(clause2) {
|
|
82430
82446
|
return () => {
|
|
@@ -82574,7 +82590,7 @@ function createTypeChecker(host) {
|
|
|
82574
82590
|
const localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfDeclaration(info.declaration)) === type.symbol ? info.declaration : void 0;
|
|
82575
82591
|
const errorNode = localCheckDeclaration || localIndexDeclaration || (interfaceDeclaration && !some(getBaseTypes(type), (base) => !!getIndexInfoOfType(base, checkInfo.keyType) && !!getIndexTypeOfType(base, info.keyType)) ? interfaceDeclaration : void 0);
|
|
82576
82592
|
if (errorNode && !isTypeAssignableTo(checkInfo.type, info.type)) {
|
|
82577
|
-
|
|
82593
|
+
error2(
|
|
82578
82594
|
errorNode,
|
|
82579
82595
|
Diagnostics._0_index_type_1_is_not_assignable_to_2_index_type_3,
|
|
82580
82596
|
typeToString(checkInfo.keyType),
|
|
@@ -82597,12 +82613,12 @@ function createTypeChecker(host) {
|
|
|
82597
82613
|
case "symbol":
|
|
82598
82614
|
case "void":
|
|
82599
82615
|
case "object":
|
|
82600
|
-
|
|
82616
|
+
error2(name, message, name.escapedText);
|
|
82601
82617
|
}
|
|
82602
82618
|
}
|
|
82603
82619
|
function checkClassNameCollisionWithObject(name) {
|
|
82604
82620
|
if (languageVersion >= 1 /* ES5 */ && name.escapedText === "Object" && (moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(name).impliedNodeFormat === 1 /* CommonJS */)) {
|
|
82605
|
-
|
|
82621
|
+
error2(name, Diagnostics.Class_name_cannot_be_Object_when_targeting_ES5_with_module_0, ModuleKind[moduleKind]);
|
|
82606
82622
|
}
|
|
82607
82623
|
}
|
|
82608
82624
|
function checkUnmatchedJSDocParameters(node) {
|
|
@@ -82625,7 +82641,7 @@ function createTypeChecker(host) {
|
|
|
82625
82641
|
const lastJSDocParamIndex = jsdocParameters.length - 1;
|
|
82626
82642
|
const lastJSDocParam = jsdocParameters[lastJSDocParamIndex];
|
|
82627
82643
|
if (isJs && lastJSDocParam && isIdentifier(lastJSDocParam.name) && lastJSDocParam.typeExpression && lastJSDocParam.typeExpression.type && !parameters.has(lastJSDocParam.name.escapedText) && !excludedParameters.has(lastJSDocParamIndex) && !isArrayType(getTypeFromTypeNode(lastJSDocParam.typeExpression.type))) {
|
|
82628
|
-
|
|
82644
|
+
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));
|
|
82629
82645
|
}
|
|
82630
82646
|
} else {
|
|
82631
82647
|
forEach(jsdocParameters, ({ name, isNameFirst }, index) => {
|
|
@@ -82634,7 +82650,7 @@ function createTypeChecker(host) {
|
|
|
82634
82650
|
}
|
|
82635
82651
|
if (isQualifiedName(name)) {
|
|
82636
82652
|
if (isJs) {
|
|
82637
|
-
|
|
82653
|
+
error2(name, Diagnostics.Qualified_name_0_is_not_allowed_without_a_leading_param_object_1, entityNameToString(name), entityNameToString(name.left));
|
|
82638
82654
|
}
|
|
82639
82655
|
} else {
|
|
82640
82656
|
if (!isNameFirst) {
|
|
@@ -82659,11 +82675,11 @@ function createTypeChecker(host) {
|
|
|
82659
82675
|
seenDefault = true;
|
|
82660
82676
|
checkTypeParametersNotReferenced(node.default, typeParameterDeclarations, i);
|
|
82661
82677
|
} else if (seenDefault) {
|
|
82662
|
-
|
|
82678
|
+
error2(node, Diagnostics.Required_type_parameters_may_not_follow_optional_type_parameters);
|
|
82663
82679
|
}
|
|
82664
82680
|
for (let j = 0; j < i; j++) {
|
|
82665
82681
|
if (typeParameterDeclarations[j].symbol === node.symbol) {
|
|
82666
|
-
|
|
82682
|
+
error2(node.name, Diagnostics.Duplicate_identifier_0, declarationNameToString(node.name));
|
|
82667
82683
|
}
|
|
82668
82684
|
}
|
|
82669
82685
|
};
|
|
@@ -82677,7 +82693,7 @@ function createTypeChecker(host) {
|
|
|
82677
82693
|
if (type.flags & 262144 /* TypeParameter */) {
|
|
82678
82694
|
for (let i = index; i < typeParameters.length; i++) {
|
|
82679
82695
|
if (type.symbol === getSymbolOfDeclaration(typeParameters[i])) {
|
|
82680
|
-
|
|
82696
|
+
error2(node, Diagnostics.Type_parameter_defaults_can_only_reference_previously_declared_type_parameters);
|
|
82681
82697
|
}
|
|
82682
82698
|
}
|
|
82683
82699
|
}
|
|
@@ -82700,7 +82716,7 @@ function createTypeChecker(host) {
|
|
|
82700
82716
|
if (!areTypeParametersIdentical(declarations, type.localTypeParameters, getEffectiveTypeParameterDeclarations)) {
|
|
82701
82717
|
const name = symbolToString(symbol);
|
|
82702
82718
|
for (const declaration of declarations) {
|
|
82703
|
-
|
|
82719
|
+
error2(declaration.name, Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, name);
|
|
82704
82720
|
}
|
|
82705
82721
|
}
|
|
82706
82722
|
}
|
|
@@ -82871,18 +82887,18 @@ function createTypeChecker(host) {
|
|
|
82871
82887
|
}
|
|
82872
82888
|
if (baseConstructorType.flags & 8650752 /* TypeVariable */) {
|
|
82873
82889
|
if (!isMixinConstructorType(staticType)) {
|
|
82874
|
-
|
|
82890
|
+
error2(node.name || node, Diagnostics.A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any);
|
|
82875
82891
|
} else {
|
|
82876
82892
|
const constructSignatures = getSignaturesOfType(baseConstructorType, 1 /* Construct */);
|
|
82877
82893
|
if (constructSignatures.some((signature) => signature.flags & 4 /* Abstract */) && !hasSyntacticModifier(node, 256 /* Abstract */)) {
|
|
82878
|
-
|
|
82894
|
+
error2(node.name || node, Diagnostics.A_mixin_class_that_extends_from_a_type_variable_containing_an_abstract_construct_signature_must_also_be_declared_abstract);
|
|
82879
82895
|
}
|
|
82880
82896
|
}
|
|
82881
82897
|
}
|
|
82882
82898
|
if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32 /* Class */) && !(baseConstructorType.flags & 8650752 /* TypeVariable */)) {
|
|
82883
82899
|
const constructors = getInstantiatedConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments, baseTypeNode);
|
|
82884
82900
|
if (forEach(constructors, (sig) => !isJSConstructor(sig.declaration) && !isTypeIdenticalTo(getReturnTypeOfSignature(sig), baseType))) {
|
|
82885
|
-
|
|
82901
|
+
error2(baseTypeNode.expression, Diagnostics.Base_constructors_must_all_have_the_same_return_type);
|
|
82886
82902
|
}
|
|
82887
82903
|
}
|
|
82888
82904
|
checkKindsOfPropertyMemberOverrides(type, baseType);
|
|
@@ -82894,7 +82910,7 @@ function createTypeChecker(host) {
|
|
|
82894
82910
|
if (implementedTypeNodes) {
|
|
82895
82911
|
for (const typeRefNode of implementedTypeNodes) {
|
|
82896
82912
|
if (!isEntityNameExpression(typeRefNode.expression) || isOptionalChain(typeRefNode.expression)) {
|
|
82897
|
-
|
|
82913
|
+
error2(typeRefNode.expression, Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments);
|
|
82898
82914
|
}
|
|
82899
82915
|
checkTypeReferenceNode(typeRefNode);
|
|
82900
82916
|
addLazyDiagnostic(createImplementsDiagnostics(typeRefNode));
|
|
@@ -82927,7 +82943,7 @@ function createTypeChecker(host) {
|
|
|
82927
82943
|
issueMemberSpecificError(node, typeWithThis, baseWithThis, genericDiag);
|
|
82928
82944
|
}
|
|
82929
82945
|
} else {
|
|
82930
|
-
|
|
82946
|
+
error2(typeRefNode, Diagnostics.A_class_can_only_implement_an_object_type_or_intersection_of_object_types_with_statically_known_members);
|
|
82931
82947
|
}
|
|
82932
82948
|
}
|
|
82933
82949
|
};
|
|
@@ -83005,12 +83021,12 @@ function createTypeChecker(host) {
|
|
|
83005
83021
|
if (prop && !baseProp && memberHasOverrideModifier) {
|
|
83006
83022
|
if (errorNode) {
|
|
83007
83023
|
const suggestion = getSuggestedSymbolForNonexistentClassMember(memberName, baseType);
|
|
83008
|
-
suggestion ?
|
|
83024
|
+
suggestion ? error2(
|
|
83009
83025
|
errorNode,
|
|
83010
83026
|
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,
|
|
83011
83027
|
baseClassName,
|
|
83012
83028
|
symbolToString(suggestion)
|
|
83013
|
-
) :
|
|
83029
|
+
) : error2(
|
|
83014
83030
|
errorNode,
|
|
83015
83031
|
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,
|
|
83016
83032
|
baseClassName
|
|
@@ -83025,12 +83041,12 @@ function createTypeChecker(host) {
|
|
|
83025
83041
|
if (!baseHasAbstract) {
|
|
83026
83042
|
if (errorNode) {
|
|
83027
83043
|
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;
|
|
83028
|
-
|
|
83044
|
+
error2(errorNode, diag2, baseClassName);
|
|
83029
83045
|
}
|
|
83030
83046
|
return 1 /* NeedsOverride */;
|
|
83031
83047
|
} else if (memberHasAbstractModifier && baseHasAbstract) {
|
|
83032
83048
|
if (errorNode) {
|
|
83033
|
-
|
|
83049
|
+
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);
|
|
83034
83050
|
}
|
|
83035
83051
|
return 1 /* NeedsOverride */;
|
|
83036
83052
|
}
|
|
@@ -83038,7 +83054,7 @@ function createTypeChecker(host) {
|
|
|
83038
83054
|
} else if (memberHasOverrideModifier) {
|
|
83039
83055
|
if (errorNode) {
|
|
83040
83056
|
const className = typeToString(type);
|
|
83041
|
-
|
|
83057
|
+
error2(
|
|
83042
83058
|
errorNode,
|
|
83043
83059
|
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,
|
|
83044
83060
|
className
|
|
@@ -83091,7 +83107,7 @@ function createTypeChecker(host) {
|
|
|
83091
83107
|
if (declaration && hasEffectiveModifier(declaration, 8 /* Private */)) {
|
|
83092
83108
|
const typeClassDeclaration = getClassLikeDeclarationOfSymbol(type.symbol);
|
|
83093
83109
|
if (!isNodeWithinClass(node, typeClassDeclaration)) {
|
|
83094
|
-
|
|
83110
|
+
error2(node, Diagnostics.Cannot_extend_a_class_0_Class_constructor_is_marked_as_private, getFullyQualifiedName(type.symbol));
|
|
83095
83111
|
}
|
|
83096
83112
|
}
|
|
83097
83113
|
}
|
|
@@ -83160,7 +83176,7 @@ function createTypeChecker(host) {
|
|
|
83160
83176
|
}
|
|
83161
83177
|
}
|
|
83162
83178
|
if (!inheritedAbstractMemberNotImplementedError) {
|
|
83163
|
-
inheritedAbstractMemberNotImplementedError =
|
|
83179
|
+
inheritedAbstractMemberNotImplementedError = error2(
|
|
83164
83180
|
derivedClassDecl,
|
|
83165
83181
|
Diagnostics.Non_abstract_class_0_does_not_implement_all_abstract_members_of_1,
|
|
83166
83182
|
typeToString(type),
|
|
@@ -83206,7 +83222,7 @@ function createTypeChecker(host) {
|
|
|
83206
83222
|
const overriddenInstanceAccessor = basePropertyFlags === 4 /* Property */ && derivedPropertyFlags !== 4 /* Property */;
|
|
83207
83223
|
if (overriddenInstanceProperty || overriddenInstanceAccessor) {
|
|
83208
83224
|
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;
|
|
83209
|
-
|
|
83225
|
+
error2(getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage2, symbolToString(base), typeToString(baseType), typeToString(type));
|
|
83210
83226
|
} else if (useDefineForClassFields) {
|
|
83211
83227
|
const uninitialized = (_c = derived.declarations) == null ? void 0 : _c.find((d) => d.kind === 171 /* PropertyDeclaration */ && !d.initializer);
|
|
83212
83228
|
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 */)))) {
|
|
@@ -83214,7 +83230,7 @@ function createTypeChecker(host) {
|
|
|
83214
83230
|
const propName = uninitialized.name;
|
|
83215
83231
|
if (uninitialized.exclamationToken || !constructor || !isIdentifier(propName) || !strictNullChecks || !isPropertyInitializedInConstructor(propName, type, constructor)) {
|
|
83216
83232
|
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;
|
|
83217
|
-
|
|
83233
|
+
error2(getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage2, symbolToString(base), typeToString(baseType));
|
|
83218
83234
|
}
|
|
83219
83235
|
}
|
|
83220
83236
|
}
|
|
@@ -83231,7 +83247,7 @@ function createTypeChecker(host) {
|
|
|
83231
83247
|
} else {
|
|
83232
83248
|
errorMessage = Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function;
|
|
83233
83249
|
}
|
|
83234
|
-
|
|
83250
|
+
error2(getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type));
|
|
83235
83251
|
}
|
|
83236
83252
|
}
|
|
83237
83253
|
}
|
|
@@ -83310,7 +83326,7 @@ function createTypeChecker(host) {
|
|
|
83310
83326
|
const type = getTypeOfSymbol(getSymbolOfDeclaration(member));
|
|
83311
83327
|
if (!(type.flags & 3 /* AnyOrUnknown */ || containsUndefinedType(type))) {
|
|
83312
83328
|
if (!constructor || !isPropertyInitializedInConstructor(propName, type, constructor)) {
|
|
83313
|
-
|
|
83329
|
+
error2(member.name, Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor, declarationNameToString(propName));
|
|
83314
83330
|
}
|
|
83315
83331
|
}
|
|
83316
83332
|
}
|
|
@@ -83367,7 +83383,7 @@ function createTypeChecker(host) {
|
|
|
83367
83383
|
});
|
|
83368
83384
|
forEach(getInterfaceBaseTypeNodes(node), (heritageElement) => {
|
|
83369
83385
|
if (!isEntityNameExpression(heritageElement.expression) || isOptionalChain(heritageElement.expression)) {
|
|
83370
|
-
|
|
83386
|
+
error2(heritageElement.expression, Diagnostics.An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments);
|
|
83371
83387
|
}
|
|
83372
83388
|
checkTypeReferenceNode(heritageElement);
|
|
83373
83389
|
});
|
|
@@ -83384,7 +83400,7 @@ function createTypeChecker(host) {
|
|
|
83384
83400
|
checkTypeParameters(node.typeParameters);
|
|
83385
83401
|
if (node.type.kind === 141 /* IntrinsicKeyword */) {
|
|
83386
83402
|
if (!intrinsicTypeKinds.has(node.name.escapedText) || length(node.typeParameters) !== 1) {
|
|
83387
|
-
|
|
83403
|
+
error2(node.type, Diagnostics.The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types);
|
|
83388
83404
|
}
|
|
83389
83405
|
} else {
|
|
83390
83406
|
checkSourceElement(node.type);
|
|
@@ -83405,11 +83421,11 @@ function createTypeChecker(host) {
|
|
|
83405
83421
|
}
|
|
83406
83422
|
function computeMemberValue(member, autoValue) {
|
|
83407
83423
|
if (isComputedNonLiteralName(member.name)) {
|
|
83408
|
-
|
|
83424
|
+
error2(member.name, Diagnostics.Computed_property_names_are_not_allowed_in_enums);
|
|
83409
83425
|
} else {
|
|
83410
83426
|
const text = getTextOfPropertyName(member.name);
|
|
83411
83427
|
if (isNumericLiteralName(text) && !isInfinityOrNaNString(text)) {
|
|
83412
|
-
|
|
83428
|
+
error2(member.name, Diagnostics.An_enum_member_cannot_have_a_numeric_name);
|
|
83413
83429
|
}
|
|
83414
83430
|
}
|
|
83415
83431
|
if (member.initializer) {
|
|
@@ -83421,7 +83437,7 @@ function createTypeChecker(host) {
|
|
|
83421
83437
|
if (autoValue !== void 0) {
|
|
83422
83438
|
return autoValue;
|
|
83423
83439
|
}
|
|
83424
|
-
|
|
83440
|
+
error2(member.name, Diagnostics.Enum_member_must_have_initializer);
|
|
83425
83441
|
return void 0;
|
|
83426
83442
|
}
|
|
83427
83443
|
function computeConstantValue(member) {
|
|
@@ -83430,12 +83446,12 @@ function createTypeChecker(host) {
|
|
|
83430
83446
|
const value = evaluate(initializer, member);
|
|
83431
83447
|
if (value !== void 0) {
|
|
83432
83448
|
if (isConstEnum && typeof value === "number" && !isFinite(value)) {
|
|
83433
|
-
|
|
83449
|
+
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);
|
|
83434
83450
|
}
|
|
83435
83451
|
} else if (isConstEnum) {
|
|
83436
|
-
|
|
83452
|
+
error2(initializer, Diagnostics.const_enum_member_initializers_must_be_constant_expressions);
|
|
83437
83453
|
} else if (member.parent.flags & 16777216 /* Ambient */) {
|
|
83438
|
-
|
|
83454
|
+
error2(initializer, Diagnostics.In_ambient_enum_declarations_member_initializer_must_be_constant_expression);
|
|
83439
83455
|
} else {
|
|
83440
83456
|
checkTypeAssignableTo(checkExpression(initializer), numberType, initializer, Diagnostics.Type_0_is_not_assignable_to_type_1_as_required_for_computed_enum_member_values);
|
|
83441
83457
|
}
|
|
@@ -83549,11 +83565,11 @@ function createTypeChecker(host) {
|
|
|
83549
83565
|
function evaluateEnumMember(expr, symbol, location) {
|
|
83550
83566
|
const declaration = symbol.valueDeclaration;
|
|
83551
83567
|
if (!declaration || declaration === location) {
|
|
83552
|
-
|
|
83568
|
+
error2(expr, Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(symbol));
|
|
83553
83569
|
return void 0;
|
|
83554
83570
|
}
|
|
83555
83571
|
if (!isBlockScopedNameDeclaredBeforeUse(declaration, location)) {
|
|
83556
|
-
|
|
83572
|
+
error2(expr, Diagnostics.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums);
|
|
83557
83573
|
return 0;
|
|
83558
83574
|
}
|
|
83559
83575
|
return getEnumMemberValue(declaration);
|
|
@@ -83586,7 +83602,7 @@ function createTypeChecker(host) {
|
|
|
83586
83602
|
const enumIsConst = isEnumConst(node);
|
|
83587
83603
|
forEach(enumSymbol.declarations, (decl) => {
|
|
83588
83604
|
if (isEnumDeclaration(decl) && isEnumConst(decl) !== enumIsConst) {
|
|
83589
|
-
|
|
83605
|
+
error2(getNameOfDeclaration(decl), Diagnostics.Enum_declarations_must_all_be_const_or_non_const);
|
|
83590
83606
|
}
|
|
83591
83607
|
});
|
|
83592
83608
|
}
|
|
@@ -83602,7 +83618,7 @@ function createTypeChecker(host) {
|
|
|
83602
83618
|
const firstEnumMember = enumDeclaration.members[0];
|
|
83603
83619
|
if (!firstEnumMember.initializer) {
|
|
83604
83620
|
if (seenEnumMissingInitialInitializer) {
|
|
83605
|
-
|
|
83621
|
+
error2(firstEnumMember.name, Diagnostics.In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element);
|
|
83606
83622
|
} else {
|
|
83607
83623
|
seenEnumMissingInitialInitializer = true;
|
|
83608
83624
|
}
|
|
@@ -83612,7 +83628,7 @@ function createTypeChecker(host) {
|
|
|
83612
83628
|
}
|
|
83613
83629
|
function checkEnumMember(node) {
|
|
83614
83630
|
if (isPrivateIdentifier(node.name)) {
|
|
83615
|
-
|
|
83631
|
+
error2(node, Diagnostics.An_enum_member_cannot_be_named_with_a_private_identifier);
|
|
83616
83632
|
}
|
|
83617
83633
|
if (node.initializer) {
|
|
83618
83634
|
checkExpression(node.initializer);
|
|
@@ -83653,7 +83669,7 @@ function createTypeChecker(host) {
|
|
|
83653
83669
|
const isGlobalAugmentation = isGlobalScopeAugmentation(node);
|
|
83654
83670
|
const inAmbientContext = node.flags & 16777216 /* Ambient */;
|
|
83655
83671
|
if (isGlobalAugmentation && !inAmbientContext) {
|
|
83656
|
-
|
|
83672
|
+
error2(node.name, Diagnostics.Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context);
|
|
83657
83673
|
}
|
|
83658
83674
|
const isAmbientExternalModule = isAmbientModule(node);
|
|
83659
83675
|
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;
|
|
@@ -83672,15 +83688,15 @@ function createTypeChecker(host) {
|
|
|
83672
83688
|
const symbol = getSymbolOfDeclaration(node);
|
|
83673
83689
|
if (symbol.flags & 512 /* ValueModule */ && !inAmbientContext && isInstantiatedModule(node, shouldPreserveConstEnums(compilerOptions))) {
|
|
83674
83690
|
if (getIsolatedModules(compilerOptions) && !getSourceFileOfNode(node).externalModuleIndicator) {
|
|
83675
|
-
|
|
83691
|
+
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);
|
|
83676
83692
|
}
|
|
83677
83693
|
if (((_a = symbol.declarations) == null ? void 0 : _a.length) > 1) {
|
|
83678
83694
|
const firstNonAmbientClassOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol);
|
|
83679
83695
|
if (firstNonAmbientClassOrFunc) {
|
|
83680
83696
|
if (getSourceFileOfNode(node) !== getSourceFileOfNode(firstNonAmbientClassOrFunc)) {
|
|
83681
|
-
|
|
83697
|
+
error2(node.name, Diagnostics.A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged);
|
|
83682
83698
|
} else if (node.pos < firstNonAmbientClassOrFunc.pos) {
|
|
83683
|
-
|
|
83699
|
+
error2(node.name, Diagnostics.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged);
|
|
83684
83700
|
}
|
|
83685
83701
|
}
|
|
83686
83702
|
const mergedClass = getDeclarationOfKind(symbol, 262 /* ClassDeclaration */);
|
|
@@ -83691,7 +83707,7 @@ function createTypeChecker(host) {
|
|
|
83691
83707
|
if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 311 /* SourceFile */ && (moduleKind === 1 /* CommonJS */ || node.parent.impliedNodeFormat === 1 /* CommonJS */)) {
|
|
83692
83708
|
const exportModifier = (_b = node.modifiers) == null ? void 0 : _b.find((m) => m.kind === 95 /* ExportKeyword */);
|
|
83693
83709
|
if (exportModifier) {
|
|
83694
|
-
|
|
83710
|
+
error2(exportModifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
|
83695
83711
|
}
|
|
83696
83712
|
}
|
|
83697
83713
|
}
|
|
@@ -83705,15 +83721,15 @@ function createTypeChecker(host) {
|
|
|
83705
83721
|
}
|
|
83706
83722
|
} else if (isGlobalSourceFile(node.parent)) {
|
|
83707
83723
|
if (isGlobalAugmentation) {
|
|
83708
|
-
|
|
83724
|
+
error2(node.name, Diagnostics.Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations);
|
|
83709
83725
|
} else if (isExternalModuleNameRelative(getTextOfIdentifierOrLiteral(node.name))) {
|
|
83710
|
-
|
|
83726
|
+
error2(node.name, Diagnostics.Ambient_module_declaration_cannot_specify_relative_module_name);
|
|
83711
83727
|
}
|
|
83712
83728
|
} else {
|
|
83713
83729
|
if (isGlobalAugmentation) {
|
|
83714
|
-
|
|
83730
|
+
error2(node.name, Diagnostics.Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations);
|
|
83715
83731
|
} else {
|
|
83716
|
-
|
|
83732
|
+
error2(node.name, Diagnostics.Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces);
|
|
83717
83733
|
}
|
|
83718
83734
|
}
|
|
83719
83735
|
}
|
|
@@ -83780,17 +83796,17 @@ function createTypeChecker(host) {
|
|
|
83780
83796
|
return false;
|
|
83781
83797
|
}
|
|
83782
83798
|
if (!isStringLiteral(moduleName)) {
|
|
83783
|
-
|
|
83799
|
+
error2(moduleName, Diagnostics.String_literal_expected);
|
|
83784
83800
|
return false;
|
|
83785
83801
|
}
|
|
83786
83802
|
const inAmbientExternalModule = node.parent.kind === 267 /* ModuleBlock */ && isAmbientModule(node.parent.parent);
|
|
83787
83803
|
if (node.parent.kind !== 311 /* SourceFile */ && !inAmbientExternalModule) {
|
|
83788
|
-
|
|
83804
|
+
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);
|
|
83789
83805
|
return false;
|
|
83790
83806
|
}
|
|
83791
83807
|
if (inAmbientExternalModule && isExternalModuleNameRelative(moduleName.text)) {
|
|
83792
83808
|
if (!isTopLevelInExternalModuleAugmentation(node)) {
|
|
83793
|
-
|
|
83809
|
+
error2(node, Diagnostics.Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name);
|
|
83794
83810
|
return false;
|
|
83795
83811
|
}
|
|
83796
83812
|
}
|
|
@@ -83799,7 +83815,7 @@ function createTypeChecker(host) {
|
|
|
83799
83815
|
for (const clause of node.assertClause.elements) {
|
|
83800
83816
|
if (!isStringLiteral(clause.value)) {
|
|
83801
83817
|
hasError = true;
|
|
83802
|
-
|
|
83818
|
+
error2(clause.value, Diagnostics.Import_assertion_values_must_be_string_literal_expressions);
|
|
83803
83819
|
}
|
|
83804
83820
|
}
|
|
83805
83821
|
return !hasError;
|
|
@@ -83816,7 +83832,7 @@ function createTypeChecker(host) {
|
|
|
83816
83832
|
const errorNode = isImportOrExportSpecifier(node) ? node.propertyName || node.name : isNamedDeclaration(node) ? node.name : node;
|
|
83817
83833
|
Debug.assert(node.kind !== 279 /* NamespaceExport */);
|
|
83818
83834
|
if (node.kind === 280 /* ExportSpecifier */) {
|
|
83819
|
-
const diag2 =
|
|
83835
|
+
const diag2 = error2(errorNode, Diagnostics.Types_cannot_appear_in_export_declarations_in_JavaScript_files);
|
|
83820
83836
|
const alreadyExportedSymbol = (_b = (_a = getSourceFileOfNode(node).symbol) == null ? void 0 : _a.exports) == null ? void 0 : _b.get((node.propertyName || node.name).escapedText);
|
|
83821
83837
|
if (alreadyExportedSymbol === target) {
|
|
83822
83838
|
const exportingDeclaration = (_c = alreadyExportedSymbol.declarations) == null ? void 0 : _c.find(isJSDocNode);
|
|
@@ -83833,7 +83849,7 @@ function createTypeChecker(host) {
|
|
|
83833
83849
|
const importDeclaration = findAncestor(node, or(isImportDeclaration, isImportEqualsDeclaration));
|
|
83834
83850
|
const moduleSpecifier = (importDeclaration && ((_d = tryGetModuleSpecifierFromDeclaration(importDeclaration)) == null ? void 0 : _d.text)) ?? "...";
|
|
83835
83851
|
const importedIdentifier = unescapeLeadingUnderscores(isIdentifier(errorNode) ? errorNode.escapedText : symbol.escapedName);
|
|
83836
|
-
|
|
83852
|
+
error2(
|
|
83837
83853
|
errorNode,
|
|
83838
83854
|
Diagnostics._0_is_a_type_and_cannot_be_imported_in_JavaScript_files_Use_1_in_a_JSDoc_type_annotation,
|
|
83839
83855
|
importedIdentifier,
|
|
@@ -83846,7 +83862,7 @@ function createTypeChecker(host) {
|
|
|
83846
83862
|
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);
|
|
83847
83863
|
if (targetFlags & excludedMeanings) {
|
|
83848
83864
|
const message = node.kind === 280 /* ExportSpecifier */ ? Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0;
|
|
83849
|
-
|
|
83865
|
+
error2(node, message, symbolToString(symbol));
|
|
83850
83866
|
}
|
|
83851
83867
|
if (getIsolatedModules(compilerOptions) && !isTypeOnlyImportOrExportDeclaration(node) && !(node.flags & 16777216 /* Ambient */)) {
|
|
83852
83868
|
const typeOnlyAlias = getTypeOnlyAliasDeclaration(symbol);
|
|
@@ -83861,20 +83877,20 @@ function createTypeChecker(host) {
|
|
|
83861
83877
|
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;
|
|
83862
83878
|
const name = idText(node.kind === 275 /* ImportSpecifier */ ? node.propertyName || node.name : node.name);
|
|
83863
83879
|
addTypeOnlyDeclarationRelatedInfo(
|
|
83864
|
-
|
|
83880
|
+
error2(node, message, name),
|
|
83865
83881
|
isType ? void 0 : typeOnlyAlias,
|
|
83866
83882
|
name
|
|
83867
83883
|
);
|
|
83868
83884
|
}
|
|
83869
83885
|
if (isType && node.kind === 270 /* ImportEqualsDeclaration */ && hasEffectiveModifier(node, 1 /* Export */)) {
|
|
83870
|
-
|
|
83886
|
+
error2(node, Diagnostics.Cannot_use_export_import_on_a_type_or_type_only_namespace_when_0_is_enabled, isolatedModulesLikeFlagName);
|
|
83871
83887
|
}
|
|
83872
83888
|
break;
|
|
83873
83889
|
}
|
|
83874
83890
|
case 280 /* ExportSpecifier */: {
|
|
83875
83891
|
if (compilerOptions.verbatimModuleSyntax || getSourceFileOfNode(typeOnlyAlias) !== getSourceFileOfNode(node)) {
|
|
83876
83892
|
const name = idText(node.propertyName || node.name);
|
|
83877
|
-
const diagnostic = isType ?
|
|
83893
|
+
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);
|
|
83878
83894
|
addTypeOnlyDeclarationRelatedInfo(diagnostic, isType ? void 0 : typeOnlyAlias, name);
|
|
83879
83895
|
break;
|
|
83880
83896
|
}
|
|
@@ -83882,7 +83898,7 @@ function createTypeChecker(host) {
|
|
|
83882
83898
|
}
|
|
83883
83899
|
}
|
|
83884
83900
|
if (compilerOptions.verbatimModuleSyntax && node.kind !== 270 /* ImportEqualsDeclaration */ && !isInJSFile(node) && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) {
|
|
83885
|
-
|
|
83901
|
+
error2(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
|
83886
83902
|
}
|
|
83887
83903
|
}
|
|
83888
83904
|
if (isImportSpecifier(node)) {
|
|
@@ -84004,7 +84020,7 @@ function createTypeChecker(host) {
|
|
|
84004
84020
|
if (targetFlags & 111551 /* Value */) {
|
|
84005
84021
|
const moduleName = getFirstIdentifier(node.moduleReference);
|
|
84006
84022
|
if (!(resolveEntityName(moduleName, 111551 /* Value */ | 1920 /* Namespace */).flags & 1920 /* Namespace */)) {
|
|
84007
|
-
|
|
84023
|
+
error2(moduleName, Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name, declarationNameToString(moduleName));
|
|
84008
84024
|
}
|
|
84009
84025
|
}
|
|
84010
84026
|
if (targetFlags & 788968 /* Type */) {
|
|
@@ -84038,12 +84054,12 @@ function createTypeChecker(host) {
|
|
|
84038
84054
|
const inAmbientExternalModule = node.parent.kind === 267 /* ModuleBlock */ && isAmbientModule(node.parent.parent);
|
|
84039
84055
|
const inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 267 /* ModuleBlock */ && !node.moduleSpecifier && node.flags & 16777216 /* Ambient */;
|
|
84040
84056
|
if (node.parent.kind !== 311 /* SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) {
|
|
84041
|
-
|
|
84057
|
+
error2(node, Diagnostics.Export_declarations_are_not_permitted_in_a_namespace);
|
|
84042
84058
|
}
|
|
84043
84059
|
} else {
|
|
84044
84060
|
const moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier);
|
|
84045
84061
|
if (moduleSymbol && hasExportAssignmentSymbol(moduleSymbol)) {
|
|
84046
|
-
|
|
84062
|
+
error2(node.moduleSpecifier, Diagnostics.Module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol));
|
|
84047
84063
|
} else if (node.exportClause) {
|
|
84048
84064
|
checkAliasSymbol(node.exportClause);
|
|
84049
84065
|
}
|
|
@@ -84104,7 +84120,7 @@ function createTypeChecker(host) {
|
|
|
84104
84120
|
}
|
|
84105
84121
|
for (const statement of sourceFile.statements) {
|
|
84106
84122
|
if (canConvertImportDeclarationToTypeOnly(statement) || canConvertImportEqualsDeclarationToTypeOnly(statement)) {
|
|
84107
|
-
|
|
84123
|
+
error2(
|
|
84108
84124
|
statement,
|
|
84109
84125
|
Diagnostics.This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error
|
|
84110
84126
|
);
|
|
@@ -84134,7 +84150,7 @@ function createTypeChecker(host) {
|
|
|
84134
84150
|
true
|
|
84135
84151
|
);
|
|
84136
84152
|
if (symbol && (symbol === undefinedSymbol || symbol === globalThisSymbol || symbol.declarations && isGlobalSourceFile(getDeclarationContainer(symbol.declarations[0])))) {
|
|
84137
|
-
|
|
84153
|
+
error2(exportedName, Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, idText(exportedName));
|
|
84138
84154
|
} else {
|
|
84139
84155
|
if (!node.isTypeOnly && !node.parent.parent.isTypeOnly) {
|
|
84140
84156
|
markExportAsReferenced(node);
|
|
@@ -84158,9 +84174,9 @@ function createTypeChecker(host) {
|
|
|
84158
84174
|
const container = node.parent.kind === 311 /* SourceFile */ ? node.parent : node.parent.parent;
|
|
84159
84175
|
if (container.kind === 266 /* ModuleDeclaration */ && !isAmbientModule(container)) {
|
|
84160
84176
|
if (node.isExportEquals) {
|
|
84161
|
-
|
|
84177
|
+
error2(node, Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace);
|
|
84162
84178
|
} else {
|
|
84163
|
-
|
|
84179
|
+
error2(node, Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module);
|
|
84164
84180
|
}
|
|
84165
84181
|
return;
|
|
84166
84182
|
}
|
|
@@ -84188,14 +84204,14 @@ function createTypeChecker(host) {
|
|
|
84188
84204
|
if (getAllSymbolFlags(sym) & 111551 /* Value */) {
|
|
84189
84205
|
checkExpressionCached(id);
|
|
84190
84206
|
if (!isIllegalExportDefaultInCJS && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax && getTypeOnlyAliasDeclaration(sym, 111551 /* Value */)) {
|
|
84191
|
-
|
|
84207
|
+
error2(
|
|
84192
84208
|
id,
|
|
84193
84209
|
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,
|
|
84194
84210
|
idText(id)
|
|
84195
84211
|
);
|
|
84196
84212
|
}
|
|
84197
84213
|
} else if (!isIllegalExportDefaultInCJS && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax) {
|
|
84198
|
-
|
|
84214
|
+
error2(
|
|
84199
84215
|
id,
|
|
84200
84216
|
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,
|
|
84201
84217
|
idText(id)
|
|
@@ -84215,7 +84231,7 @@ function createTypeChecker(host) {
|
|
|
84215
84231
|
checkExpressionCached(node.expression);
|
|
84216
84232
|
}
|
|
84217
84233
|
if (isIllegalExportDefaultInCJS) {
|
|
84218
|
-
|
|
84234
|
+
error2(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
|
84219
84235
|
}
|
|
84220
84236
|
checkExternalModuleExports(container);
|
|
84221
84237
|
if (node.flags & 16777216 /* Ambient */ && !isEntityNameExpression(node.expression)) {
|
|
@@ -84240,7 +84256,7 @@ function createTypeChecker(host) {
|
|
|
84240
84256
|
if (exportEqualsSymbol && hasExportedMembers(moduleSymbol)) {
|
|
84241
84257
|
const declaration = getDeclarationOfAliasSymbol(exportEqualsSymbol) || exportEqualsSymbol.valueDeclaration;
|
|
84242
84258
|
if (declaration && !isTopLevelInExternalModuleAugmentation(declaration) && !isInJSFile(declaration)) {
|
|
84243
|
-
|
|
84259
|
+
error2(declaration, Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements);
|
|
84244
84260
|
}
|
|
84245
84261
|
}
|
|
84246
84262
|
const exports = getExportsOfModule(moduleSymbol);
|
|
@@ -84506,16 +84522,16 @@ function createTypeChecker(host) {
|
|
|
84506
84522
|
const { parent: parent2 } = node;
|
|
84507
84523
|
if (isParameter(parent2) && isJSDocFunctionType(parent2.parent)) {
|
|
84508
84524
|
if (last(parent2.parent.parameters) !== parent2) {
|
|
84509
|
-
|
|
84525
|
+
error2(node, Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list);
|
|
84510
84526
|
}
|
|
84511
84527
|
return;
|
|
84512
84528
|
}
|
|
84513
84529
|
if (!isJSDocTypeExpression(parent2)) {
|
|
84514
|
-
|
|
84530
|
+
error2(node, Diagnostics.JSDoc_may_only_appear_in_the_last_parameter_of_a_signature);
|
|
84515
84531
|
}
|
|
84516
84532
|
const paramTag = node.parent.parent;
|
|
84517
84533
|
if (!isJSDocParameterTag(paramTag)) {
|
|
84518
|
-
|
|
84534
|
+
error2(node, Diagnostics.JSDoc_may_only_appear_in_the_last_parameter_of_a_signature);
|
|
84519
84535
|
return;
|
|
84520
84536
|
}
|
|
84521
84537
|
const param = getParameterSymbolFromJSDoc(paramTag);
|
|
@@ -84524,7 +84540,7 @@ function createTypeChecker(host) {
|
|
|
84524
84540
|
}
|
|
84525
84541
|
const host2 = getHostSignatureFromJSDoc(paramTag);
|
|
84526
84542
|
if (!host2 || last(host2.parameters).symbol !== param) {
|
|
84527
|
-
|
|
84543
|
+
error2(node, Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list);
|
|
84528
84544
|
}
|
|
84529
84545
|
}
|
|
84530
84546
|
function getTypeFromJSDocVariadicType(node) {
|
|
@@ -86361,18 +86377,18 @@ function createTypeChecker(host) {
|
|
|
86361
86377
|
requestedExternalEmitHelperNames.add(name);
|
|
86362
86378
|
const symbol = resolveSymbol(getSymbol2(getExportsOfModule(helpersModule), escapeLeadingUnderscores(name), 111551 /* Value */));
|
|
86363
86379
|
if (!symbol) {
|
|
86364
|
-
|
|
86380
|
+
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);
|
|
86365
86381
|
} else if (helper & 524288 /* ClassPrivateFieldGet */) {
|
|
86366
86382
|
if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 3)) {
|
|
86367
|
-
|
|
86383
|
+
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);
|
|
86368
86384
|
}
|
|
86369
86385
|
} else if (helper & 1048576 /* ClassPrivateFieldSet */) {
|
|
86370
86386
|
if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 4)) {
|
|
86371
|
-
|
|
86387
|
+
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);
|
|
86372
86388
|
}
|
|
86373
86389
|
} else if (helper & 1024 /* SpreadArray */) {
|
|
86374
86390
|
if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 2)) {
|
|
86375
|
-
|
|
86391
|
+
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);
|
|
86376
86392
|
}
|
|
86377
86393
|
}
|
|
86378
86394
|
}
|
|
@@ -86479,7 +86495,7 @@ function createTypeChecker(host) {
|
|
|
86479
86495
|
const sourceFile = getSourceFileOfNode(modifier);
|
|
86480
86496
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
86481
86497
|
addRelatedInfo(
|
|
86482
|
-
|
|
86498
|
+
error2(modifier, Diagnostics.Decorators_may_not_appear_after_export_or_export_default_if_they_also_appear_before_export),
|
|
86483
86499
|
createDiagnosticForNode(firstDecorator, Diagnostics.Decorator_used_before_export_here)
|
|
86484
86500
|
);
|
|
86485
86501
|
return true;
|
|
@@ -86872,12 +86888,12 @@ function createTypeChecker(host) {
|
|
|
86872
86888
|
if (length(nonSimpleParameters)) {
|
|
86873
86889
|
forEach(nonSimpleParameters, (parameter) => {
|
|
86874
86890
|
addRelatedInfo(
|
|
86875
|
-
|
|
86891
|
+
error2(parameter, Diagnostics.This_parameter_is_not_allowed_with_use_strict_directive),
|
|
86876
86892
|
createDiagnosticForNode(useStrictDirective, Diagnostics.use_strict_directive_used_here)
|
|
86877
86893
|
);
|
|
86878
86894
|
});
|
|
86879
86895
|
const diagnostics2 = nonSimpleParameters.map((parameter, index) => index === 0 ? createDiagnosticForNode(parameter, Diagnostics.Non_simple_parameter_declared_here) : createDiagnosticForNode(parameter, Diagnostics.and_here));
|
|
86880
|
-
addRelatedInfo(
|
|
86896
|
+
addRelatedInfo(error2(useStrictDirective, Diagnostics.use_strict_directive_cannot_be_used_with_non_simple_parameter_list), ...diagnostics2);
|
|
86881
86897
|
return true;
|
|
86882
86898
|
}
|
|
86883
86899
|
}
|
|
@@ -89645,13 +89661,13 @@ function decodeMappings(mappings) {
|
|
|
89645
89661
|
let sourceLine = 0;
|
|
89646
89662
|
let sourceCharacter = 0;
|
|
89647
89663
|
let nameIndex = 0;
|
|
89648
|
-
let
|
|
89664
|
+
let error2;
|
|
89649
89665
|
return {
|
|
89650
89666
|
get pos() {
|
|
89651
89667
|
return pos;
|
|
89652
89668
|
},
|
|
89653
89669
|
get error() {
|
|
89654
|
-
return
|
|
89670
|
+
return error2;
|
|
89655
89671
|
},
|
|
89656
89672
|
get state() {
|
|
89657
89673
|
return captureMapping(
|
|
@@ -89736,8 +89752,8 @@ function decodeMappings(mappings) {
|
|
|
89736
89752
|
return { value: void 0, done: true };
|
|
89737
89753
|
}
|
|
89738
89754
|
function setError(message) {
|
|
89739
|
-
if (
|
|
89740
|
-
|
|
89755
|
+
if (error2 === void 0) {
|
|
89756
|
+
error2 = message;
|
|
89741
89757
|
}
|
|
89742
89758
|
}
|
|
89743
89759
|
function setErrorAndStopIterating(message) {
|
|
@@ -89745,7 +89761,7 @@ function decodeMappings(mappings) {
|
|
|
89745
89761
|
return stopIterating();
|
|
89746
89762
|
}
|
|
89747
89763
|
function hasReportedError() {
|
|
89748
|
-
return
|
|
89764
|
+
return error2 !== void 0;
|
|
89749
89765
|
}
|
|
89750
89766
|
function isSourceMappingSegmentEnd() {
|
|
89751
89767
|
return pos === mappings.length || mappings.charCodeAt(pos) === 44 /* comma */ || mappings.charCodeAt(pos) === 59 /* semicolon */;
|
|
@@ -119374,13 +119390,13 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119374
119390
|
sourceFileOptions,
|
|
119375
119391
|
/*onError*/
|
|
119376
119392
|
void 0,
|
|
119377
|
-
shouldCreateNewSourceFile
|
|
119393
|
+
shouldCreateNewSourceFile
|
|
119378
119394
|
) : host.getSourceFile(
|
|
119379
119395
|
oldSourceFile.fileName,
|
|
119380
119396
|
sourceFileOptions,
|
|
119381
119397
|
/*onError*/
|
|
119382
119398
|
void 0,
|
|
119383
|
-
shouldCreateNewSourceFile
|
|
119399
|
+
shouldCreateNewSourceFile
|
|
119384
119400
|
);
|
|
119385
119401
|
if (!newSourceFile) {
|
|
119386
119402
|
return 0 /* Not */;
|
|
@@ -120336,7 +120352,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120336
120352
|
return typeof result === "object" ? { ...result, languageVersion, setExternalModuleIndicator: setExternalModuleIndicator2 } : { languageVersion, impliedNodeFormat: result, setExternalModuleIndicator: setExternalModuleIndicator2 };
|
|
120337
120353
|
}
|
|
120338
120354
|
function findSourceFileWorker(fileName, isDefaultLib, ignoreNoDefaultLib, reason, packageId) {
|
|
120339
|
-
var _a2
|
|
120355
|
+
var _a2;
|
|
120340
120356
|
const path = toPath3(fileName);
|
|
120341
120357
|
if (useSourceOfProjectReferenceRedirect) {
|
|
120342
120358
|
let source = getSourceOfProjectReferenceRedirect(path);
|
|
@@ -120415,7 +120431,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120415
120431
|
Diagnostics.Cannot_read_file_0_Colon_1,
|
|
120416
120432
|
[fileName, hostErrorMessage]
|
|
120417
120433
|
),
|
|
120418
|
-
shouldCreateNewSourceFile
|
|
120434
|
+
shouldCreateNewSourceFile
|
|
120419
120435
|
);
|
|
120420
120436
|
if (packageId) {
|
|
120421
120437
|
const packageIdKey = packageIdToString(packageId);
|
|
@@ -120440,7 +120456,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120440
120456
|
file.path = path;
|
|
120441
120457
|
file.resolvedPath = toPath3(fileName);
|
|
120442
120458
|
file.originalFileName = originalFileName;
|
|
120443
|
-
file.packageJsonLocations = ((
|
|
120459
|
+
file.packageJsonLocations = ((_a2 = sourceFileOptions.packageJsonLocations) == null ? void 0 : _a2.length) ? sourceFileOptions.packageJsonLocations : void 0;
|
|
120444
120460
|
file.packageJsonScope = sourceFileOptions.packageJsonScope;
|
|
120445
120461
|
addFileIncludeReason(file, reason);
|
|
120446
120462
|
if (host.useCaseSensitiveFileNames()) {
|
|
@@ -124695,17 +124711,17 @@ function getFilesInErrorForSummary(diagnostics) {
|
|
|
124695
124711
|
function getWatchErrorSummaryDiagnosticMessage(errorCount) {
|
|
124696
124712
|
return errorCount === 1 ? Diagnostics.Found_1_error_Watching_for_file_changes : Diagnostics.Found_0_errors_Watching_for_file_changes;
|
|
124697
124713
|
}
|
|
124698
|
-
function prettyPathForFileError(
|
|
124699
|
-
const line = formatColorAndReset(":" +
|
|
124700
|
-
if (pathIsAbsolute(
|
|
124714
|
+
function prettyPathForFileError(error2, cwd) {
|
|
124715
|
+
const line = formatColorAndReset(":" + error2.line, "\x1B[90m" /* Grey */);
|
|
124716
|
+
if (pathIsAbsolute(error2.fileName) && pathIsAbsolute(cwd)) {
|
|
124701
124717
|
return getRelativePathFromDirectory(
|
|
124702
124718
|
cwd,
|
|
124703
|
-
|
|
124719
|
+
error2.fileName,
|
|
124704
124720
|
/*ignoreCase*/
|
|
124705
124721
|
false
|
|
124706
124722
|
) + line;
|
|
124707
124723
|
}
|
|
124708
|
-
return
|
|
124724
|
+
return error2.fileName + line;
|
|
124709
124725
|
}
|
|
124710
124726
|
function getErrorSummaryText(errorCount, filesInError, newLine, host) {
|
|
124711
124727
|
if (errorCount === 0)
|
|
@@ -125570,7 +125586,8 @@ function createWatchProgram(host) {
|
|
|
125570
125586
|
if (isFileMissingOnHost(hostSourceFile)) {
|
|
125571
125587
|
return void 0;
|
|
125572
125588
|
}
|
|
125573
|
-
|
|
125589
|
+
const impliedNodeFormat = typeof languageVersionOrOptions === "object" ? languageVersionOrOptions.impliedNodeFormat : void 0;
|
|
125590
|
+
if (hostSourceFile === void 0 || shouldCreateNewSourceFile || isFilePresenceUnknownOnHost(hostSourceFile) || hostSourceFile.sourceFile.impliedNodeFormat !== impliedNodeFormat) {
|
|
125574
125591
|
const sourceFile = getNewSourceFile(fileName, languageVersionOrOptions, onError);
|
|
125575
125592
|
if (hostSourceFile) {
|
|
125576
125593
|
if (sourceFile) {
|
|
@@ -133354,13 +133371,6 @@ function createDocumentRegistryInternal(useCaseSensitiveFileNames, currentDirect
|
|
|
133354
133371
|
}
|
|
133355
133372
|
}
|
|
133356
133373
|
}
|
|
133357
|
-
function getLanguageServiceRefCounts(path, scriptKind) {
|
|
133358
|
-
return arrayFrom(buckets.entries(), ([key, bucket]) => {
|
|
133359
|
-
const bucketEntry = bucket.get(path);
|
|
133360
|
-
const entry = bucketEntry && getDocumentRegistryEntry(bucketEntry, scriptKind);
|
|
133361
|
-
return [key, entry && entry.languageServiceRefCount];
|
|
133362
|
-
});
|
|
133363
|
-
}
|
|
133364
133374
|
return {
|
|
133365
133375
|
acquireDocument,
|
|
133366
133376
|
acquireDocumentWithKey,
|
|
@@ -133368,9 +133378,10 @@ function createDocumentRegistryInternal(useCaseSensitiveFileNames, currentDirect
|
|
|
133368
133378
|
updateDocumentWithKey,
|
|
133369
133379
|
releaseDocument,
|
|
133370
133380
|
releaseDocumentWithKey,
|
|
133371
|
-
|
|
133381
|
+
getKeyForCompilationSettings,
|
|
133382
|
+
getDocumentRegistryBucketKeyWithMode,
|
|
133372
133383
|
reportStats,
|
|
133373
|
-
|
|
133384
|
+
getBuckets: () => buckets
|
|
133374
133385
|
};
|
|
133375
133386
|
}
|
|
133376
133387
|
function getKeyForCompilationSettings(settings) {
|
|
@@ -136564,15 +136575,22 @@ registerRefactor(refactorNameForMoveToFile, {
|
|
|
136564
136575
|
getEditsForAction: function getRefactorEditsToMoveToFile(context, actionName2, interactiveRefactorArguments) {
|
|
136565
136576
|
Debug.assert(actionName2 === refactorNameForMoveToFile, "Wrong refactor invoked");
|
|
136566
136577
|
const statements = Debug.checkDefined(getStatementsToMove(context));
|
|
136578
|
+
const { host, program } = context;
|
|
136567
136579
|
Debug.assert(interactiveRefactorArguments, "No interactive refactor arguments available");
|
|
136568
136580
|
const targetFile = interactiveRefactorArguments.targetFile;
|
|
136569
136581
|
if (hasJSFileExtension(targetFile) || hasTSFileExtension(targetFile)) {
|
|
136570
|
-
|
|
136582
|
+
if (host.fileExists(targetFile) && program.getSourceFile(targetFile) === void 0) {
|
|
136583
|
+
return error(getLocaleSpecificMessage(Diagnostics.Cannot_move_statements_to_the_selected_file));
|
|
136584
|
+
}
|
|
136585
|
+
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange4(context, context.file, interactiveRefactorArguments.targetFile, program, statements, t, context.host, context.preferences));
|
|
136571
136586
|
return { edits, renameFilename: void 0, renameLocation: void 0 };
|
|
136572
136587
|
}
|
|
136573
|
-
return
|
|
136588
|
+
return error(getLocaleSpecificMessage(Diagnostics.Cannot_move_to_file_selected_file_is_invalid));
|
|
136574
136589
|
}
|
|
136575
136590
|
});
|
|
136591
|
+
function error(notApplicableReason) {
|
|
136592
|
+
return { edits: [], renameFilename: void 0, renameLocation: void 0, notApplicableReason };
|
|
136593
|
+
}
|
|
136576
136594
|
function doChange4(context, oldFile, targetFile, program, toMove, changes, host, preferences) {
|
|
136577
136595
|
const checker = program.getTypeChecker();
|
|
136578
136596
|
const usage = getUsageInfo(oldFile, toMove.all, checker);
|
|
@@ -137801,25 +137819,25 @@ function getRefactorActionsToConvertFunctionExpressions(context) {
|
|
|
137801
137819
|
const possibleActions = [];
|
|
137802
137820
|
const errors = [];
|
|
137803
137821
|
if (refactorKindBeginsWith(toNamedFunctionAction.kind, kind)) {
|
|
137804
|
-
const
|
|
137805
|
-
if (
|
|
137806
|
-
errors.push({ ...toNamedFunctionAction, notApplicableReason:
|
|
137822
|
+
const error2 = selectedVariableDeclaration || isArrowFunction(func) && isVariableDeclaration(func.parent) ? void 0 : getLocaleSpecificMessage(Diagnostics.Could_not_convert_to_named_function);
|
|
137823
|
+
if (error2) {
|
|
137824
|
+
errors.push({ ...toNamedFunctionAction, notApplicableReason: error2 });
|
|
137807
137825
|
} else {
|
|
137808
137826
|
possibleActions.push(toNamedFunctionAction);
|
|
137809
137827
|
}
|
|
137810
137828
|
}
|
|
137811
137829
|
if (refactorKindBeginsWith(toAnonymousFunctionAction.kind, kind)) {
|
|
137812
|
-
const
|
|
137813
|
-
if (
|
|
137814
|
-
errors.push({ ...toAnonymousFunctionAction, notApplicableReason:
|
|
137830
|
+
const error2 = !selectedVariableDeclaration && isArrowFunction(func) ? void 0 : getLocaleSpecificMessage(Diagnostics.Could_not_convert_to_anonymous_function);
|
|
137831
|
+
if (error2) {
|
|
137832
|
+
errors.push({ ...toAnonymousFunctionAction, notApplicableReason: error2 });
|
|
137815
137833
|
} else {
|
|
137816
137834
|
possibleActions.push(toAnonymousFunctionAction);
|
|
137817
137835
|
}
|
|
137818
137836
|
}
|
|
137819
137837
|
if (refactorKindBeginsWith(toArrowFunctionAction.kind, kind)) {
|
|
137820
|
-
const
|
|
137821
|
-
if (
|
|
137822
|
-
errors.push({ ...toArrowFunctionAction, notApplicableReason:
|
|
137838
|
+
const error2 = isFunctionExpression(func) ? void 0 : getLocaleSpecificMessage(Diagnostics.Could_not_convert_to_arrow_function);
|
|
137839
|
+
if (error2) {
|
|
137840
|
+
errors.push({ ...toArrowFunctionAction, notApplicableReason: error2 });
|
|
137823
137841
|
} else {
|
|
137824
137842
|
possibleActions.push(toArrowFunctionAction);
|
|
137825
137843
|
}
|
|
@@ -139106,11 +139124,11 @@ function getRefactorActionsToExtractSymbol(context) {
|
|
|
139106
139124
|
}
|
|
139107
139125
|
return infos.length ? infos : emptyArray;
|
|
139108
139126
|
function getStringError(errors) {
|
|
139109
|
-
let
|
|
139110
|
-
if (typeof
|
|
139111
|
-
|
|
139127
|
+
let error2 = errors[0].messageText;
|
|
139128
|
+
if (typeof error2 !== "string") {
|
|
139129
|
+
error2 = error2.messageText;
|
|
139112
139130
|
}
|
|
139113
|
-
return
|
|
139131
|
+
return error2;
|
|
139114
139132
|
}
|
|
139115
139133
|
}
|
|
139116
139134
|
function getRefactorEditsToExtractSymbol(context, actionName2) {
|
|
@@ -141886,9 +141904,9 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
|
141886
141904
|
function getValidSourceFile(fileName) {
|
|
141887
141905
|
const sourceFile = program.getSourceFile(fileName);
|
|
141888
141906
|
if (!sourceFile) {
|
|
141889
|
-
const
|
|
141890
|
-
|
|
141891
|
-
throw
|
|
141907
|
+
const error2 = new Error(`Could not find source file: '${fileName}'.`);
|
|
141908
|
+
error2.ProgramFiles = program.getSourceFiles().map((f) => f.fileName);
|
|
141909
|
+
throw error2;
|
|
141892
141910
|
}
|
|
141893
141911
|
return sourceFile;
|
|
141894
141912
|
}
|
|
@@ -142121,14 +142139,14 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
|
142121
142139
|
}
|
|
142122
142140
|
}
|
|
142123
142141
|
function cleanupSemanticCache() {
|
|
142124
|
-
program = void 0;
|
|
142125
|
-
}
|
|
142126
|
-
function dispose() {
|
|
142127
142142
|
if (program) {
|
|
142128
142143
|
const key = documentRegistry.getKeyForCompilationSettings(program.getCompilerOptions());
|
|
142129
142144
|
forEach(program.getSourceFiles(), (f) => documentRegistry.releaseDocumentWithKey(f.resolvedPath, key, f.scriptKind, f.impliedNodeFormat));
|
|
142130
142145
|
program = void 0;
|
|
142131
142146
|
}
|
|
142147
|
+
}
|
|
142148
|
+
function dispose() {
|
|
142149
|
+
cleanupSemanticCache();
|
|
142132
142150
|
host = void 0;
|
|
142133
142151
|
}
|
|
142134
142152
|
function getSyntacticDiagnostics(fileName) {
|
|
@@ -145104,9 +145122,9 @@ function createCodeFixActionWorker(fixName8, description3, changes, fixId52, fix
|
|
|
145104
145122
|
return { fixName: fixName8, description: description3, changes, fixId: fixId52, fixAllDescription, commands: command ? [command] : void 0 };
|
|
145105
145123
|
}
|
|
145106
145124
|
function registerCodeFix(reg) {
|
|
145107
|
-
for (const
|
|
145125
|
+
for (const error2 of reg.errorCodes) {
|
|
145108
145126
|
errorCodeToFixesArray = void 0;
|
|
145109
|
-
errorCodeToFixes.add(String(
|
|
145127
|
+
errorCodeToFixes.add(String(error2), reg);
|
|
145110
145128
|
}
|
|
145111
145129
|
if (reg.fixIds) {
|
|
145112
145130
|
for (const fixId52 of reg.fixIds) {
|
|
@@ -154780,8 +154798,8 @@ registerCodeFix({
|
|
|
154780
154798
|
return [createCodeFixAction(fixId48, changes, Diagnostics.Split_into_two_separate_import_declarations, fixId48, Diagnostics.Split_all_invalid_type_only_imports)];
|
|
154781
154799
|
}
|
|
154782
154800
|
},
|
|
154783
|
-
getAllCodeActions: (context) => codeFixAll(context, errorCodes60, (changes,
|
|
154784
|
-
splitTypeOnlyImport(changes, getImportDeclaration2(context.sourceFile,
|
|
154801
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes60, (changes, error2) => {
|
|
154802
|
+
splitTypeOnlyImport(changes, getImportDeclaration2(context.sourceFile, error2), context);
|
|
154785
154803
|
})
|
|
154786
154804
|
});
|
|
154787
154805
|
function getImportDeclaration2(sourceFile, span) {
|
|
@@ -163397,7 +163415,7 @@ function organizeImports(sourceFile, formatContext, host, program, preferences,
|
|
|
163397
163415
|
if (length(oldImportDecls) === 0) {
|
|
163398
163416
|
return;
|
|
163399
163417
|
}
|
|
163400
|
-
|
|
163418
|
+
setEmitFlags(oldImportDecls[0], 1024 /* NoLeadingComments */);
|
|
163401
163419
|
const oldImportGroups = shouldCombine ? group(oldImportDecls, (importDecl) => getExternalModuleName2(importDecl.moduleSpecifier)) : [oldImportDecls];
|
|
163402
163420
|
const sortedImportGroups = shouldSort ? stableSort(oldImportGroups, (group1, group2) => compareModuleSpecifiersWorker(group1[0].moduleSpecifier, group2[0].moduleSpecifier, comparer)) : oldImportGroups;
|
|
163403
163421
|
const newImportDecls = flatMap(sortedImportGroups, (importGroup) => getExternalModuleName2(importGroup[0].moduleSpecifier) || importGroup[0].moduleSpecifier === void 0 ? coalesce(importGroup) : importGroup);
|
|
@@ -168492,11 +168510,11 @@ function prepareRangeContainsErrorFunction(errors, originalRange) {
|
|
|
168492
168510
|
if (index >= sorted.length) {
|
|
168493
168511
|
return false;
|
|
168494
168512
|
}
|
|
168495
|
-
const
|
|
168496
|
-
if (r.end <=
|
|
168513
|
+
const error2 = sorted[index];
|
|
168514
|
+
if (r.end <= error2.start) {
|
|
168497
168515
|
return false;
|
|
168498
168516
|
}
|
|
168499
|
-
if (startEndOverlapsWithStartEnd(r.pos, r.end,
|
|
168517
|
+
if (startEndOverlapsWithStartEnd(r.pos, r.end, error2.start, error2.start + error2.length)) {
|
|
168500
168518
|
return true;
|
|
168501
168519
|
}
|
|
168502
168520
|
index++;
|
|
@@ -171173,6 +171191,7 @@ __export(ts_exports2, {
|
|
|
171173
171191
|
isDiagnosticWithLocation: () => isDiagnosticWithLocation,
|
|
171174
171192
|
isDiskPathRoot: () => isDiskPathRoot,
|
|
171175
171193
|
isDoStatement: () => isDoStatement,
|
|
171194
|
+
isDocumentRegistryEntry: () => isDocumentRegistryEntry,
|
|
171176
171195
|
isDotDotDotToken: () => isDotDotDotToken,
|
|
171177
171196
|
isDottedName: () => isDottedName,
|
|
171178
171197
|
isDynamicName: () => isDynamicName,
|
|
@@ -172195,11 +172214,11 @@ var typeScriptVersion2;
|
|
|
172195
172214
|
function getTypeScriptVersion() {
|
|
172196
172215
|
return typeScriptVersion2 ?? (typeScriptVersion2 = new Version(version));
|
|
172197
172216
|
}
|
|
172198
|
-
function formatDeprecationMessage(name,
|
|
172199
|
-
let deprecationMessage =
|
|
172217
|
+
function formatDeprecationMessage(name, error2, errorAfter, since, message) {
|
|
172218
|
+
let deprecationMessage = error2 ? "DeprecationError: " : "DeprecationWarning: ";
|
|
172200
172219
|
deprecationMessage += `'${name}' `;
|
|
172201
172220
|
deprecationMessage += since ? `has been deprecated since v${since}` : "is deprecated";
|
|
172202
|
-
deprecationMessage +=
|
|
172221
|
+
deprecationMessage += error2 ? " and can no longer be used." : errorAfter ? ` and will no longer be usable after v${errorAfter}.` : ".";
|
|
172203
172222
|
deprecationMessage += message ? ` ${formatStringFromArgs(message, [name], 0)}` : "";
|
|
172204
172223
|
return deprecationMessage;
|
|
172205
172224
|
}
|
|
@@ -172237,9 +172256,9 @@ function createDeprecation(name, options = {}) {
|
|
|
172237
172256
|
const errorAfter = typeof options.errorAfter === "string" ? new Version(options.errorAfter) : options.errorAfter;
|
|
172238
172257
|
const warnAfter = typeof options.warnAfter === "string" ? new Version(options.warnAfter) : options.warnAfter;
|
|
172239
172258
|
const since = typeof options.since === "string" ? new Version(options.since) : options.since ?? warnAfter;
|
|
172240
|
-
const
|
|
172259
|
+
const error2 = options.error || errorAfter && version2.compareTo(errorAfter) >= 0;
|
|
172241
172260
|
const warn = !warnAfter || version2.compareTo(warnAfter) >= 0;
|
|
172242
|
-
return
|
|
172261
|
+
return error2 ? createErrorDeprecation(name, errorAfter, since, options.message) : warn ? createWarningDeprecation(name, errorAfter, since, options.message) : noop;
|
|
172243
172262
|
}
|
|
172244
172263
|
function wrapFunction(deprecation, func) {
|
|
172245
172264
|
return function() {
|
|
@@ -172337,6 +172356,7 @@ __export(ts_server_exports3, {
|
|
|
172337
172356
|
ActionWatchTypingLocations: () => ActionWatchTypingLocations,
|
|
172338
172357
|
Arguments: () => Arguments,
|
|
172339
172358
|
AutoImportProviderProject: () => AutoImportProviderProject,
|
|
172359
|
+
AuxiliaryProject: () => AuxiliaryProject,
|
|
172340
172360
|
CharRangeSection: () => CharRangeSection,
|
|
172341
172361
|
CommandNames: () => CommandNames,
|
|
172342
172362
|
ConfigFileDiagEvent: () => ConfigFileDiagEvent,
|
|
@@ -174370,6 +174390,16 @@ var Project3 = class {
|
|
|
174370
174390
|
true
|
|
174371
174391
|
);
|
|
174372
174392
|
}
|
|
174393
|
+
/** @internal */
|
|
174394
|
+
cleanupProgram() {
|
|
174395
|
+
if (this.program) {
|
|
174396
|
+
for (const f of this.program.getSourceFiles()) {
|
|
174397
|
+
this.detachScriptInfoIfNotRoot(f.fileName);
|
|
174398
|
+
}
|
|
174399
|
+
this.program.forEachResolvedProjectReference((ref) => this.detachScriptInfoFromProject(ref.sourceFile.fileName));
|
|
174400
|
+
this.program = void 0;
|
|
174401
|
+
}
|
|
174402
|
+
}
|
|
174373
174403
|
disableLanguageService(lastFileExceededProgramSize) {
|
|
174374
174404
|
if (!this.languageServiceEnabled) {
|
|
174375
174405
|
return;
|
|
@@ -174377,6 +174407,7 @@ var Project3 = class {
|
|
|
174377
174407
|
Debug.assert(this.projectService.serverMode !== 2 /* Syntactic */);
|
|
174378
174408
|
this.languageService.cleanupSemanticCache();
|
|
174379
174409
|
this.languageServiceEnabled = false;
|
|
174410
|
+
this.cleanupProgram();
|
|
174380
174411
|
this.lastFileExceededProgramSize = lastFileExceededProgramSize;
|
|
174381
174412
|
this.builderState = void 0;
|
|
174382
174413
|
if (this.autoImportProviderHost) {
|
|
@@ -174385,6 +174416,7 @@ var Project3 = class {
|
|
|
174385
174416
|
this.autoImportProviderHost = void 0;
|
|
174386
174417
|
this.resolutionCache.closeTypeRootsWatch();
|
|
174387
174418
|
this.clearGeneratedFileWatch();
|
|
174419
|
+
this.projectService.verifyDocumentRegistry();
|
|
174388
174420
|
this.projectService.onUpdateLanguageServiceStateForProject(
|
|
174389
174421
|
this,
|
|
174390
174422
|
/*languageServiceEnabled*/
|
|
@@ -174428,12 +174460,7 @@ var Project3 = class {
|
|
|
174428
174460
|
close() {
|
|
174429
174461
|
this.projectService.typingsCache.onProjectClosed(this);
|
|
174430
174462
|
this.closeWatchingTypingLocations();
|
|
174431
|
-
|
|
174432
|
-
for (const f of this.program.getSourceFiles()) {
|
|
174433
|
-
this.detachScriptInfoIfNotRoot(f.fileName);
|
|
174434
|
-
}
|
|
174435
|
-
this.program.forEachResolvedProjectReference((ref) => this.detachScriptInfoFromProject(ref.sourceFile.fileName));
|
|
174436
|
-
}
|
|
174463
|
+
this.cleanupProgram();
|
|
174437
174464
|
forEach(this.externalFiles, (externalFile) => this.detachScriptInfoIfNotRoot(externalFile));
|
|
174438
174465
|
for (const root of this.rootFiles) {
|
|
174439
174466
|
root.detachFromProject(this);
|
|
@@ -174811,6 +174838,7 @@ var Project3 = class {
|
|
|
174811
174838
|
updateGraphWorker() {
|
|
174812
174839
|
var _a, _b;
|
|
174813
174840
|
const oldProgram = this.languageService.getCurrentProgram();
|
|
174841
|
+
Debug.assert(oldProgram === this.program);
|
|
174814
174842
|
Debug.assert(!this.isClosed(), "Called update graph worker of closed project");
|
|
174815
174843
|
this.writeLog(`Starting updateGraphWorker: Project: ${this.getProjectName()}`);
|
|
174816
174844
|
const start2 = timestamp();
|
|
@@ -174941,6 +174969,7 @@ var Project3 = class {
|
|
|
174941
174969
|
} else if (this.program !== oldProgram) {
|
|
174942
174970
|
this.writeLog(`Different program with same set of files`);
|
|
174943
174971
|
}
|
|
174972
|
+
this.projectService.verifyDocumentRegistry();
|
|
174944
174973
|
return hasNewProgram;
|
|
174945
174974
|
}
|
|
174946
174975
|
/** @internal */
|
|
@@ -175585,7 +175614,6 @@ var AuxiliaryProject = class extends Project3 {
|
|
|
175585
175614
|
isOrphan() {
|
|
175586
175615
|
return true;
|
|
175587
175616
|
}
|
|
175588
|
-
/** @internal */
|
|
175589
175617
|
scheduleInvalidateResolutionsOfFailedLookupLocations() {
|
|
175590
175618
|
return;
|
|
175591
175619
|
}
|
|
@@ -176465,6 +176493,9 @@ var _ProjectService = class {
|
|
|
176465
176493
|
this.sharedExtendedConfigFileWatchers = /* @__PURE__ */ new Map();
|
|
176466
176494
|
/** @internal */
|
|
176467
176495
|
this.extendedConfigCache = /* @__PURE__ */ new Map();
|
|
176496
|
+
/** @internal */
|
|
176497
|
+
this.verifyDocumentRegistry = noop;
|
|
176498
|
+
var _a;
|
|
176468
176499
|
this.host = opts.host;
|
|
176469
176500
|
this.logger = opts.logger;
|
|
176470
176501
|
this.cancellationToken = opts.cancellationToken;
|
|
@@ -176512,6 +176543,7 @@ var _ProjectService = class {
|
|
|
176512
176543
|
watchFile: returnNoopFileWatcher,
|
|
176513
176544
|
watchDirectory: returnNoopFileWatcher
|
|
176514
176545
|
} : getWatchFactory(this.host, watchLogLevel, log, getDetailWatchInfo);
|
|
176546
|
+
(_a = opts.incrementalVerifier) == null ? void 0 : _a.call(opts, this);
|
|
176515
176547
|
}
|
|
176516
176548
|
toPath(fileName) {
|
|
176517
176549
|
return toPath(fileName, this.currentDirectory, this.toCanonicalFileName);
|
|
@@ -177840,6 +177872,7 @@ var _ProjectService = class {
|
|
|
177840
177872
|
/*ensureSynchronized*/
|
|
177841
177873
|
false
|
|
177842
177874
|
).cleanupSemanticCache();
|
|
177875
|
+
project.cleanupProgram();
|
|
177843
177876
|
project.markAsDirty();
|
|
177844
177877
|
}
|
|
177845
177878
|
sendConfigFileDiagEvent(project, triggerFile) {
|
|
@@ -180709,7 +180742,8 @@ var Session3 = class {
|
|
|
180709
180742
|
allowLocalPluginLoads: opts.allowLocalPluginLoads,
|
|
180710
180743
|
typesMapLocation: opts.typesMapLocation,
|
|
180711
180744
|
serverMode: opts.serverMode,
|
|
180712
|
-
session: this
|
|
180745
|
+
session: this,
|
|
180746
|
+
incrementalVerifier: opts.incrementalVerifier
|
|
180713
180747
|
};
|
|
180714
180748
|
this.projectService = new ProjectService3(settings);
|
|
180715
180749
|
this.projectService.setPerformanceEventHandler(this.performanceEventHandler.bind(this));
|
|
@@ -181029,6 +181063,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
181029
181063
|
/*ensureSynchronized*/
|
|
181030
181064
|
false
|
|
181031
181065
|
).cleanupSemanticCache();
|
|
181066
|
+
p.cleanupProgram();
|
|
181032
181067
|
}
|
|
181033
181068
|
}
|
|
181034
181069
|
cleanup() {
|
|
@@ -183567,6 +183602,7 @@ __export(ts_server_exports4, {
|
|
|
183567
183602
|
ActionWatchTypingLocations: () => ActionWatchTypingLocations,
|
|
183568
183603
|
Arguments: () => Arguments,
|
|
183569
183604
|
AutoImportProviderProject: () => AutoImportProviderProject,
|
|
183605
|
+
AuxiliaryProject: () => AuxiliaryProject,
|
|
183570
183606
|
CharRangeSection: () => CharRangeSection,
|
|
183571
183607
|
CommandNames: () => CommandNames,
|
|
183572
183608
|
ConfigFileDiagEvent: () => ConfigFileDiagEvent,
|
|
@@ -185646,6 +185682,7 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
185646
185682
|
isDiagnosticWithLocation,
|
|
185647
185683
|
isDiskPathRoot,
|
|
185648
185684
|
isDoStatement,
|
|
185685
|
+
isDocumentRegistryEntry,
|
|
185649
185686
|
isDotDotDotToken,
|
|
185650
185687
|
isDottedName,
|
|
185651
185688
|
isDynamicName,
|