@typescript-deploys/pr-build 5.2.0-pr-54546-4 → 5.2.0-pr-54581-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/lib.es2015.collection.d.ts +9 -9
- package/lib/lib.es2015.iterable.d.ts +4 -4
- package/lib/lib.es2015.symbol.wellknown.d.ts +2 -2
- package/lib/lib.es2021.weakref.d.ts +19 -16
- package/lib/lib.es2023.collection.d.ts +21 -0
- package/lib/lib.es2023.d.ts +1 -0
- package/lib/lib.es5.d.ts +9 -0
- package/lib/tsc.js +48 -95
- package/lib/tsserver.js +640 -683
- package/lib/tsserverlibrary.js +639 -680
- package/lib/typescript.js +613 -669
- package/lib/typingsInstaller.js +24 -2
- package/package.json +2 -2
package/lib/tsserver.js
CHANGED
|
@@ -919,11 +919,8 @@ __export(server_exports, {
|
|
|
919
919
|
getOriginalNodeId: () => getOriginalNodeId,
|
|
920
920
|
getOriginalSourceFile: () => getOriginalSourceFile,
|
|
921
921
|
getOutputDeclarationFileName: () => getOutputDeclarationFileName,
|
|
922
|
-
getOutputDeclarationFileNameWithoutConfigFile: () => getOutputDeclarationFileNameWithoutConfigFile,
|
|
923
922
|
getOutputExtension: () => getOutputExtension,
|
|
924
923
|
getOutputFileNames: () => getOutputFileNames,
|
|
925
|
-
getOutputJSFileName: () => getOutputJSFileName,
|
|
926
|
-
getOutputJSFileNameWithoutConfigFile: () => getOutputJSFileNameWithoutConfigFile,
|
|
927
924
|
getOutputPathsFor: () => getOutputPathsFor,
|
|
928
925
|
getOutputPathsForBundle: () => getOutputPathsForBundle,
|
|
929
926
|
getOwnEmitOutputFilePath: () => getOwnEmitOutputFilePath,
|
|
@@ -1288,6 +1285,7 @@ __export(server_exports, {
|
|
|
1288
1285
|
isDiagnosticWithLocation: () => isDiagnosticWithLocation,
|
|
1289
1286
|
isDiskPathRoot: () => isDiskPathRoot,
|
|
1290
1287
|
isDoStatement: () => isDoStatement,
|
|
1288
|
+
isDocumentRegistryEntry: () => isDocumentRegistryEntry,
|
|
1291
1289
|
isDotDotDotToken: () => isDotDotDotToken,
|
|
1292
1290
|
isDottedName: () => isDottedName,
|
|
1293
1291
|
isDynamicName: () => isDynamicName,
|
|
@@ -2307,7 +2305,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2307
2305
|
|
|
2308
2306
|
// src/compiler/corePublic.ts
|
|
2309
2307
|
var versionMajorMinor = "5.2";
|
|
2310
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2308
|
+
var version = `${versionMajorMinor}.0-insiders.20230609`;
|
|
2311
2309
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2312
2310
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2313
2311
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -4008,10 +4006,10 @@ var Debug;
|
|
|
4008
4006
|
}
|
|
4009
4007
|
Debug2.log = log;
|
|
4010
4008
|
((_log) => {
|
|
4011
|
-
function
|
|
4009
|
+
function error2(s) {
|
|
4012
4010
|
logMessage(1 /* Error */, s);
|
|
4013
4011
|
}
|
|
4014
|
-
_log.error =
|
|
4012
|
+
_log.error = error2;
|
|
4015
4013
|
function warn(s) {
|
|
4016
4014
|
logMessage(2 /* Warning */, s);
|
|
4017
4015
|
}
|
|
@@ -4285,6 +4283,15 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
|
|
|
4285
4283
|
);
|
|
4286
4284
|
}
|
|
4287
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;
|
|
4288
4295
|
function formatNodeFlags(flags) {
|
|
4289
4296
|
return formatEnum(
|
|
4290
4297
|
flags,
|
|
@@ -6923,16 +6930,16 @@ var NewLineKind = /* @__PURE__ */ ((NewLineKind3) => {
|
|
|
6923
6930
|
NewLineKind3[NewLineKind3["LineFeed"] = 1] = "LineFeed";
|
|
6924
6931
|
return NewLineKind3;
|
|
6925
6932
|
})(NewLineKind || {});
|
|
6926
|
-
var ScriptKind = /* @__PURE__ */ ((
|
|
6927
|
-
|
|
6928
|
-
|
|
6929
|
-
|
|
6930
|
-
|
|
6931
|
-
|
|
6932
|
-
|
|
6933
|
-
|
|
6934
|
-
|
|
6935
|
-
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;
|
|
6936
6943
|
})(ScriptKind || {});
|
|
6937
6944
|
var ScriptTarget = /* @__PURE__ */ ((ScriptTarget11) => {
|
|
6938
6945
|
ScriptTarget11[ScriptTarget11["ES3"] = 0] = "ES3";
|
|
@@ -8462,8 +8469,8 @@ var sys = (() => {
|
|
|
8462
8469
|
try {
|
|
8463
8470
|
const modulePath = resolveJSModule(moduleName, baseDir, nodeSystem);
|
|
8464
8471
|
return { module: require(modulePath), modulePath, error: void 0 };
|
|
8465
|
-
} catch (
|
|
8466
|
-
return { module: void 0, modulePath: void 0, error };
|
|
8472
|
+
} catch (error2) {
|
|
8473
|
+
return { module: void 0, modulePath: void 0, error: error2 };
|
|
8467
8474
|
}
|
|
8468
8475
|
}
|
|
8469
8476
|
};
|
|
@@ -9649,7 +9656,6 @@ var Diagnostics = {
|
|
|
9649
9656
|
The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate: diag(2210, 1 /* Error */, "The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_roo_2210", "The project root is ambiguous, but is required to resolve import map entry '{0}' in file '{1}'. Supply the `rootDir` compiler option to disambiguate."),
|
|
9650
9657
|
Add_extends_constraint: diag(2211, 3 /* Message */, "Add_extends_constraint_2211", "Add `extends` constraint."),
|
|
9651
9658
|
Add_extends_constraint_to_all_type_parameters: diag(2212, 3 /* Message */, "Add_extends_constraint_to_all_type_parameters_2212", "Add `extends` constraint to all type parameters"),
|
|
9652
|
-
The_project_root_is_ambiguous_but_is_required_to_determine_the_module_format_of_output_js_files_Supply_the_rootDir_compiler_option_to_disambiguate: diag(2213, 1 /* Error */, "The_project_root_is_ambiguous_but_is_required_to_determine_the_module_format_of_output_js_files_Supp_2213", "The project root is ambiguous, but is required to determine the module format of output '.js' files. Supply the `rootDir` compiler option to disambiguate."),
|
|
9653
9659
|
Duplicate_identifier_0: diag(2300, 1 /* Error */, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."),
|
|
9654
9660
|
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2301, 1 /* Error */, "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."),
|
|
9655
9661
|
Static_members_cannot_reference_class_type_parameters: diag(2302, 1 /* Error */, "Static_members_cannot_reference_class_type_parameters_2302", "Static members cannot reference class type parameters."),
|
|
@@ -11220,6 +11226,7 @@ var Diagnostics = {
|
|
|
11220
11226
|
Use_import_type: diag(95180, 3 /* Message */, "Use_import_type_95180", "Use 'import type'"),
|
|
11221
11227
|
Use_type_0: diag(95181, 3 /* Message */, "Use_type_0_95181", "Use 'type {0}'"),
|
|
11222
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"),
|
|
11223
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."),
|
|
11224
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'."),
|
|
11225
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?"),
|
|
@@ -11695,9 +11702,9 @@ function isConflictMarkerTrivia(text, pos) {
|
|
|
11695
11702
|
}
|
|
11696
11703
|
return false;
|
|
11697
11704
|
}
|
|
11698
|
-
function scanConflictMarkerTrivia(text, pos,
|
|
11699
|
-
if (
|
|
11700
|
-
|
|
11705
|
+
function scanConflictMarkerTrivia(text, pos, error2) {
|
|
11706
|
+
if (error2) {
|
|
11707
|
+
error2(Diagnostics.Merge_conflict_marker_encountered, pos, mergeConflictMarkerLength);
|
|
11701
11708
|
}
|
|
11702
11709
|
const ch = text.charCodeAt(pos);
|
|
11703
11710
|
const len = text.length;
|
|
@@ -11994,7 +12001,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
11994
12001
|
});
|
|
11995
12002
|
}
|
|
11996
12003
|
return scanner2;
|
|
11997
|
-
function
|
|
12004
|
+
function error2(message, errPos = pos, length3, arg0) {
|
|
11998
12005
|
if (onError) {
|
|
11999
12006
|
const oldPos = pos;
|
|
12000
12007
|
pos = errPos;
|
|
@@ -12018,9 +12025,9 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12018
12025
|
} else {
|
|
12019
12026
|
tokenFlags |= 16384 /* ContainsInvalidSeparator */;
|
|
12020
12027
|
if (isPreviousTokenSeparator) {
|
|
12021
|
-
|
|
12028
|
+
error2(Diagnostics.Multiple_consecutive_numeric_separators_are_not_permitted, pos, 1);
|
|
12022
12029
|
} else {
|
|
12023
|
-
|
|
12030
|
+
error2(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1);
|
|
12024
12031
|
}
|
|
12025
12032
|
}
|
|
12026
12033
|
pos++;
|
|
@@ -12037,7 +12044,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12037
12044
|
}
|
|
12038
12045
|
if (text.charCodeAt(pos - 1) === 95 /* _ */) {
|
|
12039
12046
|
tokenFlags |= 16384 /* ContainsInvalidSeparator */;
|
|
12040
|
-
|
|
12047
|
+
error2(Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1);
|
|
12041
12048
|
}
|
|
12042
12049
|
return result + text.substring(start3, pos);
|
|
12043
12050
|
}
|
|
@@ -12048,7 +12055,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12048
12055
|
pos++;
|
|
12049
12056
|
if (text.charCodeAt(pos) === 95 /* _ */) {
|
|
12050
12057
|
tokenFlags |= 512 /* ContainsSeparator */ | 16384 /* ContainsInvalidSeparator */;
|
|
12051
|
-
|
|
12058
|
+
error2(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1);
|
|
12052
12059
|
pos--;
|
|
12053
12060
|
mainFragment = scanNumberFragment();
|
|
12054
12061
|
} else if (!scanDigits()) {
|
|
@@ -12063,7 +12070,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12063
12070
|
const literal = (withMinus ? "-" : "") + "0o" + (+tokenValue).toString(8);
|
|
12064
12071
|
if (withMinus)
|
|
12065
12072
|
start3--;
|
|
12066
|
-
|
|
12073
|
+
error2(Diagnostics.Octal_literals_are_not_allowed_Use_the_syntax_0, start3, pos - start3, literal);
|
|
12067
12074
|
return { type: 9 /* NumericLiteral */, value: tokenValue };
|
|
12068
12075
|
}
|
|
12069
12076
|
} else {
|
|
@@ -12084,7 +12091,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12084
12091
|
const preNumericPart = pos;
|
|
12085
12092
|
const finalFragment = scanNumberFragment();
|
|
12086
12093
|
if (!finalFragment) {
|
|
12087
|
-
|
|
12094
|
+
error2(Diagnostics.Digit_expected);
|
|
12088
12095
|
} else {
|
|
12089
12096
|
scientificFragment = text.substring(end2, preNumericPart) + finalFragment;
|
|
12090
12097
|
end2 = pos;
|
|
@@ -12103,7 +12110,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12103
12110
|
result = text.substring(start3, end2);
|
|
12104
12111
|
}
|
|
12105
12112
|
if (tokenFlags & 8192 /* ContainsLeadingZero */) {
|
|
12106
|
-
|
|
12113
|
+
error2(Diagnostics.Decimals_with_leading_zeros_are_not_allowed, start3, end2 - start3);
|
|
12107
12114
|
return { type: 9 /* NumericLiteral */, value: "" + +result };
|
|
12108
12115
|
}
|
|
12109
12116
|
if (decimalFragment !== void 0 || tokenFlags & 16 /* Scientific */) {
|
|
@@ -12128,12 +12135,12 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12128
12135
|
const { length: length3 } = scanIdentifierParts();
|
|
12129
12136
|
if (length3 === 1 && text[identifierStart] === "n") {
|
|
12130
12137
|
if (isScientific) {
|
|
12131
|
-
|
|
12138
|
+
error2(Diagnostics.A_bigint_literal_cannot_use_exponential_notation, numericStart, identifierStart - numericStart + 1);
|
|
12132
12139
|
} else {
|
|
12133
|
-
|
|
12140
|
+
error2(Diagnostics.A_bigint_literal_must_be_an_integer, numericStart, identifierStart - numericStart + 1);
|
|
12134
12141
|
}
|
|
12135
12142
|
} else {
|
|
12136
|
-
|
|
12143
|
+
error2(Diagnostics.An_identifier_or_keyword_cannot_immediately_follow_a_numeric_literal, identifierStart, length3);
|
|
12137
12144
|
pos = identifierStart;
|
|
12138
12145
|
}
|
|
12139
12146
|
}
|
|
@@ -12180,9 +12187,9 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12180
12187
|
allowSeparator = false;
|
|
12181
12188
|
isPreviousTokenSeparator = true;
|
|
12182
12189
|
} else if (isPreviousTokenSeparator) {
|
|
12183
|
-
|
|
12190
|
+
error2(Diagnostics.Multiple_consecutive_numeric_separators_are_not_permitted, pos, 1);
|
|
12184
12191
|
} else {
|
|
12185
|
-
|
|
12192
|
+
error2(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1);
|
|
12186
12193
|
}
|
|
12187
12194
|
pos++;
|
|
12188
12195
|
continue;
|
|
@@ -12201,7 +12208,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12201
12208
|
valueChars = [];
|
|
12202
12209
|
}
|
|
12203
12210
|
if (text.charCodeAt(pos - 1) === 95 /* _ */) {
|
|
12204
|
-
|
|
12211
|
+
error2(Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1);
|
|
12205
12212
|
}
|
|
12206
12213
|
return String.fromCharCode(...valueChars);
|
|
12207
12214
|
}
|
|
@@ -12214,7 +12221,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12214
12221
|
if (pos >= end) {
|
|
12215
12222
|
result += text.substring(start3, pos);
|
|
12216
12223
|
tokenFlags |= 4 /* Unterminated */;
|
|
12217
|
-
|
|
12224
|
+
error2(Diagnostics.Unterminated_string_literal);
|
|
12218
12225
|
break;
|
|
12219
12226
|
}
|
|
12220
12227
|
const ch = text.charCodeAt(pos);
|
|
@@ -12235,7 +12242,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12235
12242
|
if (isLineBreak(ch) && !jsxAttributeString) {
|
|
12236
12243
|
result += text.substring(start3, pos);
|
|
12237
12244
|
tokenFlags |= 4 /* Unterminated */;
|
|
12238
|
-
|
|
12245
|
+
error2(Diagnostics.Unterminated_string_literal);
|
|
12239
12246
|
break;
|
|
12240
12247
|
}
|
|
12241
12248
|
pos++;
|
|
@@ -12252,7 +12259,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12252
12259
|
if (pos >= end) {
|
|
12253
12260
|
contents += text.substring(start3, pos);
|
|
12254
12261
|
tokenFlags |= 4 /* Unterminated */;
|
|
12255
|
-
|
|
12262
|
+
error2(Diagnostics.Unterminated_template_literal);
|
|
12256
12263
|
resultingToken = startedWithBacktick ? 15 /* NoSubstitutionTemplateLiteral */ : 18 /* TemplateTail */;
|
|
12257
12264
|
break;
|
|
12258
12265
|
}
|
|
@@ -12295,7 +12302,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12295
12302
|
const start3 = pos;
|
|
12296
12303
|
pos++;
|
|
12297
12304
|
if (pos >= end) {
|
|
12298
|
-
|
|
12305
|
+
error2(Diagnostics.Unexpected_end_of_text);
|
|
12299
12306
|
return "";
|
|
12300
12307
|
}
|
|
12301
12308
|
const ch = text.charCodeAt(pos);
|
|
@@ -12321,7 +12328,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12321
12328
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
12322
12329
|
if (shouldEmitInvalidEscapeError) {
|
|
12323
12330
|
const code = parseInt(text.substring(start3 + 1, pos), 8);
|
|
12324
|
-
|
|
12331
|
+
error2(Diagnostics.Octal_escape_sequences_are_not_allowed_Use_the_syntax_0, start3, pos - start3, "\\x" + padLeft(code.toString(16), 2, "0"));
|
|
12325
12332
|
return String.fromCharCode(code);
|
|
12326
12333
|
}
|
|
12327
12334
|
return text.substring(start3, pos);
|
|
@@ -12329,7 +12336,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12329
12336
|
case 57 /* _9 */:
|
|
12330
12337
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
12331
12338
|
if (shouldEmitInvalidEscapeError) {
|
|
12332
|
-
|
|
12339
|
+
error2(Diagnostics.Escape_sequence_0_is_not_allowed, start3, pos - start3, text.substring(start3, pos));
|
|
12333
12340
|
return String.fromCharCode(ch);
|
|
12334
12341
|
}
|
|
12335
12342
|
return text.substring(start3, pos);
|
|
@@ -12361,28 +12368,28 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12361
12368
|
if (escapedValue < 0) {
|
|
12362
12369
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
12363
12370
|
if (shouldEmitInvalidEscapeError) {
|
|
12364
|
-
|
|
12371
|
+
error2(Diagnostics.Hexadecimal_digit_expected);
|
|
12365
12372
|
}
|
|
12366
12373
|
return text.substring(start3, pos);
|
|
12367
12374
|
}
|
|
12368
12375
|
if (!isCodePoint(escapedValue)) {
|
|
12369
12376
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
12370
12377
|
if (shouldEmitInvalidEscapeError) {
|
|
12371
|
-
|
|
12378
|
+
error2(Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive);
|
|
12372
12379
|
}
|
|
12373
12380
|
return text.substring(start3, pos);
|
|
12374
12381
|
}
|
|
12375
12382
|
if (pos >= end) {
|
|
12376
12383
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
12377
12384
|
if (shouldEmitInvalidEscapeError) {
|
|
12378
|
-
|
|
12385
|
+
error2(Diagnostics.Unexpected_end_of_text);
|
|
12379
12386
|
}
|
|
12380
12387
|
return text.substring(start3, pos);
|
|
12381
12388
|
}
|
|
12382
12389
|
if (text.charCodeAt(pos) !== 125 /* closeBrace */) {
|
|
12383
12390
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
12384
12391
|
if (shouldEmitInvalidEscapeError) {
|
|
12385
|
-
|
|
12392
|
+
error2(Diagnostics.Unterminated_Unicode_escape_sequence);
|
|
12386
12393
|
}
|
|
12387
12394
|
return text.substring(start3, pos);
|
|
12388
12395
|
}
|
|
@@ -12394,7 +12401,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12394
12401
|
if (!(pos < end && isHexDigit(text.charCodeAt(pos)))) {
|
|
12395
12402
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
12396
12403
|
if (shouldEmitInvalidEscapeError) {
|
|
12397
|
-
|
|
12404
|
+
error2(Diagnostics.Hexadecimal_digit_expected);
|
|
12398
12405
|
}
|
|
12399
12406
|
return text.substring(start3, pos);
|
|
12400
12407
|
}
|
|
@@ -12406,7 +12413,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12406
12413
|
if (!(pos < end && isHexDigit(text.charCodeAt(pos)))) {
|
|
12407
12414
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
12408
12415
|
if (shouldEmitInvalidEscapeError) {
|
|
12409
|
-
|
|
12416
|
+
error2(Diagnostics.Hexadecimal_digit_expected);
|
|
12410
12417
|
}
|
|
12411
12418
|
return text.substring(start3, pos);
|
|
12412
12419
|
}
|
|
@@ -12434,19 +12441,19 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12434
12441
|
const escapedValue = escapedValueString ? parseInt(escapedValueString, 16) : -1;
|
|
12435
12442
|
let isInvalidExtendedEscape = false;
|
|
12436
12443
|
if (escapedValue < 0) {
|
|
12437
|
-
|
|
12444
|
+
error2(Diagnostics.Hexadecimal_digit_expected);
|
|
12438
12445
|
isInvalidExtendedEscape = true;
|
|
12439
12446
|
} else if (escapedValue > 1114111) {
|
|
12440
|
-
|
|
12447
|
+
error2(Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive);
|
|
12441
12448
|
isInvalidExtendedEscape = true;
|
|
12442
12449
|
}
|
|
12443
12450
|
if (pos >= end) {
|
|
12444
|
-
|
|
12451
|
+
error2(Diagnostics.Unexpected_end_of_text);
|
|
12445
12452
|
isInvalidExtendedEscape = true;
|
|
12446
12453
|
} else if (text.charCodeAt(pos) === 125 /* closeBrace */) {
|
|
12447
12454
|
pos++;
|
|
12448
12455
|
} else {
|
|
12449
|
-
|
|
12456
|
+
error2(Diagnostics.Unterminated_Unicode_escape_sequence);
|
|
12450
12457
|
isInvalidExtendedEscape = true;
|
|
12451
12458
|
}
|
|
12452
12459
|
if (isInvalidExtendedEscape) {
|
|
@@ -12540,9 +12547,9 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12540
12547
|
separatorAllowed = false;
|
|
12541
12548
|
isPreviousTokenSeparator = true;
|
|
12542
12549
|
} else if (isPreviousTokenSeparator) {
|
|
12543
|
-
|
|
12550
|
+
error2(Diagnostics.Multiple_consecutive_numeric_separators_are_not_permitted, pos, 1);
|
|
12544
12551
|
} else {
|
|
12545
|
-
|
|
12552
|
+
error2(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1);
|
|
12546
12553
|
}
|
|
12547
12554
|
pos++;
|
|
12548
12555
|
continue;
|
|
@@ -12556,7 +12563,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12556
12563
|
isPreviousTokenSeparator = false;
|
|
12557
12564
|
}
|
|
12558
12565
|
if (text.charCodeAt(pos - 1) === 95 /* _ */) {
|
|
12559
|
-
|
|
12566
|
+
error2(Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1);
|
|
12560
12567
|
}
|
|
12561
12568
|
return value;
|
|
12562
12569
|
}
|
|
@@ -12586,7 +12593,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12586
12593
|
const ch = codePointAt(text, pos);
|
|
12587
12594
|
if (pos === 0) {
|
|
12588
12595
|
if (ch === 65533 /* replacementCharacter */) {
|
|
12589
|
-
|
|
12596
|
+
error2(Diagnostics.File_appears_to_be_binary);
|
|
12590
12597
|
pos = end;
|
|
12591
12598
|
return token = 8 /* NonTextFileMarkerTrivia */;
|
|
12592
12599
|
}
|
|
@@ -12777,7 +12784,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12777
12784
|
}
|
|
12778
12785
|
commentDirectives = appendIfCommentDirective(commentDirectives, text.slice(lastLineStart, pos), commentDirectiveRegExMultiLine, lastLineStart);
|
|
12779
12786
|
if (!commentClosed) {
|
|
12780
|
-
|
|
12787
|
+
error2(Diagnostics.Asterisk_Slash_expected);
|
|
12781
12788
|
}
|
|
12782
12789
|
if (skipTrivia2) {
|
|
12783
12790
|
continue;
|
|
@@ -12802,7 +12809,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12802
12809
|
true
|
|
12803
12810
|
);
|
|
12804
12811
|
if (!tokenValue) {
|
|
12805
|
-
|
|
12812
|
+
error2(Diagnostics.Hexadecimal_digit_expected);
|
|
12806
12813
|
tokenValue = "0";
|
|
12807
12814
|
}
|
|
12808
12815
|
tokenValue = "0x" + tokenValue;
|
|
@@ -12815,7 +12822,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12815
12822
|
2
|
|
12816
12823
|
);
|
|
12817
12824
|
if (!tokenValue) {
|
|
12818
|
-
|
|
12825
|
+
error2(Diagnostics.Binary_digit_expected);
|
|
12819
12826
|
tokenValue = "0";
|
|
12820
12827
|
}
|
|
12821
12828
|
tokenValue = "0b" + tokenValue;
|
|
@@ -12828,7 +12835,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12828
12835
|
8
|
|
12829
12836
|
);
|
|
12830
12837
|
if (!tokenValue) {
|
|
12831
|
-
|
|
12838
|
+
error2(Diagnostics.Octal_digit_expected);
|
|
12832
12839
|
tokenValue = "0";
|
|
12833
12840
|
}
|
|
12834
12841
|
tokenValue = "0o" + tokenValue;
|
|
@@ -12854,7 +12861,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12854
12861
|
return token = 27 /* SemicolonToken */;
|
|
12855
12862
|
case 60 /* lessThan */:
|
|
12856
12863
|
if (isConflictMarkerTrivia(text, pos)) {
|
|
12857
|
-
pos = scanConflictMarkerTrivia(text, pos,
|
|
12864
|
+
pos = scanConflictMarkerTrivia(text, pos, error2);
|
|
12858
12865
|
if (skipTrivia2) {
|
|
12859
12866
|
continue;
|
|
12860
12867
|
} else {
|
|
@@ -12877,7 +12884,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12877
12884
|
return token = 30 /* LessThanToken */;
|
|
12878
12885
|
case 61 /* equals */:
|
|
12879
12886
|
if (isConflictMarkerTrivia(text, pos)) {
|
|
12880
|
-
pos = scanConflictMarkerTrivia(text, pos,
|
|
12887
|
+
pos = scanConflictMarkerTrivia(text, pos, error2);
|
|
12881
12888
|
if (skipTrivia2) {
|
|
12882
12889
|
continue;
|
|
12883
12890
|
} else {
|
|
@@ -12897,7 +12904,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12897
12904
|
return token = 64 /* EqualsToken */;
|
|
12898
12905
|
case 62 /* greaterThan */:
|
|
12899
12906
|
if (isConflictMarkerTrivia(text, pos)) {
|
|
12900
|
-
pos = scanConflictMarkerTrivia(text, pos,
|
|
12907
|
+
pos = scanConflictMarkerTrivia(text, pos, error2);
|
|
12901
12908
|
if (skipTrivia2) {
|
|
12902
12909
|
continue;
|
|
12903
12910
|
} else {
|
|
@@ -12935,7 +12942,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12935
12942
|
return token = 19 /* OpenBraceToken */;
|
|
12936
12943
|
case 124 /* bar */:
|
|
12937
12944
|
if (isConflictMarkerTrivia(text, pos)) {
|
|
12938
|
-
pos = scanConflictMarkerTrivia(text, pos,
|
|
12945
|
+
pos = scanConflictMarkerTrivia(text, pos, error2);
|
|
12939
12946
|
if (skipTrivia2) {
|
|
12940
12947
|
continue;
|
|
12941
12948
|
} else {
|
|
@@ -12977,12 +12984,12 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12977
12984
|
tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts();
|
|
12978
12985
|
return token = getIdentifierToken();
|
|
12979
12986
|
}
|
|
12980
|
-
|
|
12987
|
+
error2(Diagnostics.Invalid_character);
|
|
12981
12988
|
pos++;
|
|
12982
12989
|
return token = 0 /* Unknown */;
|
|
12983
12990
|
case 35 /* hash */:
|
|
12984
12991
|
if (pos !== 0 && text[pos + 1] === "!") {
|
|
12985
|
-
|
|
12992
|
+
error2(Diagnostics.can_only_be_used_at_the_start_of_a_file);
|
|
12986
12993
|
pos++;
|
|
12987
12994
|
return token = 0 /* Unknown */;
|
|
12988
12995
|
}
|
|
@@ -13010,7 +13017,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13010
13017
|
scanIdentifier(charAfterHash, languageVersion);
|
|
13011
13018
|
} else {
|
|
13012
13019
|
tokenValue = "#";
|
|
13013
|
-
|
|
13020
|
+
error2(Diagnostics.Invalid_character, pos++, charSize(ch));
|
|
13014
13021
|
}
|
|
13015
13022
|
return token = 81 /* PrivateIdentifier */;
|
|
13016
13023
|
default:
|
|
@@ -13026,7 +13033,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13026
13033
|
continue;
|
|
13027
13034
|
}
|
|
13028
13035
|
const size = charSize(ch);
|
|
13029
|
-
|
|
13036
|
+
error2(Diagnostics.Invalid_character, pos, size);
|
|
13030
13037
|
pos += size;
|
|
13031
13038
|
return token = 0 /* Unknown */;
|
|
13032
13039
|
}
|
|
@@ -13092,13 +13099,13 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13092
13099
|
while (true) {
|
|
13093
13100
|
if (p >= end) {
|
|
13094
13101
|
tokenFlags |= 4 /* Unterminated */;
|
|
13095
|
-
|
|
13102
|
+
error2(Diagnostics.Unterminated_regular_expression_literal);
|
|
13096
13103
|
break;
|
|
13097
13104
|
}
|
|
13098
13105
|
const ch = text.charCodeAt(p);
|
|
13099
13106
|
if (isLineBreak(ch)) {
|
|
13100
13107
|
tokenFlags |= 4 /* Unterminated */;
|
|
13101
|
-
|
|
13108
|
+
error2(Diagnostics.Unterminated_regular_expression_literal);
|
|
13102
13109
|
break;
|
|
13103
13110
|
}
|
|
13104
13111
|
if (inEscape) {
|
|
@@ -13210,16 +13217,16 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13210
13217
|
}
|
|
13211
13218
|
if (char === 60 /* lessThan */) {
|
|
13212
13219
|
if (isConflictMarkerTrivia(text, pos)) {
|
|
13213
|
-
pos = scanConflictMarkerTrivia(text, pos,
|
|
13220
|
+
pos = scanConflictMarkerTrivia(text, pos, error2);
|
|
13214
13221
|
return token = 7 /* ConflictMarkerTrivia */;
|
|
13215
13222
|
}
|
|
13216
13223
|
break;
|
|
13217
13224
|
}
|
|
13218
13225
|
if (char === 62 /* greaterThan */) {
|
|
13219
|
-
|
|
13226
|
+
error2(Diagnostics.Unexpected_token_Did_you_mean_or_gt, pos, 1);
|
|
13220
13227
|
}
|
|
13221
13228
|
if (char === 125 /* closeBrace */) {
|
|
13222
|
-
|
|
13229
|
+
error2(Diagnostics.Unexpected_token_Did_you_mean_or_rbrace, pos, 1);
|
|
13223
13230
|
}
|
|
13224
13231
|
if (isLineBreak(char) && firstNonWhitespace === 0) {
|
|
13225
13232
|
firstNonWhitespace = -1;
|
|
@@ -37796,7 +37803,9 @@ var libEntries = [
|
|
|
37796
37803
|
["es2022.string", "lib.es2022.string.d.ts"],
|
|
37797
37804
|
["es2022.regexp", "lib.es2022.regexp.d.ts"],
|
|
37798
37805
|
["es2023.array", "lib.es2023.array.d.ts"],
|
|
37806
|
+
["es2023.collection", "lib.es2023.collection.d.ts"],
|
|
37799
37807
|
["esnext.array", "lib.es2023.array.d.ts"],
|
|
37808
|
+
["esnext.collection", "lib.es2023.collection.d.ts"],
|
|
37800
37809
|
["esnext.symbol", "lib.es2019.symbol.d.ts"],
|
|
37801
37810
|
["esnext.asynciterable", "lib.es2018.asynciterable.d.ts"],
|
|
37802
37811
|
["esnext.intl", "lib.esnext.intl.d.ts"],
|
|
@@ -40116,8 +40125,8 @@ function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, exis
|
|
|
40116
40125
|
const fileName = configFileName || "tsconfig.json";
|
|
40117
40126
|
const diagnosticMessage = Diagnostics.The_files_list_in_config_file_0_is_empty;
|
|
40118
40127
|
const nodeValue = forEachTsConfigPropArray(sourceFile, "files", (property) => property.initializer);
|
|
40119
|
-
const
|
|
40120
|
-
errors.push(
|
|
40128
|
+
const error2 = createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, nodeValue, diagnosticMessage, fileName);
|
|
40129
|
+
errors.push(error2);
|
|
40121
40130
|
} else {
|
|
40122
40131
|
createCompilerDiagnosticOnlyIfJson(Diagnostics.The_files_list_in_config_file_0_is_empty, configFileName || "tsconfig.json");
|
|
40123
40132
|
}
|
|
@@ -40224,8 +40233,8 @@ function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, exis
|
|
|
40224
40233
|
}
|
|
40225
40234
|
}
|
|
40226
40235
|
}
|
|
40227
|
-
function isErrorNoInputFiles(
|
|
40228
|
-
return
|
|
40236
|
+
function isErrorNoInputFiles(error2) {
|
|
40237
|
+
return error2.code === Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2.code;
|
|
40229
40238
|
}
|
|
40230
40239
|
function getErrorForNoInputFiles({ includeSpecs, excludeSpecs }, configFileName) {
|
|
40231
40240
|
return createCompilerDiagnostic(
|
|
@@ -40246,7 +40255,7 @@ function updateErrorForNoInputFiles(fileNames, configFileName, configFileSpecs,
|
|
|
40246
40255
|
if (shouldReportNoInputFiles(fileNames, canJsonReportNoInutFiles)) {
|
|
40247
40256
|
configParseDiagnostics.push(getErrorForNoInputFiles(configFileSpecs, configFileName));
|
|
40248
40257
|
} else {
|
|
40249
|
-
filterMutate(configParseDiagnostics, (
|
|
40258
|
+
filterMutate(configParseDiagnostics, (error2) => !isErrorNoInputFiles(error2));
|
|
40250
40259
|
}
|
|
40251
40260
|
return existingErrors !== configParseDiagnostics.length;
|
|
40252
40261
|
}
|
|
@@ -41390,7 +41399,7 @@ function compilerOptionValueToString(value) {
|
|
|
41390
41399
|
return str + "}";
|
|
41391
41400
|
}
|
|
41392
41401
|
function getKeyForCompilerOptions(options, affectingOptionDeclarations) {
|
|
41393
|
-
return affectingOptionDeclarations.map((option) => compilerOptionValueToString(getCompilerOptionValue(options, option))).join("|") +
|
|
41402
|
+
return affectingOptionDeclarations.map((option) => compilerOptionValueToString(getCompilerOptionValue(options, option))).join("|") + `|${options.pathsBasePath}`;
|
|
41394
41403
|
}
|
|
41395
41404
|
function createCacheWithRedirects(ownOptions) {
|
|
41396
41405
|
const redirectsMap = /* @__PURE__ */ new Map();
|
|
@@ -48323,14 +48332,14 @@ function createTypeChecker(host) {
|
|
|
48323
48332
|
}
|
|
48324
48333
|
}
|
|
48325
48334
|
function errorSkippedOn(key, location, message, ...args) {
|
|
48326
|
-
const diagnostic =
|
|
48335
|
+
const diagnostic = error2(location, message, ...args);
|
|
48327
48336
|
diagnostic.skippedOn = key;
|
|
48328
48337
|
return diagnostic;
|
|
48329
48338
|
}
|
|
48330
48339
|
function createError(location, message, ...args) {
|
|
48331
48340
|
return location ? createDiagnosticForNode(location, message, ...args) : createCompilerDiagnostic(message, ...args);
|
|
48332
48341
|
}
|
|
48333
|
-
function
|
|
48342
|
+
function error2(location, message, ...args) {
|
|
48334
48343
|
const diagnostic = createError(location, message, ...args);
|
|
48335
48344
|
diagnostics.add(diagnostic);
|
|
48336
48345
|
return diagnostic;
|
|
@@ -48354,7 +48363,7 @@ function createTypeChecker(host) {
|
|
|
48354
48363
|
addErrorOrSuggestion(isError, "message" in message ? createDiagnosticForNode(location, message, ...args) : createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(location), location, message));
|
|
48355
48364
|
}
|
|
48356
48365
|
function errorAndMaybeSuggestAwait(location, maybeMissingAwait, message, ...args) {
|
|
48357
|
-
const diagnostic =
|
|
48366
|
+
const diagnostic = error2(location, message, ...args);
|
|
48358
48367
|
if (maybeMissingAwait) {
|
|
48359
48368
|
const related = createDiagnosticForNode(location, Diagnostics.Did_you_forget_to_use_await);
|
|
48360
48369
|
addRelatedInfo(diagnostic, related);
|
|
@@ -48500,7 +48509,7 @@ function createTypeChecker(host) {
|
|
|
48500
48509
|
}
|
|
48501
48510
|
} else if (target.flags & 1024 /* NamespaceModule */) {
|
|
48502
48511
|
if (target !== globalThisSymbol) {
|
|
48503
|
-
|
|
48512
|
+
error2(
|
|
48504
48513
|
source.declarations && getNameOfDeclaration(source.declarations[0]),
|
|
48505
48514
|
Diagnostics.Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity,
|
|
48506
48515
|
symbolToString(target)
|
|
@@ -48630,7 +48639,7 @@ function createTypeChecker(host) {
|
|
|
48630
48639
|
mergeSymbol(mainModule, moduleAugmentation.symbol);
|
|
48631
48640
|
}
|
|
48632
48641
|
} else {
|
|
48633
|
-
|
|
48642
|
+
error2(moduleName, Diagnostics.Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity, moduleName.text);
|
|
48634
48643
|
}
|
|
48635
48644
|
}
|
|
48636
48645
|
}
|
|
@@ -48957,7 +48966,7 @@ function createTypeChecker(host) {
|
|
|
48957
48966
|
case 265 /* EnumDeclaration */:
|
|
48958
48967
|
if (result = lookup(((_c = getSymbolOfDeclaration(location)) == null ? void 0 : _c.exports) || emptySymbols, name, meaning & 8 /* EnumMember */)) {
|
|
48959
48968
|
if (nameNotFoundMessage && getIsolatedModules(compilerOptions) && !(location.flags & 16777216 /* Ambient */) && getSourceFileOfNode(location) !== getSourceFileOfNode(result.valueDeclaration)) {
|
|
48960
|
-
|
|
48969
|
+
error2(
|
|
48961
48970
|
errorLocation,
|
|
48962
48971
|
Diagnostics.Cannot_access_0_from_another_file_without_qualification_when_1_is_enabled_Use_2_instead,
|
|
48963
48972
|
unescapeLeadingUnderscores(name),
|
|
@@ -48989,7 +48998,7 @@ function createTypeChecker(host) {
|
|
|
48989
48998
|
}
|
|
48990
48999
|
if (lastLocation && isStatic(lastLocation)) {
|
|
48991
49000
|
if (nameNotFoundMessage) {
|
|
48992
|
-
|
|
49001
|
+
error2(errorLocation, Diagnostics.Static_members_cannot_reference_class_type_parameters);
|
|
48993
49002
|
}
|
|
48994
49003
|
return void 0;
|
|
48995
49004
|
}
|
|
@@ -49008,7 +49017,7 @@ function createTypeChecker(host) {
|
|
|
49008
49017
|
const container = location.parent.parent;
|
|
49009
49018
|
if (isClassLike(container) && (result = lookup(getSymbolOfDeclaration(container).members, name, meaning & 788968 /* Type */))) {
|
|
49010
49019
|
if (nameNotFoundMessage) {
|
|
49011
|
-
|
|
49020
|
+
error2(errorLocation, Diagnostics.Base_class_expressions_cannot_reference_class_type_parameters);
|
|
49012
49021
|
}
|
|
49013
49022
|
return void 0;
|
|
49014
49023
|
}
|
|
@@ -49019,7 +49028,7 @@ function createTypeChecker(host) {
|
|
|
49019
49028
|
if (isClassLike(grandparent) || grandparent.kind === 263 /* InterfaceDeclaration */) {
|
|
49020
49029
|
if (result = lookup(getSymbolOfDeclaration(grandparent).members, name, meaning & 788968 /* Type */)) {
|
|
49021
49030
|
if (nameNotFoundMessage) {
|
|
49022
|
-
|
|
49031
|
+
error2(errorLocation, Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);
|
|
49023
49032
|
}
|
|
49024
49033
|
return void 0;
|
|
49025
49034
|
}
|
|
@@ -49130,7 +49139,7 @@ function createTypeChecker(host) {
|
|
|
49130
49139
|
}
|
|
49131
49140
|
function checkAndReportErrorForInvalidInitializer() {
|
|
49132
49141
|
if (propertyWithInvalidInitializer && !(useDefineForClassFields && getEmitScriptTarget(compilerOptions) >= 9 /* ES2022 */)) {
|
|
49133
|
-
|
|
49142
|
+
error2(
|
|
49134
49143
|
errorLocation,
|
|
49135
49144
|
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,
|
|
49136
49145
|
declarationNameToString(propertyWithInvalidInitializer.name),
|
|
@@ -49150,7 +49159,7 @@ function createTypeChecker(host) {
|
|
|
49150
49159
|
if (nameArg) {
|
|
49151
49160
|
suggestedLib = getSuggestedLibForNonExistentName(nameArg);
|
|
49152
49161
|
if (suggestedLib) {
|
|
49153
|
-
|
|
49162
|
+
error2(errorLocation, nameNotFoundMessage, diagnosticName(nameArg), suggestedLib);
|
|
49154
49163
|
}
|
|
49155
49164
|
}
|
|
49156
49165
|
if (!suggestedLib && getSpellingSuggestions && suggestionCount < maximumSuggestionCount) {
|
|
@@ -49179,7 +49188,7 @@ function createTypeChecker(host) {
|
|
|
49179
49188
|
}
|
|
49180
49189
|
}
|
|
49181
49190
|
if (!suggestion && !suggestedLib && nameArg) {
|
|
49182
|
-
|
|
49191
|
+
error2(errorLocation, nameNotFoundMessage, diagnosticName(nameArg));
|
|
49183
49192
|
}
|
|
49184
49193
|
suggestionCount++;
|
|
49185
49194
|
}
|
|
@@ -49207,9 +49216,9 @@ function createTypeChecker(host) {
|
|
|
49207
49216
|
const candidate = getMergedSymbol(getLateBoundSymbol(result));
|
|
49208
49217
|
const root = getRootDeclaration(associatedDeclarationForContainingInitializerOrBindingName);
|
|
49209
49218
|
if (candidate === getSymbolOfDeclaration(associatedDeclarationForContainingInitializerOrBindingName)) {
|
|
49210
|
-
|
|
49219
|
+
error2(errorLocation, Diagnostics.Parameter_0_cannot_reference_itself, declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name));
|
|
49211
49220
|
} else if (candidate.valueDeclaration && candidate.valueDeclaration.pos > associatedDeclarationForContainingInitializerOrBindingName.pos && root.parent.locals && lookup(root.parent.locals, candidate.escapedName, meaning) === candidate) {
|
|
49212
|
-
|
|
49221
|
+
error2(errorLocation, Diagnostics.Parameter_0_cannot_reference_identifier_1_declared_after_it, declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name), declarationNameToString(errorLocation));
|
|
49213
49222
|
}
|
|
49214
49223
|
}
|
|
49215
49224
|
if (result && errorLocation && meaning & 111551 /* Value */ && result.flags & 2097152 /* Alias */ && !(result.flags & 111551 /* Value */) && !isValidTypeOnlyAliasUseSite(errorLocation)) {
|
|
@@ -49218,7 +49227,7 @@ function createTypeChecker(host) {
|
|
|
49218
49227
|
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;
|
|
49219
49228
|
const unescapedName = unescapeLeadingUnderscores(name);
|
|
49220
49229
|
addTypeOnlyDeclarationRelatedInfo(
|
|
49221
|
-
|
|
49230
|
+
error2(errorLocation, message, unescapedName),
|
|
49222
49231
|
typeOnlyDeclaration,
|
|
49223
49232
|
unescapedName
|
|
49224
49233
|
);
|
|
@@ -49301,13 +49310,13 @@ function createTypeChecker(host) {
|
|
|
49301
49310
|
}
|
|
49302
49311
|
const constructorType = getTypeOfSymbol(classSymbol);
|
|
49303
49312
|
if (getPropertyOfType(constructorType, name)) {
|
|
49304
|
-
|
|
49313
|
+
error2(errorLocation, Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0, diagnosticName(nameArg), symbolToString(classSymbol));
|
|
49305
49314
|
return true;
|
|
49306
49315
|
}
|
|
49307
49316
|
if (location === container && !isStatic(location)) {
|
|
49308
49317
|
const instanceType = getDeclaredTypeOfSymbol(classSymbol).thisType;
|
|
49309
49318
|
if (getPropertyOfType(instanceType, name)) {
|
|
49310
|
-
|
|
49319
|
+
error2(errorLocation, Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0, diagnosticName(nameArg));
|
|
49311
49320
|
return true;
|
|
49312
49321
|
}
|
|
49313
49322
|
}
|
|
@@ -49324,7 +49333,7 @@ function createTypeChecker(host) {
|
|
|
49324
49333
|
/*ignoreErrors*/
|
|
49325
49334
|
true
|
|
49326
49335
|
)) {
|
|
49327
|
-
|
|
49336
|
+
error2(errorLocation, Diagnostics.Cannot_extend_an_interface_0_Did_you_mean_implements, getTextOfNode(expression));
|
|
49328
49337
|
return true;
|
|
49329
49338
|
}
|
|
49330
49339
|
return false;
|
|
@@ -49363,7 +49372,7 @@ function createTypeChecker(host) {
|
|
|
49363
49372
|
const propName = parent2.right.escapedText;
|
|
49364
49373
|
const propType = getPropertyOfType(getDeclaredTypeOfSymbol(symbol), propName);
|
|
49365
49374
|
if (propType) {
|
|
49366
|
-
|
|
49375
|
+
error2(
|
|
49367
49376
|
parent2,
|
|
49368
49377
|
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,
|
|
49369
49378
|
unescapeLeadingUnderscores(name),
|
|
@@ -49372,7 +49381,7 @@ function createTypeChecker(host) {
|
|
|
49372
49381
|
return true;
|
|
49373
49382
|
}
|
|
49374
49383
|
}
|
|
49375
|
-
|
|
49384
|
+
error2(errorLocation, Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here, unescapeLeadingUnderscores(name));
|
|
49376
49385
|
return true;
|
|
49377
49386
|
}
|
|
49378
49387
|
}
|
|
@@ -49392,7 +49401,7 @@ function createTypeChecker(host) {
|
|
|
49392
49401
|
false
|
|
49393
49402
|
));
|
|
49394
49403
|
if (symbol && !(symbol.flags & 1920 /* Namespace */)) {
|
|
49395
|
-
|
|
49404
|
+
error2(errorLocation, Diagnostics._0_refers_to_a_value_but_is_being_used_as_a_type_here_Did_you_mean_typeof_0, unescapeLeadingUnderscores(name));
|
|
49396
49405
|
return true;
|
|
49397
49406
|
}
|
|
49398
49407
|
}
|
|
@@ -49403,7 +49412,7 @@ function createTypeChecker(host) {
|
|
|
49403
49412
|
}
|
|
49404
49413
|
function checkAndReportErrorForExportingPrimitiveType(errorLocation, name) {
|
|
49405
49414
|
if (isPrimitiveTypeName(name) && errorLocation.parent.kind === 280 /* ExportSpecifier */) {
|
|
49406
|
-
|
|
49415
|
+
error2(errorLocation, Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, name);
|
|
49407
49416
|
return true;
|
|
49408
49417
|
}
|
|
49409
49418
|
return false;
|
|
@@ -49412,9 +49421,9 @@ function createTypeChecker(host) {
|
|
|
49412
49421
|
if (meaning & 111551 /* Value */) {
|
|
49413
49422
|
if (isPrimitiveTypeName(name)) {
|
|
49414
49423
|
if (isExtendedByInterface(errorLocation)) {
|
|
49415
|
-
|
|
49424
|
+
error2(errorLocation, Diagnostics.An_interface_cannot_extend_a_primitive_type_like_0_an_interface_can_only_extend_named_types_and_classes, unescapeLeadingUnderscores(name));
|
|
49416
49425
|
} else {
|
|
49417
|
-
|
|
49426
|
+
error2(errorLocation, Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, unescapeLeadingUnderscores(name));
|
|
49418
49427
|
}
|
|
49419
49428
|
return true;
|
|
49420
49429
|
}
|
|
@@ -49433,11 +49442,11 @@ function createTypeChecker(host) {
|
|
|
49433
49442
|
if (symbol && allFlags !== void 0 && !(allFlags & 111551 /* Value */)) {
|
|
49434
49443
|
const rawName = unescapeLeadingUnderscores(name);
|
|
49435
49444
|
if (isES2015OrLaterConstructorName(name)) {
|
|
49436
|
-
|
|
49445
|
+
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);
|
|
49437
49446
|
} else if (maybeMappedType(errorLocation, symbol)) {
|
|
49438
|
-
|
|
49447
|
+
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");
|
|
49439
49448
|
} else {
|
|
49440
|
-
|
|
49449
|
+
error2(errorLocation, Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, rawName);
|
|
49441
49450
|
}
|
|
49442
49451
|
return true;
|
|
49443
49452
|
}
|
|
@@ -49493,7 +49502,7 @@ function createTypeChecker(host) {
|
|
|
49493
49502
|
false
|
|
49494
49503
|
));
|
|
49495
49504
|
if (symbol) {
|
|
49496
|
-
|
|
49505
|
+
error2(
|
|
49497
49506
|
errorLocation,
|
|
49498
49507
|
Diagnostics.Cannot_use_namespace_0_as_a_value,
|
|
49499
49508
|
unescapeLeadingUnderscores(name)
|
|
@@ -49513,7 +49522,7 @@ function createTypeChecker(host) {
|
|
|
49513
49522
|
false
|
|
49514
49523
|
));
|
|
49515
49524
|
if (symbol) {
|
|
49516
|
-
|
|
49525
|
+
error2(errorLocation, Diagnostics.Cannot_use_namespace_0_as_a_type, unescapeLeadingUnderscores(name));
|
|
49517
49526
|
return true;
|
|
49518
49527
|
}
|
|
49519
49528
|
}
|
|
@@ -49534,11 +49543,11 @@ function createTypeChecker(host) {
|
|
|
49534
49543
|
let diagnosticMessage;
|
|
49535
49544
|
const declarationName = declarationNameToString(getNameOfDeclaration(declaration));
|
|
49536
49545
|
if (result.flags & 2 /* BlockScopedVariable */) {
|
|
49537
|
-
diagnosticMessage =
|
|
49546
|
+
diagnosticMessage = error2(errorLocation, Diagnostics.Block_scoped_variable_0_used_before_its_declaration, declarationName);
|
|
49538
49547
|
} else if (result.flags & 32 /* Class */) {
|
|
49539
|
-
diagnosticMessage =
|
|
49548
|
+
diagnosticMessage = error2(errorLocation, Diagnostics.Class_0_used_before_its_declaration, declarationName);
|
|
49540
49549
|
} else if (result.flags & 256 /* RegularEnum */) {
|
|
49541
|
-
diagnosticMessage =
|
|
49550
|
+
diagnosticMessage = error2(errorLocation, Diagnostics.Enum_0_used_before_its_declaration, declarationName);
|
|
49542
49551
|
}
|
|
49543
49552
|
if (diagnosticMessage) {
|
|
49544
49553
|
addRelatedInfo(
|
|
@@ -49613,7 +49622,7 @@ function createTypeChecker(host) {
|
|
|
49613
49622
|
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;
|
|
49614
49623
|
const relatedMessage = isExport ? Diagnostics._0_was_exported_here : Diagnostics._0_was_imported_here;
|
|
49615
49624
|
const name = typeOnlyDeclaration.kind === 277 /* ExportDeclaration */ ? "*" : unescapeLeadingUnderscores(typeOnlyDeclaration.name.escapedText);
|
|
49616
|
-
addRelatedInfo(
|
|
49625
|
+
addRelatedInfo(error2(node.moduleReference, message), createDiagnosticForNode(typeOnlyDeclaration, relatedMessage, name));
|
|
49617
49626
|
}
|
|
49618
49627
|
}
|
|
49619
49628
|
function resolveExportByName(moduleSymbol, name, sourceNode, dontResolveAlias) {
|
|
@@ -49718,7 +49727,7 @@ function createTypeChecker(host) {
|
|
|
49718
49727
|
const compilerOptionName = moduleKind >= 5 /* ES2015 */ ? "allowSyntheticDefaultImports" : "esModuleInterop";
|
|
49719
49728
|
const exportEqualsSymbol = moduleSymbol.exports.get("export=" /* ExportEquals */);
|
|
49720
49729
|
const exportAssignment = exportEqualsSymbol.valueDeclaration;
|
|
49721
|
-
const err =
|
|
49730
|
+
const err = error2(node.name, Diagnostics.Module_0_can_only_be_default_imported_using_the_1_flag, symbolToString(moduleSymbol), compilerOptionName);
|
|
49722
49731
|
if (exportAssignment) {
|
|
49723
49732
|
addRelatedInfo(err, createDiagnosticForNode(
|
|
49724
49733
|
exportAssignment,
|
|
@@ -49771,14 +49780,14 @@ function createTypeChecker(host) {
|
|
|
49771
49780
|
function reportNonDefaultExport(moduleSymbol, node) {
|
|
49772
49781
|
var _a, _b, _c;
|
|
49773
49782
|
if ((_a = moduleSymbol.exports) == null ? void 0 : _a.has(node.symbol.escapedName)) {
|
|
49774
|
-
|
|
49783
|
+
error2(
|
|
49775
49784
|
node.name,
|
|
49776
49785
|
Diagnostics.Module_0_has_no_default_export_Did_you_mean_to_use_import_1_from_0_instead,
|
|
49777
49786
|
symbolToString(moduleSymbol),
|
|
49778
49787
|
symbolToString(node.symbol)
|
|
49779
49788
|
);
|
|
49780
49789
|
} else {
|
|
49781
|
-
const diagnostic =
|
|
49790
|
+
const diagnostic = error2(node.name, Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol));
|
|
49782
49791
|
const exportStar = (_b = moduleSymbol.exports) == null ? void 0 : _b.get("__export" /* ExportStar */);
|
|
49783
49792
|
if (exportStar) {
|
|
49784
49793
|
const defaultExport = (_c = exportStar.declarations) == null ? void 0 : _c.find((decl) => {
|
|
@@ -49929,7 +49938,7 @@ function createTypeChecker(host) {
|
|
|
49929
49938
|
const suggestion = getSuggestedSymbolForNonexistentModule(name, targetSymbol);
|
|
49930
49939
|
if (suggestion !== void 0) {
|
|
49931
49940
|
const suggestionName = symbolToString(suggestion);
|
|
49932
|
-
const diagnostic =
|
|
49941
|
+
const diagnostic = error2(name, Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, moduleName, declarationName, suggestionName);
|
|
49933
49942
|
if (suggestion.valueDeclaration) {
|
|
49934
49943
|
addRelatedInfo(
|
|
49935
49944
|
diagnostic,
|
|
@@ -49938,7 +49947,7 @@ function createTypeChecker(host) {
|
|
|
49938
49947
|
}
|
|
49939
49948
|
} else {
|
|
49940
49949
|
if ((_a = moduleSymbol.exports) == null ? void 0 : _a.has("default" /* Default */)) {
|
|
49941
|
-
|
|
49950
|
+
error2(
|
|
49942
49951
|
name,
|
|
49943
49952
|
Diagnostics.Module_0_has_no_exported_member_1_Did_you_mean_to_use_import_1_from_0_instead,
|
|
49944
49953
|
moduleName,
|
|
@@ -49956,10 +49965,10 @@ function createTypeChecker(host) {
|
|
|
49956
49965
|
if (localSymbol) {
|
|
49957
49966
|
const exportedEqualsSymbol = exports == null ? void 0 : exports.get("export=" /* ExportEquals */);
|
|
49958
49967
|
if (exportedEqualsSymbol) {
|
|
49959
|
-
getSymbolIfSameReference(exportedEqualsSymbol, localSymbol) ? reportInvalidImportEqualsExportMember(node, name, declarationName, moduleName) :
|
|
49968
|
+
getSymbolIfSameReference(exportedEqualsSymbol, localSymbol) ? reportInvalidImportEqualsExportMember(node, name, declarationName, moduleName) : error2(name, Diagnostics.Module_0_has_no_exported_member_1, moduleName, declarationName);
|
|
49960
49969
|
} else {
|
|
49961
49970
|
const exportedSymbol = exports ? find(symbolsToArray(exports), (symbol) => !!getSymbolIfSameReference(symbol, localSymbol)) : void 0;
|
|
49962
|
-
const diagnostic = exportedSymbol ?
|
|
49971
|
+
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);
|
|
49963
49972
|
if (localSymbol.declarations) {
|
|
49964
49973
|
addRelatedInfo(
|
|
49965
49974
|
diagnostic,
|
|
@@ -49968,20 +49977,20 @@ function createTypeChecker(host) {
|
|
|
49968
49977
|
}
|
|
49969
49978
|
}
|
|
49970
49979
|
} else {
|
|
49971
|
-
|
|
49980
|
+
error2(name, Diagnostics.Module_0_has_no_exported_member_1, moduleName, declarationName);
|
|
49972
49981
|
}
|
|
49973
49982
|
}
|
|
49974
49983
|
function reportInvalidImportEqualsExportMember(node, name, declarationName, moduleName) {
|
|
49975
49984
|
if (moduleKind >= 5 /* ES2015 */) {
|
|
49976
49985
|
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;
|
|
49977
|
-
|
|
49986
|
+
error2(name, message, declarationName);
|
|
49978
49987
|
} else {
|
|
49979
49988
|
if (isInJSFile(node)) {
|
|
49980
49989
|
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;
|
|
49981
|
-
|
|
49990
|
+
error2(name, message, declarationName);
|
|
49982
49991
|
} else {
|
|
49983
49992
|
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;
|
|
49984
|
-
|
|
49993
|
+
error2(name, message, declarationName, declarationName, moduleName);
|
|
49985
49994
|
}
|
|
49986
49995
|
}
|
|
49987
49996
|
}
|
|
@@ -50151,7 +50160,7 @@ function createTypeChecker(host) {
|
|
|
50151
50160
|
if (links.aliasTarget === resolvingSymbol) {
|
|
50152
50161
|
links.aliasTarget = target || unknownSymbol;
|
|
50153
50162
|
} else {
|
|
50154
|
-
|
|
50163
|
+
error2(node, Diagnostics.Circular_definition_of_import_alias_0, symbolToString(symbol));
|
|
50155
50164
|
}
|
|
50156
50165
|
} else if (links.aliasTarget === resolvingSymbol) {
|
|
50157
50166
|
links.aliasTarget = unknownSymbol;
|
|
@@ -50387,13 +50396,13 @@ function createTypeChecker(host) {
|
|
|
50387
50396
|
const declarationName = declarationNameToString(right);
|
|
50388
50397
|
const suggestionForNonexistentModule = getSuggestedSymbolForNonexistentModule(right, namespace);
|
|
50389
50398
|
if (suggestionForNonexistentModule) {
|
|
50390
|
-
|
|
50399
|
+
error2(right, Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, namespaceName, declarationName, symbolToString(suggestionForNonexistentModule));
|
|
50391
50400
|
return void 0;
|
|
50392
50401
|
}
|
|
50393
50402
|
const containingQualifiedName = isQualifiedName(name) && getContainingQualifiedNameNode(name);
|
|
50394
50403
|
const canSuggestTypeof = globalObjectType && meaning & 788968 /* Type */ && containingQualifiedName && !isTypeOfExpression(containingQualifiedName.parent) && tryGetQualifiedNameAsValue(containingQualifiedName);
|
|
50395
50404
|
if (canSuggestTypeof) {
|
|
50396
|
-
|
|
50405
|
+
error2(
|
|
50397
50406
|
containingQualifiedName,
|
|
50398
50407
|
Diagnostics._0_refers_to_a_value_but_is_being_used_as_a_type_here_Did_you_mean_typeof_0,
|
|
50399
50408
|
entityNameToString(containingQualifiedName)
|
|
@@ -50403,7 +50412,7 @@ function createTypeChecker(host) {
|
|
|
50403
50412
|
if (meaning & 1920 /* Namespace */ && isQualifiedName(name.parent)) {
|
|
50404
50413
|
const exportedTypeSymbol = getMergedSymbol(getSymbol2(getExportsOfSymbol(namespace), right.escapedText, 788968 /* Type */));
|
|
50405
50414
|
if (exportedTypeSymbol) {
|
|
50406
|
-
|
|
50415
|
+
error2(
|
|
50407
50416
|
name.parent.right,
|
|
50408
50417
|
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,
|
|
50409
50418
|
symbolToString(exportedTypeSymbol),
|
|
@@ -50412,7 +50421,7 @@ function createTypeChecker(host) {
|
|
|
50412
50421
|
return void 0;
|
|
50413
50422
|
}
|
|
50414
50423
|
}
|
|
50415
|
-
|
|
50424
|
+
error2(right, Diagnostics.Namespace_0_has_no_exported_member_1, namespaceName, declarationName);
|
|
50416
50425
|
}
|
|
50417
50426
|
return void 0;
|
|
50418
50427
|
}
|
|
@@ -50517,7 +50526,7 @@ function createTypeChecker(host) {
|
|
|
50517
50526
|
if (startsWith(moduleReference, "@types/")) {
|
|
50518
50527
|
const diag2 = Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
|
|
50519
50528
|
const withoutAtTypePrefix = removePrefix(moduleReference, "@types/");
|
|
50520
|
-
|
|
50529
|
+
error2(errorNode, diag2, withoutAtTypePrefix, moduleReference);
|
|
50521
50530
|
}
|
|
50522
50531
|
const ambientModule = tryFindAmbientModule(
|
|
50523
50532
|
moduleReference,
|
|
@@ -50536,12 +50545,12 @@ function createTypeChecker(host) {
|
|
|
50536
50545
|
const sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName);
|
|
50537
50546
|
if (sourceFile) {
|
|
50538
50547
|
if (resolutionDiagnostic) {
|
|
50539
|
-
|
|
50548
|
+
error2(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
|
|
50540
50549
|
}
|
|
50541
50550
|
if (resolvedModule.resolvedUsingTsExtension && isDeclarationFileName(moduleReference)) {
|
|
50542
50551
|
const importOrExport = ((_g = findAncestor(location, isImportDeclaration)) == null ? void 0 : _g.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
|
|
50543
50552
|
if (importOrExport && !importOrExport.isTypeOnly || findAncestor(location, isImportCall)) {
|
|
50544
|
-
|
|
50553
|
+
error2(
|
|
50545
50554
|
errorNode,
|
|
50546
50555
|
Diagnostics.A_declaration_file_cannot_be_imported_without_import_type_Did_you_mean_to_import_an_implementation_file_0_instead,
|
|
50547
50556
|
getSuggestedImportSource(Debug.checkDefined(tryExtractTSExtension(moduleReference)))
|
|
@@ -50549,7 +50558,7 @@ function createTypeChecker(host) {
|
|
|
50549
50558
|
}
|
|
50550
50559
|
} else if (resolvedModule.resolvedUsingTsExtension && !shouldAllowImportingTsExtension(compilerOptions, currentSourceFile.fileName)) {
|
|
50551
50560
|
const tsExtension = Debug.checkDefined(tryExtractTSExtension(moduleReference));
|
|
50552
|
-
|
|
50561
|
+
error2(errorNode, Diagnostics.An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled, tsExtension);
|
|
50553
50562
|
}
|
|
50554
50563
|
if (sourceFile.symbol) {
|
|
50555
50564
|
if (resolvedModule.isExternalLibraryImport && !resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
|
|
@@ -50569,7 +50578,7 @@ function createTypeChecker(host) {
|
|
|
50569
50578
|
const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (_h = overrideClauseHost.assertions) == null ? void 0 : _h.assertClause : overrideClauseHost == null ? void 0 : overrideClauseHost.assertClause;
|
|
50570
50579
|
if (isSyncImport && sourceFile.impliedNodeFormat === 99 /* ESNext */ && !getResolutionModeOverrideForClause(overrideClause)) {
|
|
50571
50580
|
if (findAncestor(location, isImportEqualsDeclaration)) {
|
|
50572
|
-
|
|
50581
|
+
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);
|
|
50573
50582
|
} else {
|
|
50574
50583
|
let diagnosticDetails;
|
|
50575
50584
|
const ext = tryGetExtensionFromPath2(currentSourceFile.fileName);
|
|
@@ -50621,7 +50630,7 @@ function createTypeChecker(host) {
|
|
|
50621
50630
|
return getMergedSymbol(sourceFile.symbol);
|
|
50622
50631
|
}
|
|
50623
50632
|
if (moduleNotFoundError) {
|
|
50624
|
-
|
|
50633
|
+
error2(errorNode, Diagnostics.File_0_is_not_a_module, sourceFile.fileName);
|
|
50625
50634
|
}
|
|
50626
50635
|
return void 0;
|
|
50627
50636
|
}
|
|
@@ -50638,7 +50647,7 @@ function createTypeChecker(host) {
|
|
|
50638
50647
|
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) {
|
|
50639
50648
|
if (isForAugmentation) {
|
|
50640
50649
|
const diag2 = Diagnostics.Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented;
|
|
50641
|
-
|
|
50650
|
+
error2(errorNode, diag2, moduleReference, resolvedModule.resolvedFileName);
|
|
50642
50651
|
} else {
|
|
50643
50652
|
errorOnImplicitAnyModule(
|
|
50644
50653
|
/*isError*/
|
|
@@ -50656,31 +50665,31 @@ function createTypeChecker(host) {
|
|
|
50656
50665
|
if (resolvedModule) {
|
|
50657
50666
|
const redirect = host.getProjectReferenceRedirect(resolvedModule.resolvedFileName);
|
|
50658
50667
|
if (redirect) {
|
|
50659
|
-
|
|
50668
|
+
error2(errorNode, Diagnostics.Output_file_0_has_not_been_built_from_source_file_1, redirect, resolvedModule.resolvedFileName);
|
|
50660
50669
|
return void 0;
|
|
50661
50670
|
}
|
|
50662
50671
|
}
|
|
50663
50672
|
if (resolutionDiagnostic) {
|
|
50664
|
-
|
|
50673
|
+
error2(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
|
|
50665
50674
|
} else {
|
|
50666
50675
|
const isExtensionlessRelativePathImport = pathIsRelative(moduleReference) && !hasExtension(moduleReference);
|
|
50667
50676
|
const resolutionIsNode16OrNext = moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */;
|
|
50668
50677
|
if (!getResolveJsonModule(compilerOptions) && fileExtensionIs(moduleReference, ".json" /* Json */) && moduleResolutionKind !== 1 /* Classic */ && hasJsonModuleEmitEnabled(compilerOptions)) {
|
|
50669
|
-
|
|
50678
|
+
error2(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
50670
50679
|
} else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
|
|
50671
50680
|
const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
|
|
50672
50681
|
const suggestedExt = (_i = suggestedExtensions.find(([actualExt, _importExt]) => host.fileExists(absoluteRef + actualExt))) == null ? void 0 : _i[1];
|
|
50673
50682
|
if (suggestedExt) {
|
|
50674
|
-
|
|
50683
|
+
error2(
|
|
50675
50684
|
errorNode,
|
|
50676
50685
|
Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0,
|
|
50677
50686
|
moduleReference + suggestedExt
|
|
50678
50687
|
);
|
|
50679
50688
|
} else {
|
|
50680
|
-
|
|
50689
|
+
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);
|
|
50681
50690
|
}
|
|
50682
50691
|
} else {
|
|
50683
|
-
|
|
50692
|
+
error2(errorNode, moduleNotFoundError, moduleReference);
|
|
50684
50693
|
}
|
|
50685
50694
|
}
|
|
50686
50695
|
}
|
|
@@ -50746,7 +50755,7 @@ function createTypeChecker(host) {
|
|
|
50746
50755
|
if (!dontResolveAlias && symbol) {
|
|
50747
50756
|
if (!suppressInteropError && !(symbol.flags & (1536 /* Module */ | 3 /* Variable */)) && !getDeclarationOfKind(symbol, 311 /* SourceFile */)) {
|
|
50748
50757
|
const compilerOptionName = moduleKind >= 5 /* ES2015 */ ? "allowSyntheticDefaultImports" : "esModuleInterop";
|
|
50749
|
-
|
|
50758
|
+
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);
|
|
50750
50759
|
return symbol;
|
|
50751
50760
|
}
|
|
50752
50761
|
const referenceParent = referencingLocation.parent;
|
|
@@ -51130,7 +51139,7 @@ function createTypeChecker(host) {
|
|
|
51130
51139
|
function createIntrinsicType(kind, intrinsicName, objectFlags = 0 /* None */) {
|
|
51131
51140
|
const type = createType(kind);
|
|
51132
51141
|
type.intrinsicName = intrinsicName;
|
|
51133
|
-
type.objectFlags = objectFlags
|
|
51142
|
+
type.objectFlags = objectFlags | 524288 /* CouldContainTypeVariablesComputed */ | 2097152 /* IsGenericTypeComputed */ | 33554432 /* IsUnknownLikeUnionComputed */ | 16777216 /* IsNeverIntersectionComputed */;
|
|
51134
51143
|
return type;
|
|
51135
51144
|
}
|
|
51136
51145
|
function createObjectType(objectFlags, symbol) {
|
|
@@ -55573,7 +55582,7 @@ function createTypeChecker(host) {
|
|
|
55573
55582
|
if (declaration.dotDotDotToken) {
|
|
55574
55583
|
parentType = getReducedType(parentType);
|
|
55575
55584
|
if (parentType.flags & 2 /* Unknown */ || !isValidSpreadType(parentType)) {
|
|
55576
|
-
|
|
55585
|
+
error2(declaration, Diagnostics.Rest_types_may_only_be_created_from_object_types);
|
|
55577
55586
|
return errorType;
|
|
55578
55587
|
}
|
|
55579
55588
|
const literalMembers = [];
|
|
@@ -55806,7 +55815,7 @@ function createTypeChecker(host) {
|
|
|
55806
55815
|
reference.flowNode = staticBlock.returnFlowNode;
|
|
55807
55816
|
const flowType = getFlowTypeOfProperty(reference, symbol);
|
|
55808
55817
|
if (noImplicitAny && (flowType === autoType || flowType === autoArrayType)) {
|
|
55809
|
-
|
|
55818
|
+
error2(symbol.valueDeclaration, Diagnostics.Member_0_implicitly_has_an_1_type, symbolToString(symbol), typeToString(flowType));
|
|
55810
55819
|
}
|
|
55811
55820
|
if (everyType(flowType, isNullableType)) {
|
|
55812
55821
|
continue;
|
|
@@ -55822,7 +55831,7 @@ function createTypeChecker(host) {
|
|
|
55822
55831
|
reference.flowNode = constructor.returnFlowNode;
|
|
55823
55832
|
const flowType = getFlowTypeOfProperty(reference, symbol);
|
|
55824
55833
|
if (noImplicitAny && (flowType === autoType || flowType === autoArrayType)) {
|
|
55825
|
-
|
|
55834
|
+
error2(symbol.valueDeclaration, Diagnostics.Member_0_implicitly_has_an_1_type, symbolToString(symbol), typeToString(flowType));
|
|
55826
55835
|
}
|
|
55827
55836
|
return everyType(flowType, isNullableType) ? void 0 : convertAutoToAny(flowType);
|
|
55828
55837
|
}
|
|
@@ -55997,11 +56006,11 @@ function createTypeChecker(host) {
|
|
|
55997
56006
|
const unescapedName = unescapeLeadingUnderscores(s.escapedName);
|
|
55998
56007
|
const exportedMemberName = ((_a = tryCast(exportedMember.valueDeclaration, isNamedDeclaration)) == null ? void 0 : _a.name) || exportedMember.valueDeclaration;
|
|
55999
56008
|
addRelatedInfo(
|
|
56000
|
-
|
|
56009
|
+
error2(s.valueDeclaration, Diagnostics.Duplicate_identifier_0, unescapedName),
|
|
56001
56010
|
createDiagnosticForNode(exportedMemberName, Diagnostics._0_was_also_declared_here, unescapedName)
|
|
56002
56011
|
);
|
|
56003
56012
|
addRelatedInfo(
|
|
56004
|
-
|
|
56013
|
+
error2(exportedMemberName, Diagnostics.Duplicate_identifier_0, unescapedName),
|
|
56005
56014
|
createDiagnosticForNode(s.valueDeclaration, Diagnostics._0_was_also_declared_here, unescapedName)
|
|
56006
56015
|
);
|
|
56007
56016
|
}
|
|
@@ -56356,13 +56365,13 @@ function createTypeChecker(host) {
|
|
|
56356
56365
|
}
|
|
56357
56366
|
if (!popTypeResolution()) {
|
|
56358
56367
|
if (getAnnotatedAccessorTypeNode(getter)) {
|
|
56359
|
-
|
|
56368
|
+
error2(getter, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol));
|
|
56360
56369
|
} else if (getAnnotatedAccessorTypeNode(setter)) {
|
|
56361
|
-
|
|
56370
|
+
error2(setter, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol));
|
|
56362
56371
|
} else if (getAnnotatedAccessorTypeNode(accessor)) {
|
|
56363
|
-
|
|
56372
|
+
error2(setter, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol));
|
|
56364
56373
|
} else if (getter && noImplicitAny) {
|
|
56365
|
-
|
|
56374
|
+
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));
|
|
56366
56375
|
}
|
|
56367
56376
|
type = anyType;
|
|
56368
56377
|
}
|
|
@@ -56380,7 +56389,7 @@ function createTypeChecker(host) {
|
|
|
56380
56389
|
let writeType = getAnnotatedAccessorType(setter);
|
|
56381
56390
|
if (!popTypeResolution()) {
|
|
56382
56391
|
if (getAnnotatedAccessorTypeNode(setter)) {
|
|
56383
|
-
|
|
56392
|
+
error2(setter, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol));
|
|
56384
56393
|
}
|
|
56385
56394
|
writeType = anyType;
|
|
56386
56395
|
}
|
|
@@ -56473,7 +56482,7 @@ function createTypeChecker(host) {
|
|
|
56473
56482
|
function reportCircularityError(symbol) {
|
|
56474
56483
|
const declaration = symbol.valueDeclaration;
|
|
56475
56484
|
if (getEffectiveTypeAnnotationNode(declaration)) {
|
|
56476
|
-
|
|
56485
|
+
error2(
|
|
56477
56486
|
symbol.valueDeclaration,
|
|
56478
56487
|
Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation,
|
|
56479
56488
|
symbolToString(symbol)
|
|
@@ -56481,7 +56490,7 @@ function createTypeChecker(host) {
|
|
|
56481
56490
|
return errorType;
|
|
56482
56491
|
}
|
|
56483
56492
|
if (noImplicitAny && (declaration.kind !== 168 /* Parameter */ || declaration.initializer)) {
|
|
56484
|
-
|
|
56493
|
+
error2(
|
|
56485
56494
|
symbol.valueDeclaration,
|
|
56486
56495
|
Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer,
|
|
56487
56496
|
symbolToString(symbol)
|
|
@@ -56726,11 +56735,11 @@ function createTypeChecker(host) {
|
|
|
56726
56735
|
resolveStructuredTypeMembers(baseConstructorType);
|
|
56727
56736
|
}
|
|
56728
56737
|
if (!popTypeResolution()) {
|
|
56729
|
-
|
|
56738
|
+
error2(type.symbol.valueDeclaration, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_base_expression, symbolToString(type.symbol));
|
|
56730
56739
|
return type.resolvedBaseConstructorType = errorType;
|
|
56731
56740
|
}
|
|
56732
56741
|
if (!(baseConstructorType.flags & 1 /* Any */) && baseConstructorType !== nullWideningType && !isConstructorType(baseConstructorType)) {
|
|
56733
|
-
const err =
|
|
56742
|
+
const err = error2(baseTypeNode.expression, Diagnostics.Type_0_is_not_a_constructor_function_type, typeToString(baseConstructorType));
|
|
56734
56743
|
if (baseConstructorType.flags & 262144 /* TypeParameter */) {
|
|
56735
56744
|
const constraint = getConstraintFromTypeParameter(baseConstructorType);
|
|
56736
56745
|
let ctorReturn = unknownType;
|
|
@@ -56772,7 +56781,7 @@ function createTypeChecker(host) {
|
|
|
56772
56781
|
return resolvedImplementsTypes;
|
|
56773
56782
|
}
|
|
56774
56783
|
function reportCircularBaseType(node, type) {
|
|
56775
|
-
|
|
56784
|
+
error2(node, Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(
|
|
56776
56785
|
type,
|
|
56777
56786
|
/*enclosingDeclaration*/
|
|
56778
56787
|
void 0,
|
|
@@ -56826,7 +56835,7 @@ function createTypeChecker(host) {
|
|
|
56826
56835
|
} else {
|
|
56827
56836
|
const constructors = getInstantiatedConstructorsForTypeArguments(baseConstructorType, baseTypeNode.typeArguments, baseTypeNode);
|
|
56828
56837
|
if (!constructors.length) {
|
|
56829
|
-
|
|
56838
|
+
error2(baseTypeNode.expression, Diagnostics.No_base_constructor_has_the_specified_number_of_type_arguments);
|
|
56830
56839
|
return type.resolvedBaseTypes = emptyArray;
|
|
56831
56840
|
}
|
|
56832
56841
|
baseType = getReturnTypeOfSignature(constructors[0]);
|
|
@@ -56846,7 +56855,7 @@ function createTypeChecker(host) {
|
|
|
56846
56855
|
return type.resolvedBaseTypes = emptyArray;
|
|
56847
56856
|
}
|
|
56848
56857
|
if (type === reducedBaseType || hasBaseType(reducedBaseType, type)) {
|
|
56849
|
-
|
|
56858
|
+
error2(
|
|
56850
56859
|
type.symbol.valueDeclaration,
|
|
56851
56860
|
Diagnostics.Type_0_recursively_references_itself_as_a_base_type,
|
|
56852
56861
|
typeToString(
|
|
@@ -56900,7 +56909,7 @@ function createTypeChecker(host) {
|
|
|
56900
56909
|
reportCircularBaseType(declaration, type);
|
|
56901
56910
|
}
|
|
56902
56911
|
} else {
|
|
56903
|
-
|
|
56912
|
+
error2(node, Diagnostics.An_interface_can_only_extend_an_object_type_or_intersection_of_object_types_with_statically_known_members);
|
|
56904
56913
|
}
|
|
56905
56914
|
}
|
|
56906
56915
|
}
|
|
@@ -56986,9 +56995,9 @@ function createTypeChecker(host) {
|
|
|
56986
56995
|
} else {
|
|
56987
56996
|
type = errorType;
|
|
56988
56997
|
if (declaration.kind === 346 /* JSDocEnumTag */) {
|
|
56989
|
-
|
|
56998
|
+
error2(declaration.typeExpression.type, Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
|
|
56990
56999
|
} else {
|
|
56991
|
-
|
|
57000
|
+
error2(isNamedDeclaration(declaration) ? declaration.name || declaration : declaration, Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
|
|
56992
57001
|
}
|
|
56993
57002
|
}
|
|
56994
57003
|
links.declaredType = type;
|
|
@@ -57237,8 +57246,8 @@ function createTypeChecker(host) {
|
|
|
57237
57246
|
if (lateSymbol.flags & getExcludedSymbolFlags(symbolFlags) || earlySymbol) {
|
|
57238
57247
|
const declarations = earlySymbol ? concatenate(earlySymbol.declarations, lateSymbol.declarations) : lateSymbol.declarations;
|
|
57239
57248
|
const name = !(type.flags & 8192 /* UniqueESSymbol */) && unescapeLeadingUnderscores(memberName) || declarationNameToString(declName);
|
|
57240
|
-
forEach(declarations, (declaration) =>
|
|
57241
|
-
|
|
57249
|
+
forEach(declarations, (declaration) => error2(getNameOfDeclaration(declaration) || declaration, Diagnostics.Property_0_was_also_declared_here, name));
|
|
57250
|
+
error2(declName || decl, Diagnostics.Duplicate_property_0, name);
|
|
57242
57251
|
lateSymbol = createSymbol(0 /* None */, memberName, 4096 /* Late */);
|
|
57243
57252
|
}
|
|
57244
57253
|
lateSymbol.links.nameType = type;
|
|
@@ -58084,7 +58093,7 @@ function createTypeChecker(host) {
|
|
|
58084
58093
|
true
|
|
58085
58094
|
) : symbol.links.checkFlags & 524288 /* StripOptional */ ? removeMissingOrUndefinedType(propType) : propType;
|
|
58086
58095
|
if (!popTypeResolution()) {
|
|
58087
|
-
|
|
58096
|
+
error2(currentNode, Diagnostics.Type_of_property_0_circularly_references_itself_in_mapped_type_1, symbolToString(symbol), typeToString(mappedType));
|
|
58088
58097
|
type = errorType;
|
|
58089
58098
|
}
|
|
58090
58099
|
symbol.links.type = type;
|
|
@@ -58410,7 +58419,7 @@ function createTypeChecker(host) {
|
|
|
58410
58419
|
if (t.flags & 262144 /* TypeParameter */) {
|
|
58411
58420
|
const errorNode = getConstraintDeclaration(t);
|
|
58412
58421
|
if (errorNode) {
|
|
58413
|
-
const diagnostic =
|
|
58422
|
+
const diagnostic = error2(errorNode, Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(t));
|
|
58414
58423
|
if (currentNode && !isNodeDescendantOf(errorNode, currentNode) && !isNodeDescendantOf(currentNode, errorNode)) {
|
|
58415
58424
|
addRelatedInfo(diagnostic, createDiagnosticForNode(currentNode, Diagnostics.Circularity_originates_in_type_at_this_location));
|
|
58416
58425
|
}
|
|
@@ -59260,14 +59269,14 @@ function createTypeChecker(host) {
|
|
|
59260
59269
|
if (signature.declaration) {
|
|
59261
59270
|
const typeNode = getEffectiveReturnTypeNode(signature.declaration);
|
|
59262
59271
|
if (typeNode) {
|
|
59263
|
-
|
|
59272
|
+
error2(typeNode, Diagnostics.Return_type_annotation_circularly_references_itself);
|
|
59264
59273
|
} else if (noImplicitAny) {
|
|
59265
59274
|
const declaration = signature.declaration;
|
|
59266
59275
|
const name = getNameOfDeclaration(declaration);
|
|
59267
59276
|
if (name) {
|
|
59268
|
-
|
|
59277
|
+
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));
|
|
59269
59278
|
} else {
|
|
59270
|
-
|
|
59279
|
+
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);
|
|
59271
59280
|
}
|
|
59272
59281
|
}
|
|
59273
59282
|
}
|
|
@@ -59611,7 +59620,7 @@ function createTypeChecker(host) {
|
|
|
59611
59620
|
type.resolvedTypeArguments = type.mapper ? instantiateTypes(typeArguments, type.mapper) : typeArguments;
|
|
59612
59621
|
} else {
|
|
59613
59622
|
type.resolvedTypeArguments = ((_b = type.target.localTypeParameters) == null ? void 0 : _b.map(() => errorType)) || emptyArray;
|
|
59614
|
-
|
|
59623
|
+
error2(
|
|
59615
59624
|
type.node || currentNode,
|
|
59616
59625
|
type.target.symbol ? Diagnostics.Type_arguments_for_0_circularly_reference_themselves : Diagnostics.Tuple_type_arguments_circularly_reference_themselves,
|
|
59617
59626
|
type.target.symbol && symbolToString(type.target.symbol)
|
|
@@ -59640,7 +59649,7 @@ function createTypeChecker(host) {
|
|
|
59640
59649
|
void 0,
|
|
59641
59650
|
2 /* WriteArrayAsGenericType */
|
|
59642
59651
|
);
|
|
59643
|
-
|
|
59652
|
+
error2(node, diag2, typeStr, minTypeArgumentCount, typeParameters.length);
|
|
59644
59653
|
if (!isJs) {
|
|
59645
59654
|
return errorType;
|
|
59646
59655
|
}
|
|
@@ -59696,7 +59705,7 @@ function createTypeChecker(host) {
|
|
|
59696
59705
|
const numTypeArguments = length(node.typeArguments);
|
|
59697
59706
|
const minTypeArgumentCount = getMinTypeArgumentCount(typeParameters);
|
|
59698
59707
|
if (numTypeArguments < minTypeArgumentCount || numTypeArguments > typeParameters.length) {
|
|
59699
|
-
|
|
59708
|
+
error2(
|
|
59700
59709
|
node,
|
|
59701
59710
|
minTypeArgumentCount === typeParameters.length ? Diagnostics.Generic_type_0_requires_1_type_argument_s : Diagnostics.Generic_type_0_requires_between_1_and_2_type_arguments,
|
|
59702
59711
|
symbolToString(symbol),
|
|
@@ -59872,7 +59881,7 @@ function createTypeChecker(host) {
|
|
|
59872
59881
|
}
|
|
59873
59882
|
function checkNoTypeArguments(node, symbol) {
|
|
59874
59883
|
if (node.typeArguments) {
|
|
59875
|
-
|
|
59884
|
+
error2(node, Diagnostics.Type_0_is_not_generic, symbol ? symbolToString(symbol) : node.typeName ? declarationNameToString(node.typeName) : anon);
|
|
59876
59885
|
return false;
|
|
59877
59886
|
}
|
|
59878
59887
|
return true;
|
|
@@ -60004,11 +60013,11 @@ function createTypeChecker(host) {
|
|
|
60004
60013
|
}
|
|
60005
60014
|
const type = getDeclaredTypeOfSymbol(symbol);
|
|
60006
60015
|
if (!(type.flags & 524288 /* Object */)) {
|
|
60007
|
-
|
|
60016
|
+
error2(getTypeDeclaration(symbol), Diagnostics.Global_type_0_must_be_a_class_or_interface_type, symbolName(symbol));
|
|
60008
60017
|
return arity ? emptyGenericType : emptyObjectType;
|
|
60009
60018
|
}
|
|
60010
60019
|
if (length(type.typeParameters) !== arity) {
|
|
60011
|
-
|
|
60020
|
+
error2(getTypeDeclaration(symbol), Diagnostics.Global_type_0_must_have_1_type_parameter_s, symbolName(symbol), arity);
|
|
60012
60021
|
return arity ? emptyGenericType : emptyObjectType;
|
|
60013
60022
|
}
|
|
60014
60023
|
return type;
|
|
@@ -60025,7 +60034,7 @@ function createTypeChecker(host) {
|
|
|
60025
60034
|
getDeclaredTypeOfSymbol(symbol);
|
|
60026
60035
|
if (length(getSymbolLinks(symbol).typeParameters) !== arity) {
|
|
60027
60036
|
const decl = symbol.declarations && find(symbol.declarations, isTypeAliasDeclaration);
|
|
60028
|
-
|
|
60037
|
+
error2(decl, Diagnostics.Global_type_0_must_have_1_type_parameter_s, symbolName(symbol), arity);
|
|
60029
60038
|
return void 0;
|
|
60030
60039
|
}
|
|
60031
60040
|
}
|
|
@@ -60570,7 +60579,7 @@ function createTypeChecker(host) {
|
|
|
60570
60579
|
} else if (isTupleType(type)) {
|
|
60571
60580
|
const elements = getElementTypes(type);
|
|
60572
60581
|
if (elements.length + expandedTypes.length >= 1e4) {
|
|
60573
|
-
|
|
60582
|
+
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);
|
|
60574
60583
|
return errorType;
|
|
60575
60584
|
}
|
|
60576
60585
|
forEach(elements, (t, n) => {
|
|
@@ -60735,7 +60744,7 @@ function createTypeChecker(host) {
|
|
|
60735
60744
|
const estimatedCount = count / (len - i) * len;
|
|
60736
60745
|
if (estimatedCount > 1e6) {
|
|
60737
60746
|
(_a = tracing) == null ? void 0 : _a.instant(tracing.Phase.CheckTypes, "removeSubtypes_DepthLimit", { typeIds: types.map((t) => t.id) });
|
|
60738
|
-
|
|
60747
|
+
error2(currentNode, Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent);
|
|
60739
60748
|
return void 0;
|
|
60740
60749
|
}
|
|
60741
60750
|
}
|
|
@@ -61144,7 +61153,7 @@ function createTypeChecker(host) {
|
|
|
61144
61153
|
const size = getCrossProductUnionSize(types);
|
|
61145
61154
|
if (size >= 1e5) {
|
|
61146
61155
|
(_a = tracing) == null ? void 0 : _a.instant(tracing.Phase.CheckTypes, "checkCrossProductUnion_DepthLimit", { typeIds: types.map((t) => t.id), size });
|
|
61147
|
-
|
|
61156
|
+
error2(currentNode, Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent);
|
|
61148
61157
|
return false;
|
|
61149
61158
|
}
|
|
61150
61159
|
return true;
|
|
@@ -61516,7 +61525,7 @@ function createTypeChecker(host) {
|
|
|
61516
61525
|
if (accessExpression) {
|
|
61517
61526
|
markPropertyAsReferenced(prop, accessExpression, isSelfTypeAccess(accessExpression.expression, objectType.symbol));
|
|
61518
61527
|
if (isAssignmentToReadonlyEntity(accessExpression, prop, getAssignmentTargetKind(accessExpression))) {
|
|
61519
|
-
|
|
61528
|
+
error2(accessExpression.argumentExpression, Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, symbolToString(prop));
|
|
61520
61529
|
return void 0;
|
|
61521
61530
|
}
|
|
61522
61531
|
if (accessFlags & 8 /* CacheSymbol */) {
|
|
@@ -61535,10 +61544,10 @@ function createTypeChecker(host) {
|
|
|
61535
61544
|
const indexNode = getIndexNodeForAccessExpression(accessNode);
|
|
61536
61545
|
if (isTupleType(objectType)) {
|
|
61537
61546
|
if (index < 0) {
|
|
61538
|
-
|
|
61547
|
+
error2(indexNode, Diagnostics.A_tuple_type_cannot_be_indexed_with_a_negative_value);
|
|
61539
61548
|
return undefinedType;
|
|
61540
61549
|
}
|
|
61541
|
-
|
|
61550
|
+
error2(
|
|
61542
61551
|
indexNode,
|
|
61543
61552
|
Diagnostics.Tuple_type_0_of_length_1_has_no_element_at_index_2,
|
|
61544
61553
|
typeToString(objectType),
|
|
@@ -61546,7 +61555,7 @@ function createTypeChecker(host) {
|
|
|
61546
61555
|
unescapeLeadingUnderscores(propName)
|
|
61547
61556
|
);
|
|
61548
61557
|
} else {
|
|
61549
|
-
|
|
61558
|
+
error2(indexNode, Diagnostics.Property_0_does_not_exist_on_type_1, unescapeLeadingUnderscores(propName), typeToString(objectType));
|
|
61550
61559
|
}
|
|
61551
61560
|
}
|
|
61552
61561
|
if (index >= 0) {
|
|
@@ -61566,13 +61575,13 @@ function createTypeChecker(host) {
|
|
|
61566
61575
|
if (indexInfo) {
|
|
61567
61576
|
if (accessFlags & 2 /* NoIndexSignatures */ && indexInfo.keyType !== numberType) {
|
|
61568
61577
|
if (accessExpression) {
|
|
61569
|
-
|
|
61578
|
+
error2(accessExpression, Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(originalObjectType));
|
|
61570
61579
|
}
|
|
61571
61580
|
return void 0;
|
|
61572
61581
|
}
|
|
61573
61582
|
if (accessNode && indexInfo.keyType === stringType && !isTypeAssignableToKind(indexType, 4 /* String */ | 8 /* Number */)) {
|
|
61574
61583
|
const indexNode = getIndexNodeForAccessExpression(accessNode);
|
|
61575
|
-
|
|
61584
|
+
error2(indexNode, Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType));
|
|
61576
61585
|
return accessFlags & 1 /* IncludeUndefined */ ? getUnionType([indexInfo.type, missingType]) : indexInfo.type;
|
|
61577
61586
|
}
|
|
61578
61587
|
errorIfWritingToReadonlyIndex(indexInfo);
|
|
@@ -61600,23 +61609,23 @@ function createTypeChecker(host) {
|
|
|
61600
61609
|
}
|
|
61601
61610
|
}
|
|
61602
61611
|
if (objectType.symbol === globalThisSymbol && propName !== void 0 && globalThisSymbol.exports.has(propName) && globalThisSymbol.exports.get(propName).flags & 418 /* BlockScoped */) {
|
|
61603
|
-
|
|
61612
|
+
error2(accessExpression, Diagnostics.Property_0_does_not_exist_on_type_1, unescapeLeadingUnderscores(propName), typeToString(objectType));
|
|
61604
61613
|
} else if (noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors && !(accessFlags & 128 /* SuppressNoImplicitAnyError */)) {
|
|
61605
61614
|
if (propName !== void 0 && typeHasStaticProperty(propName, objectType)) {
|
|
61606
61615
|
const typeName = typeToString(objectType);
|
|
61607
|
-
|
|
61616
|
+
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) + "]");
|
|
61608
61617
|
} else if (getIndexTypeOfType(objectType, numberType)) {
|
|
61609
|
-
|
|
61618
|
+
error2(accessExpression.argumentExpression, Diagnostics.Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number);
|
|
61610
61619
|
} else {
|
|
61611
61620
|
let suggestion;
|
|
61612
61621
|
if (propName !== void 0 && (suggestion = getSuggestionForNonexistentProperty(propName, objectType))) {
|
|
61613
61622
|
if (suggestion !== void 0) {
|
|
61614
|
-
|
|
61623
|
+
error2(accessExpression.argumentExpression, Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2, propName, typeToString(objectType), suggestion);
|
|
61615
61624
|
}
|
|
61616
61625
|
} else {
|
|
61617
61626
|
const suggestion2 = getSuggestionForNonexistentIndexSignature(objectType, accessExpression, indexType);
|
|
61618
61627
|
if (suggestion2 !== void 0) {
|
|
61619
|
-
|
|
61628
|
+
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);
|
|
61620
61629
|
} else {
|
|
61621
61630
|
let errorInfo;
|
|
61622
61631
|
if (indexType.flags & 1024 /* EnumLiteral */) {
|
|
@@ -61681,11 +61690,11 @@ function createTypeChecker(host) {
|
|
|
61681
61690
|
if (accessNode) {
|
|
61682
61691
|
const indexNode = getIndexNodeForAccessExpression(accessNode);
|
|
61683
61692
|
if (indexType.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */)) {
|
|
61684
|
-
|
|
61693
|
+
error2(indexNode, Diagnostics.Property_0_does_not_exist_on_type_1, "" + indexType.value, typeToString(objectType));
|
|
61685
61694
|
} else if (indexType.flags & (4 /* String */ | 8 /* Number */)) {
|
|
61686
|
-
|
|
61695
|
+
error2(indexNode, Diagnostics.Type_0_has_no_matching_index_signature_for_type_1, typeToString(objectType), typeToString(indexType));
|
|
61687
61696
|
} else {
|
|
61688
|
-
|
|
61697
|
+
error2(indexNode, Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType));
|
|
61689
61698
|
}
|
|
61690
61699
|
}
|
|
61691
61700
|
if (isTypeAny(indexType)) {
|
|
@@ -61694,7 +61703,7 @@ function createTypeChecker(host) {
|
|
|
61694
61703
|
return void 0;
|
|
61695
61704
|
function errorIfWritingToReadonlyIndex(indexInfo) {
|
|
61696
61705
|
if (indexInfo && indexInfo.isReadonly && accessExpression && (isAssignmentTarget(accessExpression) || isDeleteTarget(accessExpression))) {
|
|
61697
|
-
|
|
61706
|
+
error2(accessExpression, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
|
|
61698
61707
|
}
|
|
61699
61708
|
}
|
|
61700
61709
|
}
|
|
@@ -61919,7 +61928,7 @@ function createTypeChecker(host) {
|
|
|
61919
61928
|
let tailCount = 0;
|
|
61920
61929
|
while (true) {
|
|
61921
61930
|
if (tailCount === 1e3) {
|
|
61922
|
-
|
|
61931
|
+
error2(currentNode, Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
|
|
61923
61932
|
return errorType;
|
|
61924
61933
|
}
|
|
61925
61934
|
const checkType = instantiateType(getActualTypeVariable(root.checkType), mapper);
|
|
@@ -62097,7 +62106,7 @@ function createTypeChecker(host) {
|
|
|
62097
62106
|
const links = getNodeLinks(node);
|
|
62098
62107
|
if (!links.resolvedType) {
|
|
62099
62108
|
if (!isLiteralImportTypeNode(node)) {
|
|
62100
|
-
|
|
62109
|
+
error2(node.argument, Diagnostics.String_literal_expected);
|
|
62101
62110
|
links.resolvedSymbol = unknownSymbol;
|
|
62102
62111
|
return links.resolvedType = errorType;
|
|
62103
62112
|
}
|
|
@@ -62131,7 +62140,7 @@ function createTypeChecker(host) {
|
|
|
62131
62140
|
const symbolFromModule = node.isTypeOf ? void 0 : getSymbol2(getExportsOfSymbol(mergedResolvedSymbol), current.escapedText, meaning);
|
|
62132
62141
|
const next = symbolFromModule ?? symbolFromVariable;
|
|
62133
62142
|
if (!next) {
|
|
62134
|
-
|
|
62143
|
+
error2(current, Diagnostics.Namespace_0_has_no_exported_member_1, getFullyQualifiedName(currentNamespace), declarationNameToString(current));
|
|
62135
62144
|
return links.resolvedType = errorType;
|
|
62136
62145
|
}
|
|
62137
62146
|
getNodeLinks(current).resolvedSymbol = next;
|
|
@@ -62144,7 +62153,7 @@ function createTypeChecker(host) {
|
|
|
62144
62153
|
links.resolvedType = resolveImportSymbolType(node, links, moduleSymbol, targetMeaning);
|
|
62145
62154
|
} else {
|
|
62146
62155
|
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;
|
|
62147
|
-
|
|
62156
|
+
error2(node, errorMessage, node.argument.literal.text);
|
|
62148
62157
|
links.resolvedSymbol = unknownSymbol;
|
|
62149
62158
|
links.resolvedType = errorType;
|
|
62150
62159
|
}
|
|
@@ -62422,7 +62431,7 @@ function createTypeChecker(host) {
|
|
|
62422
62431
|
if (isJSConstructor(container) && isNodeDescendantOf(node, container.body)) {
|
|
62423
62432
|
return getDeclaredTypeOfClassOrInterface(getSymbolOfDeclaration(container)).thisType;
|
|
62424
62433
|
}
|
|
62425
|
-
|
|
62434
|
+
error2(node, Diagnostics.A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface);
|
|
62426
62435
|
return errorType;
|
|
62427
62436
|
}
|
|
62428
62437
|
function getTypeFromThisTypeNode(node) {
|
|
@@ -62751,13 +62760,18 @@ function createTypeChecker(host) {
|
|
|
62751
62760
|
if (!result) {
|
|
62752
62761
|
const newMapper = createTypeMapper(typeParameters, typeArguments);
|
|
62753
62762
|
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);
|
|
62754
|
-
|
|
62763
|
+
target.instantiations.set(id, result);
|
|
62764
|
+
const resultObjectFlags = getObjectFlags(result);
|
|
62765
|
+
if (result.flags & 138117121 /* ObjectFlagsType */ && !(resultObjectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
|
|
62755
62766
|
const resultCouldContainTypeVariables = some(typeArguments, couldContainTypeVariables);
|
|
62756
|
-
if (!(result
|
|
62757
|
-
|
|
62767
|
+
if (!(getObjectFlags(result) & 524288 /* CouldContainTypeVariablesComputed */)) {
|
|
62768
|
+
if (resultObjectFlags & (32 /* Mapped */ | 16 /* Anonymous */ | 4 /* Reference */)) {
|
|
62769
|
+
result.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (resultCouldContainTypeVariables ? 1048576 /* CouldContainTypeVariables */ : 0);
|
|
62770
|
+
} else {
|
|
62771
|
+
result.objectFlags |= !resultCouldContainTypeVariables ? 524288 /* CouldContainTypeVariablesComputed */ : 0;
|
|
62772
|
+
}
|
|
62758
62773
|
}
|
|
62759
62774
|
}
|
|
62760
|
-
target.instantiations.set(id, result);
|
|
62761
62775
|
}
|
|
62762
62776
|
return result;
|
|
62763
62777
|
}
|
|
@@ -62942,7 +62956,7 @@ function createTypeChecker(host) {
|
|
|
62942
62956
|
}
|
|
62943
62957
|
if (instantiationDepth === 100 || instantiationCount >= 5e6) {
|
|
62944
62958
|
(_a = tracing) == null ? void 0 : _a.instant(tracing.Phase.CheckTypes, "instantiateType_DepthLimit", { typeId: type.id, instantiationDepth, instantiationCount });
|
|
62945
|
-
|
|
62959
|
+
error2(currentNode, Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
|
|
62946
62960
|
return errorType;
|
|
62947
62961
|
}
|
|
62948
62962
|
totalInstantiationCount++;
|
|
@@ -63562,7 +63576,7 @@ function createTypeChecker(host) {
|
|
|
63562
63576
|
result = elaborateIterableOrArrayLikeTargetElementwise(children, realSource, arrayLikeTargetParts, relation, containingMessageChain, errorOutputContainer) || result;
|
|
63563
63577
|
} else if (!isTypeRelatedTo(getIndexedAccessType(source, childrenNameType), childrenTargetType, relation)) {
|
|
63564
63578
|
result = true;
|
|
63565
|
-
const diag2 =
|
|
63579
|
+
const diag2 = error2(
|
|
63566
63580
|
containingElement.openingElement.tagName,
|
|
63567
63581
|
Diagnostics.This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided,
|
|
63568
63582
|
childrenPropName,
|
|
@@ -63590,7 +63604,7 @@ function createTypeChecker(host) {
|
|
|
63590
63604
|
}
|
|
63591
63605
|
} else if (!isTypeRelatedTo(getIndexedAccessType(source, childrenNameType), childrenTargetType, relation)) {
|
|
63592
63606
|
result = true;
|
|
63593
|
-
const diag2 =
|
|
63607
|
+
const diag2 = error2(
|
|
63594
63608
|
containingElement.openingElement.tagName,
|
|
63595
63609
|
Diagnostics.This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_provided,
|
|
63596
63610
|
childrenPropName,
|
|
@@ -64095,7 +64109,7 @@ function createTypeChecker(host) {
|
|
|
64095
64109
|
}
|
|
64096
64110
|
if (overflow) {
|
|
64097
64111
|
(_a = tracing) == null ? void 0 : _a.instant(tracing.Phase.CheckTypes, "checkTypeRelatedTo_DepthLimit", { sourceId: source.id, targetId: target.id, depth: sourceDepth, targetDepth });
|
|
64098
|
-
const diag2 =
|
|
64112
|
+
const diag2 = error2(errorNode || currentNode, Diagnostics.Excessive_stack_depth_comparing_types_0_and_1, typeToString(source), typeToString(target));
|
|
64099
64113
|
if (errorOutputContainer) {
|
|
64100
64114
|
(errorOutputContainer.errors || (errorOutputContainer.errors = [])).push(diag2);
|
|
64101
64115
|
}
|
|
@@ -67211,7 +67225,7 @@ function createTypeChecker(host) {
|
|
|
67211
67225
|
const t = getTypeOfSymbol(p);
|
|
67212
67226
|
if (getObjectFlags(t) & 65536 /* ContainsWideningType */) {
|
|
67213
67227
|
if (!reportWideningErrorsInType(t)) {
|
|
67214
|
-
|
|
67228
|
+
error2(p.valueDeclaration, Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, symbolToString(p), typeToString(getWidenedType(t)));
|
|
67215
67229
|
}
|
|
67216
67230
|
errorReported = true;
|
|
67217
67231
|
}
|
|
@@ -67261,11 +67275,11 @@ function createTypeChecker(host) {
|
|
|
67261
67275
|
}
|
|
67262
67276
|
break;
|
|
67263
67277
|
case 323 /* JSDocFunctionType */:
|
|
67264
|
-
|
|
67278
|
+
error2(declaration, Diagnostics.Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString);
|
|
67265
67279
|
return;
|
|
67266
67280
|
case 329 /* JSDocSignature */:
|
|
67267
67281
|
if (noImplicitAny && isJSDocOverloadTag(declaration.parent)) {
|
|
67268
|
-
|
|
67282
|
+
error2(declaration.parent.tagName, Diagnostics.This_overload_implicitly_returns_the_type_0_because_it_lacks_a_return_type_annotation, typeAsString);
|
|
67269
67283
|
}
|
|
67270
67284
|
return;
|
|
67271
67285
|
case 261 /* FunctionDeclaration */:
|
|
@@ -67277,9 +67291,9 @@ function createTypeChecker(host) {
|
|
|
67277
67291
|
case 218 /* ArrowFunction */:
|
|
67278
67292
|
if (noImplicitAny && !declaration.name) {
|
|
67279
67293
|
if (wideningKind === 3 /* GeneratorYield */) {
|
|
67280
|
-
|
|
67294
|
+
error2(declaration, Diagnostics.Generator_implicitly_has_yield_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type_annotation, typeAsString);
|
|
67281
67295
|
} else {
|
|
67282
|
-
|
|
67296
|
+
error2(declaration, Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString);
|
|
67283
67297
|
}
|
|
67284
67298
|
return;
|
|
67285
67299
|
}
|
|
@@ -67287,7 +67301,7 @@ function createTypeChecker(host) {
|
|
|
67287
67301
|
break;
|
|
67288
67302
|
case 199 /* MappedType */:
|
|
67289
67303
|
if (noImplicitAny) {
|
|
67290
|
-
|
|
67304
|
+
error2(declaration, Diagnostics.Mapped_object_type_implicitly_has_an_any_template_type);
|
|
67291
67305
|
}
|
|
67292
67306
|
return;
|
|
67293
67307
|
default:
|
|
@@ -70565,15 +70579,15 @@ function createTypeChecker(host) {
|
|
|
70565
70579
|
}
|
|
70566
70580
|
if (symbol === argumentsSymbol) {
|
|
70567
70581
|
if (isInPropertyInitializerOrClassStaticBlock(node)) {
|
|
70568
|
-
|
|
70582
|
+
error2(node, Diagnostics.arguments_cannot_be_referenced_in_property_initializers);
|
|
70569
70583
|
return errorType;
|
|
70570
70584
|
}
|
|
70571
70585
|
const container = getContainingFunction(node);
|
|
70572
70586
|
if (languageVersion < 2 /* ES2015 */) {
|
|
70573
70587
|
if (container.kind === 218 /* ArrowFunction */) {
|
|
70574
|
-
|
|
70588
|
+
error2(node, Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression);
|
|
70575
70589
|
} else if (hasSyntacticModifier(container, 512 /* Async */)) {
|
|
70576
|
-
|
|
70590
|
+
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);
|
|
70577
70591
|
}
|
|
70578
70592
|
}
|
|
70579
70593
|
getNodeLinks(container).flags |= 512 /* CaptureArguments */;
|
|
@@ -70631,14 +70645,14 @@ function createTypeChecker(host) {
|
|
|
70631
70645
|
if (assignmentKind) {
|
|
70632
70646
|
if (!(localOrExportSymbol.flags & 3 /* Variable */) && !(isInJSFile(node) && localOrExportSymbol.flags & 512 /* ValueModule */)) {
|
|
70633
70647
|
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;
|
|
70634
|
-
|
|
70648
|
+
error2(node, assignmentError, symbolToString(symbol));
|
|
70635
70649
|
return errorType;
|
|
70636
70650
|
}
|
|
70637
70651
|
if (isReadonlySymbol(localOrExportSymbol)) {
|
|
70638
70652
|
if (localOrExportSymbol.flags & 3 /* Variable */) {
|
|
70639
|
-
|
|
70653
|
+
error2(node, Diagnostics.Cannot_assign_to_0_because_it_is_a_constant, symbolToString(symbol));
|
|
70640
70654
|
} else {
|
|
70641
|
-
|
|
70655
|
+
error2(node, Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, symbolToString(symbol));
|
|
70642
70656
|
}
|
|
70643
70657
|
return errorType;
|
|
70644
70658
|
}
|
|
@@ -70674,13 +70688,13 @@ function createTypeChecker(host) {
|
|
|
70674
70688
|
if (!isEvolvingArrayOperationTarget(node) && (type === autoType || type === autoArrayType)) {
|
|
70675
70689
|
if (flowType === autoType || flowType === autoArrayType) {
|
|
70676
70690
|
if (noImplicitAny) {
|
|
70677
|
-
|
|
70678
|
-
|
|
70691
|
+
error2(getNameOfDeclaration(declaration), Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined, symbolToString(symbol), typeToString(flowType));
|
|
70692
|
+
error2(node, Diagnostics.Variable_0_implicitly_has_an_1_type, symbolToString(symbol), typeToString(flowType));
|
|
70679
70693
|
}
|
|
70680
70694
|
return convertAutoToAny(flowType);
|
|
70681
70695
|
}
|
|
70682
70696
|
} else if (!assumeInitialized && !containsUndefinedType(type) && containsUndefinedType(flowType)) {
|
|
70683
|
-
|
|
70697
|
+
error2(node, Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol));
|
|
70684
70698
|
return type;
|
|
70685
70699
|
}
|
|
70686
70700
|
return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType;
|
|
@@ -70810,13 +70824,13 @@ function createTypeChecker(host) {
|
|
|
70810
70824
|
/*noCacheCheck*/
|
|
70811
70825
|
false
|
|
70812
70826
|
)) {
|
|
70813
|
-
|
|
70827
|
+
error2(node, diagnosticMessage);
|
|
70814
70828
|
}
|
|
70815
70829
|
}
|
|
70816
70830
|
}
|
|
70817
70831
|
function checkThisInStaticClassFieldInitializerInDecoratedClass(thisExpression, container) {
|
|
70818
70832
|
if (isPropertyDeclaration(container) && hasStaticModifier(container) && legacyDecorators && container.initializer && textRangeContainsPositionInclusive(container.initializer, thisExpression.pos) && hasDecorators(container.parent)) {
|
|
70819
|
-
|
|
70833
|
+
error2(thisExpression, Diagnostics.Cannot_use_this_in_a_static_property_initializer_of_a_decorated_class);
|
|
70820
70834
|
}
|
|
70821
70835
|
}
|
|
70822
70836
|
function checkThisExpression(node) {
|
|
@@ -70857,18 +70871,18 @@ function createTypeChecker(host) {
|
|
|
70857
70871
|
}
|
|
70858
70872
|
checkThisInStaticClassFieldInitializerInDecoratedClass(node, container);
|
|
70859
70873
|
if (thisInComputedPropertyName) {
|
|
70860
|
-
|
|
70874
|
+
error2(node, Diagnostics.this_cannot_be_referenced_in_a_computed_property_name);
|
|
70861
70875
|
} else {
|
|
70862
70876
|
switch (container.kind) {
|
|
70863
70877
|
case 266 /* ModuleDeclaration */:
|
|
70864
|
-
|
|
70878
|
+
error2(node, Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body);
|
|
70865
70879
|
break;
|
|
70866
70880
|
case 265 /* EnumDeclaration */:
|
|
70867
|
-
|
|
70881
|
+
error2(node, Diagnostics.this_cannot_be_referenced_in_current_location);
|
|
70868
70882
|
break;
|
|
70869
70883
|
case 175 /* Constructor */:
|
|
70870
70884
|
if (isInConstructorArgumentInitializer(node, container)) {
|
|
70871
|
-
|
|
70885
|
+
error2(node, Diagnostics.this_cannot_be_referenced_in_constructor_arguments);
|
|
70872
70886
|
}
|
|
70873
70887
|
break;
|
|
70874
70888
|
}
|
|
@@ -70885,9 +70899,9 @@ function createTypeChecker(host) {
|
|
|
70885
70899
|
if (noImplicitThis) {
|
|
70886
70900
|
const globalThisType2 = getTypeOfSymbol(globalThisSymbol);
|
|
70887
70901
|
if (type === globalThisType2 && capturedByArrowFunction) {
|
|
70888
|
-
|
|
70902
|
+
error2(node, Diagnostics.The_containing_arrow_function_captures_the_global_value_of_this);
|
|
70889
70903
|
} else if (!type) {
|
|
70890
|
-
const diag2 =
|
|
70904
|
+
const diag2 = error2(node, Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation);
|
|
70891
70905
|
if (!isSourceFile(container)) {
|
|
70892
70906
|
const outsideThis = tryGetThisTypeAt(container);
|
|
70893
70907
|
if (outsideThis && outsideThis !== globalThisType2) {
|
|
@@ -71016,13 +71030,13 @@ function createTypeChecker(host) {
|
|
|
71016
71030
|
if (!container || !isLegalUsageOfSuperExpression(container)) {
|
|
71017
71031
|
const current = findAncestor(node, (n) => n === container ? "quit" : n.kind === 166 /* ComputedPropertyName */);
|
|
71018
71032
|
if (current && current.kind === 166 /* ComputedPropertyName */) {
|
|
71019
|
-
|
|
71033
|
+
error2(node, Diagnostics.super_cannot_be_referenced_in_a_computed_property_name);
|
|
71020
71034
|
} else if (isCallExpression2) {
|
|
71021
|
-
|
|
71035
|
+
error2(node, Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors);
|
|
71022
71036
|
} else if (!container || !container.parent || !(isClassLike(container.parent) || container.parent.kind === 209 /* ObjectLiteralExpression */)) {
|
|
71023
|
-
|
|
71037
|
+
error2(node, Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions);
|
|
71024
71038
|
} else {
|
|
71025
|
-
|
|
71039
|
+
error2(node, Diagnostics.super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class);
|
|
71026
71040
|
}
|
|
71027
71041
|
return errorType;
|
|
71028
71042
|
}
|
|
@@ -71054,7 +71068,7 @@ function createTypeChecker(host) {
|
|
|
71054
71068
|
}
|
|
71055
71069
|
if (container.parent.kind === 209 /* ObjectLiteralExpression */) {
|
|
71056
71070
|
if (languageVersion < 2 /* ES2015 */) {
|
|
71057
|
-
|
|
71071
|
+
error2(node, Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher);
|
|
71058
71072
|
return errorType;
|
|
71059
71073
|
} else {
|
|
71060
71074
|
return anyType;
|
|
@@ -71062,7 +71076,7 @@ function createTypeChecker(host) {
|
|
|
71062
71076
|
}
|
|
71063
71077
|
const classLikeDeclaration = container.parent;
|
|
71064
71078
|
if (!getClassExtendsHeritageElement(classLikeDeclaration)) {
|
|
71065
|
-
|
|
71079
|
+
error2(node, Diagnostics.super_can_only_be_referenced_in_a_derived_class);
|
|
71066
71080
|
return errorType;
|
|
71067
71081
|
}
|
|
71068
71082
|
const classType = getDeclaredTypeOfSymbol(getSymbolOfDeclaration(classLikeDeclaration));
|
|
@@ -71071,7 +71085,7 @@ function createTypeChecker(host) {
|
|
|
71071
71085
|
return errorType;
|
|
71072
71086
|
}
|
|
71073
71087
|
if (container.kind === 175 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) {
|
|
71074
|
-
|
|
71088
|
+
error2(node, Diagnostics.super_cannot_be_referenced_in_constructor_arguments);
|
|
71075
71089
|
return errorType;
|
|
71076
71090
|
}
|
|
71077
71091
|
return nodeCheckFlag === 32 /* SuperStatic */ ? getBaseConstructorTypeOfClass(classType) : getTypeWithThisArgument(baseClassType, classType.thisType);
|
|
@@ -72027,7 +72041,7 @@ function createTypeChecker(host) {
|
|
|
72027
72041
|
let attributesType = forcedLookupLocation === void 0 ? getTypeOfFirstParameterOfSignatureWithFallback(sig, unknownType) : forcedLookupLocation === "" ? getReturnTypeOfSignature(sig) : getJsxPropsTypeForSignatureFromMember(sig, forcedLookupLocation);
|
|
72028
72042
|
if (!attributesType) {
|
|
72029
72043
|
if (!!forcedLookupLocation && !!length(context.attributes.properties)) {
|
|
72030
|
-
|
|
72044
|
+
error2(context, Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, unescapeLeadingUnderscores(forcedLookupLocation));
|
|
72031
72045
|
}
|
|
72032
72046
|
return unknownType;
|
|
72033
72047
|
}
|
|
@@ -72335,7 +72349,7 @@ function createTypeChecker(host) {
|
|
|
72335
72349
|
}
|
|
72336
72350
|
}
|
|
72337
72351
|
if (links.resolvedType.flags & 98304 /* Nullable */ || !isTypeAssignableToKind(links.resolvedType, 402653316 /* StringLike */ | 296 /* NumberLike */ | 12288 /* ESSymbolLike */) && !isTypeAssignableTo(links.resolvedType, stringNumberSymbolType)) {
|
|
72338
|
-
|
|
72352
|
+
error2(node, Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any);
|
|
72339
72353
|
}
|
|
72340
72354
|
}
|
|
72341
72355
|
return links.resolvedType;
|
|
@@ -72444,7 +72458,7 @@ function createTypeChecker(host) {
|
|
|
72444
72458
|
if (impliedProp) {
|
|
72445
72459
|
prop.flags |= impliedProp.flags & 16777216 /* Optional */;
|
|
72446
72460
|
} else if (!compilerOptions.suppressExcessPropertyErrors && !getIndexInfoOfType(contextualType, stringType)) {
|
|
72447
|
-
|
|
72461
|
+
error2(
|
|
72448
72462
|
memberDecl.name,
|
|
72449
72463
|
Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1,
|
|
72450
72464
|
symbolToString(member),
|
|
@@ -72491,7 +72505,7 @@ function createTypeChecker(host) {
|
|
|
72491
72505
|
}
|
|
72492
72506
|
spread = getSpreadType(spread, mergedType, node.symbol, objectFlags, inConstContext);
|
|
72493
72507
|
} else {
|
|
72494
|
-
|
|
72508
|
+
error2(memberDecl, Diagnostics.Spread_types_may_only_be_created_from_object_types);
|
|
72495
72509
|
spread = errorType;
|
|
72496
72510
|
}
|
|
72497
72511
|
continue;
|
|
@@ -72531,7 +72545,7 @@ function createTypeChecker(host) {
|
|
|
72531
72545
|
for (const prop of getPropertiesOfType(contextualType)) {
|
|
72532
72546
|
if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) {
|
|
72533
72547
|
if (!(prop.flags & 16777216 /* Optional */)) {
|
|
72534
|
-
|
|
72548
|
+
error2(
|
|
72535
72549
|
prop.valueDeclaration || ((_a = tryCast(prop, isTransientSymbol)) == null ? void 0 : _a.links.bindingElement),
|
|
72536
72550
|
Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value
|
|
72537
72551
|
);
|
|
@@ -72606,7 +72620,7 @@ function createTypeChecker(host) {
|
|
|
72606
72620
|
checkJsxOpeningLikeElementOrOpeningFragment(node.openingFragment);
|
|
72607
72621
|
const nodeSourceFile = getSourceFileOfNode(node);
|
|
72608
72622
|
if (getJSXTransformEnabled(compilerOptions) && (compilerOptions.jsxFactory || nodeSourceFile.pragmas.has("jsx")) && !compilerOptions.jsxFragmentFactory && !nodeSourceFile.pragmas.has("jsxfrag")) {
|
|
72609
|
-
|
|
72623
|
+
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);
|
|
72610
72624
|
}
|
|
72611
72625
|
checkJsxChildren(node);
|
|
72612
72626
|
return getJsxElementTypeAt(node) || anyType;
|
|
@@ -72693,7 +72707,7 @@ function createTypeChecker(host) {
|
|
|
72693
72707
|
checkSpreadPropOverrides(exprType, allAttributesTable, attributeDecl);
|
|
72694
72708
|
}
|
|
72695
72709
|
} else {
|
|
72696
|
-
|
|
72710
|
+
error2(attributeDecl.expression, Diagnostics.Spread_types_may_only_be_created_from_object_types);
|
|
72697
72711
|
typeToIntersect = typeToIntersect ? getIntersectionType([typeToIntersect, exprType]) : exprType;
|
|
72698
72712
|
}
|
|
72699
72713
|
}
|
|
@@ -72715,7 +72729,7 @@ function createTypeChecker(host) {
|
|
|
72715
72729
|
const childrenTypes = checkJsxChildren(parent2, checkMode);
|
|
72716
72730
|
if (!hasSpreadAnyType && jsxChildrenPropertyName && jsxChildrenPropertyName !== "") {
|
|
72717
72731
|
if (explicitlySpecifyChildrenAttribute) {
|
|
72718
|
-
|
|
72732
|
+
error2(attributes, Diagnostics._0_are_specified_twice_The_attribute_named_0_will_be_overwritten, unescapeLeadingUnderscores(jsxChildrenPropertyName));
|
|
72719
72733
|
}
|
|
72720
72734
|
const contextualType2 = getApparentTypeOfContextualType(
|
|
72721
72735
|
openingLikeElement.attributes,
|
|
@@ -72782,7 +72796,7 @@ function createTypeChecker(host) {
|
|
|
72782
72796
|
if (!(right.flags & 16777216 /* Optional */)) {
|
|
72783
72797
|
const left = props.get(right.escapedName);
|
|
72784
72798
|
if (left) {
|
|
72785
|
-
const diagnostic =
|
|
72799
|
+
const diagnostic = error2(left.valueDeclaration, Diagnostics._0_is_specified_more_than_once_so_this_usage_will_be_overwritten, unescapeLeadingUnderscores(left.escapedName));
|
|
72786
72800
|
addRelatedInfo(diagnostic, createDiagnosticForNode(spread, Diagnostics.This_spread_always_overwrites_this_property));
|
|
72787
72801
|
}
|
|
72788
72802
|
}
|
|
@@ -72814,11 +72828,11 @@ function createTypeChecker(host) {
|
|
|
72814
72828
|
links.jsxFlags |= 2 /* IntrinsicIndexedElement */;
|
|
72815
72829
|
return links.resolvedSymbol = intrinsicElementsType.symbol;
|
|
72816
72830
|
}
|
|
72817
|
-
|
|
72831
|
+
error2(node, Diagnostics.Property_0_does_not_exist_on_type_1, intrinsicTagNameToString(node.tagName), "JSX." + JsxNames.IntrinsicElements);
|
|
72818
72832
|
return links.resolvedSymbol = unknownSymbol;
|
|
72819
72833
|
} else {
|
|
72820
72834
|
if (noImplicitAny) {
|
|
72821
|
-
|
|
72835
|
+
error2(node, Diagnostics.JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists, unescapeLeadingUnderscores(JsxNames.IntrinsicElements));
|
|
72822
72836
|
}
|
|
72823
72837
|
return links.resolvedSymbol = unknownSymbol;
|
|
72824
72838
|
}
|
|
@@ -72901,7 +72915,7 @@ function createTypeChecker(host) {
|
|
|
72901
72915
|
} else if (propertiesOfJsxElementAttribPropInterface.length === 1) {
|
|
72902
72916
|
return propertiesOfJsxElementAttribPropInterface[0].escapedName;
|
|
72903
72917
|
} else if (propertiesOfJsxElementAttribPropInterface.length > 1 && jsxElementAttribPropInterfaceSym.declarations) {
|
|
72904
|
-
|
|
72918
|
+
error2(jsxElementAttribPropInterfaceSym.declarations[0], Diagnostics.The_global_type_JSX_0_may_not_have_more_than_one_property, unescapeLeadingUnderscores(nameOfAttribPropContainer));
|
|
72905
72919
|
}
|
|
72906
72920
|
}
|
|
72907
72921
|
return void 0;
|
|
@@ -72924,7 +72938,7 @@ function createTypeChecker(host) {
|
|
|
72924
72938
|
} else if (elementType.flags & 128 /* StringLiteral */) {
|
|
72925
72939
|
const intrinsicType = getIntrinsicAttributesTypeFromStringLiteralType(elementType, caller);
|
|
72926
72940
|
if (!intrinsicType) {
|
|
72927
|
-
|
|
72941
|
+
error2(caller, Diagnostics.Property_0_does_not_exist_on_type_1, elementType.value, "JSX." + JsxNames.IntrinsicElements);
|
|
72928
72942
|
return emptyArray;
|
|
72929
72943
|
} else {
|
|
72930
72944
|
const fakeSignature = createSignatureForJSXIntrinsic(caller, intrinsicType);
|
|
@@ -73050,11 +73064,11 @@ function createTypeChecker(host) {
|
|
|
73050
73064
|
}
|
|
73051
73065
|
function checkJsxPreconditions(errorNode) {
|
|
73052
73066
|
if ((compilerOptions.jsx || 0 /* None */) === 0 /* None */) {
|
|
73053
|
-
|
|
73067
|
+
error2(errorNode, Diagnostics.Cannot_use_JSX_unless_the_jsx_flag_is_provided);
|
|
73054
73068
|
}
|
|
73055
73069
|
if (getJsxElementTypeAt(errorNode) === void 0) {
|
|
73056
73070
|
if (noImplicitAny) {
|
|
73057
|
-
|
|
73071
|
+
error2(errorNode, Diagnostics.JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist);
|
|
73058
73072
|
}
|
|
73059
73073
|
}
|
|
73060
73074
|
}
|
|
@@ -73146,7 +73160,7 @@ function createTypeChecker(host) {
|
|
|
73146
73160
|
if (node.expression) {
|
|
73147
73161
|
const type = checkExpression(node.expression, checkMode);
|
|
73148
73162
|
if (node.dotDotDotToken && type !== anyType && !isArrayType(type)) {
|
|
73149
|
-
|
|
73163
|
+
error2(node, Diagnostics.JSX_spread_child_must_be_an_array_type);
|
|
73150
73164
|
}
|
|
73151
73165
|
return type;
|
|
73152
73166
|
} else {
|
|
@@ -73175,14 +73189,14 @@ function createTypeChecker(host) {
|
|
|
73175
73189
|
if (languageVersion < 2 /* ES2015 */) {
|
|
73176
73190
|
if (symbolHasNonMethodDeclaration(prop)) {
|
|
73177
73191
|
if (errorNode) {
|
|
73178
|
-
|
|
73192
|
+
error2(errorNode, Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword);
|
|
73179
73193
|
}
|
|
73180
73194
|
return false;
|
|
73181
73195
|
}
|
|
73182
73196
|
}
|
|
73183
73197
|
if (flags & 256 /* Abstract */) {
|
|
73184
73198
|
if (errorNode) {
|
|
73185
|
-
|
|
73199
|
+
error2(
|
|
73186
73200
|
errorNode,
|
|
73187
73201
|
Diagnostics.Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression,
|
|
73188
73202
|
symbolToString(prop),
|
|
@@ -73196,7 +73210,7 @@ function createTypeChecker(host) {
|
|
|
73196
73210
|
const declaringClassDeclaration = getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop));
|
|
73197
73211
|
if (declaringClassDeclaration && isNodeUsedDuringClassInitialization(location)) {
|
|
73198
73212
|
if (errorNode) {
|
|
73199
|
-
|
|
73213
|
+
error2(
|
|
73200
73214
|
errorNode,
|
|
73201
73215
|
Diagnostics.Abstract_property_0_in_class_1_cannot_be_accessed_in_the_constructor,
|
|
73202
73216
|
symbolToString(prop),
|
|
@@ -73213,7 +73227,7 @@ function createTypeChecker(host) {
|
|
|
73213
73227
|
const declaringClassDeclaration = getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop));
|
|
73214
73228
|
if (!isNodeWithinClass(location, declaringClassDeclaration)) {
|
|
73215
73229
|
if (errorNode) {
|
|
73216
|
-
|
|
73230
|
+
error2(
|
|
73217
73231
|
errorNode,
|
|
73218
73232
|
Diagnostics.Property_0_is_private_and_only_accessible_within_class_1,
|
|
73219
73233
|
symbolToString(prop),
|
|
@@ -73236,7 +73250,7 @@ function createTypeChecker(host) {
|
|
|
73236
73250
|
enclosingClass = enclosingClass && isClassDerivedFromDeclaringClasses(enclosingClass, prop, writing);
|
|
73237
73251
|
if (flags & 32 /* Static */ || !enclosingClass) {
|
|
73238
73252
|
if (errorNode) {
|
|
73239
|
-
|
|
73253
|
+
error2(
|
|
73240
73254
|
errorNode,
|
|
73241
73255
|
Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses,
|
|
73242
73256
|
symbolToString(prop),
|
|
@@ -73254,7 +73268,7 @@ function createTypeChecker(host) {
|
|
|
73254
73268
|
}
|
|
73255
73269
|
if (!containingType || !hasBaseType(containingType, enclosingClass)) {
|
|
73256
73270
|
if (errorNode) {
|
|
73257
|
-
|
|
73271
|
+
error2(
|
|
73258
73272
|
errorNode,
|
|
73259
73273
|
Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1_This_is_an_instance_of_class_2,
|
|
73260
73274
|
symbolToString(prop),
|
|
@@ -73302,28 +73316,28 @@ function createTypeChecker(host) {
|
|
|
73302
73316
|
function reportObjectPossiblyNullOrUndefinedError(node, facts) {
|
|
73303
73317
|
const nodeText2 = isEntityNameExpression(node) ? entityNameToString(node) : void 0;
|
|
73304
73318
|
if (node.kind === 106 /* NullKeyword */) {
|
|
73305
|
-
|
|
73319
|
+
error2(node, Diagnostics.The_value_0_cannot_be_used_here, "null");
|
|
73306
73320
|
return;
|
|
73307
73321
|
}
|
|
73308
73322
|
if (nodeText2 !== void 0 && nodeText2.length < 100) {
|
|
73309
73323
|
if (isIdentifier(node) && nodeText2 === "undefined") {
|
|
73310
|
-
|
|
73324
|
+
error2(node, Diagnostics.The_value_0_cannot_be_used_here, "undefined");
|
|
73311
73325
|
return;
|
|
73312
73326
|
}
|
|
73313
|
-
|
|
73327
|
+
error2(
|
|
73314
73328
|
node,
|
|
73315
73329
|
facts & 16777216 /* IsUndefined */ ? facts & 33554432 /* IsNull */ ? Diagnostics._0_is_possibly_null_or_undefined : Diagnostics._0_is_possibly_undefined : Diagnostics._0_is_possibly_null,
|
|
73316
73330
|
nodeText2
|
|
73317
73331
|
);
|
|
73318
73332
|
} else {
|
|
73319
|
-
|
|
73333
|
+
error2(
|
|
73320
73334
|
node,
|
|
73321
73335
|
facts & 16777216 /* IsUndefined */ ? facts & 33554432 /* IsNull */ ? Diagnostics.Object_is_possibly_null_or_undefined : Diagnostics.Object_is_possibly_undefined : Diagnostics.Object_is_possibly_null
|
|
73322
73336
|
);
|
|
73323
73337
|
}
|
|
73324
73338
|
}
|
|
73325
73339
|
function reportCannotInvokePossiblyNullOrUndefinedError(node, facts) {
|
|
73326
|
-
|
|
73340
|
+
error2(
|
|
73327
73341
|
node,
|
|
73328
73342
|
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
|
|
73329
73343
|
);
|
|
@@ -73333,11 +73347,11 @@ function createTypeChecker(host) {
|
|
|
73333
73347
|
if (isEntityNameExpression(node)) {
|
|
73334
73348
|
const nodeText2 = entityNameToString(node);
|
|
73335
73349
|
if (nodeText2.length < 100) {
|
|
73336
|
-
|
|
73350
|
+
error2(node, Diagnostics._0_is_of_type_unknown, nodeText2);
|
|
73337
73351
|
return errorType;
|
|
73338
73352
|
}
|
|
73339
73353
|
}
|
|
73340
|
-
|
|
73354
|
+
error2(node, Diagnostics.Object_is_of_type_unknown);
|
|
73341
73355
|
return errorType;
|
|
73342
73356
|
}
|
|
73343
73357
|
const facts = getTypeFacts(type);
|
|
@@ -73357,15 +73371,15 @@ function createTypeChecker(host) {
|
|
|
73357
73371
|
if (isEntityNameExpression(node)) {
|
|
73358
73372
|
const nodeText2 = entityNameToString(node);
|
|
73359
73373
|
if (isIdentifier(node) && nodeText2 === "undefined") {
|
|
73360
|
-
|
|
73374
|
+
error2(node, Diagnostics.The_value_0_cannot_be_used_here, nodeText2);
|
|
73361
73375
|
return nonNullType;
|
|
73362
73376
|
}
|
|
73363
73377
|
if (nodeText2.length < 100) {
|
|
73364
|
-
|
|
73378
|
+
error2(node, Diagnostics._0_is_possibly_undefined, nodeText2);
|
|
73365
73379
|
return nonNullType;
|
|
73366
73380
|
}
|
|
73367
73381
|
}
|
|
73368
|
-
|
|
73382
|
+
error2(node, Diagnostics.Object_is_possibly_undefined);
|
|
73369
73383
|
}
|
|
73370
73384
|
return nonNullType;
|
|
73371
73385
|
}
|
|
@@ -73460,7 +73474,7 @@ function createTypeChecker(host) {
|
|
|
73460
73474
|
const lexicalClass = getContainingClass(lexicalValueDecl);
|
|
73461
73475
|
Debug.assert(!!lexicalClass);
|
|
73462
73476
|
if (findAncestor(lexicalClass, (n) => typeClass === n)) {
|
|
73463
|
-
const diagnostic =
|
|
73477
|
+
const diagnostic = error2(
|
|
73464
73478
|
right,
|
|
73465
73479
|
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,
|
|
73466
73480
|
diagName,
|
|
@@ -73482,7 +73496,7 @@ function createTypeChecker(host) {
|
|
|
73482
73496
|
return true;
|
|
73483
73497
|
}
|
|
73484
73498
|
}
|
|
73485
|
-
|
|
73499
|
+
error2(
|
|
73486
73500
|
right,
|
|
73487
73501
|
Diagnostics.Property_0_is_not_accessible_outside_class_1_because_it_has_a_private_identifier,
|
|
73488
73502
|
diagName,
|
|
@@ -73535,7 +73549,7 @@ function createTypeChecker(host) {
|
|
|
73535
73549
|
} else {
|
|
73536
73550
|
const isSetonlyAccessor = prop && prop.flags & 65536 /* SetAccessor */ && !(prop.flags & 32768 /* GetAccessor */);
|
|
73537
73551
|
if (isSetonlyAccessor && assignmentKind !== 1 /* Definite */) {
|
|
73538
|
-
|
|
73552
|
+
error2(node, Diagnostics.Private_accessor_was_defined_without_a_getter);
|
|
73539
73553
|
}
|
|
73540
73554
|
}
|
|
73541
73555
|
} else {
|
|
@@ -73572,9 +73586,9 @@ function createTypeChecker(host) {
|
|
|
73572
73586
|
}
|
|
73573
73587
|
if (leftType.symbol === globalThisSymbol) {
|
|
73574
73588
|
if (globalThisSymbol.exports.has(right.escapedText) && globalThisSymbol.exports.get(right.escapedText).flags & 418 /* BlockScoped */) {
|
|
73575
|
-
|
|
73589
|
+
error2(right, Diagnostics.Property_0_does_not_exist_on_type_1, unescapeLeadingUnderscores(right.escapedText), typeToString(leftType));
|
|
73576
73590
|
} else if (noImplicitAny) {
|
|
73577
|
-
|
|
73591
|
+
error2(right, Diagnostics.Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature, typeToString(leftType));
|
|
73578
73592
|
}
|
|
73579
73593
|
return anyType;
|
|
73580
73594
|
}
|
|
@@ -73584,11 +73598,11 @@ function createTypeChecker(host) {
|
|
|
73584
73598
|
return errorType;
|
|
73585
73599
|
}
|
|
73586
73600
|
if (indexInfo.isReadonly && (isAssignmentTarget(node) || isDeleteTarget(node))) {
|
|
73587
|
-
|
|
73601
|
+
error2(node, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(apparentType));
|
|
73588
73602
|
}
|
|
73589
73603
|
propType = compilerOptions.noUncheckedIndexedAccess && !isAssignmentTarget(node) ? getUnionType([indexInfo.type, missingType]) : indexInfo.type;
|
|
73590
73604
|
if (compilerOptions.noPropertyAccessFromIndexSignature && isPropertyAccessExpression(node)) {
|
|
73591
|
-
|
|
73605
|
+
error2(right, Diagnostics.Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0, unescapeLeadingUnderscores(right.escapedText));
|
|
73592
73606
|
}
|
|
73593
73607
|
if (indexInfo.declaration && getCombinedNodeFlags(indexInfo.declaration) & 268435456 /* Deprecated */) {
|
|
73594
73608
|
addDeprecatedSuggestion(right, [indexInfo.declaration], right.escapedText);
|
|
@@ -73603,7 +73617,7 @@ function createTypeChecker(host) {
|
|
|
73603
73617
|
getNodeLinks(node).resolvedSymbol = prop;
|
|
73604
73618
|
checkPropertyAccessibility(node, left.kind === 108 /* SuperKeyword */, isWriteAccess(node), apparentType, prop);
|
|
73605
73619
|
if (isAssignmentToReadonlyEntity(node, prop, assignmentKind)) {
|
|
73606
|
-
|
|
73620
|
+
error2(right, Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, idText(right));
|
|
73607
73621
|
return errorType;
|
|
73608
73622
|
}
|
|
73609
73623
|
propType = isThisPropertyAccessInConstructor(node, prop) ? autoType : writeOnly || isWriteOnlyAccess(node) ? getWriteTypeOfSymbol(prop) : getTypeOfSymbol(prop);
|
|
@@ -73648,7 +73662,7 @@ function createTypeChecker(host) {
|
|
|
73648
73662
|
}
|
|
73649
73663
|
const flowType = getFlowTypeOfReference(node, propType, assumeUninitialized ? getOptionalType(propType) : propType);
|
|
73650
73664
|
if (assumeUninitialized && !containsUndefinedType(propType) && containsUndefinedType(flowType)) {
|
|
73651
|
-
|
|
73665
|
+
error2(errorNode, Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(prop));
|
|
73652
73666
|
return propType;
|
|
73653
73667
|
}
|
|
73654
73668
|
return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType;
|
|
@@ -73661,9 +73675,9 @@ function createTypeChecker(host) {
|
|
|
73661
73675
|
let diagnosticMessage;
|
|
73662
73676
|
const declarationName = idText(right);
|
|
73663
73677
|
if (isInPropertyInitializerOrClassStaticBlock(node) && !isOptionalPropertyDeclaration(valueDeclaration) && !(isAccessExpression(node) && isAccessExpression(node.expression)) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right) && !(isMethodDeclaration(valueDeclaration) && getCombinedModifierFlags(valueDeclaration) & 32 /* Static */) && (compilerOptions.useDefineForClassFields || !isPropertyDeclaredInAncestorClass(prop))) {
|
|
73664
|
-
diagnosticMessage =
|
|
73678
|
+
diagnosticMessage = error2(right, Diagnostics.Property_0_is_used_before_its_initialization, declarationName);
|
|
73665
73679
|
} else if (valueDeclaration.kind === 262 /* ClassDeclaration */ && node.parent.kind !== 182 /* TypeReference */ && !(valueDeclaration.flags & 16777216 /* Ambient */) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) {
|
|
73666
|
-
diagnosticMessage =
|
|
73680
|
+
diagnosticMessage = error2(right, Diagnostics.Class_0_used_before_its_declaration, declarationName);
|
|
73667
73681
|
}
|
|
73668
73682
|
if (diagnosticMessage) {
|
|
73669
73683
|
addRelatedInfo(
|
|
@@ -74041,7 +74055,7 @@ function createTypeChecker(host) {
|
|
|
74041
74055
|
return objectType;
|
|
74042
74056
|
}
|
|
74043
74057
|
if (isConstEnumObjectType(objectType) && !isStringLiteralLike(indexExpression)) {
|
|
74044
|
-
|
|
74058
|
+
error2(indexExpression, Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal);
|
|
74045
74059
|
return errorType;
|
|
74046
74060
|
}
|
|
74047
74061
|
const effectiveIndexType = isForInVariableForNumericPropertyNames(indexExpression) ? numberType : indexType;
|
|
@@ -74748,7 +74762,7 @@ function createTypeChecker(host) {
|
|
|
74748
74762
|
if (isVoidPromiseError && isInJSFile(node)) {
|
|
74749
74763
|
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);
|
|
74750
74764
|
}
|
|
74751
|
-
const
|
|
74765
|
+
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;
|
|
74752
74766
|
if (min2 < args.length && args.length < max) {
|
|
74753
74767
|
if (headMessage) {
|
|
74754
74768
|
let chain = chainDiagnosticMessages(
|
|
@@ -74769,14 +74783,14 @@ function createTypeChecker(host) {
|
|
|
74769
74783
|
let chain = chainDiagnosticMessages(
|
|
74770
74784
|
/*details*/
|
|
74771
74785
|
void 0,
|
|
74772
|
-
|
|
74786
|
+
error3,
|
|
74773
74787
|
parameterRange,
|
|
74774
74788
|
args.length
|
|
74775
74789
|
);
|
|
74776
74790
|
chain = chainDiagnosticMessages(chain, headMessage);
|
|
74777
74791
|
diagnostic = getDiagnosticForCallNode(node, chain);
|
|
74778
74792
|
} else {
|
|
74779
|
-
diagnostic = getDiagnosticForCallNode(node,
|
|
74793
|
+
diagnostic = getDiagnosticForCallNode(node, error3, parameterRange, args.length);
|
|
74780
74794
|
}
|
|
74781
74795
|
const parameter = (_a = closestSignature == null ? void 0 : closestSignature.declaration) == null ? void 0 : _a.parameters[closestSignature.thisParameter ? args.length + 1 : args.length];
|
|
74782
74796
|
if (parameter) {
|
|
@@ -74797,14 +74811,14 @@ function createTypeChecker(host) {
|
|
|
74797
74811
|
let chain = chainDiagnosticMessages(
|
|
74798
74812
|
/*details*/
|
|
74799
74813
|
void 0,
|
|
74800
|
-
|
|
74814
|
+
error3,
|
|
74801
74815
|
parameterRange,
|
|
74802
74816
|
args.length
|
|
74803
74817
|
);
|
|
74804
74818
|
chain = chainDiagnosticMessages(chain, headMessage);
|
|
74805
74819
|
return createDiagnosticForNodeArrayFromMessageChain(getSourceFileOfNode(node), errorSpan, chain);
|
|
74806
74820
|
}
|
|
74807
|
-
return createDiagnosticForNodeArray(getSourceFileOfNode(node), errorSpan,
|
|
74821
|
+
return createDiagnosticForNodeArray(getSourceFileOfNode(node), errorSpan, error3, parameterRange, args.length);
|
|
74808
74822
|
}
|
|
74809
74823
|
}
|
|
74810
74824
|
function getTypeArgumentArityError(node, signatures, typeArguments, headMessage) {
|
|
@@ -75286,13 +75300,13 @@ function createTypeChecker(host) {
|
|
|
75286
75300
|
const numConstructSignatures = getSignaturesOfType(apparentType, 1 /* Construct */).length;
|
|
75287
75301
|
if (isUntypedFunctionCall(funcType, apparentType, callSignatures.length, numConstructSignatures)) {
|
|
75288
75302
|
if (!isErrorType(funcType) && node.typeArguments) {
|
|
75289
|
-
|
|
75303
|
+
error2(node, Diagnostics.Untyped_function_calls_may_not_accept_type_arguments);
|
|
75290
75304
|
}
|
|
75291
75305
|
return resolveUntypedCall(node);
|
|
75292
75306
|
}
|
|
75293
75307
|
if (!callSignatures.length) {
|
|
75294
75308
|
if (numConstructSignatures) {
|
|
75295
|
-
|
|
75309
|
+
error2(node, Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new, typeToString(funcType));
|
|
75296
75310
|
} else {
|
|
75297
75311
|
let relatedInformation;
|
|
75298
75312
|
if (node.arguments.length === 1) {
|
|
@@ -75315,7 +75329,7 @@ function createTypeChecker(host) {
|
|
|
75315
75329
|
return resolvingSignature;
|
|
75316
75330
|
}
|
|
75317
75331
|
if (callSignatures.some((sig) => isInJSFile(sig.declaration) && !!getJSDocClassTag(sig.declaration))) {
|
|
75318
|
-
|
|
75332
|
+
error2(node, Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new, typeToString(funcType));
|
|
75319
75333
|
return resolveErrorCall(node);
|
|
75320
75334
|
}
|
|
75321
75335
|
return resolveCall(node, callSignatures, candidatesOutArray, checkMode, callChainFlags);
|
|
@@ -75330,7 +75344,7 @@ function createTypeChecker(host) {
|
|
|
75330
75344
|
if (node.arguments && languageVersion < 1 /* ES5 */) {
|
|
75331
75345
|
const spreadIndex = getSpreadArgumentIndex(node.arguments);
|
|
75332
75346
|
if (spreadIndex >= 0) {
|
|
75333
|
-
|
|
75347
|
+
error2(node.arguments[spreadIndex], Diagnostics.Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher);
|
|
75334
75348
|
}
|
|
75335
75349
|
}
|
|
75336
75350
|
let expressionType = checkNonNullExpression(node.expression);
|
|
@@ -75343,7 +75357,7 @@ function createTypeChecker(host) {
|
|
|
75343
75357
|
}
|
|
75344
75358
|
if (isTypeAny(expressionType)) {
|
|
75345
75359
|
if (node.typeArguments) {
|
|
75346
|
-
|
|
75360
|
+
error2(node, Diagnostics.Untyped_function_calls_may_not_accept_type_arguments);
|
|
75347
75361
|
}
|
|
75348
75362
|
return resolveUntypedCall(node);
|
|
75349
75363
|
}
|
|
@@ -75353,12 +75367,12 @@ function createTypeChecker(host) {
|
|
|
75353
75367
|
return resolveErrorCall(node);
|
|
75354
75368
|
}
|
|
75355
75369
|
if (someSignature(constructSignatures, (signature) => !!(signature.flags & 4 /* Abstract */))) {
|
|
75356
|
-
|
|
75370
|
+
error2(node, Diagnostics.Cannot_create_an_instance_of_an_abstract_class);
|
|
75357
75371
|
return resolveErrorCall(node);
|
|
75358
75372
|
}
|
|
75359
75373
|
const valueDecl = expressionType.symbol && getClassLikeDeclarationOfSymbol(expressionType.symbol);
|
|
75360
75374
|
if (valueDecl && hasSyntacticModifier(valueDecl, 256 /* Abstract */)) {
|
|
75361
|
-
|
|
75375
|
+
error2(node, Diagnostics.Cannot_create_an_instance_of_an_abstract_class);
|
|
75362
75376
|
return resolveErrorCall(node);
|
|
75363
75377
|
}
|
|
75364
75378
|
return resolveCall(node, constructSignatures, candidatesOutArray, checkMode, 0 /* None */);
|
|
@@ -75368,10 +75382,10 @@ function createTypeChecker(host) {
|
|
|
75368
75382
|
const signature = resolveCall(node, callSignatures, candidatesOutArray, checkMode, 0 /* None */);
|
|
75369
75383
|
if (!noImplicitAny) {
|
|
75370
75384
|
if (signature.declaration && !isJSConstructor(signature.declaration) && getReturnTypeOfSignature(signature) !== voidType) {
|
|
75371
|
-
|
|
75385
|
+
error2(node, Diagnostics.Only_a_void_function_can_be_called_with_the_new_keyword);
|
|
75372
75386
|
}
|
|
75373
75387
|
if (getThisTypeOfSignature(signature) === voidType) {
|
|
75374
|
-
|
|
75388
|
+
error2(node, Diagnostics.A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void);
|
|
75375
75389
|
}
|
|
75376
75390
|
}
|
|
75377
75391
|
return signature;
|
|
@@ -75435,10 +75449,10 @@ function createTypeChecker(host) {
|
|
|
75435
75449
|
}
|
|
75436
75450
|
}
|
|
75437
75451
|
if (modifiers & 8 /* Private */) {
|
|
75438
|
-
|
|
75452
|
+
error2(node, Diagnostics.Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration, typeToString(declaringClass));
|
|
75439
75453
|
}
|
|
75440
75454
|
if (modifiers & 16 /* Protected */) {
|
|
75441
|
-
|
|
75455
|
+
error2(node, Diagnostics.Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration, typeToString(declaringClass));
|
|
75442
75456
|
}
|
|
75443
75457
|
return false;
|
|
75444
75458
|
}
|
|
@@ -75600,7 +75614,7 @@ function createTypeChecker(host) {
|
|
|
75600
75614
|
/*includeTrivia*/
|
|
75601
75615
|
false
|
|
75602
75616
|
);
|
|
75603
|
-
|
|
75617
|
+
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);
|
|
75604
75618
|
return resolveErrorCall(node);
|
|
75605
75619
|
}
|
|
75606
75620
|
const headMessage = getDiagnosticHeadMessageForDecoratorResolution(node);
|
|
@@ -75690,7 +75704,7 @@ function createTypeChecker(host) {
|
|
|
75690
75704
|
return resolveUntypedCall(node);
|
|
75691
75705
|
}
|
|
75692
75706
|
if (signatures.length === 0) {
|
|
75693
|
-
|
|
75707
|
+
error2(node.tagName, Diagnostics.JSX_element_type_0_does_not_have_any_construct_or_call_signatures, getTextOfNode(node.tagName));
|
|
75694
75708
|
return resolveErrorCall(node);
|
|
75695
75709
|
}
|
|
75696
75710
|
return resolveCall(node, signatures, candidatesOutArray, checkMode, 0 /* None */);
|
|
@@ -75850,7 +75864,7 @@ function createTypeChecker(host) {
|
|
|
75850
75864
|
const declaration = signature.declaration;
|
|
75851
75865
|
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)) {
|
|
75852
75866
|
if (noImplicitAny) {
|
|
75853
|
-
|
|
75867
|
+
error2(node, Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type);
|
|
75854
75868
|
}
|
|
75855
75869
|
return anyType;
|
|
75856
75870
|
}
|
|
@@ -75864,9 +75878,9 @@ function createTypeChecker(host) {
|
|
|
75864
75878
|
}
|
|
75865
75879
|
if (node.kind === 212 /* CallExpression */ && !node.questionDotToken && node.parent.kind === 243 /* ExpressionStatement */ && returnType.flags & 16384 /* Void */ && getTypePredicateOfSignature(signature)) {
|
|
75866
75880
|
if (!isDottedName(node.expression)) {
|
|
75867
|
-
|
|
75881
|
+
error2(node.expression, Diagnostics.Assertions_require_the_call_target_to_be_an_identifier_or_qualified_name);
|
|
75868
75882
|
} else if (!getEffectsSignature(node)) {
|
|
75869
|
-
const diagnostic =
|
|
75883
|
+
const diagnostic = error2(node.expression, Diagnostics.Assertions_require_every_name_in_the_call_target_to_be_declared_with_an_explicit_type_annotation);
|
|
75870
75884
|
getTypeOfDottedName(node.expression, diagnostic);
|
|
75871
75885
|
}
|
|
75872
75886
|
}
|
|
@@ -75955,7 +75969,7 @@ function createTypeChecker(host) {
|
|
|
75955
75969
|
checkExpressionCached(node.arguments[i]);
|
|
75956
75970
|
}
|
|
75957
75971
|
if (specifierType.flags & 32768 /* Undefined */ || specifierType.flags & 65536 /* Null */ || !isTypeAssignableTo(specifierType, stringType)) {
|
|
75958
|
-
|
|
75972
|
+
error2(specifier, Diagnostics.Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0, typeToString(specifierType));
|
|
75959
75973
|
}
|
|
75960
75974
|
if (optionsType) {
|
|
75961
75975
|
const importCallOptionsType = getGlobalImportCallOptionsType(
|
|
@@ -76129,7 +76143,7 @@ function createTypeChecker(host) {
|
|
|
76129
76143
|
const exprType = checkExpression(expression, checkMode);
|
|
76130
76144
|
if (isConstTypeReference(type)) {
|
|
76131
76145
|
if (!isValidConstAssertionArgument(expression)) {
|
|
76132
|
-
|
|
76146
|
+
error2(expression, Diagnostics.A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array_or_object_literals);
|
|
76133
76147
|
}
|
|
76134
76148
|
return getRegularTypeOfLiteralType(exprType);
|
|
76135
76149
|
}
|
|
@@ -76190,7 +76204,7 @@ function createTypeChecker(host) {
|
|
|
76190
76204
|
if (node.kind === 232 /* ExpressionWithTypeArguments */) {
|
|
76191
76205
|
const parent2 = walkUpParenthesizedExpressions(node.parent);
|
|
76192
76206
|
if (parent2.kind === 225 /* BinaryExpression */ && parent2.operatorToken.kind === 104 /* InstanceOfKeyword */ && isNodeDescendantOf(node, parent2.right)) {
|
|
76193
|
-
|
|
76207
|
+
error2(node, Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_not_be_an_instantiation_expression);
|
|
76194
76208
|
}
|
|
76195
76209
|
}
|
|
76196
76210
|
const exprType = node.kind === 232 /* ExpressionWithTypeArguments */ ? checkExpression(node.expression) : isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName);
|
|
@@ -76305,7 +76319,7 @@ function createTypeChecker(host) {
|
|
|
76305
76319
|
function checkNewTargetMetaProperty(node) {
|
|
76306
76320
|
const container = getNewTargetContainer(node);
|
|
76307
76321
|
if (!container) {
|
|
76308
|
-
|
|
76322
|
+
error2(node, Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target");
|
|
76309
76323
|
return errorType;
|
|
76310
76324
|
} else if (container.kind === 175 /* Constructor */) {
|
|
76311
76325
|
const symbol = getSymbolOfDeclaration(container.parent);
|
|
@@ -76318,10 +76332,10 @@ function createTypeChecker(host) {
|
|
|
76318
76332
|
function checkImportMetaProperty(node) {
|
|
76319
76333
|
if (moduleKind === 100 /* Node16 */ || moduleKind === 199 /* NodeNext */) {
|
|
76320
76334
|
if (getSourceFileOfNode(node).impliedNodeFormat !== 99 /* ESNext */) {
|
|
76321
|
-
|
|
76335
|
+
error2(node, Diagnostics.The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output);
|
|
76322
76336
|
}
|
|
76323
76337
|
} else if (moduleKind < 6 /* ES2020 */ && moduleKind !== 4 /* System */) {
|
|
76324
|
-
|
|
76338
|
+
error2(node, Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_or_nodenext);
|
|
76325
76339
|
}
|
|
76326
76340
|
const file = getSourceFileOfNode(node);
|
|
76327
76341
|
Debug.assert(!!(file.flags & 4194304 /* PossiblyContainsImportMeta */), "Containing file is missing import meta node flag.");
|
|
@@ -76878,13 +76892,13 @@ function createTypeChecker(host) {
|
|
|
76878
76892
|
function createPromiseReturnType(func, promisedType) {
|
|
76879
76893
|
const promiseType = createPromiseType(promisedType);
|
|
76880
76894
|
if (promiseType === unknownType) {
|
|
76881
|
-
|
|
76895
|
+
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);
|
|
76882
76896
|
return errorType;
|
|
76883
76897
|
} else if (!getGlobalPromiseConstructorSymbol(
|
|
76884
76898
|
/*reportErrors*/
|
|
76885
76899
|
true
|
|
76886
76900
|
)) {
|
|
76887
|
-
|
|
76901
|
+
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);
|
|
76888
76902
|
}
|
|
76889
76903
|
return promiseType;
|
|
76890
76904
|
}
|
|
@@ -77180,11 +77194,11 @@ function createTypeChecker(host) {
|
|
|
77180
77194
|
const hasExplicitReturn = func.flags & 512 /* HasExplicitReturn */;
|
|
77181
77195
|
const errorNode = getEffectiveReturnTypeNode(func) || func;
|
|
77182
77196
|
if (type && type.flags & 131072 /* Never */) {
|
|
77183
|
-
|
|
77197
|
+
error2(errorNode, Diagnostics.A_function_returning_never_cannot_have_a_reachable_end_point);
|
|
77184
77198
|
} else if (type && !hasExplicitReturn) {
|
|
77185
|
-
|
|
77199
|
+
error2(errorNode, Diagnostics.A_function_whose_declared_type_is_neither_undefined_void_nor_any_must_return_a_value);
|
|
77186
77200
|
} else if (type && strictNullChecks && !isTypeAssignableTo(undefinedType, type)) {
|
|
77187
|
-
|
|
77201
|
+
error2(errorNode, Diagnostics.Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined);
|
|
77188
77202
|
} else if (compilerOptions.noImplicitReturns) {
|
|
77189
77203
|
if (!type) {
|
|
77190
77204
|
if (!hasExplicitReturn) {
|
|
@@ -77195,7 +77209,7 @@ function createTypeChecker(host) {
|
|
|
77195
77209
|
return;
|
|
77196
77210
|
}
|
|
77197
77211
|
}
|
|
77198
|
-
|
|
77212
|
+
error2(errorNode, Diagnostics.Not_all_code_paths_return_a_value);
|
|
77199
77213
|
}
|
|
77200
77214
|
}
|
|
77201
77215
|
}
|
|
@@ -77395,11 +77409,11 @@ function createTypeChecker(host) {
|
|
|
77395
77409
|
function checkReferenceExpression(expr, invalidReferenceMessage, invalidOptionalChainMessage) {
|
|
77396
77410
|
const node = skipOuterExpressions(expr, 6 /* Assertions */ | 1 /* Parentheses */);
|
|
77397
77411
|
if (node.kind !== 80 /* Identifier */ && !isAccessExpression(node)) {
|
|
77398
|
-
|
|
77412
|
+
error2(expr, invalidReferenceMessage);
|
|
77399
77413
|
return false;
|
|
77400
77414
|
}
|
|
77401
77415
|
if (node.flags & 32 /* OptionalChain */) {
|
|
77402
|
-
|
|
77416
|
+
error2(expr, invalidOptionalChainMessage);
|
|
77403
77417
|
return false;
|
|
77404
77418
|
}
|
|
77405
77419
|
return true;
|
|
@@ -77408,17 +77422,17 @@ function createTypeChecker(host) {
|
|
|
77408
77422
|
checkExpression(node.expression);
|
|
77409
77423
|
const expr = skipParentheses(node.expression);
|
|
77410
77424
|
if (!isAccessExpression(expr)) {
|
|
77411
|
-
|
|
77425
|
+
error2(expr, Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference);
|
|
77412
77426
|
return booleanType;
|
|
77413
77427
|
}
|
|
77414
77428
|
if (isPropertyAccessExpression(expr) && isPrivateIdentifier(expr.name)) {
|
|
77415
|
-
|
|
77429
|
+
error2(expr, Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_private_identifier);
|
|
77416
77430
|
}
|
|
77417
77431
|
const links = getNodeLinks(expr);
|
|
77418
77432
|
const symbol = getExportSymbolOfValueSymbolIfExported(links.resolvedSymbol);
|
|
77419
77433
|
if (symbol) {
|
|
77420
77434
|
if (isReadonlySymbol(symbol)) {
|
|
77421
|
-
|
|
77435
|
+
error2(expr, Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_read_only_property);
|
|
77422
77436
|
}
|
|
77423
77437
|
checkDeleteExpressionMustBeOptional(expr, symbol);
|
|
77424
77438
|
}
|
|
@@ -77427,7 +77441,7 @@ function createTypeChecker(host) {
|
|
|
77427
77441
|
function checkDeleteExpressionMustBeOptional(expr, symbol) {
|
|
77428
77442
|
const type = getTypeOfSymbol(symbol);
|
|
77429
77443
|
if (strictNullChecks && !(type.flags & (3 /* AnyOrUnknown */ | 131072 /* Never */)) && !(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ : getTypeFacts(type) & 16777216 /* IsUndefined */)) {
|
|
77430
|
-
|
|
77444
|
+
error2(expr, Diagnostics.The_operand_of_a_delete_operator_must_be_optional);
|
|
77431
77445
|
}
|
|
77432
77446
|
}
|
|
77433
77447
|
function checkTypeOfExpression(node) {
|
|
@@ -77441,7 +77455,7 @@ function createTypeChecker(host) {
|
|
|
77441
77455
|
function checkAwaitExpressionGrammar(node) {
|
|
77442
77456
|
const container = getContainingFunctionOrClassStaticBlock(node);
|
|
77443
77457
|
if (container && isClassStaticBlockDeclaration(container)) {
|
|
77444
|
-
|
|
77458
|
+
error2(node, Diagnostics.Await_expression_cannot_be_used_inside_a_class_static_block);
|
|
77445
77459
|
} else if (!(node.flags & 32768 /* AwaitContext */)) {
|
|
77446
77460
|
if (isInTopLevelContext(node)) {
|
|
77447
77461
|
const sourceFile = getSourceFileOfNode(node);
|
|
@@ -77500,7 +77514,7 @@ function createTypeChecker(host) {
|
|
|
77500
77514
|
}
|
|
77501
77515
|
}
|
|
77502
77516
|
if (isInParameterInitializerBeforeContainingFunction(node)) {
|
|
77503
|
-
|
|
77517
|
+
error2(node, Diagnostics.await_expressions_cannot_be_used_in_a_parameter_initializer);
|
|
77504
77518
|
}
|
|
77505
77519
|
}
|
|
77506
77520
|
function checkAwaitExpression(node) {
|
|
@@ -77550,11 +77564,11 @@ function createTypeChecker(host) {
|
|
|
77550
77564
|
case 55 /* TildeToken */:
|
|
77551
77565
|
checkNonNullType(operandType, node.operand);
|
|
77552
77566
|
if (maybeTypeOfKindConsideringBaseConstraint(operandType, 12288 /* ESSymbolLike */)) {
|
|
77553
|
-
|
|
77567
|
+
error2(node.operand, Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, tokenToString(node.operator));
|
|
77554
77568
|
}
|
|
77555
77569
|
if (node.operator === 40 /* PlusToken */) {
|
|
77556
77570
|
if (maybeTypeOfKindConsideringBaseConstraint(operandType, 2112 /* BigIntLike */)) {
|
|
77557
|
-
|
|
77571
|
+
error2(node.operand, Diagnostics.Operator_0_cannot_be_applied_to_type_1, tokenToString(node.operator), typeToString(getBaseTypeOfLiteralType(operandType)));
|
|
77558
77572
|
}
|
|
77559
77573
|
return numberType;
|
|
77560
77574
|
}
|
|
@@ -77650,10 +77664,10 @@ function createTypeChecker(host) {
|
|
|
77650
77664
|
return silentNeverType;
|
|
77651
77665
|
}
|
|
77652
77666
|
if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 402784252 /* Primitive */)) {
|
|
77653
|
-
|
|
77667
|
+
error2(left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
|
|
77654
77668
|
}
|
|
77655
77669
|
if (!(isTypeAny(rightType) || typeHasCallOrConstructSignatures(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
|
|
77656
|
-
|
|
77670
|
+
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);
|
|
77657
77671
|
}
|
|
77658
77672
|
return booleanType;
|
|
77659
77673
|
}
|
|
@@ -77682,7 +77696,7 @@ function createTypeChecker(host) {
|
|
|
77682
77696
|
}
|
|
77683
77697
|
if (checkTypeAssignableTo(checkNonNullType(rightType, right), nonPrimitiveType, right)) {
|
|
77684
77698
|
if (hasEmptyObjectIntersection(rightType)) {
|
|
77685
|
-
|
|
77699
|
+
error2(right, Diagnostics.Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator, typeToString(rightType));
|
|
77686
77700
|
}
|
|
77687
77701
|
}
|
|
77688
77702
|
return booleanType;
|
|
@@ -77724,7 +77738,7 @@ function createTypeChecker(host) {
|
|
|
77724
77738
|
return checkDestructuringAssignment(property.kind === 303 /* ShorthandPropertyAssignment */ ? property : property.initializer, type);
|
|
77725
77739
|
} else if (property.kind === 304 /* SpreadAssignment */) {
|
|
77726
77740
|
if (propertyIndex < properties.length - 1) {
|
|
77727
|
-
|
|
77741
|
+
error2(property, Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern);
|
|
77728
77742
|
} else {
|
|
77729
77743
|
if (languageVersion < 99 /* ESNext */) {
|
|
77730
77744
|
checkExternalEmitHelpers(property, 4 /* Rest */);
|
|
@@ -77742,7 +77756,7 @@ function createTypeChecker(host) {
|
|
|
77742
77756
|
return checkDestructuringAssignment(property.expression, type);
|
|
77743
77757
|
}
|
|
77744
77758
|
} else {
|
|
77745
|
-
|
|
77759
|
+
error2(property, Diagnostics.Property_assignment_expected);
|
|
77746
77760
|
}
|
|
77747
77761
|
}
|
|
77748
77762
|
function checkArrayLiteralAssignment(node, sourceType, checkMode) {
|
|
@@ -77777,11 +77791,11 @@ function createTypeChecker(host) {
|
|
|
77777
77791
|
return checkDestructuringAssignment(element, elementType, checkMode);
|
|
77778
77792
|
}
|
|
77779
77793
|
if (elementIndex < elements.length - 1) {
|
|
77780
|
-
|
|
77794
|
+
error2(element, Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern);
|
|
77781
77795
|
} else {
|
|
77782
77796
|
const restExpression = element.expression;
|
|
77783
77797
|
if (restExpression.kind === 225 /* BinaryExpression */ && restExpression.operatorToken.kind === 64 /* EqualsToken */) {
|
|
77784
|
-
|
|
77798
|
+
error2(restExpression.operatorToken, Diagnostics.A_rest_element_cannot_have_an_initializer);
|
|
77785
77799
|
} else {
|
|
77786
77800
|
checkGrammarForDisallowedTrailingComma(node.elements, Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma);
|
|
77787
77801
|
const type = everyType(sourceType, isTupleType) ? mapType(sourceType, (t) => sliceTupleType(t, elementIndex)) : createArrayType(elementType);
|
|
@@ -77822,9 +77836,9 @@ function createTypeChecker(host) {
|
|
|
77822
77836
|
}
|
|
77823
77837
|
function checkReferenceAssignment(target, sourceType, checkMode) {
|
|
77824
77838
|
const targetType = checkExpression(target, checkMode);
|
|
77825
|
-
const
|
|
77839
|
+
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;
|
|
77826
77840
|
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;
|
|
77827
|
-
if (checkReferenceExpression(target,
|
|
77841
|
+
if (checkReferenceExpression(target, error3, optionalError)) {
|
|
77828
77842
|
checkTypeAssignableToAndOptionallyElaborate(sourceType, targetType, target, target);
|
|
77829
77843
|
}
|
|
77830
77844
|
if (isPrivateIdentifierPropertyAccessExpression(target)) {
|
|
@@ -78065,7 +78079,7 @@ function createTypeChecker(host) {
|
|
|
78065
78079
|
rightType = checkNonNullType(rightType, right);
|
|
78066
78080
|
let suggestedOperator;
|
|
78067
78081
|
if (leftType.flags & 528 /* BooleanLike */ && rightType.flags & 528 /* BooleanLike */ && (suggestedOperator = getSuggestedBooleanOperator(operatorToken.kind)) !== void 0) {
|
|
78068
|
-
|
|
78082
|
+
error2(errorNode || operatorToken, Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, tokenToString(operatorToken.kind), tokenToString(suggestedOperator));
|
|
78069
78083
|
return numberType;
|
|
78070
78084
|
} else {
|
|
78071
78085
|
const leftOk = checkArithmeticOperandType(
|
|
@@ -78095,7 +78109,7 @@ function createTypeChecker(host) {
|
|
|
78095
78109
|
case 43 /* AsteriskAsteriskToken */:
|
|
78096
78110
|
case 68 /* AsteriskAsteriskEqualsToken */:
|
|
78097
78111
|
if (languageVersion < 3 /* ES2016 */) {
|
|
78098
|
-
|
|
78112
|
+
error2(errorNode, Diagnostics.Exponentiation_cannot_be_performed_on_bigint_values_unless_the_target_option_is_set_to_es2016_or_later);
|
|
78099
78113
|
}
|
|
78100
78114
|
}
|
|
78101
78115
|
resultType2 = bigintType;
|
|
@@ -78193,7 +78207,7 @@ function createTypeChecker(host) {
|
|
|
78193
78207
|
if (!(checkMode && checkMode & 256 /* TypeOnly */)) {
|
|
78194
78208
|
if (isLiteralExpressionOfObject(left) || isLiteralExpressionOfObject(right)) {
|
|
78195
78209
|
const eqType = operator === 35 /* EqualsEqualsToken */ || operator === 37 /* EqualsEqualsEqualsToken */;
|
|
78196
|
-
|
|
78210
|
+
error2(errorNode, Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true");
|
|
78197
78211
|
}
|
|
78198
78212
|
checkNaNEquality(errorNode, operator, left, right);
|
|
78199
78213
|
reportOperatorErrorUnless((left2, right2) => isTypeEqualityComparableTo(left2, right2) || isTypeEqualityComparableTo(right2, left2));
|
|
@@ -78250,7 +78264,7 @@ function createTypeChecker(host) {
|
|
|
78250
78264
|
return textSpanContainsPosition(diag2, start2);
|
|
78251
78265
|
});
|
|
78252
78266
|
if (!isInDiag2657)
|
|
78253
|
-
|
|
78267
|
+
error2(left, Diagnostics.Left_side_of_comma_operator_is_unused_and_has_no_side_effects);
|
|
78254
78268
|
}
|
|
78255
78269
|
return rightType;
|
|
78256
78270
|
default:
|
|
@@ -78290,7 +78304,7 @@ function createTypeChecker(host) {
|
|
|
78290
78304
|
function checkForDisallowedESSymbolOperand(operator2) {
|
|
78291
78305
|
const offendingSymbolOperand = maybeTypeOfKindConsideringBaseConstraint(leftType, 12288 /* ESSymbolLike */) ? left : maybeTypeOfKindConsideringBaseConstraint(rightType, 12288 /* ESSymbolLike */) ? right : void 0;
|
|
78292
78306
|
if (offendingSymbolOperand) {
|
|
78293
|
-
|
|
78307
|
+
error2(offendingSymbolOperand, Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, tokenToString(operator2));
|
|
78294
78308
|
return false;
|
|
78295
78309
|
}
|
|
78296
78310
|
return true;
|
|
@@ -78411,7 +78425,7 @@ function createTypeChecker(host) {
|
|
|
78411
78425
|
const isLeftNaN = isGlobalNaN(skipParentheses(left2));
|
|
78412
78426
|
const isRightNaN = isGlobalNaN(skipParentheses(right2));
|
|
78413
78427
|
if (isLeftNaN || isRightNaN) {
|
|
78414
|
-
const err =
|
|
78428
|
+
const err = error2(
|
|
78415
78429
|
errorNode2,
|
|
78416
78430
|
Diagnostics.This_condition_will_always_return_0,
|
|
78417
78431
|
tokenToString(operator2 === 37 /* EqualsEqualsEqualsToken */ || operator2 === 35 /* EqualsEqualsToken */ ? 97 /* FalseKeyword */ : 112 /* TrueKeyword */)
|
|
@@ -78492,7 +78506,7 @@ function createTypeChecker(host) {
|
|
|
78492
78506
|
void 0
|
|
78493
78507
|
);
|
|
78494
78508
|
if (!contextualType || isTypeAny(contextualType)) {
|
|
78495
|
-
|
|
78509
|
+
error2(node, Diagnostics.yield_expression_implicitly_results_in_an_any_type_because_its_containing_generator_lacks_a_return_type_annotation);
|
|
78496
78510
|
}
|
|
78497
78511
|
}
|
|
78498
78512
|
});
|
|
@@ -78503,7 +78517,7 @@ function createTypeChecker(host) {
|
|
|
78503
78517
|
grammarErrorOnFirstToken(node, Diagnostics.A_yield_expression_is_only_allowed_in_a_generator_body);
|
|
78504
78518
|
}
|
|
78505
78519
|
if (isInParameterInitializerBeforeContainingFunction(node)) {
|
|
78506
|
-
|
|
78520
|
+
error2(node, Diagnostics.yield_expressions_cannot_be_used_in_a_parameter_initializer);
|
|
78507
78521
|
}
|
|
78508
78522
|
}
|
|
78509
78523
|
}
|
|
@@ -78524,7 +78538,7 @@ function createTypeChecker(host) {
|
|
|
78524
78538
|
for (const span of node.templateSpans) {
|
|
78525
78539
|
const type = checkExpression(span.expression);
|
|
78526
78540
|
if (maybeTypeOfKindConsideringBaseConstraint(type, 12288 /* ESSymbolLike */)) {
|
|
78527
|
-
|
|
78541
|
+
error2(span.expression, Diagnostics.Implicit_conversion_of_a_symbol_to_a_string_will_fail_at_runtime_Consider_wrapping_this_expression_in_String);
|
|
78528
78542
|
}
|
|
78529
78543
|
texts.push(span.literal.text);
|
|
78530
78544
|
types.push(isTypeAssignableTo(type, templateConstraintType) ? type : stringType);
|
|
@@ -78920,13 +78934,13 @@ function createTypeChecker(host) {
|
|
|
78920
78934
|
function checkConstEnumAccess(node, type) {
|
|
78921
78935
|
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 */;
|
|
78922
78936
|
if (!ok) {
|
|
78923
|
-
|
|
78937
|
+
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);
|
|
78924
78938
|
}
|
|
78925
78939
|
if (getIsolatedModules(compilerOptions)) {
|
|
78926
78940
|
Debug.assert(!!(type.symbol.flags & 128 /* ConstEnum */));
|
|
78927
78941
|
const constEnumDeclaration = type.symbol.valueDeclaration;
|
|
78928
78942
|
if (constEnumDeclaration.flags & 16777216 /* Ambient */ && !isValidTypeOnlyAliasUseSite(node)) {
|
|
78929
|
-
|
|
78943
|
+
error2(node, Diagnostics.Cannot_access_ambient_const_enums_when_0_is_enabled, isolatedModulesLikeFlagName);
|
|
78930
78944
|
}
|
|
78931
78945
|
}
|
|
78932
78946
|
}
|
|
@@ -79067,7 +79081,7 @@ function createTypeChecker(host) {
|
|
|
79067
79081
|
const typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfDeclaration(node));
|
|
79068
79082
|
getBaseConstraintOfType(typeParameter);
|
|
79069
79083
|
if (!hasNonCircularTypeParameterDefault(typeParameter)) {
|
|
79070
|
-
|
|
79084
|
+
error2(node.default, Diagnostics.Type_parameter_0_has_a_circular_default, typeToString(typeParameter));
|
|
79071
79085
|
}
|
|
79072
79086
|
const constraintType = getConstraintOfTypeParameter(typeParameter);
|
|
79073
79087
|
const defaultType = getDefaultFromTypeParameter(typeParameter);
|
|
@@ -79085,7 +79099,7 @@ function createTypeChecker(host) {
|
|
|
79085
79099
|
if (modifiers) {
|
|
79086
79100
|
const symbol = getSymbolOfDeclaration(node.parent);
|
|
79087
79101
|
if (isTypeAliasDeclaration(node.parent) && !(getObjectFlags(getDeclaredTypeOfSymbol(symbol)) & (16 /* Anonymous */ | 32 /* Mapped */))) {
|
|
79088
|
-
|
|
79102
|
+
error2(node, Diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types);
|
|
79089
79103
|
} else if (modifiers === 32768 /* In */ || modifiers === 65536 /* Out */) {
|
|
79090
79104
|
(_a = tracing) == null ? void 0 : _a.push(tracing.Phase.CheckTypes, "checkTypeParameterDeferred", { parent: getTypeId(getDeclaredTypeOfSymbol(symbol)), id: getTypeId(typeParameter) });
|
|
79091
79105
|
const source = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSubTypeForCheck : markerSuperTypeForCheck);
|
|
@@ -79105,37 +79119,37 @@ function createTypeChecker(host) {
|
|
|
79105
79119
|
const func = getContainingFunction(node);
|
|
79106
79120
|
if (hasSyntacticModifier(node, 16476 /* ParameterPropertyModifier */)) {
|
|
79107
79121
|
if (!(func.kind === 175 /* Constructor */ && nodeIsPresent(func.body))) {
|
|
79108
|
-
|
|
79122
|
+
error2(node, Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation);
|
|
79109
79123
|
}
|
|
79110
79124
|
if (func.kind === 175 /* Constructor */ && isIdentifier(node.name) && node.name.escapedText === "constructor") {
|
|
79111
|
-
|
|
79125
|
+
error2(node.name, Diagnostics.constructor_cannot_be_used_as_a_parameter_property_name);
|
|
79112
79126
|
}
|
|
79113
79127
|
}
|
|
79114
79128
|
if (!node.initializer && isOptionalDeclaration(node) && isBindingPattern(node.name) && func.body) {
|
|
79115
|
-
|
|
79129
|
+
error2(node, Diagnostics.A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature);
|
|
79116
79130
|
}
|
|
79117
79131
|
if (node.name && isIdentifier(node.name) && (node.name.escapedText === "this" || node.name.escapedText === "new")) {
|
|
79118
79132
|
if (func.parameters.indexOf(node) !== 0) {
|
|
79119
|
-
|
|
79133
|
+
error2(node, Diagnostics.A_0_parameter_must_be_the_first_parameter, node.name.escapedText);
|
|
79120
79134
|
}
|
|
79121
79135
|
if (func.kind === 175 /* Constructor */ || func.kind === 179 /* ConstructSignature */ || func.kind === 184 /* ConstructorType */) {
|
|
79122
|
-
|
|
79136
|
+
error2(node, Diagnostics.A_constructor_cannot_have_a_this_parameter);
|
|
79123
79137
|
}
|
|
79124
79138
|
if (func.kind === 218 /* ArrowFunction */) {
|
|
79125
|
-
|
|
79139
|
+
error2(node, Diagnostics.An_arrow_function_cannot_have_a_this_parameter);
|
|
79126
79140
|
}
|
|
79127
79141
|
if (func.kind === 176 /* GetAccessor */ || func.kind === 177 /* SetAccessor */) {
|
|
79128
|
-
|
|
79142
|
+
error2(node, Diagnostics.get_and_set_accessors_cannot_declare_this_parameters);
|
|
79129
79143
|
}
|
|
79130
79144
|
}
|
|
79131
79145
|
if (node.dotDotDotToken && !isBindingPattern(node.name) && !isTypeAssignableTo(getReducedType(getTypeOfSymbol(node.symbol)), anyReadonlyArrayType)) {
|
|
79132
|
-
|
|
79146
|
+
error2(node, Diagnostics.A_rest_parameter_must_be_of_an_array_type);
|
|
79133
79147
|
}
|
|
79134
79148
|
}
|
|
79135
79149
|
function checkTypePredicate(node) {
|
|
79136
79150
|
const parent2 = getTypePredicateParent(node);
|
|
79137
79151
|
if (!parent2) {
|
|
79138
|
-
|
|
79152
|
+
error2(node, Diagnostics.A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods);
|
|
79139
79153
|
return;
|
|
79140
79154
|
}
|
|
79141
79155
|
const signature = getSignatureFromDeclaration(parent2);
|
|
@@ -79150,7 +79164,7 @@ function createTypeChecker(host) {
|
|
|
79150
79164
|
} else {
|
|
79151
79165
|
if (typePredicate.parameterIndex >= 0) {
|
|
79152
79166
|
if (signatureHasRestParameter(signature) && typePredicate.parameterIndex === signature.parameters.length - 1) {
|
|
79153
|
-
|
|
79167
|
+
error2(parameterName, Diagnostics.A_type_predicate_cannot_reference_a_rest_parameter);
|
|
79154
79168
|
} else {
|
|
79155
79169
|
if (typePredicate.type) {
|
|
79156
79170
|
const leadingError = () => chainDiagnosticMessages(
|
|
@@ -79177,7 +79191,7 @@ function createTypeChecker(host) {
|
|
|
79177
79191
|
}
|
|
79178
79192
|
}
|
|
79179
79193
|
if (!hasReportedError) {
|
|
79180
|
-
|
|
79194
|
+
error2(node.parameterName, Diagnostics.Cannot_find_parameter_0, typePredicate.parameterName);
|
|
79181
79195
|
}
|
|
79182
79196
|
}
|
|
79183
79197
|
}
|
|
@@ -79204,7 +79218,7 @@ function createTypeChecker(host) {
|
|
|
79204
79218
|
}
|
|
79205
79219
|
const name = element.name;
|
|
79206
79220
|
if (name.kind === 80 /* Identifier */ && name.escapedText === predicateVariableName) {
|
|
79207
|
-
|
|
79221
|
+
error2(
|
|
79208
79222
|
predicateVariableNode,
|
|
79209
79223
|
Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern,
|
|
79210
79224
|
predicateVariableName
|
|
@@ -79252,10 +79266,10 @@ function createTypeChecker(host) {
|
|
|
79252
79266
|
if (noImplicitAny && !returnTypeNode) {
|
|
79253
79267
|
switch (node.kind) {
|
|
79254
79268
|
case 179 /* ConstructSignature */:
|
|
79255
|
-
|
|
79269
|
+
error2(node, Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type);
|
|
79256
79270
|
break;
|
|
79257
79271
|
case 178 /* CallSignature */:
|
|
79258
|
-
|
|
79272
|
+
error2(node, Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type);
|
|
79259
79273
|
break;
|
|
79260
79274
|
}
|
|
79261
79275
|
}
|
|
@@ -79264,7 +79278,7 @@ function createTypeChecker(host) {
|
|
|
79264
79278
|
if ((functionFlags2 & (4 /* Invalid */ | 1 /* Generator */)) === 1 /* Generator */) {
|
|
79265
79279
|
const returnType = getTypeFromTypeNode(returnTypeNode);
|
|
79266
79280
|
if (returnType === voidType) {
|
|
79267
|
-
|
|
79281
|
+
error2(returnTypeNode, Diagnostics.A_generator_cannot_have_a_void_type_annotation);
|
|
79268
79282
|
} else {
|
|
79269
79283
|
const generatorYieldType = getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || anyType;
|
|
79270
79284
|
const generatorReturnType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || generatorYieldType;
|
|
@@ -79324,16 +79338,16 @@ function createTypeChecker(host) {
|
|
|
79324
79338
|
const prev = names.get(name);
|
|
79325
79339
|
if (prev) {
|
|
79326
79340
|
if ((prev & 16 /* PrivateStatic */) !== (meaning & 16 /* PrivateStatic */)) {
|
|
79327
|
-
|
|
79341
|
+
error2(location, Diagnostics.Duplicate_identifier_0_Static_and_instance_elements_cannot_share_the_same_private_name, getTextOfNode(location));
|
|
79328
79342
|
} else {
|
|
79329
79343
|
const prevIsMethod = !!(prev & 8 /* Method */);
|
|
79330
79344
|
const isMethod = !!(meaning & 8 /* Method */);
|
|
79331
79345
|
if (prevIsMethod || isMethod) {
|
|
79332
79346
|
if (prevIsMethod !== isMethod) {
|
|
79333
|
-
|
|
79347
|
+
error2(location, Diagnostics.Duplicate_identifier_0, getTextOfNode(location));
|
|
79334
79348
|
}
|
|
79335
79349
|
} else if (prev & meaning & ~16 /* PrivateStatic */) {
|
|
79336
|
-
|
|
79350
|
+
error2(location, Diagnostics.Duplicate_identifier_0, getTextOfNode(location));
|
|
79337
79351
|
} else {
|
|
79338
79352
|
names.set(name, prev | meaning);
|
|
79339
79353
|
}
|
|
@@ -79360,7 +79374,7 @@ function createTypeChecker(host) {
|
|
|
79360
79374
|
case "prototype":
|
|
79361
79375
|
const message = Diagnostics.Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1;
|
|
79362
79376
|
const className = getNameOfSymbolAsWritten(getSymbolOfDeclaration(node));
|
|
79363
|
-
|
|
79377
|
+
error2(memberNameNode, message, memberName, className);
|
|
79364
79378
|
break;
|
|
79365
79379
|
}
|
|
79366
79380
|
}
|
|
@@ -79384,8 +79398,8 @@ function createTypeChecker(host) {
|
|
|
79384
79398
|
continue;
|
|
79385
79399
|
}
|
|
79386
79400
|
if (names.get(memberName)) {
|
|
79387
|
-
|
|
79388
|
-
|
|
79401
|
+
error2(getNameOfDeclaration(member.symbol.valueDeclaration), Diagnostics.Duplicate_identifier_0, memberName);
|
|
79402
|
+
error2(member.name, Diagnostics.Duplicate_identifier_0, memberName);
|
|
79389
79403
|
} else {
|
|
79390
79404
|
names.set(memberName, true);
|
|
79391
79405
|
}
|
|
@@ -79417,7 +79431,7 @@ function createTypeChecker(host) {
|
|
|
79417
79431
|
indexSignatureMap.forEach((entry) => {
|
|
79418
79432
|
if (entry.declarations.length > 1) {
|
|
79419
79433
|
for (const declaration of entry.declarations) {
|
|
79420
|
-
|
|
79434
|
+
error2(declaration, Diagnostics.Duplicate_index_signature_for_type_0, typeToString(entry.type));
|
|
79421
79435
|
}
|
|
79422
79436
|
}
|
|
79423
79437
|
});
|
|
@@ -79429,12 +79443,12 @@ function createTypeChecker(host) {
|
|
|
79429
79443
|
checkVariableLikeDeclaration(node);
|
|
79430
79444
|
setNodeLinksForPrivateIdentifierScope(node);
|
|
79431
79445
|
if (hasSyntacticModifier(node, 256 /* Abstract */) && node.kind === 171 /* PropertyDeclaration */ && node.initializer) {
|
|
79432
|
-
|
|
79446
|
+
error2(node, Diagnostics.Property_0_cannot_have_an_initializer_because_it_is_marked_abstract, declarationNameToString(node.name));
|
|
79433
79447
|
}
|
|
79434
79448
|
}
|
|
79435
79449
|
function checkPropertySignature(node) {
|
|
79436
79450
|
if (isPrivateIdentifier(node.name)) {
|
|
79437
|
-
|
|
79451
|
+
error2(node, Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);
|
|
79438
79452
|
}
|
|
79439
79453
|
return checkPropertyDeclaration(node);
|
|
79440
79454
|
}
|
|
@@ -79442,14 +79456,14 @@ function createTypeChecker(host) {
|
|
|
79442
79456
|
if (!checkGrammarMethod(node))
|
|
79443
79457
|
checkGrammarComputedPropertyName(node.name);
|
|
79444
79458
|
if (isMethodDeclaration(node) && node.asteriskToken && isIdentifier(node.name) && idText(node.name) === "constructor") {
|
|
79445
|
-
|
|
79459
|
+
error2(node.name, Diagnostics.Class_constructor_may_not_be_a_generator);
|
|
79446
79460
|
}
|
|
79447
79461
|
checkFunctionOrMethodDeclaration(node);
|
|
79448
79462
|
if (hasSyntacticModifier(node, 256 /* Abstract */) && node.kind === 173 /* MethodDeclaration */ && node.body) {
|
|
79449
|
-
|
|
79463
|
+
error2(node, Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, declarationNameToString(node.name));
|
|
79450
79464
|
}
|
|
79451
79465
|
if (isPrivateIdentifier(node.name) && !getContainingClass(node)) {
|
|
79452
|
-
|
|
79466
|
+
error2(node, Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);
|
|
79453
79467
|
}
|
|
79454
79468
|
setNodeLinksForPrivateIdentifierScope(node);
|
|
79455
79469
|
}
|
|
@@ -79500,12 +79514,12 @@ function createTypeChecker(host) {
|
|
|
79500
79514
|
const superCall = findFirstSuperCall(node.body);
|
|
79501
79515
|
if (superCall) {
|
|
79502
79516
|
if (classExtendsNull) {
|
|
79503
|
-
|
|
79517
|
+
error2(superCall, Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null);
|
|
79504
79518
|
}
|
|
79505
79519
|
const superCallShouldBeRootLevel = (getEmitScriptTarget(compilerOptions) !== 99 /* ESNext */ || !useDefineForClassFields) && (some(node.parent.members, isInstancePropertyWithInitializerOrPrivateIdentifierProperty) || some(node.parameters, (p) => hasSyntacticModifier(p, 16476 /* ParameterPropertyModifier */)));
|
|
79506
79520
|
if (superCallShouldBeRootLevel) {
|
|
79507
79521
|
if (!superCallIsRootLevelInConstructor(superCall, node.body)) {
|
|
79508
|
-
|
|
79522
|
+
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);
|
|
79509
79523
|
} else {
|
|
79510
79524
|
let superCallStatement;
|
|
79511
79525
|
for (const statement of node.body.statements) {
|
|
@@ -79518,12 +79532,12 @@ function createTypeChecker(host) {
|
|
|
79518
79532
|
}
|
|
79519
79533
|
}
|
|
79520
79534
|
if (superCallStatement === void 0) {
|
|
79521
|
-
|
|
79535
|
+
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);
|
|
79522
79536
|
}
|
|
79523
79537
|
}
|
|
79524
79538
|
}
|
|
79525
79539
|
} else if (!classExtendsNull) {
|
|
79526
|
-
|
|
79540
|
+
error2(node, Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call);
|
|
79527
79541
|
}
|
|
79528
79542
|
}
|
|
79529
79543
|
}
|
|
@@ -79543,7 +79557,7 @@ function createTypeChecker(host) {
|
|
|
79543
79557
|
}
|
|
79544
79558
|
function checkAccessorDeclaration(node) {
|
|
79545
79559
|
if (isIdentifier(node.name) && idText(node.name) === "constructor" && isClassLike(node.parent)) {
|
|
79546
|
-
|
|
79560
|
+
error2(node.name, Diagnostics.Class_constructor_may_not_be_an_accessor);
|
|
79547
79561
|
}
|
|
79548
79562
|
addLazyDiagnostic(checkAccessorDeclarationDiagnostics);
|
|
79549
79563
|
checkSourceElement(node.body);
|
|
@@ -79556,7 +79570,7 @@ function createTypeChecker(host) {
|
|
|
79556
79570
|
if (node.kind === 176 /* GetAccessor */) {
|
|
79557
79571
|
if (!(node.flags & 16777216 /* Ambient */) && nodeIsPresent(node.body) && node.flags & 256 /* HasImplicitReturn */) {
|
|
79558
79572
|
if (!(node.flags & 512 /* HasExplicitReturn */)) {
|
|
79559
|
-
|
|
79573
|
+
error2(node.name, Diagnostics.A_get_accessor_must_return_a_value);
|
|
79560
79574
|
}
|
|
79561
79575
|
}
|
|
79562
79576
|
}
|
|
@@ -79572,12 +79586,12 @@ function createTypeChecker(host) {
|
|
|
79572
79586
|
const getterFlags = getEffectiveModifierFlags(getter);
|
|
79573
79587
|
const setterFlags = getEffectiveModifierFlags(setter);
|
|
79574
79588
|
if ((getterFlags & 256 /* Abstract */) !== (setterFlags & 256 /* Abstract */)) {
|
|
79575
|
-
|
|
79576
|
-
|
|
79589
|
+
error2(getter.name, Diagnostics.Accessors_must_both_be_abstract_or_non_abstract);
|
|
79590
|
+
error2(setter.name, Diagnostics.Accessors_must_both_be_abstract_or_non_abstract);
|
|
79577
79591
|
}
|
|
79578
79592
|
if (getterFlags & 16 /* Protected */ && !(setterFlags & (16 /* Protected */ | 8 /* Private */)) || getterFlags & 8 /* Private */ && !(setterFlags & 8 /* Private */)) {
|
|
79579
|
-
|
|
79580
|
-
|
|
79593
|
+
error2(getter.name, Diagnostics.A_get_accessor_must_be_at_least_as_accessible_as_the_setter);
|
|
79594
|
+
error2(setter.name, Diagnostics.A_get_accessor_must_be_at_least_as_accessible_as_the_setter);
|
|
79581
79595
|
}
|
|
79582
79596
|
}
|
|
79583
79597
|
}
|
|
@@ -79715,7 +79729,7 @@ function createTypeChecker(host) {
|
|
|
79715
79729
|
if (flags & 8 /* Variadic */) {
|
|
79716
79730
|
const type = getTypeFromTypeNode(e.type);
|
|
79717
79731
|
if (!isArrayLikeType(type)) {
|
|
79718
|
-
|
|
79732
|
+
error2(e, Diagnostics.A_rest_element_type_must_be_an_array_type);
|
|
79719
79733
|
break;
|
|
79720
79734
|
}
|
|
79721
79735
|
if (isArrayType(type) || isTupleType(type) && type.target.combinedFlags & 4 /* Rest */) {
|
|
@@ -79753,7 +79767,7 @@ function createTypeChecker(host) {
|
|
|
79753
79767
|
const indexType = type.indexType;
|
|
79754
79768
|
if (isTypeAssignableTo(indexType, getIndexType(objectType, 0 /* None */))) {
|
|
79755
79769
|
if (accessNode.kind === 211 /* ElementAccessExpression */ && isAssignmentTarget(accessNode) && getObjectFlags(objectType) & 32 /* Mapped */ && getMappedTypeModifiers(objectType) & 1 /* IncludeReadonly */) {
|
|
79756
|
-
|
|
79770
|
+
error2(accessNode, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
|
|
79757
79771
|
}
|
|
79758
79772
|
return type;
|
|
79759
79773
|
}
|
|
@@ -79766,12 +79780,12 @@ function createTypeChecker(host) {
|
|
|
79766
79780
|
if (propertyName) {
|
|
79767
79781
|
const propertySymbol = forEachType(apparentObjectType, (t) => getPropertyOfType(t, propertyName));
|
|
79768
79782
|
if (propertySymbol && getDeclarationModifierFlagsFromSymbol(propertySymbol) & 24 /* NonPublicAccessibilityModifier */) {
|
|
79769
|
-
|
|
79783
|
+
error2(accessNode, Diagnostics.Private_or_protected_member_0_cannot_be_accessed_on_a_type_parameter, unescapeLeadingUnderscores(propertyName));
|
|
79770
79784
|
return errorType;
|
|
79771
79785
|
}
|
|
79772
79786
|
}
|
|
79773
79787
|
}
|
|
79774
|
-
|
|
79788
|
+
error2(accessNode, Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType));
|
|
79775
79789
|
return errorType;
|
|
79776
79790
|
}
|
|
79777
79791
|
function checkIndexedAccessType(node) {
|
|
@@ -79827,7 +79841,7 @@ function createTypeChecker(host) {
|
|
|
79827
79841
|
if (!areTypeParametersIdentical(declarations, [typeParameter], (decl) => [decl])) {
|
|
79828
79842
|
const name = symbolToString(symbol);
|
|
79829
79843
|
for (const declaration of declarations) {
|
|
79830
|
-
|
|
79844
|
+
error2(declaration.name, Diagnostics.All_declarations_of_0_must_have_identical_constraints, name);
|
|
79831
79845
|
}
|
|
79832
79846
|
}
|
|
79833
79847
|
}
|
|
@@ -79898,13 +79912,13 @@ function createTypeChecker(host) {
|
|
|
79898
79912
|
forEach(overloads, (o) => {
|
|
79899
79913
|
const deviation = getEffectiveDeclarationFlags(o, flagsToCheck2) ^ canonicalFlags;
|
|
79900
79914
|
if (deviation & 1 /* Export */) {
|
|
79901
|
-
|
|
79915
|
+
error2(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_exported_or_non_exported);
|
|
79902
79916
|
} else if (deviation & 2 /* Ambient */) {
|
|
79903
|
-
|
|
79917
|
+
error2(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_ambient_or_non_ambient);
|
|
79904
79918
|
} else if (deviation & (8 /* Private */ | 16 /* Protected */)) {
|
|
79905
|
-
|
|
79919
|
+
error2(getNameOfDeclaration(o) || o, Diagnostics.Overload_signatures_must_all_be_public_private_or_protected);
|
|
79906
79920
|
} else if (deviation & 256 /* Abstract */) {
|
|
79907
|
-
|
|
79921
|
+
error2(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_abstract_or_non_abstract);
|
|
79908
79922
|
}
|
|
79909
79923
|
});
|
|
79910
79924
|
}
|
|
@@ -79915,7 +79929,7 @@ function createTypeChecker(host) {
|
|
|
79915
79929
|
forEach(overloads, (o) => {
|
|
79916
79930
|
const deviation = hasQuestionToken(o) !== canonicalHasQuestionToken;
|
|
79917
79931
|
if (deviation) {
|
|
79918
|
-
|
|
79932
|
+
error2(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_optional_or_required);
|
|
79919
79933
|
}
|
|
79920
79934
|
});
|
|
79921
79935
|
}
|
|
@@ -79954,24 +79968,24 @@ function createTypeChecker(host) {
|
|
|
79954
79968
|
const reportError = (node.kind === 173 /* MethodDeclaration */ || node.kind === 172 /* MethodSignature */) && isStatic(node) !== isStatic(subsequentNode);
|
|
79955
79969
|
if (reportError) {
|
|
79956
79970
|
const diagnostic = isStatic(node) ? Diagnostics.Function_overload_must_be_static : Diagnostics.Function_overload_must_not_be_static;
|
|
79957
|
-
|
|
79971
|
+
error2(errorNode2, diagnostic);
|
|
79958
79972
|
}
|
|
79959
79973
|
return;
|
|
79960
79974
|
}
|
|
79961
79975
|
if (nodeIsPresent(subsequentNode.body)) {
|
|
79962
|
-
|
|
79976
|
+
error2(errorNode2, Diagnostics.Function_implementation_name_must_be_0, declarationNameToString(node.name));
|
|
79963
79977
|
return;
|
|
79964
79978
|
}
|
|
79965
79979
|
}
|
|
79966
79980
|
}
|
|
79967
79981
|
const errorNode = node.name || node;
|
|
79968
79982
|
if (isConstructor) {
|
|
79969
|
-
|
|
79983
|
+
error2(errorNode, Diagnostics.Constructor_implementation_is_missing);
|
|
79970
79984
|
} else {
|
|
79971
79985
|
if (hasSyntacticModifier(node, 256 /* Abstract */)) {
|
|
79972
|
-
|
|
79986
|
+
error2(errorNode, Diagnostics.All_declarations_of_an_abstract_method_must_be_consecutive);
|
|
79973
79987
|
} else {
|
|
79974
|
-
|
|
79988
|
+
error2(errorNode, Diagnostics.Function_implementation_is_missing_or_not_immediately_following_the_declaration);
|
|
79975
79989
|
}
|
|
79976
79990
|
}
|
|
79977
79991
|
}
|
|
@@ -80034,12 +80048,12 @@ function createTypeChecker(host) {
|
|
|
80034
80048
|
}
|
|
80035
80049
|
if (multipleConstructorImplementation) {
|
|
80036
80050
|
forEach(functionDeclarations, (declaration) => {
|
|
80037
|
-
|
|
80051
|
+
error2(declaration, Diagnostics.Multiple_constructor_implementations_are_not_allowed);
|
|
80038
80052
|
});
|
|
80039
80053
|
}
|
|
80040
80054
|
if (duplicateFunctionDeclaration) {
|
|
80041
80055
|
forEach(functionDeclarations, (declaration) => {
|
|
80042
|
-
|
|
80056
|
+
error2(getNameOfDeclaration(declaration) || declaration, Diagnostics.Duplicate_function_implementation);
|
|
80043
80057
|
});
|
|
80044
80058
|
}
|
|
80045
80059
|
if (hasNonAmbientClass && !isConstructor && symbol.flags & 16 /* Function */ && declarations) {
|
|
@@ -80048,7 +80062,7 @@ function createTypeChecker(host) {
|
|
|
80048
80062
|
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;
|
|
80049
80063
|
if (diagnostic) {
|
|
80050
80064
|
addRelatedInfo(
|
|
80051
|
-
|
|
80065
|
+
error2(getNameOfDeclaration(declaration) || declaration, diagnostic, symbolName(symbol)),
|
|
80052
80066
|
...relatedDiagnostics
|
|
80053
80067
|
);
|
|
80054
80068
|
}
|
|
@@ -80069,7 +80083,7 @@ function createTypeChecker(host) {
|
|
|
80069
80083
|
if (!isImplementationCompatibleWithOverload(bodySignature, signature)) {
|
|
80070
80084
|
const errorNode = signature.declaration && isJSDocSignature(signature.declaration) ? signature.declaration.parent.tagName : signature.declaration;
|
|
80071
80085
|
addRelatedInfo(
|
|
80072
|
-
|
|
80086
|
+
error2(errorNode, Diagnostics.This_overload_signature_is_not_compatible_with_its_implementation_signature),
|
|
80073
80087
|
createDiagnosticForNode(bodyDeclaration, Diagnostics.The_implementation_signature_is_declared_here)
|
|
80074
80088
|
);
|
|
80075
80089
|
break;
|
|
@@ -80116,9 +80130,9 @@ function createTypeChecker(host) {
|
|
|
80116
80130
|
const declarationSpaces = getDeclarationSpaces(d);
|
|
80117
80131
|
const name = getNameOfDeclaration(d);
|
|
80118
80132
|
if (declarationSpaces & commonDeclarationSpacesForDefaultAndNonDefault) {
|
|
80119
|
-
|
|
80133
|
+
error2(name, Diagnostics.Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead, declarationNameToString(name));
|
|
80120
80134
|
} else if (declarationSpaces & commonDeclarationSpacesForExportsAndLocals) {
|
|
80121
|
-
|
|
80135
|
+
error2(name, Diagnostics.Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local, declarationNameToString(name));
|
|
80122
80136
|
}
|
|
80123
80137
|
}
|
|
80124
80138
|
}
|
|
@@ -80198,7 +80212,7 @@ function createTypeChecker(host) {
|
|
|
80198
80212
|
const thenSignatures = thenFunction ? getSignaturesOfType(thenFunction, 0 /* Call */) : emptyArray;
|
|
80199
80213
|
if (thenSignatures.length === 0) {
|
|
80200
80214
|
if (errorNode) {
|
|
80201
|
-
|
|
80215
|
+
error2(errorNode, Diagnostics.A_promise_must_have_a_then_method);
|
|
80202
80216
|
}
|
|
80203
80217
|
return void 0;
|
|
80204
80218
|
}
|
|
@@ -80218,7 +80232,7 @@ function createTypeChecker(host) {
|
|
|
80218
80232
|
thisTypeForErrorOut.value = thisTypeForError;
|
|
80219
80233
|
}
|
|
80220
80234
|
if (errorNode) {
|
|
80221
|
-
|
|
80235
|
+
error2(errorNode, Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1, typeToString(type), typeToString(thisTypeForError));
|
|
80222
80236
|
}
|
|
80223
80237
|
return void 0;
|
|
80224
80238
|
}
|
|
@@ -80229,7 +80243,7 @@ function createTypeChecker(host) {
|
|
|
80229
80243
|
const onfulfilledParameterSignatures = getSignaturesOfType(onfulfilledParameterType, 0 /* Call */);
|
|
80230
80244
|
if (onfulfilledParameterSignatures.length === 0) {
|
|
80231
80245
|
if (errorNode) {
|
|
80232
|
-
|
|
80246
|
+
error2(errorNode, Diagnostics.The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback);
|
|
80233
80247
|
}
|
|
80234
80248
|
return void 0;
|
|
80235
80249
|
}
|
|
@@ -80310,7 +80324,7 @@ function createTypeChecker(host) {
|
|
|
80310
80324
|
if (type.flags & 1048576 /* Union */) {
|
|
80311
80325
|
if (awaitedTypeStack.lastIndexOf(type.id) >= 0) {
|
|
80312
80326
|
if (errorNode) {
|
|
80313
|
-
|
|
80327
|
+
error2(errorNode, Diagnostics.Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method);
|
|
80314
80328
|
}
|
|
80315
80329
|
return void 0;
|
|
80316
80330
|
}
|
|
@@ -80333,7 +80347,7 @@ function createTypeChecker(host) {
|
|
|
80333
80347
|
if (promisedType) {
|
|
80334
80348
|
if (type.id === promisedType.id || awaitedTypeStack.lastIndexOf(promisedType.id) >= 0) {
|
|
80335
80349
|
if (errorNode) {
|
|
80336
|
-
|
|
80350
|
+
error2(errorNode, Diagnostics.Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method);
|
|
80337
80351
|
}
|
|
80338
80352
|
return void 0;
|
|
80339
80353
|
}
|
|
@@ -80370,7 +80384,7 @@ function createTypeChecker(host) {
|
|
|
80370
80384
|
true
|
|
80371
80385
|
);
|
|
80372
80386
|
if (globalPromiseType !== emptyGenericType && !isReferenceToType2(returnType, globalPromiseType)) {
|
|
80373
|
-
|
|
80387
|
+
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));
|
|
80374
80388
|
return;
|
|
80375
80389
|
}
|
|
80376
80390
|
} else {
|
|
@@ -80380,7 +80394,7 @@ function createTypeChecker(host) {
|
|
|
80380
80394
|
}
|
|
80381
80395
|
const promiseConstructorName = getEntityNameFromTypeNode(returnTypeNode);
|
|
80382
80396
|
if (promiseConstructorName === void 0) {
|
|
80383
|
-
|
|
80397
|
+
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));
|
|
80384
80398
|
return;
|
|
80385
80399
|
}
|
|
80386
80400
|
const promiseConstructorSymbol = resolveEntityName(
|
|
@@ -80395,9 +80409,9 @@ function createTypeChecker(host) {
|
|
|
80395
80409
|
/*reportErrors*/
|
|
80396
80410
|
false
|
|
80397
80411
|
)) {
|
|
80398
|
-
|
|
80412
|
+
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);
|
|
80399
80413
|
} else {
|
|
80400
|
-
|
|
80414
|
+
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));
|
|
80401
80415
|
}
|
|
80402
80416
|
return;
|
|
80403
80417
|
}
|
|
@@ -80406,7 +80420,7 @@ function createTypeChecker(host) {
|
|
|
80406
80420
|
true
|
|
80407
80421
|
);
|
|
80408
80422
|
if (globalPromiseConstructorLikeType === emptyObjectType) {
|
|
80409
|
-
|
|
80423
|
+
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));
|
|
80410
80424
|
return;
|
|
80411
80425
|
}
|
|
80412
80426
|
if (!checkTypeAssignableTo(
|
|
@@ -80420,7 +80434,7 @@ function createTypeChecker(host) {
|
|
|
80420
80434
|
const rootName = promiseConstructorName && getFirstIdentifier(promiseConstructorName);
|
|
80421
80435
|
const collidingSymbol = getSymbol2(node.locals, rootName.escapedText, 111551 /* Value */);
|
|
80422
80436
|
if (collidingSymbol) {
|
|
80423
|
-
|
|
80437
|
+
error2(
|
|
80424
80438
|
collidingSymbol.valueDeclaration,
|
|
80425
80439
|
Diagnostics.Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions,
|
|
80426
80440
|
idText(rootName),
|
|
@@ -80533,7 +80547,7 @@ function createTypeChecker(host) {
|
|
|
80533
80547
|
if (canCollectSymbolAliasAccessabilityData && symbolIsValue(rootSymbol) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol)) && !getTypeOnlyAliasDeclaration(rootSymbol)) {
|
|
80534
80548
|
markAliasSymbolAsReferenced(rootSymbol);
|
|
80535
80549
|
} else if (forDecoratorMetadata && getIsolatedModules(compilerOptions) && getEmitModuleKind(compilerOptions) >= 5 /* ES2015 */ && !symbolIsValue(rootSymbol) && !some(rootSymbol.declarations, isTypeOnlyImportOrExportDeclaration)) {
|
|
80536
|
-
const diag2 =
|
|
80550
|
+
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);
|
|
80537
80551
|
const aliasDeclaration = find(rootSymbol.declarations || emptyArray, isAliasSymbolDeclaration2);
|
|
80538
80552
|
if (aliasDeclaration) {
|
|
80539
80553
|
addRelatedInfo(diag2, createDiagnosticForNode(aliasDeclaration, Diagnostics._0_was_imported_here, idText(rootName)));
|
|
@@ -80681,7 +80695,7 @@ function createTypeChecker(host) {
|
|
|
80681
80695
|
}
|
|
80682
80696
|
function checkJSDocTypeAliasTag(node) {
|
|
80683
80697
|
if (!node.typeExpression) {
|
|
80684
|
-
|
|
80698
|
+
error2(node.name, Diagnostics.JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags);
|
|
80685
80699
|
}
|
|
80686
80700
|
if (node.name) {
|
|
80687
80701
|
checkTypeNameIsReserved(node.name, Diagnostics.Type_alias_name_cannot_be_0);
|
|
@@ -80706,7 +80720,7 @@ function createTypeChecker(host) {
|
|
|
80706
80720
|
if (length(tags) > 1) {
|
|
80707
80721
|
for (let i = 1; i < length(tags); i++) {
|
|
80708
80722
|
const tagName = tags[i].tagName;
|
|
80709
|
-
|
|
80723
|
+
error2(tagName, Diagnostics._0_tag_already_specified, idText(tagName));
|
|
80710
80724
|
}
|
|
80711
80725
|
}
|
|
80712
80726
|
}
|
|
@@ -80738,33 +80752,33 @@ function createTypeChecker(host) {
|
|
|
80738
80752
|
function checkJSDocImplementsTag(node) {
|
|
80739
80753
|
const classLike = getEffectiveJSDocHost(node);
|
|
80740
80754
|
if (!classLike || !isClassDeclaration(classLike) && !isClassExpression(classLike)) {
|
|
80741
|
-
|
|
80755
|
+
error2(classLike, Diagnostics.JSDoc_0_is_not_attached_to_a_class, idText(node.tagName));
|
|
80742
80756
|
}
|
|
80743
80757
|
}
|
|
80744
80758
|
function checkJSDocAugmentsTag(node) {
|
|
80745
80759
|
const classLike = getEffectiveJSDocHost(node);
|
|
80746
80760
|
if (!classLike || !isClassDeclaration(classLike) && !isClassExpression(classLike)) {
|
|
80747
|
-
|
|
80761
|
+
error2(classLike, Diagnostics.JSDoc_0_is_not_attached_to_a_class, idText(node.tagName));
|
|
80748
80762
|
return;
|
|
80749
80763
|
}
|
|
80750
80764
|
const augmentsTags = getJSDocTags(classLike).filter(isJSDocAugmentsTag);
|
|
80751
80765
|
Debug.assert(augmentsTags.length > 0);
|
|
80752
80766
|
if (augmentsTags.length > 1) {
|
|
80753
|
-
|
|
80767
|
+
error2(augmentsTags[1], Diagnostics.Class_declarations_cannot_have_more_than_one_augments_or_extends_tag);
|
|
80754
80768
|
}
|
|
80755
80769
|
const name = getIdentifierFromEntityNameExpression(node.class.expression);
|
|
80756
80770
|
const extend2 = getClassExtendsHeritageElement(classLike);
|
|
80757
80771
|
if (extend2) {
|
|
80758
80772
|
const className = getIdentifierFromEntityNameExpression(extend2.expression);
|
|
80759
80773
|
if (className && name.escapedText !== className.escapedText) {
|
|
80760
|
-
|
|
80774
|
+
error2(name, Diagnostics.JSDoc_0_1_does_not_match_the_extends_2_clause, idText(node.tagName), idText(name), idText(className));
|
|
80761
80775
|
}
|
|
80762
80776
|
}
|
|
80763
80777
|
}
|
|
80764
80778
|
function checkJSDocAccessibilityModifiers(node) {
|
|
80765
80779
|
const host2 = getJSDocHost(node);
|
|
80766
80780
|
if (host2 && isPrivateIdentifierClassElementDeclaration(host2)) {
|
|
80767
|
-
|
|
80781
|
+
error2(node, Diagnostics.An_accessibility_modifier_cannot_be_used_with_a_private_identifier);
|
|
80768
80782
|
}
|
|
80769
80783
|
}
|
|
80770
80784
|
function getIdentifierFromEntityNameExpression(node) {
|
|
@@ -80806,7 +80820,7 @@ function createTypeChecker(host) {
|
|
|
80806
80820
|
if (isInJSFile(node)) {
|
|
80807
80821
|
const typeTag = getJSDocTypeTag(node);
|
|
80808
80822
|
if (typeTag && typeTag.typeExpression && !getContextualCallSignature(getTypeFromTypeNode(typeTag.typeExpression), node)) {
|
|
80809
|
-
|
|
80823
|
+
error2(typeTag.typeExpression.type, Diagnostics.The_type_of_a_function_declaration_must_match_the_function_s_signature);
|
|
80810
80824
|
}
|
|
80811
80825
|
}
|
|
80812
80826
|
function checkFunctionOrMethodDeclarationDiagnostics() {
|
|
@@ -81130,9 +81144,9 @@ function createTypeChecker(host) {
|
|
|
81130
81144
|
if (getNodeCheckFlags(current) & 4 /* CaptureThis */) {
|
|
81131
81145
|
const isDeclaration2 = node.kind !== 80 /* Identifier */;
|
|
81132
81146
|
if (isDeclaration2) {
|
|
81133
|
-
|
|
81147
|
+
error2(getNameOfDeclaration(node), Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference);
|
|
81134
81148
|
} else {
|
|
81135
|
-
|
|
81149
|
+
error2(node, Diagnostics.Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference);
|
|
81136
81150
|
}
|
|
81137
81151
|
return true;
|
|
81138
81152
|
}
|
|
@@ -81144,9 +81158,9 @@ function createTypeChecker(host) {
|
|
|
81144
81158
|
if (getNodeCheckFlags(current) & 8 /* CaptureNewTarget */) {
|
|
81145
81159
|
const isDeclaration2 = node.kind !== 80 /* Identifier */;
|
|
81146
81160
|
if (isDeclaration2) {
|
|
81147
|
-
|
|
81161
|
+
error2(getNameOfDeclaration(node), Diagnostics.Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference);
|
|
81148
81162
|
} else {
|
|
81149
|
-
|
|
81163
|
+
error2(node, Diagnostics.Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference);
|
|
81150
81164
|
}
|
|
81151
81165
|
return true;
|
|
81152
81166
|
}
|
|
@@ -81284,7 +81298,7 @@ function createTypeChecker(host) {
|
|
|
81284
81298
|
const namesShareScope = container && (container.kind === 240 /* Block */ && isFunctionLike(container.parent) || container.kind === 267 /* ModuleBlock */ || container.kind === 266 /* ModuleDeclaration */ || container.kind === 311 /* SourceFile */);
|
|
81285
81299
|
if (!namesShareScope) {
|
|
81286
81300
|
const name = symbolToString(localDeclarationSymbol);
|
|
81287
|
-
|
|
81301
|
+
error2(node, Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name);
|
|
81288
81302
|
}
|
|
81289
81303
|
}
|
|
81290
81304
|
}
|
|
@@ -81355,7 +81369,7 @@ function createTypeChecker(host) {
|
|
|
81355
81369
|
forEach(node.name.elements, checkSourceElement);
|
|
81356
81370
|
}
|
|
81357
81371
|
if (isParameter(node) && node.initializer && nodeIsMissing(getContainingFunction(node).body)) {
|
|
81358
|
-
|
|
81372
|
+
error2(node, Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation);
|
|
81359
81373
|
return;
|
|
81360
81374
|
}
|
|
81361
81375
|
if (isBindingPattern(node.name)) {
|
|
@@ -81407,7 +81421,7 @@ function createTypeChecker(host) {
|
|
|
81407
81421
|
}
|
|
81408
81422
|
if (symbol.declarations && symbol.declarations.length > 1) {
|
|
81409
81423
|
if (some(symbol.declarations, (d) => d !== node && isVariableLike(d) && !areDeclarationFlagsIdentical(d, node))) {
|
|
81410
|
-
|
|
81424
|
+
error2(node.name, Diagnostics.All_declarations_of_0_must_have_identical_modifiers, declarationNameToString(node.name));
|
|
81411
81425
|
}
|
|
81412
81426
|
}
|
|
81413
81427
|
} else {
|
|
@@ -81426,7 +81440,7 @@ function createTypeChecker(host) {
|
|
|
81426
81440
|
);
|
|
81427
81441
|
}
|
|
81428
81442
|
if (symbol.valueDeclaration && !areDeclarationFlagsIdentical(node, symbol.valueDeclaration)) {
|
|
81429
|
-
|
|
81443
|
+
error2(node.name, Diagnostics.All_declarations_of_0_must_have_identical_modifiers, declarationNameToString(node.name));
|
|
81430
81444
|
}
|
|
81431
81445
|
}
|
|
81432
81446
|
if (node.kind !== 171 /* PropertyDeclaration */ && node.kind !== 170 /* PropertySignature */) {
|
|
@@ -81441,7 +81455,7 @@ function createTypeChecker(host) {
|
|
|
81441
81455
|
const nextDeclarationName = getNameOfDeclaration(nextDeclaration);
|
|
81442
81456
|
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;
|
|
81443
81457
|
const declName = declarationNameToString(nextDeclarationName);
|
|
81444
|
-
const err =
|
|
81458
|
+
const err = error2(
|
|
81445
81459
|
nextDeclarationName,
|
|
81446
81460
|
message,
|
|
81447
81461
|
declName,
|
|
@@ -81491,7 +81505,7 @@ function createTypeChecker(host) {
|
|
|
81491
81505
|
checkTestingKnownTruthyCallableOrAwaitableType(node.expression, type, node.thenStatement);
|
|
81492
81506
|
checkSourceElement(node.thenStatement);
|
|
81493
81507
|
if (node.thenStatement.kind === 241 /* EmptyStatement */) {
|
|
81494
|
-
|
|
81508
|
+
error2(node.thenStatement, Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement);
|
|
81495
81509
|
}
|
|
81496
81510
|
checkSourceElement(node.elseStatement);
|
|
81497
81511
|
}
|
|
@@ -81541,7 +81555,7 @@ function createTypeChecker(host) {
|
|
|
81541
81555
|
getTypeNameForErrorDisplay(type)
|
|
81542
81556
|
);
|
|
81543
81557
|
} else {
|
|
81544
|
-
|
|
81558
|
+
error2(location, Diagnostics.This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_instead);
|
|
81545
81559
|
}
|
|
81546
81560
|
}
|
|
81547
81561
|
}
|
|
@@ -81607,7 +81621,7 @@ function createTypeChecker(host) {
|
|
|
81607
81621
|
}
|
|
81608
81622
|
function checkTruthinessOfType(type, node) {
|
|
81609
81623
|
if (type.flags & 16384 /* Void */) {
|
|
81610
|
-
|
|
81624
|
+
error2(node, Diagnostics.An_expression_of_type_void_cannot_be_tested_for_truthiness);
|
|
81611
81625
|
}
|
|
81612
81626
|
return type;
|
|
81613
81627
|
}
|
|
@@ -81681,16 +81695,16 @@ function createTypeChecker(host) {
|
|
|
81681
81695
|
if (node.initializer.kind === 260 /* VariableDeclarationList */) {
|
|
81682
81696
|
const variable = node.initializer.declarations[0];
|
|
81683
81697
|
if (variable && isBindingPattern(variable.name)) {
|
|
81684
|
-
|
|
81698
|
+
error2(variable.name, Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern);
|
|
81685
81699
|
}
|
|
81686
81700
|
checkForInOrForOfVariableDeclaration(node);
|
|
81687
81701
|
} else {
|
|
81688
81702
|
const varExpr = node.initializer;
|
|
81689
81703
|
const leftType = checkExpression(varExpr);
|
|
81690
81704
|
if (varExpr.kind === 208 /* ArrayLiteralExpression */ || varExpr.kind === 209 /* ObjectLiteralExpression */) {
|
|
81691
|
-
|
|
81705
|
+
error2(varExpr, Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern);
|
|
81692
81706
|
} else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) {
|
|
81693
|
-
|
|
81707
|
+
error2(varExpr, Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any);
|
|
81694
81708
|
} else {
|
|
81695
81709
|
checkReferenceExpression(
|
|
81696
81710
|
varExpr,
|
|
@@ -81700,7 +81714,7 @@ function createTypeChecker(host) {
|
|
|
81700
81714
|
}
|
|
81701
81715
|
}
|
|
81702
81716
|
if (rightType === neverType || !isTypeAssignableToKind(rightType, 67108864 /* NonPrimitive */ | 58982400 /* InstantiableNonPrimitive */)) {
|
|
81703
|
-
|
|
81717
|
+
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));
|
|
81704
81718
|
}
|
|
81705
81719
|
checkSourceElement(node.statement);
|
|
81706
81720
|
if (node.locals) {
|
|
@@ -81771,7 +81785,7 @@ function createTypeChecker(host) {
|
|
|
81771
81785
|
if (hasStringConstituent) {
|
|
81772
81786
|
if (languageVersion < 1 /* ES5 */) {
|
|
81773
81787
|
if (errorNode) {
|
|
81774
|
-
|
|
81788
|
+
error2(errorNode, Diagnostics.Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher);
|
|
81775
81789
|
reportedError = true;
|
|
81776
81790
|
}
|
|
81777
81791
|
}
|
|
@@ -82231,7 +82245,7 @@ function createTypeChecker(host) {
|
|
|
82231
82245
|
errorOutputContainer.errors ?? (errorOutputContainer.errors = []);
|
|
82232
82246
|
errorOutputContainer.errors.push(createDiagnosticForNode(errorNode, diagnostic, methodName));
|
|
82233
82247
|
} else {
|
|
82234
|
-
|
|
82248
|
+
error2(errorNode, diagnostic, methodName);
|
|
82235
82249
|
}
|
|
82236
82250
|
}
|
|
82237
82251
|
return methodName === "next" ? noIterationTypes : void 0;
|
|
@@ -82286,7 +82300,7 @@ function createTypeChecker(host) {
|
|
|
82286
82300
|
errorOutputContainer.errors ?? (errorOutputContainer.errors = []);
|
|
82287
82301
|
errorOutputContainer.errors.push(createDiagnosticForNode(errorNode, resolver.mustHaveAValueDiagnostic, methodName));
|
|
82288
82302
|
} else {
|
|
82289
|
-
|
|
82303
|
+
error2(errorNode, resolver.mustHaveAValueDiagnostic, methodName);
|
|
82290
82304
|
}
|
|
82291
82305
|
}
|
|
82292
82306
|
yieldType = anyType;
|
|
@@ -82372,11 +82386,11 @@ function createTypeChecker(host) {
|
|
|
82372
82386
|
const exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType;
|
|
82373
82387
|
if (container.kind === 177 /* SetAccessor */) {
|
|
82374
82388
|
if (node.expression) {
|
|
82375
|
-
|
|
82389
|
+
error2(node, Diagnostics.Setters_cannot_return_a_value);
|
|
82376
82390
|
}
|
|
82377
82391
|
} else if (container.kind === 175 /* Constructor */) {
|
|
82378
82392
|
if (node.expression && !checkTypeAssignableToAndOptionallyElaborate(exprType, returnType, node, node.expression)) {
|
|
82379
|
-
|
|
82393
|
+
error2(node, Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class);
|
|
82380
82394
|
}
|
|
82381
82395
|
} else if (getReturnTypeFromAnnotation(container)) {
|
|
82382
82396
|
const unwrappedReturnType = unwrapReturnType(returnType, functionFlags) ?? returnType;
|
|
@@ -82392,7 +82406,7 @@ function createTypeChecker(host) {
|
|
|
82392
82406
|
}
|
|
82393
82407
|
}
|
|
82394
82408
|
} else if (container.kind !== 175 /* Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeUndefinedVoidOrAny(container, returnType)) {
|
|
82395
|
-
|
|
82409
|
+
error2(node, Diagnostics.Not_all_code_paths_return_a_value);
|
|
82396
82410
|
}
|
|
82397
82411
|
}
|
|
82398
82412
|
function checkWithStatement(node) {
|
|
@@ -82428,7 +82442,7 @@ function createTypeChecker(host) {
|
|
|
82428
82442
|
}
|
|
82429
82443
|
forEach(clause.statements, checkSourceElement);
|
|
82430
82444
|
if (compilerOptions.noFallthroughCasesInSwitch && clause.fallthroughFlowNode && isReachableFlowNode(clause.fallthroughFlowNode)) {
|
|
82431
|
-
|
|
82445
|
+
error2(clause, Diagnostics.Fallthrough_case_in_switch);
|
|
82432
82446
|
}
|
|
82433
82447
|
function createLazyCaseClauseDiagnostics(clause2) {
|
|
82434
82448
|
return () => {
|
|
@@ -82578,7 +82592,7 @@ function createTypeChecker(host) {
|
|
|
82578
82592
|
const localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfDeclaration(info.declaration)) === type.symbol ? info.declaration : void 0;
|
|
82579
82593
|
const errorNode = localCheckDeclaration || localIndexDeclaration || (interfaceDeclaration && !some(getBaseTypes(type), (base) => !!getIndexInfoOfType(base, checkInfo.keyType) && !!getIndexTypeOfType(base, info.keyType)) ? interfaceDeclaration : void 0);
|
|
82580
82594
|
if (errorNode && !isTypeAssignableTo(checkInfo.type, info.type)) {
|
|
82581
|
-
|
|
82595
|
+
error2(
|
|
82582
82596
|
errorNode,
|
|
82583
82597
|
Diagnostics._0_index_type_1_is_not_assignable_to_2_index_type_3,
|
|
82584
82598
|
typeToString(checkInfo.keyType),
|
|
@@ -82601,12 +82615,12 @@ function createTypeChecker(host) {
|
|
|
82601
82615
|
case "symbol":
|
|
82602
82616
|
case "void":
|
|
82603
82617
|
case "object":
|
|
82604
|
-
|
|
82618
|
+
error2(name, message, name.escapedText);
|
|
82605
82619
|
}
|
|
82606
82620
|
}
|
|
82607
82621
|
function checkClassNameCollisionWithObject(name) {
|
|
82608
82622
|
if (languageVersion >= 1 /* ES5 */ && name.escapedText === "Object" && (moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(name).impliedNodeFormat === 1 /* CommonJS */)) {
|
|
82609
|
-
|
|
82623
|
+
error2(name, Diagnostics.Class_name_cannot_be_Object_when_targeting_ES5_with_module_0, ModuleKind[moduleKind]);
|
|
82610
82624
|
}
|
|
82611
82625
|
}
|
|
82612
82626
|
function checkUnmatchedJSDocParameters(node) {
|
|
@@ -82629,7 +82643,7 @@ function createTypeChecker(host) {
|
|
|
82629
82643
|
const lastJSDocParamIndex = jsdocParameters.length - 1;
|
|
82630
82644
|
const lastJSDocParam = jsdocParameters[lastJSDocParamIndex];
|
|
82631
82645
|
if (isJs && lastJSDocParam && isIdentifier(lastJSDocParam.name) && lastJSDocParam.typeExpression && lastJSDocParam.typeExpression.type && !parameters.has(lastJSDocParam.name.escapedText) && !excludedParameters.has(lastJSDocParamIndex) && !isArrayType(getTypeFromTypeNode(lastJSDocParam.typeExpression.type))) {
|
|
82632
|
-
|
|
82646
|
+
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));
|
|
82633
82647
|
}
|
|
82634
82648
|
} else {
|
|
82635
82649
|
forEach(jsdocParameters, ({ name, isNameFirst }, index) => {
|
|
@@ -82638,7 +82652,7 @@ function createTypeChecker(host) {
|
|
|
82638
82652
|
}
|
|
82639
82653
|
if (isQualifiedName(name)) {
|
|
82640
82654
|
if (isJs) {
|
|
82641
|
-
|
|
82655
|
+
error2(name, Diagnostics.Qualified_name_0_is_not_allowed_without_a_leading_param_object_1, entityNameToString(name), entityNameToString(name.left));
|
|
82642
82656
|
}
|
|
82643
82657
|
} else {
|
|
82644
82658
|
if (!isNameFirst) {
|
|
@@ -82663,11 +82677,11 @@ function createTypeChecker(host) {
|
|
|
82663
82677
|
seenDefault = true;
|
|
82664
82678
|
checkTypeParametersNotReferenced(node.default, typeParameterDeclarations, i);
|
|
82665
82679
|
} else if (seenDefault) {
|
|
82666
|
-
|
|
82680
|
+
error2(node, Diagnostics.Required_type_parameters_may_not_follow_optional_type_parameters);
|
|
82667
82681
|
}
|
|
82668
82682
|
for (let j = 0; j < i; j++) {
|
|
82669
82683
|
if (typeParameterDeclarations[j].symbol === node.symbol) {
|
|
82670
|
-
|
|
82684
|
+
error2(node.name, Diagnostics.Duplicate_identifier_0, declarationNameToString(node.name));
|
|
82671
82685
|
}
|
|
82672
82686
|
}
|
|
82673
82687
|
};
|
|
@@ -82681,7 +82695,7 @@ function createTypeChecker(host) {
|
|
|
82681
82695
|
if (type.flags & 262144 /* TypeParameter */) {
|
|
82682
82696
|
for (let i = index; i < typeParameters.length; i++) {
|
|
82683
82697
|
if (type.symbol === getSymbolOfDeclaration(typeParameters[i])) {
|
|
82684
|
-
|
|
82698
|
+
error2(node, Diagnostics.Type_parameter_defaults_can_only_reference_previously_declared_type_parameters);
|
|
82685
82699
|
}
|
|
82686
82700
|
}
|
|
82687
82701
|
}
|
|
@@ -82704,7 +82718,7 @@ function createTypeChecker(host) {
|
|
|
82704
82718
|
if (!areTypeParametersIdentical(declarations, type.localTypeParameters, getEffectiveTypeParameterDeclarations)) {
|
|
82705
82719
|
const name = symbolToString(symbol);
|
|
82706
82720
|
for (const declaration of declarations) {
|
|
82707
|
-
|
|
82721
|
+
error2(declaration.name, Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, name);
|
|
82708
82722
|
}
|
|
82709
82723
|
}
|
|
82710
82724
|
}
|
|
@@ -82875,18 +82889,18 @@ function createTypeChecker(host) {
|
|
|
82875
82889
|
}
|
|
82876
82890
|
if (baseConstructorType.flags & 8650752 /* TypeVariable */) {
|
|
82877
82891
|
if (!isMixinConstructorType(staticType)) {
|
|
82878
|
-
|
|
82892
|
+
error2(node.name || node, Diagnostics.A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any);
|
|
82879
82893
|
} else {
|
|
82880
82894
|
const constructSignatures = getSignaturesOfType(baseConstructorType, 1 /* Construct */);
|
|
82881
82895
|
if (constructSignatures.some((signature) => signature.flags & 4 /* Abstract */) && !hasSyntacticModifier(node, 256 /* Abstract */)) {
|
|
82882
|
-
|
|
82896
|
+
error2(node.name || node, Diagnostics.A_mixin_class_that_extends_from_a_type_variable_containing_an_abstract_construct_signature_must_also_be_declared_abstract);
|
|
82883
82897
|
}
|
|
82884
82898
|
}
|
|
82885
82899
|
}
|
|
82886
82900
|
if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32 /* Class */) && !(baseConstructorType.flags & 8650752 /* TypeVariable */)) {
|
|
82887
82901
|
const constructors = getInstantiatedConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments, baseTypeNode);
|
|
82888
82902
|
if (forEach(constructors, (sig) => !isJSConstructor(sig.declaration) && !isTypeIdenticalTo(getReturnTypeOfSignature(sig), baseType))) {
|
|
82889
|
-
|
|
82903
|
+
error2(baseTypeNode.expression, Diagnostics.Base_constructors_must_all_have_the_same_return_type);
|
|
82890
82904
|
}
|
|
82891
82905
|
}
|
|
82892
82906
|
checkKindsOfPropertyMemberOverrides(type, baseType);
|
|
@@ -82898,7 +82912,7 @@ function createTypeChecker(host) {
|
|
|
82898
82912
|
if (implementedTypeNodes) {
|
|
82899
82913
|
for (const typeRefNode of implementedTypeNodes) {
|
|
82900
82914
|
if (!isEntityNameExpression(typeRefNode.expression) || isOptionalChain(typeRefNode.expression)) {
|
|
82901
|
-
|
|
82915
|
+
error2(typeRefNode.expression, Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments);
|
|
82902
82916
|
}
|
|
82903
82917
|
checkTypeReferenceNode(typeRefNode);
|
|
82904
82918
|
addLazyDiagnostic(createImplementsDiagnostics(typeRefNode));
|
|
@@ -82931,7 +82945,7 @@ function createTypeChecker(host) {
|
|
|
82931
82945
|
issueMemberSpecificError(node, typeWithThis, baseWithThis, genericDiag);
|
|
82932
82946
|
}
|
|
82933
82947
|
} else {
|
|
82934
|
-
|
|
82948
|
+
error2(typeRefNode, Diagnostics.A_class_can_only_implement_an_object_type_or_intersection_of_object_types_with_statically_known_members);
|
|
82935
82949
|
}
|
|
82936
82950
|
}
|
|
82937
82951
|
};
|
|
@@ -83009,12 +83023,12 @@ function createTypeChecker(host) {
|
|
|
83009
83023
|
if (prop && !baseProp && memberHasOverrideModifier) {
|
|
83010
83024
|
if (errorNode) {
|
|
83011
83025
|
const suggestion = getSuggestedSymbolForNonexistentClassMember(memberName, baseType);
|
|
83012
|
-
suggestion ?
|
|
83026
|
+
suggestion ? error2(
|
|
83013
83027
|
errorNode,
|
|
83014
83028
|
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,
|
|
83015
83029
|
baseClassName,
|
|
83016
83030
|
symbolToString(suggestion)
|
|
83017
|
-
) :
|
|
83031
|
+
) : error2(
|
|
83018
83032
|
errorNode,
|
|
83019
83033
|
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,
|
|
83020
83034
|
baseClassName
|
|
@@ -83029,12 +83043,12 @@ function createTypeChecker(host) {
|
|
|
83029
83043
|
if (!baseHasAbstract) {
|
|
83030
83044
|
if (errorNode) {
|
|
83031
83045
|
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;
|
|
83032
|
-
|
|
83046
|
+
error2(errorNode, diag2, baseClassName);
|
|
83033
83047
|
}
|
|
83034
83048
|
return 1 /* NeedsOverride */;
|
|
83035
83049
|
} else if (memberHasAbstractModifier && baseHasAbstract) {
|
|
83036
83050
|
if (errorNode) {
|
|
83037
|
-
|
|
83051
|
+
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);
|
|
83038
83052
|
}
|
|
83039
83053
|
return 1 /* NeedsOverride */;
|
|
83040
83054
|
}
|
|
@@ -83042,7 +83056,7 @@ function createTypeChecker(host) {
|
|
|
83042
83056
|
} else if (memberHasOverrideModifier) {
|
|
83043
83057
|
if (errorNode) {
|
|
83044
83058
|
const className = typeToString(type);
|
|
83045
|
-
|
|
83059
|
+
error2(
|
|
83046
83060
|
errorNode,
|
|
83047
83061
|
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,
|
|
83048
83062
|
className
|
|
@@ -83095,7 +83109,7 @@ function createTypeChecker(host) {
|
|
|
83095
83109
|
if (declaration && hasEffectiveModifier(declaration, 8 /* Private */)) {
|
|
83096
83110
|
const typeClassDeclaration = getClassLikeDeclarationOfSymbol(type.symbol);
|
|
83097
83111
|
if (!isNodeWithinClass(node, typeClassDeclaration)) {
|
|
83098
|
-
|
|
83112
|
+
error2(node, Diagnostics.Cannot_extend_a_class_0_Class_constructor_is_marked_as_private, getFullyQualifiedName(type.symbol));
|
|
83099
83113
|
}
|
|
83100
83114
|
}
|
|
83101
83115
|
}
|
|
@@ -83164,7 +83178,7 @@ function createTypeChecker(host) {
|
|
|
83164
83178
|
}
|
|
83165
83179
|
}
|
|
83166
83180
|
if (!inheritedAbstractMemberNotImplementedError) {
|
|
83167
|
-
inheritedAbstractMemberNotImplementedError =
|
|
83181
|
+
inheritedAbstractMemberNotImplementedError = error2(
|
|
83168
83182
|
derivedClassDecl,
|
|
83169
83183
|
Diagnostics.Non_abstract_class_0_does_not_implement_all_abstract_members_of_1,
|
|
83170
83184
|
typeToString(type),
|
|
@@ -83210,7 +83224,7 @@ function createTypeChecker(host) {
|
|
|
83210
83224
|
const overriddenInstanceAccessor = basePropertyFlags === 4 /* Property */ && derivedPropertyFlags !== 4 /* Property */;
|
|
83211
83225
|
if (overriddenInstanceProperty || overriddenInstanceAccessor) {
|
|
83212
83226
|
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;
|
|
83213
|
-
|
|
83227
|
+
error2(getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage2, symbolToString(base), typeToString(baseType), typeToString(type));
|
|
83214
83228
|
} else if (useDefineForClassFields) {
|
|
83215
83229
|
const uninitialized = (_c = derived.declarations) == null ? void 0 : _c.find((d) => d.kind === 171 /* PropertyDeclaration */ && !d.initializer);
|
|
83216
83230
|
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 */)))) {
|
|
@@ -83218,7 +83232,7 @@ function createTypeChecker(host) {
|
|
|
83218
83232
|
const propName = uninitialized.name;
|
|
83219
83233
|
if (uninitialized.exclamationToken || !constructor || !isIdentifier(propName) || !strictNullChecks || !isPropertyInitializedInConstructor(propName, type, constructor)) {
|
|
83220
83234
|
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;
|
|
83221
|
-
|
|
83235
|
+
error2(getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage2, symbolToString(base), typeToString(baseType));
|
|
83222
83236
|
}
|
|
83223
83237
|
}
|
|
83224
83238
|
}
|
|
@@ -83235,7 +83249,7 @@ function createTypeChecker(host) {
|
|
|
83235
83249
|
} else {
|
|
83236
83250
|
errorMessage = Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function;
|
|
83237
83251
|
}
|
|
83238
|
-
|
|
83252
|
+
error2(getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type));
|
|
83239
83253
|
}
|
|
83240
83254
|
}
|
|
83241
83255
|
}
|
|
@@ -83314,7 +83328,7 @@ function createTypeChecker(host) {
|
|
|
83314
83328
|
const type = getTypeOfSymbol(getSymbolOfDeclaration(member));
|
|
83315
83329
|
if (!(type.flags & 3 /* AnyOrUnknown */ || containsUndefinedType(type))) {
|
|
83316
83330
|
if (!constructor || !isPropertyInitializedInConstructor(propName, type, constructor)) {
|
|
83317
|
-
|
|
83331
|
+
error2(member.name, Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor, declarationNameToString(propName));
|
|
83318
83332
|
}
|
|
83319
83333
|
}
|
|
83320
83334
|
}
|
|
@@ -83371,7 +83385,7 @@ function createTypeChecker(host) {
|
|
|
83371
83385
|
});
|
|
83372
83386
|
forEach(getInterfaceBaseTypeNodes(node), (heritageElement) => {
|
|
83373
83387
|
if (!isEntityNameExpression(heritageElement.expression) || isOptionalChain(heritageElement.expression)) {
|
|
83374
|
-
|
|
83388
|
+
error2(heritageElement.expression, Diagnostics.An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments);
|
|
83375
83389
|
}
|
|
83376
83390
|
checkTypeReferenceNode(heritageElement);
|
|
83377
83391
|
});
|
|
@@ -83388,7 +83402,7 @@ function createTypeChecker(host) {
|
|
|
83388
83402
|
checkTypeParameters(node.typeParameters);
|
|
83389
83403
|
if (node.type.kind === 141 /* IntrinsicKeyword */) {
|
|
83390
83404
|
if (!intrinsicTypeKinds.has(node.name.escapedText) || length(node.typeParameters) !== 1) {
|
|
83391
|
-
|
|
83405
|
+
error2(node.type, Diagnostics.The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types);
|
|
83392
83406
|
}
|
|
83393
83407
|
} else {
|
|
83394
83408
|
checkSourceElement(node.type);
|
|
@@ -83409,11 +83423,11 @@ function createTypeChecker(host) {
|
|
|
83409
83423
|
}
|
|
83410
83424
|
function computeMemberValue(member, autoValue) {
|
|
83411
83425
|
if (isComputedNonLiteralName(member.name)) {
|
|
83412
|
-
|
|
83426
|
+
error2(member.name, Diagnostics.Computed_property_names_are_not_allowed_in_enums);
|
|
83413
83427
|
} else {
|
|
83414
83428
|
const text = getTextOfPropertyName(member.name);
|
|
83415
83429
|
if (isNumericLiteralName(text) && !isInfinityOrNaNString(text)) {
|
|
83416
|
-
|
|
83430
|
+
error2(member.name, Diagnostics.An_enum_member_cannot_have_a_numeric_name);
|
|
83417
83431
|
}
|
|
83418
83432
|
}
|
|
83419
83433
|
if (member.initializer) {
|
|
@@ -83425,7 +83439,7 @@ function createTypeChecker(host) {
|
|
|
83425
83439
|
if (autoValue !== void 0) {
|
|
83426
83440
|
return autoValue;
|
|
83427
83441
|
}
|
|
83428
|
-
|
|
83442
|
+
error2(member.name, Diagnostics.Enum_member_must_have_initializer);
|
|
83429
83443
|
return void 0;
|
|
83430
83444
|
}
|
|
83431
83445
|
function computeConstantValue(member) {
|
|
@@ -83434,12 +83448,12 @@ function createTypeChecker(host) {
|
|
|
83434
83448
|
const value = evaluate(initializer, member);
|
|
83435
83449
|
if (value !== void 0) {
|
|
83436
83450
|
if (isConstEnum && typeof value === "number" && !isFinite(value)) {
|
|
83437
|
-
|
|
83451
|
+
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);
|
|
83438
83452
|
}
|
|
83439
83453
|
} else if (isConstEnum) {
|
|
83440
|
-
|
|
83454
|
+
error2(initializer, Diagnostics.const_enum_member_initializers_must_be_constant_expressions);
|
|
83441
83455
|
} else if (member.parent.flags & 16777216 /* Ambient */) {
|
|
83442
|
-
|
|
83456
|
+
error2(initializer, Diagnostics.In_ambient_enum_declarations_member_initializer_must_be_constant_expression);
|
|
83443
83457
|
} else {
|
|
83444
83458
|
checkTypeAssignableTo(checkExpression(initializer), numberType, initializer, Diagnostics.Type_0_is_not_assignable_to_type_1_as_required_for_computed_enum_member_values);
|
|
83445
83459
|
}
|
|
@@ -83553,11 +83567,11 @@ function createTypeChecker(host) {
|
|
|
83553
83567
|
function evaluateEnumMember(expr, symbol, location) {
|
|
83554
83568
|
const declaration = symbol.valueDeclaration;
|
|
83555
83569
|
if (!declaration || declaration === location) {
|
|
83556
|
-
|
|
83570
|
+
error2(expr, Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(symbol));
|
|
83557
83571
|
return void 0;
|
|
83558
83572
|
}
|
|
83559
83573
|
if (!isBlockScopedNameDeclaredBeforeUse(declaration, location)) {
|
|
83560
|
-
|
|
83574
|
+
error2(expr, Diagnostics.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums);
|
|
83561
83575
|
return 0;
|
|
83562
83576
|
}
|
|
83563
83577
|
return getEnumMemberValue(declaration);
|
|
@@ -83590,7 +83604,7 @@ function createTypeChecker(host) {
|
|
|
83590
83604
|
const enumIsConst = isEnumConst(node);
|
|
83591
83605
|
forEach(enumSymbol.declarations, (decl) => {
|
|
83592
83606
|
if (isEnumDeclaration(decl) && isEnumConst(decl) !== enumIsConst) {
|
|
83593
|
-
|
|
83607
|
+
error2(getNameOfDeclaration(decl), Diagnostics.Enum_declarations_must_all_be_const_or_non_const);
|
|
83594
83608
|
}
|
|
83595
83609
|
});
|
|
83596
83610
|
}
|
|
@@ -83606,7 +83620,7 @@ function createTypeChecker(host) {
|
|
|
83606
83620
|
const firstEnumMember = enumDeclaration.members[0];
|
|
83607
83621
|
if (!firstEnumMember.initializer) {
|
|
83608
83622
|
if (seenEnumMissingInitialInitializer) {
|
|
83609
|
-
|
|
83623
|
+
error2(firstEnumMember.name, Diagnostics.In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element);
|
|
83610
83624
|
} else {
|
|
83611
83625
|
seenEnumMissingInitialInitializer = true;
|
|
83612
83626
|
}
|
|
@@ -83616,7 +83630,7 @@ function createTypeChecker(host) {
|
|
|
83616
83630
|
}
|
|
83617
83631
|
function checkEnumMember(node) {
|
|
83618
83632
|
if (isPrivateIdentifier(node.name)) {
|
|
83619
|
-
|
|
83633
|
+
error2(node, Diagnostics.An_enum_member_cannot_be_named_with_a_private_identifier);
|
|
83620
83634
|
}
|
|
83621
83635
|
if (node.initializer) {
|
|
83622
83636
|
checkExpression(node.initializer);
|
|
@@ -83657,7 +83671,7 @@ function createTypeChecker(host) {
|
|
|
83657
83671
|
const isGlobalAugmentation = isGlobalScopeAugmentation(node);
|
|
83658
83672
|
const inAmbientContext = node.flags & 16777216 /* Ambient */;
|
|
83659
83673
|
if (isGlobalAugmentation && !inAmbientContext) {
|
|
83660
|
-
|
|
83674
|
+
error2(node.name, Diagnostics.Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context);
|
|
83661
83675
|
}
|
|
83662
83676
|
const isAmbientExternalModule = isAmbientModule(node);
|
|
83663
83677
|
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;
|
|
@@ -83676,15 +83690,15 @@ function createTypeChecker(host) {
|
|
|
83676
83690
|
const symbol = getSymbolOfDeclaration(node);
|
|
83677
83691
|
if (symbol.flags & 512 /* ValueModule */ && !inAmbientContext && isInstantiatedModule(node, shouldPreserveConstEnums(compilerOptions))) {
|
|
83678
83692
|
if (getIsolatedModules(compilerOptions) && !getSourceFileOfNode(node).externalModuleIndicator) {
|
|
83679
|
-
|
|
83693
|
+
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);
|
|
83680
83694
|
}
|
|
83681
83695
|
if (((_a = symbol.declarations) == null ? void 0 : _a.length) > 1) {
|
|
83682
83696
|
const firstNonAmbientClassOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol);
|
|
83683
83697
|
if (firstNonAmbientClassOrFunc) {
|
|
83684
83698
|
if (getSourceFileOfNode(node) !== getSourceFileOfNode(firstNonAmbientClassOrFunc)) {
|
|
83685
|
-
|
|
83699
|
+
error2(node.name, Diagnostics.A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged);
|
|
83686
83700
|
} else if (node.pos < firstNonAmbientClassOrFunc.pos) {
|
|
83687
|
-
|
|
83701
|
+
error2(node.name, Diagnostics.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged);
|
|
83688
83702
|
}
|
|
83689
83703
|
}
|
|
83690
83704
|
const mergedClass = getDeclarationOfKind(symbol, 262 /* ClassDeclaration */);
|
|
@@ -83695,7 +83709,7 @@ function createTypeChecker(host) {
|
|
|
83695
83709
|
if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 311 /* SourceFile */ && (moduleKind === 1 /* CommonJS */ || node.parent.impliedNodeFormat === 1 /* CommonJS */)) {
|
|
83696
83710
|
const exportModifier = (_b = node.modifiers) == null ? void 0 : _b.find((m) => m.kind === 95 /* ExportKeyword */);
|
|
83697
83711
|
if (exportModifier) {
|
|
83698
|
-
|
|
83712
|
+
error2(exportModifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
|
83699
83713
|
}
|
|
83700
83714
|
}
|
|
83701
83715
|
}
|
|
@@ -83709,15 +83723,15 @@ function createTypeChecker(host) {
|
|
|
83709
83723
|
}
|
|
83710
83724
|
} else if (isGlobalSourceFile(node.parent)) {
|
|
83711
83725
|
if (isGlobalAugmentation) {
|
|
83712
|
-
|
|
83726
|
+
error2(node.name, Diagnostics.Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations);
|
|
83713
83727
|
} else if (isExternalModuleNameRelative(getTextOfIdentifierOrLiteral(node.name))) {
|
|
83714
|
-
|
|
83728
|
+
error2(node.name, Diagnostics.Ambient_module_declaration_cannot_specify_relative_module_name);
|
|
83715
83729
|
}
|
|
83716
83730
|
} else {
|
|
83717
83731
|
if (isGlobalAugmentation) {
|
|
83718
|
-
|
|
83732
|
+
error2(node.name, Diagnostics.Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations);
|
|
83719
83733
|
} else {
|
|
83720
|
-
|
|
83734
|
+
error2(node.name, Diagnostics.Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces);
|
|
83721
83735
|
}
|
|
83722
83736
|
}
|
|
83723
83737
|
}
|
|
@@ -83784,17 +83798,17 @@ function createTypeChecker(host) {
|
|
|
83784
83798
|
return false;
|
|
83785
83799
|
}
|
|
83786
83800
|
if (!isStringLiteral(moduleName)) {
|
|
83787
|
-
|
|
83801
|
+
error2(moduleName, Diagnostics.String_literal_expected);
|
|
83788
83802
|
return false;
|
|
83789
83803
|
}
|
|
83790
83804
|
const inAmbientExternalModule = node.parent.kind === 267 /* ModuleBlock */ && isAmbientModule(node.parent.parent);
|
|
83791
83805
|
if (node.parent.kind !== 311 /* SourceFile */ && !inAmbientExternalModule) {
|
|
83792
|
-
|
|
83806
|
+
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);
|
|
83793
83807
|
return false;
|
|
83794
83808
|
}
|
|
83795
83809
|
if (inAmbientExternalModule && isExternalModuleNameRelative(moduleName.text)) {
|
|
83796
83810
|
if (!isTopLevelInExternalModuleAugmentation(node)) {
|
|
83797
|
-
|
|
83811
|
+
error2(node, Diagnostics.Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name);
|
|
83798
83812
|
return false;
|
|
83799
83813
|
}
|
|
83800
83814
|
}
|
|
@@ -83803,7 +83817,7 @@ function createTypeChecker(host) {
|
|
|
83803
83817
|
for (const clause of node.assertClause.elements) {
|
|
83804
83818
|
if (!isStringLiteral(clause.value)) {
|
|
83805
83819
|
hasError = true;
|
|
83806
|
-
|
|
83820
|
+
error2(clause.value, Diagnostics.Import_assertion_values_must_be_string_literal_expressions);
|
|
83807
83821
|
}
|
|
83808
83822
|
}
|
|
83809
83823
|
return !hasError;
|
|
@@ -83820,7 +83834,7 @@ function createTypeChecker(host) {
|
|
|
83820
83834
|
const errorNode = isImportOrExportSpecifier(node) ? node.propertyName || node.name : isNamedDeclaration(node) ? node.name : node;
|
|
83821
83835
|
Debug.assert(node.kind !== 279 /* NamespaceExport */);
|
|
83822
83836
|
if (node.kind === 280 /* ExportSpecifier */) {
|
|
83823
|
-
const diag2 =
|
|
83837
|
+
const diag2 = error2(errorNode, Diagnostics.Types_cannot_appear_in_export_declarations_in_JavaScript_files);
|
|
83824
83838
|
const alreadyExportedSymbol = (_b = (_a = getSourceFileOfNode(node).symbol) == null ? void 0 : _a.exports) == null ? void 0 : _b.get((node.propertyName || node.name).escapedText);
|
|
83825
83839
|
if (alreadyExportedSymbol === target) {
|
|
83826
83840
|
const exportingDeclaration = (_c = alreadyExportedSymbol.declarations) == null ? void 0 : _c.find(isJSDocNode);
|
|
@@ -83837,7 +83851,7 @@ function createTypeChecker(host) {
|
|
|
83837
83851
|
const importDeclaration = findAncestor(node, or(isImportDeclaration, isImportEqualsDeclaration));
|
|
83838
83852
|
const moduleSpecifier = (importDeclaration && ((_d = tryGetModuleSpecifierFromDeclaration(importDeclaration)) == null ? void 0 : _d.text)) ?? "...";
|
|
83839
83853
|
const importedIdentifier = unescapeLeadingUnderscores(isIdentifier(errorNode) ? errorNode.escapedText : symbol.escapedName);
|
|
83840
|
-
|
|
83854
|
+
error2(
|
|
83841
83855
|
errorNode,
|
|
83842
83856
|
Diagnostics._0_is_a_type_and_cannot_be_imported_in_JavaScript_files_Use_1_in_a_JSDoc_type_annotation,
|
|
83843
83857
|
importedIdentifier,
|
|
@@ -83850,7 +83864,7 @@ function createTypeChecker(host) {
|
|
|
83850
83864
|
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);
|
|
83851
83865
|
if (targetFlags & excludedMeanings) {
|
|
83852
83866
|
const message = node.kind === 280 /* ExportSpecifier */ ? Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0;
|
|
83853
|
-
|
|
83867
|
+
error2(node, message, symbolToString(symbol));
|
|
83854
83868
|
}
|
|
83855
83869
|
if (getIsolatedModules(compilerOptions) && !isTypeOnlyImportOrExportDeclaration(node) && !(node.flags & 16777216 /* Ambient */)) {
|
|
83856
83870
|
const typeOnlyAlias = getTypeOnlyAliasDeclaration(symbol);
|
|
@@ -83865,20 +83879,20 @@ function createTypeChecker(host) {
|
|
|
83865
83879
|
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;
|
|
83866
83880
|
const name = idText(node.kind === 275 /* ImportSpecifier */ ? node.propertyName || node.name : node.name);
|
|
83867
83881
|
addTypeOnlyDeclarationRelatedInfo(
|
|
83868
|
-
|
|
83882
|
+
error2(node, message, name),
|
|
83869
83883
|
isType ? void 0 : typeOnlyAlias,
|
|
83870
83884
|
name
|
|
83871
83885
|
);
|
|
83872
83886
|
}
|
|
83873
83887
|
if (isType && node.kind === 270 /* ImportEqualsDeclaration */ && hasEffectiveModifier(node, 1 /* Export */)) {
|
|
83874
|
-
|
|
83888
|
+
error2(node, Diagnostics.Cannot_use_export_import_on_a_type_or_type_only_namespace_when_0_is_enabled, isolatedModulesLikeFlagName);
|
|
83875
83889
|
}
|
|
83876
83890
|
break;
|
|
83877
83891
|
}
|
|
83878
83892
|
case 280 /* ExportSpecifier */: {
|
|
83879
83893
|
if (compilerOptions.verbatimModuleSyntax || getSourceFileOfNode(typeOnlyAlias) !== getSourceFileOfNode(node)) {
|
|
83880
83894
|
const name = idText(node.propertyName || node.name);
|
|
83881
|
-
const diagnostic = isType ?
|
|
83895
|
+
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);
|
|
83882
83896
|
addTypeOnlyDeclarationRelatedInfo(diagnostic, isType ? void 0 : typeOnlyAlias, name);
|
|
83883
83897
|
break;
|
|
83884
83898
|
}
|
|
@@ -83886,7 +83900,7 @@ function createTypeChecker(host) {
|
|
|
83886
83900
|
}
|
|
83887
83901
|
}
|
|
83888
83902
|
if (compilerOptions.verbatimModuleSyntax && node.kind !== 270 /* ImportEqualsDeclaration */ && !isInJSFile(node) && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) {
|
|
83889
|
-
|
|
83903
|
+
error2(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
|
83890
83904
|
}
|
|
83891
83905
|
}
|
|
83892
83906
|
if (isImportSpecifier(node)) {
|
|
@@ -84008,7 +84022,7 @@ function createTypeChecker(host) {
|
|
|
84008
84022
|
if (targetFlags & 111551 /* Value */) {
|
|
84009
84023
|
const moduleName = getFirstIdentifier(node.moduleReference);
|
|
84010
84024
|
if (!(resolveEntityName(moduleName, 111551 /* Value */ | 1920 /* Namespace */).flags & 1920 /* Namespace */)) {
|
|
84011
|
-
|
|
84025
|
+
error2(moduleName, Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name, declarationNameToString(moduleName));
|
|
84012
84026
|
}
|
|
84013
84027
|
}
|
|
84014
84028
|
if (targetFlags & 788968 /* Type */) {
|
|
@@ -84042,12 +84056,12 @@ function createTypeChecker(host) {
|
|
|
84042
84056
|
const inAmbientExternalModule = node.parent.kind === 267 /* ModuleBlock */ && isAmbientModule(node.parent.parent);
|
|
84043
84057
|
const inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 267 /* ModuleBlock */ && !node.moduleSpecifier && node.flags & 16777216 /* Ambient */;
|
|
84044
84058
|
if (node.parent.kind !== 311 /* SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) {
|
|
84045
|
-
|
|
84059
|
+
error2(node, Diagnostics.Export_declarations_are_not_permitted_in_a_namespace);
|
|
84046
84060
|
}
|
|
84047
84061
|
} else {
|
|
84048
84062
|
const moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier);
|
|
84049
84063
|
if (moduleSymbol && hasExportAssignmentSymbol(moduleSymbol)) {
|
|
84050
|
-
|
|
84064
|
+
error2(node.moduleSpecifier, Diagnostics.Module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol));
|
|
84051
84065
|
} else if (node.exportClause) {
|
|
84052
84066
|
checkAliasSymbol(node.exportClause);
|
|
84053
84067
|
}
|
|
@@ -84108,7 +84122,7 @@ function createTypeChecker(host) {
|
|
|
84108
84122
|
}
|
|
84109
84123
|
for (const statement of sourceFile.statements) {
|
|
84110
84124
|
if (canConvertImportDeclarationToTypeOnly(statement) || canConvertImportEqualsDeclarationToTypeOnly(statement)) {
|
|
84111
|
-
|
|
84125
|
+
error2(
|
|
84112
84126
|
statement,
|
|
84113
84127
|
Diagnostics.This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error
|
|
84114
84128
|
);
|
|
@@ -84138,7 +84152,7 @@ function createTypeChecker(host) {
|
|
|
84138
84152
|
true
|
|
84139
84153
|
);
|
|
84140
84154
|
if (symbol && (symbol === undefinedSymbol || symbol === globalThisSymbol || symbol.declarations && isGlobalSourceFile(getDeclarationContainer(symbol.declarations[0])))) {
|
|
84141
|
-
|
|
84155
|
+
error2(exportedName, Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, idText(exportedName));
|
|
84142
84156
|
} else {
|
|
84143
84157
|
if (!node.isTypeOnly && !node.parent.parent.isTypeOnly) {
|
|
84144
84158
|
markExportAsReferenced(node);
|
|
@@ -84162,9 +84176,9 @@ function createTypeChecker(host) {
|
|
|
84162
84176
|
const container = node.parent.kind === 311 /* SourceFile */ ? node.parent : node.parent.parent;
|
|
84163
84177
|
if (container.kind === 266 /* ModuleDeclaration */ && !isAmbientModule(container)) {
|
|
84164
84178
|
if (node.isExportEquals) {
|
|
84165
|
-
|
|
84179
|
+
error2(node, Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace);
|
|
84166
84180
|
} else {
|
|
84167
|
-
|
|
84181
|
+
error2(node, Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module);
|
|
84168
84182
|
}
|
|
84169
84183
|
return;
|
|
84170
84184
|
}
|
|
@@ -84192,14 +84206,14 @@ function createTypeChecker(host) {
|
|
|
84192
84206
|
if (getAllSymbolFlags(sym) & 111551 /* Value */) {
|
|
84193
84207
|
checkExpressionCached(id);
|
|
84194
84208
|
if (!isIllegalExportDefaultInCJS && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax && getTypeOnlyAliasDeclaration(sym, 111551 /* Value */)) {
|
|
84195
|
-
|
|
84209
|
+
error2(
|
|
84196
84210
|
id,
|
|
84197
84211
|
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,
|
|
84198
84212
|
idText(id)
|
|
84199
84213
|
);
|
|
84200
84214
|
}
|
|
84201
84215
|
} else if (!isIllegalExportDefaultInCJS && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax) {
|
|
84202
|
-
|
|
84216
|
+
error2(
|
|
84203
84217
|
id,
|
|
84204
84218
|
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,
|
|
84205
84219
|
idText(id)
|
|
@@ -84219,7 +84233,7 @@ function createTypeChecker(host) {
|
|
|
84219
84233
|
checkExpressionCached(node.expression);
|
|
84220
84234
|
}
|
|
84221
84235
|
if (isIllegalExportDefaultInCJS) {
|
|
84222
|
-
|
|
84236
|
+
error2(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
|
84223
84237
|
}
|
|
84224
84238
|
checkExternalModuleExports(container);
|
|
84225
84239
|
if (node.flags & 16777216 /* Ambient */ && !isEntityNameExpression(node.expression)) {
|
|
@@ -84244,7 +84258,7 @@ function createTypeChecker(host) {
|
|
|
84244
84258
|
if (exportEqualsSymbol && hasExportedMembers(moduleSymbol)) {
|
|
84245
84259
|
const declaration = getDeclarationOfAliasSymbol(exportEqualsSymbol) || exportEqualsSymbol.valueDeclaration;
|
|
84246
84260
|
if (declaration && !isTopLevelInExternalModuleAugmentation(declaration) && !isInJSFile(declaration)) {
|
|
84247
|
-
|
|
84261
|
+
error2(declaration, Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements);
|
|
84248
84262
|
}
|
|
84249
84263
|
}
|
|
84250
84264
|
const exports = getExportsOfModule(moduleSymbol);
|
|
@@ -84510,16 +84524,16 @@ function createTypeChecker(host) {
|
|
|
84510
84524
|
const { parent: parent2 } = node;
|
|
84511
84525
|
if (isParameter(parent2) && isJSDocFunctionType(parent2.parent)) {
|
|
84512
84526
|
if (last(parent2.parent.parameters) !== parent2) {
|
|
84513
|
-
|
|
84527
|
+
error2(node, Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list);
|
|
84514
84528
|
}
|
|
84515
84529
|
return;
|
|
84516
84530
|
}
|
|
84517
84531
|
if (!isJSDocTypeExpression(parent2)) {
|
|
84518
|
-
|
|
84532
|
+
error2(node, Diagnostics.JSDoc_may_only_appear_in_the_last_parameter_of_a_signature);
|
|
84519
84533
|
}
|
|
84520
84534
|
const paramTag = node.parent.parent;
|
|
84521
84535
|
if (!isJSDocParameterTag(paramTag)) {
|
|
84522
|
-
|
|
84536
|
+
error2(node, Diagnostics.JSDoc_may_only_appear_in_the_last_parameter_of_a_signature);
|
|
84523
84537
|
return;
|
|
84524
84538
|
}
|
|
84525
84539
|
const param = getParameterSymbolFromJSDoc(paramTag);
|
|
@@ -84528,7 +84542,7 @@ function createTypeChecker(host) {
|
|
|
84528
84542
|
}
|
|
84529
84543
|
const host2 = getHostSignatureFromJSDoc(paramTag);
|
|
84530
84544
|
if (!host2 || last(host2.parameters).symbol !== param) {
|
|
84531
|
-
|
|
84545
|
+
error2(node, Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list);
|
|
84532
84546
|
}
|
|
84533
84547
|
}
|
|
84534
84548
|
function getTypeFromJSDocVariadicType(node) {
|
|
@@ -86365,18 +86379,18 @@ function createTypeChecker(host) {
|
|
|
86365
86379
|
requestedExternalEmitHelperNames.add(name);
|
|
86366
86380
|
const symbol = resolveSymbol(getSymbol2(getExportsOfModule(helpersModule), escapeLeadingUnderscores(name), 111551 /* Value */));
|
|
86367
86381
|
if (!symbol) {
|
|
86368
|
-
|
|
86382
|
+
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);
|
|
86369
86383
|
} else if (helper & 524288 /* ClassPrivateFieldGet */) {
|
|
86370
86384
|
if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 3)) {
|
|
86371
|
-
|
|
86385
|
+
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);
|
|
86372
86386
|
}
|
|
86373
86387
|
} else if (helper & 1048576 /* ClassPrivateFieldSet */) {
|
|
86374
86388
|
if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 4)) {
|
|
86375
|
-
|
|
86389
|
+
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);
|
|
86376
86390
|
}
|
|
86377
86391
|
} else if (helper & 1024 /* SpreadArray */) {
|
|
86378
86392
|
if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 2)) {
|
|
86379
|
-
|
|
86393
|
+
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);
|
|
86380
86394
|
}
|
|
86381
86395
|
}
|
|
86382
86396
|
}
|
|
@@ -86483,7 +86497,7 @@ function createTypeChecker(host) {
|
|
|
86483
86497
|
const sourceFile = getSourceFileOfNode(modifier);
|
|
86484
86498
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
86485
86499
|
addRelatedInfo(
|
|
86486
|
-
|
|
86500
|
+
error2(modifier, Diagnostics.Decorators_may_not_appear_after_export_or_export_default_if_they_also_appear_before_export),
|
|
86487
86501
|
createDiagnosticForNode(firstDecorator, Diagnostics.Decorator_used_before_export_here)
|
|
86488
86502
|
);
|
|
86489
86503
|
return true;
|
|
@@ -86876,12 +86890,12 @@ function createTypeChecker(host) {
|
|
|
86876
86890
|
if (length(nonSimpleParameters)) {
|
|
86877
86891
|
forEach(nonSimpleParameters, (parameter) => {
|
|
86878
86892
|
addRelatedInfo(
|
|
86879
|
-
|
|
86893
|
+
error2(parameter, Diagnostics.This_parameter_is_not_allowed_with_use_strict_directive),
|
|
86880
86894
|
createDiagnosticForNode(useStrictDirective, Diagnostics.use_strict_directive_used_here)
|
|
86881
86895
|
);
|
|
86882
86896
|
});
|
|
86883
86897
|
const diagnostics2 = nonSimpleParameters.map((parameter, index) => index === 0 ? createDiagnosticForNode(parameter, Diagnostics.Non_simple_parameter_declared_here) : createDiagnosticForNode(parameter, Diagnostics.and_here));
|
|
86884
|
-
addRelatedInfo(
|
|
86898
|
+
addRelatedInfo(error2(useStrictDirective, Diagnostics.use_strict_directive_cannot_be_used_with_non_simple_parameter_list), ...diagnostics2);
|
|
86885
86899
|
return true;
|
|
86886
86900
|
}
|
|
86887
86901
|
}
|
|
@@ -89649,13 +89663,13 @@ function decodeMappings(mappings) {
|
|
|
89649
89663
|
let sourceLine = 0;
|
|
89650
89664
|
let sourceCharacter = 0;
|
|
89651
89665
|
let nameIndex = 0;
|
|
89652
|
-
let
|
|
89666
|
+
let error2;
|
|
89653
89667
|
return {
|
|
89654
89668
|
get pos() {
|
|
89655
89669
|
return pos;
|
|
89656
89670
|
},
|
|
89657
89671
|
get error() {
|
|
89658
|
-
return
|
|
89672
|
+
return error2;
|
|
89659
89673
|
},
|
|
89660
89674
|
get state() {
|
|
89661
89675
|
return captureMapping(
|
|
@@ -89740,8 +89754,8 @@ function decodeMappings(mappings) {
|
|
|
89740
89754
|
return { value: void 0, done: true };
|
|
89741
89755
|
}
|
|
89742
89756
|
function setError(message) {
|
|
89743
|
-
if (
|
|
89744
|
-
|
|
89757
|
+
if (error2 === void 0) {
|
|
89758
|
+
error2 = message;
|
|
89745
89759
|
}
|
|
89746
89760
|
}
|
|
89747
89761
|
function setErrorAndStopIterating(message) {
|
|
@@ -89749,7 +89763,7 @@ function decodeMappings(mappings) {
|
|
|
89749
89763
|
return stopIterating();
|
|
89750
89764
|
}
|
|
89751
89765
|
function hasReportedError() {
|
|
89752
|
-
return
|
|
89766
|
+
return error2 !== void 0;
|
|
89753
89767
|
}
|
|
89754
89768
|
function isSourceMappingSegmentEnd() {
|
|
89755
89769
|
return pos === mappings.length || mappings.charCodeAt(pos) === 44 /* comma */ || mappings.charCodeAt(pos) === 59 /* semicolon */;
|
|
@@ -111987,15 +112001,6 @@ function getOutputDeclarationFileName(inputFileName, configFile, ignoreCase, get
|
|
|
111987
112001
|
getDeclarationEmitExtensionForPath(inputFileName)
|
|
111988
112002
|
);
|
|
111989
112003
|
}
|
|
111990
|
-
function getOutputDeclarationFileNameWithoutConfigFile(inputFileName, options, ignoreCase, currentDirectory, getCommonSourceDirectory2) {
|
|
111991
|
-
const directory = options.declarationDir || options.outDir ? getNormalizedAbsolutePath(options.declarationDir || options.outDir, currentDirectory) : void 0;
|
|
111992
|
-
const outputPathWithoutChangedExtension = directory ? resolvePath(directory, getRelativePathFromDirectory(getCommonSourceDirectory2(), inputFileName, ignoreCase)) : inputFileName;
|
|
111993
|
-
const outputFileName = changeExtension(
|
|
111994
|
-
outputPathWithoutChangedExtension,
|
|
111995
|
-
getDeclarationEmitExtensionForPath(inputFileName)
|
|
111996
|
-
);
|
|
111997
|
-
return outputFileName;
|
|
111998
|
-
}
|
|
111999
112004
|
function getOutputJSFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory2) {
|
|
112000
112005
|
if (configFile.options.emitDeclarationOnly)
|
|
112001
112006
|
return void 0;
|
|
@@ -112006,18 +112011,6 @@ function getOutputJSFileName(inputFileName, configFile, ignoreCase, getCommonSou
|
|
|
112006
112011
|
);
|
|
112007
112012
|
return !isJsonFile || comparePaths(inputFileName, outputFileName, Debug.checkDefined(configFile.options.configFilePath), ignoreCase) !== 0 /* EqualTo */ ? outputFileName : void 0;
|
|
112008
112013
|
}
|
|
112009
|
-
function getOutputJSFileNameWithoutConfigFile(inputFileName, options, ignoreCase, currentDirectory, getCommonSourceDirectory2) {
|
|
112010
|
-
if (options.emitDeclarationOnly)
|
|
112011
|
-
return void 0;
|
|
112012
|
-
const isJsonFile = fileExtensionIs(inputFileName, ".json" /* Json */);
|
|
112013
|
-
const outDir = options.outDir ? getNormalizedAbsolutePath(options.outDir, currentDirectory) : void 0;
|
|
112014
|
-
const outputPathWithoutChangedExtension = outDir ? resolvePath(outDir, getRelativePathFromDirectory(getCommonSourceDirectory2(), inputFileName, ignoreCase)) : inputFileName;
|
|
112015
|
-
const outputFileName = changeExtension(
|
|
112016
|
-
outputPathWithoutChangedExtension,
|
|
112017
|
-
getOutputExtension(inputFileName, options)
|
|
112018
|
-
);
|
|
112019
|
-
return !isJsonFile || !options.configFilePath || comparePaths(inputFileName, outputFileName, options.configFilePath, ignoreCase) !== 0 /* EqualTo */ ? outputFileName : void 0;
|
|
112020
|
-
}
|
|
112021
112014
|
function createAddOutput() {
|
|
112022
112015
|
let outputs;
|
|
112023
112016
|
return { addOutput, getOutputs };
|
|
@@ -118558,15 +118551,6 @@ function getImpliedNodeFormatForFileWorker(fileName, packageJsonInfoCache, host,
|
|
|
118558
118551
|
return { impliedNodeFormat, packageJsonLocations, packageJsonScope };
|
|
118559
118552
|
}
|
|
118560
118553
|
}
|
|
118561
|
-
function moduleFormatNeedsPackageJsonLookup(fileName, options) {
|
|
118562
|
-
switch (getEmitModuleResolutionKind(options)) {
|
|
118563
|
-
case 3 /* Node16 */:
|
|
118564
|
-
case 99 /* NodeNext */:
|
|
118565
|
-
return fileExtensionIsOneOf(fileName, [".d.ts" /* Dts */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".js" /* Js */, ".jsx" /* Jsx */]);
|
|
118566
|
-
default:
|
|
118567
|
-
return false;
|
|
118568
|
-
}
|
|
118569
|
-
}
|
|
118570
118554
|
var plainJSErrors = /* @__PURE__ */ new Set([
|
|
118571
118555
|
// binder errors
|
|
118572
118556
|
Diagnostics.Cannot_redeclare_block_scoped_variable_0.code,
|
|
@@ -118687,7 +118671,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
118687
118671
|
let files;
|
|
118688
118672
|
let symlinks;
|
|
118689
118673
|
let commonSourceDirectory;
|
|
118690
|
-
let assumedCommonSourceDirectory;
|
|
118691
118674
|
let typeChecker;
|
|
118692
118675
|
let classifiableNames;
|
|
118693
118676
|
const ambientModuleNameToUnmodifiedFileName = /* @__PURE__ */ new Map();
|
|
@@ -119179,9 +119162,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119179
119162
|
}
|
|
119180
119163
|
return commonSourceDirectory;
|
|
119181
119164
|
}
|
|
119182
|
-
function getAssumedCommonSourceDirectory() {
|
|
119183
|
-
return commonSourceDirectory ?? (assumedCommonSourceDirectory ?? (assumedCommonSourceDirectory = getCommonSourceDirectory(options, () => rootNames, host.getCurrentDirectory(), getCanonicalFileName)));
|
|
119184
|
-
}
|
|
119185
119165
|
function getClassifiableNames() {
|
|
119186
119166
|
var _a2;
|
|
119187
119167
|
if (!classifiableNames) {
|
|
@@ -119405,20 +119385,20 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119405
119385
|
})(SeenPackageName || (SeenPackageName = {}));
|
|
119406
119386
|
const seenPackageNames = /* @__PURE__ */ new Map();
|
|
119407
119387
|
for (const oldSourceFile of oldSourceFiles) {
|
|
119408
|
-
const sourceFileOptions = getCreateSourceFileOptions(oldSourceFile.fileName);
|
|
119388
|
+
const sourceFileOptions = getCreateSourceFileOptions(oldSourceFile.fileName, moduleResolutionCache, host, options);
|
|
119409
119389
|
let newSourceFile = host.getSourceFileByPath ? host.getSourceFileByPath(
|
|
119410
119390
|
oldSourceFile.fileName,
|
|
119411
119391
|
oldSourceFile.resolvedPath,
|
|
119412
119392
|
sourceFileOptions,
|
|
119413
119393
|
/*onError*/
|
|
119414
119394
|
void 0,
|
|
119415
|
-
shouldCreateNewSourceFile
|
|
119395
|
+
shouldCreateNewSourceFile
|
|
119416
119396
|
) : host.getSourceFile(
|
|
119417
119397
|
oldSourceFile.fileName,
|
|
119418
119398
|
sourceFileOptions,
|
|
119419
119399
|
/*onError*/
|
|
119420
119400
|
void 0,
|
|
119421
|
-
shouldCreateNewSourceFile
|
|
119401
|
+
shouldCreateNewSourceFile
|
|
119422
119402
|
);
|
|
119423
119403
|
if (!newSourceFile) {
|
|
119424
119404
|
return 0 /* Not */;
|
|
@@ -120367,52 +120347,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120367
120347
|
(_b2 = tracing) == null ? void 0 : _b2.pop();
|
|
120368
120348
|
return result;
|
|
120369
120349
|
}
|
|
120370
|
-
function
|
|
120371
|
-
|
|
120372
|
-
|
|
120373
|
-
|
|
120374
|
-
if (projectReference) {
|
|
120375
|
-
Debug.assert(useSourceOfProjectReferenceRedirect);
|
|
120376
|
-
fileNameForModuleFormatDetection = getOutputDeclarationFileName(
|
|
120377
|
-
fileNameForModuleFormatDetection,
|
|
120378
|
-
projectReference.commandLine,
|
|
120379
|
-
!host.useCaseSensitiveFileNames()
|
|
120380
|
-
) || getOutputJSFileName(
|
|
120381
|
-
fileNameForModuleFormatDetection,
|
|
120382
|
-
projectReference.commandLine,
|
|
120383
|
-
!host.useCaseSensitiveFileNames()
|
|
120384
|
-
) || fileNameForModuleFormatDetection;
|
|
120385
|
-
} else {
|
|
120386
|
-
fileNameForModuleFormatDetection = getOutputDeclarationFileNameWithoutConfigFile(
|
|
120387
|
-
fileNameForModuleFormatDetection,
|
|
120388
|
-
options,
|
|
120389
|
-
!host.useCaseSensitiveFileNames(),
|
|
120390
|
-
currentDirectory,
|
|
120391
|
-
getAssumedCommonSourceDirectory
|
|
120392
|
-
) || getOutputJSFileNameWithoutConfigFile(
|
|
120393
|
-
fileNameForModuleFormatDetection,
|
|
120394
|
-
options,
|
|
120395
|
-
!host.useCaseSensitiveFileNames(),
|
|
120396
|
-
currentDirectory,
|
|
120397
|
-
getAssumedCommonSourceDirectory
|
|
120398
|
-
) || fileNameForModuleFormatDetection;
|
|
120399
|
-
}
|
|
120400
|
-
}
|
|
120401
|
-
return getImpliedNodeFormatForFileWorker(
|
|
120402
|
-
fileNameForModuleFormatDetection,
|
|
120403
|
-
moduleResolutionCache == null ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(),
|
|
120404
|
-
host,
|
|
120405
|
-
options
|
|
120406
|
-
);
|
|
120407
|
-
}
|
|
120408
|
-
function getCreateSourceFileOptions(fileName) {
|
|
120409
|
-
const result = getImpliedNodeFormatForFile2(fileName);
|
|
120410
|
-
const languageVersion = getEmitScriptTarget(options);
|
|
120411
|
-
const setExternalModuleIndicator2 = getSetExternalModuleIndicator(options);
|
|
120350
|
+
function getCreateSourceFileOptions(fileName, moduleResolutionCache2, host2, options2) {
|
|
120351
|
+
const result = getImpliedNodeFormatForFileWorker(getNormalizedAbsolutePath(fileName, currentDirectory), moduleResolutionCache2 == null ? void 0 : moduleResolutionCache2.getPackageJsonInfoCache(), host2, options2);
|
|
120352
|
+
const languageVersion = getEmitScriptTarget(options2);
|
|
120353
|
+
const setExternalModuleIndicator2 = getSetExternalModuleIndicator(options2);
|
|
120412
120354
|
return typeof result === "object" ? { ...result, languageVersion, setExternalModuleIndicator: setExternalModuleIndicator2 } : { languageVersion, impliedNodeFormat: result, setExternalModuleIndicator: setExternalModuleIndicator2 };
|
|
120413
120355
|
}
|
|
120414
120356
|
function findSourceFileWorker(fileName, isDefaultLib, ignoreNoDefaultLib, reason, packageId) {
|
|
120415
|
-
var _a2
|
|
120357
|
+
var _a2;
|
|
120416
120358
|
const path = toPath3(fileName);
|
|
120417
120359
|
if (useSourceOfProjectReferenceRedirect) {
|
|
120418
120360
|
let source = getSourceOfProjectReferenceRedirect(path);
|
|
@@ -120480,7 +120422,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120480
120422
|
redirectedPath = toPath3(redirect);
|
|
120481
120423
|
}
|
|
120482
120424
|
}
|
|
120483
|
-
const sourceFileOptions = getCreateSourceFileOptions(fileName);
|
|
120425
|
+
const sourceFileOptions = getCreateSourceFileOptions(fileName, moduleResolutionCache, host, options);
|
|
120484
120426
|
const file = host.getSourceFile(
|
|
120485
120427
|
fileName,
|
|
120486
120428
|
sourceFileOptions,
|
|
@@ -120491,7 +120433,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120491
120433
|
Diagnostics.Cannot_read_file_0_Colon_1,
|
|
120492
120434
|
[fileName, hostErrorMessage]
|
|
120493
120435
|
),
|
|
120494
|
-
shouldCreateNewSourceFile
|
|
120436
|
+
shouldCreateNewSourceFile
|
|
120495
120437
|
);
|
|
120496
120438
|
if (packageId) {
|
|
120497
120439
|
const packageIdKey = packageIdToString(packageId);
|
|
@@ -120516,7 +120458,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120516
120458
|
file.path = path;
|
|
120517
120459
|
file.resolvedPath = toPath3(fileName);
|
|
120518
120460
|
file.originalFileName = originalFileName;
|
|
120519
|
-
file.packageJsonLocations = ((
|
|
120461
|
+
file.packageJsonLocations = ((_a2 = sourceFileOptions.packageJsonLocations) == null ? void 0 : _a2.length) ? sourceFileOptions.packageJsonLocations : void 0;
|
|
120520
120462
|
file.packageJsonScope = sourceFileOptions.packageJsonScope;
|
|
120521
120463
|
addFileIncludeReason(file, reason);
|
|
120522
120464
|
if (host.useCaseSensitiveFileNames()) {
|
|
@@ -121103,9 +121045,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121103
121045
|
createDiagnosticForOptionName(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files, "outDir");
|
|
121104
121046
|
}
|
|
121105
121047
|
}
|
|
121106
|
-
if (assumedCommonSourceDirectory && assumedCommonSourceDirectory !== getCommonSourceDirectory2()) {
|
|
121107
|
-
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.The_project_root_is_ambiguous_but_is_required_to_determine_the_module_format_of_output_js_files_Supply_the_rootDir_compiler_option_to_disambiguate));
|
|
121108
|
-
}
|
|
121109
121048
|
if (options.useDefineForClassFields && languageVersion === 0 /* ES3 */) {
|
|
121110
121049
|
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_when_option_target_is_ES3, "useDefineForClassFields");
|
|
121111
121050
|
}
|
|
@@ -124774,17 +124713,17 @@ function getFilesInErrorForSummary(diagnostics) {
|
|
|
124774
124713
|
function getWatchErrorSummaryDiagnosticMessage(errorCount) {
|
|
124775
124714
|
return errorCount === 1 ? Diagnostics.Found_1_error_Watching_for_file_changes : Diagnostics.Found_0_errors_Watching_for_file_changes;
|
|
124776
124715
|
}
|
|
124777
|
-
function prettyPathForFileError(
|
|
124778
|
-
const line = formatColorAndReset(":" +
|
|
124779
|
-
if (pathIsAbsolute(
|
|
124716
|
+
function prettyPathForFileError(error2, cwd) {
|
|
124717
|
+
const line = formatColorAndReset(":" + error2.line, "\x1B[90m" /* Grey */);
|
|
124718
|
+
if (pathIsAbsolute(error2.fileName) && pathIsAbsolute(cwd)) {
|
|
124780
124719
|
return getRelativePathFromDirectory(
|
|
124781
124720
|
cwd,
|
|
124782
|
-
|
|
124721
|
+
error2.fileName,
|
|
124783
124722
|
/*ignoreCase*/
|
|
124784
124723
|
false
|
|
124785
124724
|
) + line;
|
|
124786
124725
|
}
|
|
124787
|
-
return
|
|
124726
|
+
return error2.fileName + line;
|
|
124788
124727
|
}
|
|
124789
124728
|
function getErrorSummaryText(errorCount, filesInError, newLine, host) {
|
|
124790
124729
|
if (errorCount === 0)
|
|
@@ -125649,7 +125588,8 @@ function createWatchProgram(host) {
|
|
|
125649
125588
|
if (isFileMissingOnHost(hostSourceFile)) {
|
|
125650
125589
|
return void 0;
|
|
125651
125590
|
}
|
|
125652
|
-
|
|
125591
|
+
const impliedNodeFormat = typeof languageVersionOrOptions === "object" ? languageVersionOrOptions.impliedNodeFormat : void 0;
|
|
125592
|
+
if (hostSourceFile === void 0 || shouldCreateNewSourceFile || isFilePresenceUnknownOnHost(hostSourceFile) || hostSourceFile.sourceFile.impliedNodeFormat !== impliedNodeFormat) {
|
|
125653
125593
|
const sourceFile = getNewSourceFile(fileName, languageVersionOrOptions, onError);
|
|
125654
125594
|
if (hostSourceFile) {
|
|
125655
125595
|
if (sourceFile) {
|
|
@@ -133433,13 +133373,6 @@ function createDocumentRegistryInternal(useCaseSensitiveFileNames, currentDirect
|
|
|
133433
133373
|
}
|
|
133434
133374
|
}
|
|
133435
133375
|
}
|
|
133436
|
-
function getLanguageServiceRefCounts(path, scriptKind) {
|
|
133437
|
-
return arrayFrom(buckets.entries(), ([key, bucket]) => {
|
|
133438
|
-
const bucketEntry = bucket.get(path);
|
|
133439
|
-
const entry = bucketEntry && getDocumentRegistryEntry(bucketEntry, scriptKind);
|
|
133440
|
-
return [key, entry && entry.languageServiceRefCount];
|
|
133441
|
-
});
|
|
133442
|
-
}
|
|
133443
133376
|
return {
|
|
133444
133377
|
acquireDocument,
|
|
133445
133378
|
acquireDocumentWithKey,
|
|
@@ -133447,9 +133380,10 @@ function createDocumentRegistryInternal(useCaseSensitiveFileNames, currentDirect
|
|
|
133447
133380
|
updateDocumentWithKey,
|
|
133448
133381
|
releaseDocument,
|
|
133449
133382
|
releaseDocumentWithKey,
|
|
133450
|
-
|
|
133383
|
+
getKeyForCompilationSettings,
|
|
133384
|
+
getDocumentRegistryBucketKeyWithMode,
|
|
133451
133385
|
reportStats,
|
|
133452
|
-
|
|
133386
|
+
getBuckets: () => buckets
|
|
133453
133387
|
};
|
|
133454
133388
|
}
|
|
133455
133389
|
function getKeyForCompilationSettings(settings) {
|
|
@@ -136643,15 +136577,22 @@ registerRefactor(refactorNameForMoveToFile, {
|
|
|
136643
136577
|
getEditsForAction: function getRefactorEditsToMoveToFile(context, actionName2, interactiveRefactorArguments) {
|
|
136644
136578
|
Debug.assert(actionName2 === refactorNameForMoveToFile, "Wrong refactor invoked");
|
|
136645
136579
|
const statements = Debug.checkDefined(getStatementsToMove(context));
|
|
136580
|
+
const { host, program } = context;
|
|
136646
136581
|
Debug.assert(interactiveRefactorArguments, "No interactive refactor arguments available");
|
|
136647
136582
|
const targetFile = interactiveRefactorArguments.targetFile;
|
|
136648
136583
|
if (hasJSFileExtension(targetFile) || hasTSFileExtension(targetFile)) {
|
|
136649
|
-
|
|
136584
|
+
if (host.fileExists(targetFile) && program.getSourceFile(targetFile) === void 0) {
|
|
136585
|
+
return error(getLocaleSpecificMessage(Diagnostics.Cannot_move_statements_to_the_selected_file));
|
|
136586
|
+
}
|
|
136587
|
+
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange4(context, context.file, interactiveRefactorArguments.targetFile, program, statements, t, context.host, context.preferences));
|
|
136650
136588
|
return { edits, renameFilename: void 0, renameLocation: void 0 };
|
|
136651
136589
|
}
|
|
136652
|
-
return
|
|
136590
|
+
return error(getLocaleSpecificMessage(Diagnostics.Cannot_move_to_file_selected_file_is_invalid));
|
|
136653
136591
|
}
|
|
136654
136592
|
});
|
|
136593
|
+
function error(notApplicableReason) {
|
|
136594
|
+
return { edits: [], renameFilename: void 0, renameLocation: void 0, notApplicableReason };
|
|
136595
|
+
}
|
|
136655
136596
|
function doChange4(context, oldFile, targetFile, program, toMove, changes, host, preferences) {
|
|
136656
136597
|
const checker = program.getTypeChecker();
|
|
136657
136598
|
const usage = getUsageInfo(oldFile, toMove.all, checker);
|
|
@@ -137880,25 +137821,25 @@ function getRefactorActionsToConvertFunctionExpressions(context) {
|
|
|
137880
137821
|
const possibleActions = [];
|
|
137881
137822
|
const errors = [];
|
|
137882
137823
|
if (refactorKindBeginsWith(toNamedFunctionAction.kind, kind)) {
|
|
137883
|
-
const
|
|
137884
|
-
if (
|
|
137885
|
-
errors.push({ ...toNamedFunctionAction, notApplicableReason:
|
|
137824
|
+
const error2 = selectedVariableDeclaration || isArrowFunction(func) && isVariableDeclaration(func.parent) ? void 0 : getLocaleSpecificMessage(Diagnostics.Could_not_convert_to_named_function);
|
|
137825
|
+
if (error2) {
|
|
137826
|
+
errors.push({ ...toNamedFunctionAction, notApplicableReason: error2 });
|
|
137886
137827
|
} else {
|
|
137887
137828
|
possibleActions.push(toNamedFunctionAction);
|
|
137888
137829
|
}
|
|
137889
137830
|
}
|
|
137890
137831
|
if (refactorKindBeginsWith(toAnonymousFunctionAction.kind, kind)) {
|
|
137891
|
-
const
|
|
137892
|
-
if (
|
|
137893
|
-
errors.push({ ...toAnonymousFunctionAction, notApplicableReason:
|
|
137832
|
+
const error2 = !selectedVariableDeclaration && isArrowFunction(func) ? void 0 : getLocaleSpecificMessage(Diagnostics.Could_not_convert_to_anonymous_function);
|
|
137833
|
+
if (error2) {
|
|
137834
|
+
errors.push({ ...toAnonymousFunctionAction, notApplicableReason: error2 });
|
|
137894
137835
|
} else {
|
|
137895
137836
|
possibleActions.push(toAnonymousFunctionAction);
|
|
137896
137837
|
}
|
|
137897
137838
|
}
|
|
137898
137839
|
if (refactorKindBeginsWith(toArrowFunctionAction.kind, kind)) {
|
|
137899
|
-
const
|
|
137900
|
-
if (
|
|
137901
|
-
errors.push({ ...toArrowFunctionAction, notApplicableReason:
|
|
137840
|
+
const error2 = isFunctionExpression(func) ? void 0 : getLocaleSpecificMessage(Diagnostics.Could_not_convert_to_arrow_function);
|
|
137841
|
+
if (error2) {
|
|
137842
|
+
errors.push({ ...toArrowFunctionAction, notApplicableReason: error2 });
|
|
137902
137843
|
} else {
|
|
137903
137844
|
possibleActions.push(toArrowFunctionAction);
|
|
137904
137845
|
}
|
|
@@ -139185,11 +139126,11 @@ function getRefactorActionsToExtractSymbol(context) {
|
|
|
139185
139126
|
}
|
|
139186
139127
|
return infos.length ? infos : emptyArray;
|
|
139187
139128
|
function getStringError(errors) {
|
|
139188
|
-
let
|
|
139189
|
-
if (typeof
|
|
139190
|
-
|
|
139129
|
+
let error2 = errors[0].messageText;
|
|
139130
|
+
if (typeof error2 !== "string") {
|
|
139131
|
+
error2 = error2.messageText;
|
|
139191
139132
|
}
|
|
139192
|
-
return
|
|
139133
|
+
return error2;
|
|
139193
139134
|
}
|
|
139194
139135
|
}
|
|
139195
139136
|
function getRefactorEditsToExtractSymbol(context, actionName2) {
|
|
@@ -141965,9 +141906,9 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
|
141965
141906
|
function getValidSourceFile(fileName) {
|
|
141966
141907
|
const sourceFile = program.getSourceFile(fileName);
|
|
141967
141908
|
if (!sourceFile) {
|
|
141968
|
-
const
|
|
141969
|
-
|
|
141970
|
-
throw
|
|
141909
|
+
const error2 = new Error(`Could not find source file: '${fileName}'.`);
|
|
141910
|
+
error2.ProgramFiles = program.getSourceFiles().map((f) => f.fileName);
|
|
141911
|
+
throw error2;
|
|
141971
141912
|
}
|
|
141972
141913
|
return sourceFile;
|
|
141973
141914
|
}
|
|
@@ -142200,14 +142141,14 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
|
142200
142141
|
}
|
|
142201
142142
|
}
|
|
142202
142143
|
function cleanupSemanticCache() {
|
|
142203
|
-
program = void 0;
|
|
142204
|
-
}
|
|
142205
|
-
function dispose() {
|
|
142206
142144
|
if (program) {
|
|
142207
142145
|
const key = documentRegistry.getKeyForCompilationSettings(program.getCompilerOptions());
|
|
142208
142146
|
forEach(program.getSourceFiles(), (f) => documentRegistry.releaseDocumentWithKey(f.resolvedPath, key, f.scriptKind, f.impliedNodeFormat));
|
|
142209
142147
|
program = void 0;
|
|
142210
142148
|
}
|
|
142149
|
+
}
|
|
142150
|
+
function dispose() {
|
|
142151
|
+
cleanupSemanticCache();
|
|
142211
142152
|
host = void 0;
|
|
142212
142153
|
}
|
|
142213
142154
|
function getSyntacticDiagnostics(fileName) {
|
|
@@ -145183,9 +145124,9 @@ function createCodeFixActionWorker(fixName8, description3, changes, fixId52, fix
|
|
|
145183
145124
|
return { fixName: fixName8, description: description3, changes, fixId: fixId52, fixAllDescription, commands: command ? [command] : void 0 };
|
|
145184
145125
|
}
|
|
145185
145126
|
function registerCodeFix(reg) {
|
|
145186
|
-
for (const
|
|
145127
|
+
for (const error2 of reg.errorCodes) {
|
|
145187
145128
|
errorCodeToFixesArray = void 0;
|
|
145188
|
-
errorCodeToFixes.add(String(
|
|
145129
|
+
errorCodeToFixes.add(String(error2), reg);
|
|
145189
145130
|
}
|
|
145190
145131
|
if (reg.fixIds) {
|
|
145191
145132
|
for (const fixId52 of reg.fixIds) {
|
|
@@ -154859,8 +154800,8 @@ registerCodeFix({
|
|
|
154859
154800
|
return [createCodeFixAction(fixId48, changes, Diagnostics.Split_into_two_separate_import_declarations, fixId48, Diagnostics.Split_all_invalid_type_only_imports)];
|
|
154860
154801
|
}
|
|
154861
154802
|
},
|
|
154862
|
-
getAllCodeActions: (context) => codeFixAll(context, errorCodes60, (changes,
|
|
154863
|
-
splitTypeOnlyImport(changes, getImportDeclaration2(context.sourceFile,
|
|
154803
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes60, (changes, error2) => {
|
|
154804
|
+
splitTypeOnlyImport(changes, getImportDeclaration2(context.sourceFile, error2), context);
|
|
154864
154805
|
})
|
|
154865
154806
|
});
|
|
154866
154807
|
function getImportDeclaration2(sourceFile, span) {
|
|
@@ -161396,7 +161337,10 @@ var Core;
|
|
|
161396
161337
|
}
|
|
161397
161338
|
Core2.someSignatureUsage = someSignatureUsage;
|
|
161398
161339
|
function getPossibleSymbolReferenceNodes(sourceFile, symbolName2, container = sourceFile) {
|
|
161399
|
-
return getPossibleSymbolReferencePositions(sourceFile, symbolName2, container)
|
|
161340
|
+
return mapDefined(getPossibleSymbolReferencePositions(sourceFile, symbolName2, container), (pos) => {
|
|
161341
|
+
const referenceLocation = getTouchingPropertyName(sourceFile, pos);
|
|
161342
|
+
return referenceLocation === sourceFile ? void 0 : referenceLocation;
|
|
161343
|
+
});
|
|
161400
161344
|
}
|
|
161401
161345
|
function getPossibleSymbolReferencePositions(sourceFile, symbolName2, container = sourceFile) {
|
|
161402
161346
|
const positions = [];
|
|
@@ -163476,7 +163420,7 @@ function organizeImports(sourceFile, formatContext, host, program, preferences,
|
|
|
163476
163420
|
if (length(oldImportDecls) === 0) {
|
|
163477
163421
|
return;
|
|
163478
163422
|
}
|
|
163479
|
-
|
|
163423
|
+
setEmitFlags(oldImportDecls[0], 1024 /* NoLeadingComments */);
|
|
163480
163424
|
const oldImportGroups = shouldCombine ? group(oldImportDecls, (importDecl) => getExternalModuleName2(importDecl.moduleSpecifier)) : [oldImportDecls];
|
|
163481
163425
|
const sortedImportGroups = shouldSort ? stableSort(oldImportGroups, (group1, group2) => compareModuleSpecifiersWorker(group1[0].moduleSpecifier, group2[0].moduleSpecifier, comparer)) : oldImportGroups;
|
|
163482
163426
|
const newImportDecls = flatMap(sortedImportGroups, (importGroup) => getExternalModuleName2(importGroup[0].moduleSpecifier) || importGroup[0].moduleSpecifier === void 0 ? coalesce(importGroup) : importGroup);
|
|
@@ -168571,11 +168515,11 @@ function prepareRangeContainsErrorFunction(errors, originalRange) {
|
|
|
168571
168515
|
if (index >= sorted.length) {
|
|
168572
168516
|
return false;
|
|
168573
168517
|
}
|
|
168574
|
-
const
|
|
168575
|
-
if (r.end <=
|
|
168518
|
+
const error2 = sorted[index];
|
|
168519
|
+
if (r.end <= error2.start) {
|
|
168576
168520
|
return false;
|
|
168577
168521
|
}
|
|
168578
|
-
if (startEndOverlapsWithStartEnd(r.pos, r.end,
|
|
168522
|
+
if (startEndOverlapsWithStartEnd(r.pos, r.end, error2.start, error2.start + error2.length)) {
|
|
168579
168523
|
return true;
|
|
168580
168524
|
}
|
|
168581
168525
|
index++;
|
|
@@ -170886,11 +170830,8 @@ __export(ts_exports2, {
|
|
|
170886
170830
|
getOriginalNodeId: () => getOriginalNodeId,
|
|
170887
170831
|
getOriginalSourceFile: () => getOriginalSourceFile,
|
|
170888
170832
|
getOutputDeclarationFileName: () => getOutputDeclarationFileName,
|
|
170889
|
-
getOutputDeclarationFileNameWithoutConfigFile: () => getOutputDeclarationFileNameWithoutConfigFile,
|
|
170890
170833
|
getOutputExtension: () => getOutputExtension,
|
|
170891
170834
|
getOutputFileNames: () => getOutputFileNames,
|
|
170892
|
-
getOutputJSFileName: () => getOutputJSFileName,
|
|
170893
|
-
getOutputJSFileNameWithoutConfigFile: () => getOutputJSFileNameWithoutConfigFile,
|
|
170894
170835
|
getOutputPathsFor: () => getOutputPathsFor,
|
|
170895
170836
|
getOutputPathsForBundle: () => getOutputPathsForBundle,
|
|
170896
170837
|
getOwnEmitOutputFilePath: () => getOwnEmitOutputFilePath,
|
|
@@ -171255,6 +171196,7 @@ __export(ts_exports2, {
|
|
|
171255
171196
|
isDiagnosticWithLocation: () => isDiagnosticWithLocation,
|
|
171256
171197
|
isDiskPathRoot: () => isDiskPathRoot,
|
|
171257
171198
|
isDoStatement: () => isDoStatement,
|
|
171199
|
+
isDocumentRegistryEntry: () => isDocumentRegistryEntry,
|
|
171258
171200
|
isDotDotDotToken: () => isDotDotDotToken,
|
|
171259
171201
|
isDottedName: () => isDottedName,
|
|
171260
171202
|
isDynamicName: () => isDynamicName,
|
|
@@ -172277,11 +172219,11 @@ var typeScriptVersion2;
|
|
|
172277
172219
|
function getTypeScriptVersion() {
|
|
172278
172220
|
return typeScriptVersion2 ?? (typeScriptVersion2 = new Version(version));
|
|
172279
172221
|
}
|
|
172280
|
-
function formatDeprecationMessage(name,
|
|
172281
|
-
let deprecationMessage =
|
|
172222
|
+
function formatDeprecationMessage(name, error2, errorAfter, since, message) {
|
|
172223
|
+
let deprecationMessage = error2 ? "DeprecationError: " : "DeprecationWarning: ";
|
|
172282
172224
|
deprecationMessage += `'${name}' `;
|
|
172283
172225
|
deprecationMessage += since ? `has been deprecated since v${since}` : "is deprecated";
|
|
172284
|
-
deprecationMessage +=
|
|
172226
|
+
deprecationMessage += error2 ? " and can no longer be used." : errorAfter ? ` and will no longer be usable after v${errorAfter}.` : ".";
|
|
172285
172227
|
deprecationMessage += message ? ` ${formatStringFromArgs(message, [name], 0)}` : "";
|
|
172286
172228
|
return deprecationMessage;
|
|
172287
172229
|
}
|
|
@@ -172319,9 +172261,9 @@ function createDeprecation(name, options = {}) {
|
|
|
172319
172261
|
const errorAfter = typeof options.errorAfter === "string" ? new Version(options.errorAfter) : options.errorAfter;
|
|
172320
172262
|
const warnAfter = typeof options.warnAfter === "string" ? new Version(options.warnAfter) : options.warnAfter;
|
|
172321
172263
|
const since = typeof options.since === "string" ? new Version(options.since) : options.since ?? warnAfter;
|
|
172322
|
-
const
|
|
172264
|
+
const error2 = options.error || errorAfter && version2.compareTo(errorAfter) >= 0;
|
|
172323
172265
|
const warn = !warnAfter || version2.compareTo(warnAfter) >= 0;
|
|
172324
|
-
return
|
|
172266
|
+
return error2 ? createErrorDeprecation(name, errorAfter, since, options.message) : warn ? createWarningDeprecation(name, errorAfter, since, options.message) : noop;
|
|
172325
172267
|
}
|
|
172326
172268
|
function wrapFunction(deprecation, func) {
|
|
172327
172269
|
return function() {
|
|
@@ -172419,6 +172361,7 @@ __export(ts_server_exports3, {
|
|
|
172419
172361
|
ActionWatchTypingLocations: () => ActionWatchTypingLocations,
|
|
172420
172362
|
Arguments: () => Arguments,
|
|
172421
172363
|
AutoImportProviderProject: () => AutoImportProviderProject,
|
|
172364
|
+
AuxiliaryProject: () => AuxiliaryProject,
|
|
172422
172365
|
CharRangeSection: () => CharRangeSection,
|
|
172423
172366
|
CommandNames: () => CommandNames,
|
|
172424
172367
|
ConfigFileDiagEvent: () => ConfigFileDiagEvent,
|
|
@@ -174452,6 +174395,16 @@ var Project3 = class {
|
|
|
174452
174395
|
true
|
|
174453
174396
|
);
|
|
174454
174397
|
}
|
|
174398
|
+
/** @internal */
|
|
174399
|
+
cleanupProgram() {
|
|
174400
|
+
if (this.program) {
|
|
174401
|
+
for (const f of this.program.getSourceFiles()) {
|
|
174402
|
+
this.detachScriptInfoIfNotRoot(f.fileName);
|
|
174403
|
+
}
|
|
174404
|
+
this.program.forEachResolvedProjectReference((ref) => this.detachScriptInfoFromProject(ref.sourceFile.fileName));
|
|
174405
|
+
this.program = void 0;
|
|
174406
|
+
}
|
|
174407
|
+
}
|
|
174455
174408
|
disableLanguageService(lastFileExceededProgramSize) {
|
|
174456
174409
|
if (!this.languageServiceEnabled) {
|
|
174457
174410
|
return;
|
|
@@ -174459,6 +174412,7 @@ var Project3 = class {
|
|
|
174459
174412
|
Debug.assert(this.projectService.serverMode !== 2 /* Syntactic */);
|
|
174460
174413
|
this.languageService.cleanupSemanticCache();
|
|
174461
174414
|
this.languageServiceEnabled = false;
|
|
174415
|
+
this.cleanupProgram();
|
|
174462
174416
|
this.lastFileExceededProgramSize = lastFileExceededProgramSize;
|
|
174463
174417
|
this.builderState = void 0;
|
|
174464
174418
|
if (this.autoImportProviderHost) {
|
|
@@ -174467,6 +174421,7 @@ var Project3 = class {
|
|
|
174467
174421
|
this.autoImportProviderHost = void 0;
|
|
174468
174422
|
this.resolutionCache.closeTypeRootsWatch();
|
|
174469
174423
|
this.clearGeneratedFileWatch();
|
|
174424
|
+
this.projectService.verifyDocumentRegistry();
|
|
174470
174425
|
this.projectService.onUpdateLanguageServiceStateForProject(
|
|
174471
174426
|
this,
|
|
174472
174427
|
/*languageServiceEnabled*/
|
|
@@ -174510,12 +174465,7 @@ var Project3 = class {
|
|
|
174510
174465
|
close() {
|
|
174511
174466
|
this.projectService.typingsCache.onProjectClosed(this);
|
|
174512
174467
|
this.closeWatchingTypingLocations();
|
|
174513
|
-
|
|
174514
|
-
for (const f of this.program.getSourceFiles()) {
|
|
174515
|
-
this.detachScriptInfoIfNotRoot(f.fileName);
|
|
174516
|
-
}
|
|
174517
|
-
this.program.forEachResolvedProjectReference((ref) => this.detachScriptInfoFromProject(ref.sourceFile.fileName));
|
|
174518
|
-
}
|
|
174468
|
+
this.cleanupProgram();
|
|
174519
174469
|
forEach(this.externalFiles, (externalFile) => this.detachScriptInfoIfNotRoot(externalFile));
|
|
174520
174470
|
for (const root of this.rootFiles) {
|
|
174521
174471
|
root.detachFromProject(this);
|
|
@@ -174893,6 +174843,7 @@ var Project3 = class {
|
|
|
174893
174843
|
updateGraphWorker() {
|
|
174894
174844
|
var _a, _b;
|
|
174895
174845
|
const oldProgram = this.languageService.getCurrentProgram();
|
|
174846
|
+
Debug.assert(oldProgram === this.program);
|
|
174896
174847
|
Debug.assert(!this.isClosed(), "Called update graph worker of closed project");
|
|
174897
174848
|
this.writeLog(`Starting updateGraphWorker: Project: ${this.getProjectName()}`);
|
|
174898
174849
|
const start2 = timestamp();
|
|
@@ -175023,6 +174974,7 @@ var Project3 = class {
|
|
|
175023
174974
|
} else if (this.program !== oldProgram) {
|
|
175024
174975
|
this.writeLog(`Different program with same set of files`);
|
|
175025
174976
|
}
|
|
174977
|
+
this.projectService.verifyDocumentRegistry();
|
|
175026
174978
|
return hasNewProgram;
|
|
175027
174979
|
}
|
|
175028
174980
|
/** @internal */
|
|
@@ -175667,7 +175619,6 @@ var AuxiliaryProject = class extends Project3 {
|
|
|
175667
175619
|
isOrphan() {
|
|
175668
175620
|
return true;
|
|
175669
175621
|
}
|
|
175670
|
-
/** @internal */
|
|
175671
175622
|
scheduleInvalidateResolutionsOfFailedLookupLocations() {
|
|
175672
175623
|
return;
|
|
175673
175624
|
}
|
|
@@ -176547,6 +176498,9 @@ var _ProjectService = class {
|
|
|
176547
176498
|
this.sharedExtendedConfigFileWatchers = /* @__PURE__ */ new Map();
|
|
176548
176499
|
/** @internal */
|
|
176549
176500
|
this.extendedConfigCache = /* @__PURE__ */ new Map();
|
|
176501
|
+
/** @internal */
|
|
176502
|
+
this.verifyDocumentRegistry = noop;
|
|
176503
|
+
var _a;
|
|
176550
176504
|
this.host = opts.host;
|
|
176551
176505
|
this.logger = opts.logger;
|
|
176552
176506
|
this.cancellationToken = opts.cancellationToken;
|
|
@@ -176594,6 +176548,7 @@ var _ProjectService = class {
|
|
|
176594
176548
|
watchFile: returnNoopFileWatcher,
|
|
176595
176549
|
watchDirectory: returnNoopFileWatcher
|
|
176596
176550
|
} : getWatchFactory(this.host, watchLogLevel, log, getDetailWatchInfo);
|
|
176551
|
+
(_a = opts.incrementalVerifier) == null ? void 0 : _a.call(opts, this);
|
|
176597
176552
|
}
|
|
176598
176553
|
toPath(fileName) {
|
|
176599
176554
|
return toPath(fileName, this.currentDirectory, this.toCanonicalFileName);
|
|
@@ -177922,6 +177877,7 @@ var _ProjectService = class {
|
|
|
177922
177877
|
/*ensureSynchronized*/
|
|
177923
177878
|
false
|
|
177924
177879
|
).cleanupSemanticCache();
|
|
177880
|
+
project.cleanupProgram();
|
|
177925
177881
|
project.markAsDirty();
|
|
177926
177882
|
}
|
|
177927
177883
|
sendConfigFileDiagEvent(project, triggerFile) {
|
|
@@ -180791,7 +180747,8 @@ var Session3 = class {
|
|
|
180791
180747
|
allowLocalPluginLoads: opts.allowLocalPluginLoads,
|
|
180792
180748
|
typesMapLocation: opts.typesMapLocation,
|
|
180793
180749
|
serverMode: opts.serverMode,
|
|
180794
|
-
session: this
|
|
180750
|
+
session: this,
|
|
180751
|
+
incrementalVerifier: opts.incrementalVerifier
|
|
180795
180752
|
};
|
|
180796
180753
|
this.projectService = new ProjectService3(settings);
|
|
180797
180754
|
this.projectService.setPerformanceEventHandler(this.performanceEventHandler.bind(this));
|
|
@@ -181111,6 +181068,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
181111
181068
|
/*ensureSynchronized*/
|
|
181112
181069
|
false
|
|
181113
181070
|
).cleanupSemanticCache();
|
|
181071
|
+
p.cleanupProgram();
|
|
181114
181072
|
}
|
|
181115
181073
|
}
|
|
181116
181074
|
cleanup() {
|
|
@@ -183649,6 +183607,7 @@ __export(ts_server_exports4, {
|
|
|
183649
183607
|
ActionWatchTypingLocations: () => ActionWatchTypingLocations,
|
|
183650
183608
|
Arguments: () => Arguments,
|
|
183651
183609
|
AutoImportProviderProject: () => AutoImportProviderProject,
|
|
183610
|
+
AuxiliaryProject: () => AuxiliaryProject,
|
|
183652
183611
|
CharRangeSection: () => CharRangeSection,
|
|
183653
183612
|
CommandNames: () => CommandNames,
|
|
183654
183613
|
ConfigFileDiagEvent: () => ConfigFileDiagEvent,
|
|
@@ -185362,11 +185321,8 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
185362
185321
|
getOriginalNodeId,
|
|
185363
185322
|
getOriginalSourceFile,
|
|
185364
185323
|
getOutputDeclarationFileName,
|
|
185365
|
-
getOutputDeclarationFileNameWithoutConfigFile,
|
|
185366
185324
|
getOutputExtension,
|
|
185367
185325
|
getOutputFileNames,
|
|
185368
|
-
getOutputJSFileName,
|
|
185369
|
-
getOutputJSFileNameWithoutConfigFile,
|
|
185370
185326
|
getOutputPathsFor,
|
|
185371
185327
|
getOutputPathsForBundle,
|
|
185372
185328
|
getOwnEmitOutputFilePath,
|
|
@@ -185731,6 +185687,7 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
185731
185687
|
isDiagnosticWithLocation,
|
|
185732
185688
|
isDiskPathRoot,
|
|
185733
185689
|
isDoStatement,
|
|
185690
|
+
isDocumentRegistryEntry,
|
|
185734
185691
|
isDotDotDotToken,
|
|
185735
185692
|
isDottedName,
|
|
185736
185693
|
isDynamicName,
|