typescript 4.6.0-dev.20211206 → 4.6.0-dev.20211210
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.es5.d.ts +1 -1
- package/lib/tsc.js +188 -48
- package/lib/tsserver.js +203 -52
- package/lib/tsserverlibrary.d.ts +5 -1
- package/lib/tsserverlibrary.js +203 -52
- package/lib/typescript.d.ts +5 -1
- package/lib/typescript.js +203 -52
- package/lib/typescriptServices.d.ts +5 -1
- package/lib/typescriptServices.js +203 -52
- package/lib/typingsInstaller.js +195 -49
- package/package.json +2 -1
package/lib/tsserver.js
CHANGED
|
@@ -100,7 +100,7 @@ var ts;
|
|
|
100
100
|
// The following is baselined as a literal template type without intervention
|
|
101
101
|
/** The version of the TypeScript compiler release */
|
|
102
102
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
103
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
103
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20211210";
|
|
104
104
|
/* @internal */
|
|
105
105
|
var Comparison;
|
|
106
106
|
(function (Comparison) {
|
|
@@ -7937,7 +7937,7 @@ var ts;
|
|
|
7937
7937
|
Duplicate_label_0: diag(1114, ts.DiagnosticCategory.Error, "Duplicate_label_0_1114", "Duplicate label '{0}'."),
|
|
7938
7938
|
A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: diag(1115, ts.DiagnosticCategory.Error, "A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement_1115", "A 'continue' statement can only jump to a label of an enclosing iteration statement."),
|
|
7939
7939
|
A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: diag(1116, ts.DiagnosticCategory.Error, "A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement_1116", "A 'break' statement can only jump to a label of an enclosing statement."),
|
|
7940
|
-
|
|
7940
|
+
An_object_literal_cannot_have_multiple_properties_with_the_same_name: diag(1117, ts.DiagnosticCategory.Error, "An_object_literal_cannot_have_multiple_properties_with_the_same_name_1117", "An object literal cannot have multiple properties with the same name."),
|
|
7941
7941
|
An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: diag(1118, ts.DiagnosticCategory.Error, "An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name_1118", "An object literal cannot have multiple get/set accessors with the same name."),
|
|
7942
7942
|
An_object_literal_cannot_have_property_and_accessor_with_the_same_name: diag(1119, ts.DiagnosticCategory.Error, "An_object_literal_cannot_have_property_and_accessor_with_the_same_name_1119", "An object literal cannot have property and accessor with the same name."),
|
|
7943
7943
|
An_export_assignment_cannot_have_modifiers: diag(1120, ts.DiagnosticCategory.Error, "An_export_assignment_cannot_have_modifiers_1120", "An export assignment cannot have modifiers."),
|
|
@@ -8889,6 +8889,7 @@ var ts;
|
|
|
8889
8889
|
DIRECTORY: diag(6038, ts.DiagnosticCategory.Message, "DIRECTORY_6038", "DIRECTORY"),
|
|
8890
8890
|
STRATEGY: diag(6039, ts.DiagnosticCategory.Message, "STRATEGY_6039", "STRATEGY"),
|
|
8891
8891
|
FILE_OR_DIRECTORY: diag(6040, ts.DiagnosticCategory.Message, "FILE_OR_DIRECTORY_6040", "FILE OR DIRECTORY"),
|
|
8892
|
+
Errors_Files: diag(6041, ts.DiagnosticCategory.Message, "Errors_Files_6041", "Errors Files"),
|
|
8892
8893
|
Generates_corresponding_map_file: diag(6043, ts.DiagnosticCategory.Message, "Generates_corresponding_map_file_6043", "Generates corresponding '.map' file."),
|
|
8893
8894
|
Compiler_option_0_expects_an_argument: diag(6044, ts.DiagnosticCategory.Error, "Compiler_option_0_expects_an_argument_6044", "Compiler option '{0}' expects an argument."),
|
|
8894
8895
|
Unterminated_quoted_string_in_response_file_0: diag(6045, ts.DiagnosticCategory.Error, "Unterminated_quoted_string_in_response_file_0_6045", "Unterminated quoted string in response file '{0}'."),
|
|
@@ -9082,6 +9083,9 @@ var ts;
|
|
|
9082
9083
|
Output_Formatting: diag(6256, ts.DiagnosticCategory.Message, "Output_Formatting_6256", "Output Formatting"),
|
|
9083
9084
|
Completeness: diag(6257, ts.DiagnosticCategory.Message, "Completeness_6257", "Completeness"),
|
|
9084
9085
|
_0_should_be_set_inside_the_compilerOptions_object_of_the_config_json_file: diag(6258, ts.DiagnosticCategory.Error, "_0_should_be_set_inside_the_compilerOptions_object_of_the_config_json_file_6258", "'{0}' should be set inside the 'compilerOptions' object of the config json file"),
|
|
9086
|
+
Found_1_error_in_1: diag(6259, ts.DiagnosticCategory.Message, "Found_1_error_in_1_6259", "Found 1 error in {1}"),
|
|
9087
|
+
Found_0_errors_in_1_file: diag(6260, ts.DiagnosticCategory.Message, "Found_0_errors_in_1_file_6260", "Found {0} errors in 1 file."),
|
|
9088
|
+
Found_0_errors_in_1_files: diag(6261, ts.DiagnosticCategory.Message, "Found_0_errors_in_1_files_6261", "Found {0} errors in {1} files."),
|
|
9085
9089
|
Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve: diag(6270, ts.DiagnosticCategory.Message, "Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve_6270", "Directory '{0}' has no containing package.json scope. Imports will not resolve."),
|
|
9086
9090
|
Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1: diag(6271, ts.DiagnosticCategory.Message, "Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1_6271", "Import specifier '{0}' does not exist in package.json scope at path '{1}'."),
|
|
9087
9091
|
Invalid_import_specifier_0_has_no_possible_resolutions: diag(6272, ts.DiagnosticCategory.Message, "Invalid_import_specifier_0_has_no_possible_resolutions_6272", "Invalid import specifier '{0}' has no possible resolutions."),
|
|
@@ -24434,7 +24438,7 @@ var ts;
|
|
|
24434
24438
|
// @api
|
|
24435
24439
|
function createAssertClause(elements, multiLine) {
|
|
24436
24440
|
var node = createBaseNode(292 /* AssertClause */);
|
|
24437
|
-
node.elements = elements;
|
|
24441
|
+
node.elements = createNodeArray(elements);
|
|
24438
24442
|
node.multiLine = multiLine;
|
|
24439
24443
|
node.transformFlags |= 4 /* ContainsESNext */;
|
|
24440
24444
|
return node;
|
|
@@ -33620,10 +33624,14 @@ var ts;
|
|
|
33620
33624
|
// - "(x,y)" is a comma expression parsed as a signature with two parameters.
|
|
33621
33625
|
// - "a ? (b): c" will have "(b):" parsed as a signature with a return type annotation.
|
|
33622
33626
|
// - "a ? (b): function() {}" will too, since function() is a valid JSDoc function type.
|
|
33623
|
-
// - "a ? (b): (function() {})" as well, but inside of a parenthesized type.
|
|
33627
|
+
// - "a ? (b): (function() {})" as well, but inside of a parenthesized type with an arbitrary amount of nesting.
|
|
33624
33628
|
//
|
|
33625
33629
|
// So we need just a bit of lookahead to ensure that it can only be a signature.
|
|
33626
|
-
var
|
|
33630
|
+
var unwrappedType = type;
|
|
33631
|
+
while ((unwrappedType === null || unwrappedType === void 0 ? void 0 : unwrappedType.kind) === 190 /* ParenthesizedType */) {
|
|
33632
|
+
unwrappedType = unwrappedType.type; // Skip parens if need be
|
|
33633
|
+
}
|
|
33634
|
+
var hasJSDocFunctionType = unwrappedType && ts.isJSDocFunctionType(unwrappedType);
|
|
33627
33635
|
if (!allowAmbiguity && token() !== 38 /* EqualsGreaterThanToken */ && (hasJSDocFunctionType || token() !== 18 /* OpenBraceToken */)) {
|
|
33628
33636
|
// Returning undefined here will cause our caller to rewind to where we started from.
|
|
33629
33637
|
return undefined;
|
|
@@ -44954,10 +44962,6 @@ var ts;
|
|
|
44954
44962
|
seen.set(identifier.escapedText, currentKind);
|
|
44955
44963
|
continue;
|
|
44956
44964
|
}
|
|
44957
|
-
if (currentKind === 1 /* Property */ && existingKind === 1 /* Property */) {
|
|
44958
|
-
var span = ts.getErrorSpanForNode(file, identifier);
|
|
44959
|
-
file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, ts.Diagnostics.An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode));
|
|
44960
|
-
}
|
|
44961
44965
|
}
|
|
44962
44966
|
}
|
|
44963
44967
|
return bindAnonymousDeclaration(node, 4096 /* ObjectLiteral */, "__object" /* Object */);
|
|
@@ -45191,7 +45195,7 @@ var ts;
|
|
|
45191
45195
|
}
|
|
45192
45196
|
}
|
|
45193
45197
|
function checkStrictModeNumericLiteral(node) {
|
|
45194
|
-
if (inStrictMode && node.numericLiteralFlags & 32 /* Octal */) {
|
|
45198
|
+
if (languageVersion < 1 /* ES5 */ && inStrictMode && node.numericLiteralFlags & 32 /* Octal */) {
|
|
45195
45199
|
file.bindDiagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode));
|
|
45196
45200
|
}
|
|
45197
45201
|
}
|
|
@@ -48796,10 +48800,12 @@ var ts;
|
|
|
48796
48800
|
}
|
|
48797
48801
|
/* Starting from 'initial' node walk up the parent chain until 'stopAt' node is reached.
|
|
48798
48802
|
* If at any point current node is equal to 'parent' node - return true.
|
|
48803
|
+
* If current node is an IIFE, continue walking up.
|
|
48799
48804
|
* Return false if 'stopAt' node is reached or isFunctionLike(current) === true.
|
|
48800
48805
|
*/
|
|
48801
48806
|
function isSameScopeDescendentOf(initial, parent, stopAt) {
|
|
48802
|
-
return !!parent && !!ts.findAncestor(initial, function (n) { return n ===
|
|
48807
|
+
return !!parent && !!ts.findAncestor(initial, function (n) { return n === parent
|
|
48808
|
+
|| (n === stopAt || ts.isFunctionLike(n) && !ts.getImmediatelyInvokedFunctionExpression(n) ? "quit" : false); });
|
|
48803
48809
|
}
|
|
48804
48810
|
function getAnyImportSyntax(node) {
|
|
48805
48811
|
switch (node.kind) {
|
|
@@ -54053,7 +54059,27 @@ var ts;
|
|
|
54053
54059
|
return mapType(source, function (t) { return getRestType(t, properties, symbol); });
|
|
54054
54060
|
}
|
|
54055
54061
|
var omitKeyType = getUnionType(ts.map(properties, getLiteralTypeFromPropertyName));
|
|
54062
|
+
var spreadableProperties = [];
|
|
54063
|
+
var unspreadableToRestKeys = [];
|
|
54064
|
+
for (var _i = 0, _a = getPropertiesOfType(source); _i < _a.length; _i++) {
|
|
54065
|
+
var prop = _a[_i];
|
|
54066
|
+
var literalTypeFromProperty = getLiteralTypeFromProperty(prop, 8576 /* StringOrNumberLiteralOrUnique */);
|
|
54067
|
+
if (!isTypeAssignableTo(literalTypeFromProperty, omitKeyType)
|
|
54068
|
+
&& !(ts.getDeclarationModifierFlagsFromSymbol(prop) & (8 /* Private */ | 16 /* Protected */))
|
|
54069
|
+
&& isSpreadableProperty(prop)) {
|
|
54070
|
+
spreadableProperties.push(prop);
|
|
54071
|
+
}
|
|
54072
|
+
else {
|
|
54073
|
+
unspreadableToRestKeys.push(literalTypeFromProperty);
|
|
54074
|
+
}
|
|
54075
|
+
}
|
|
54056
54076
|
if (isGenericObjectType(source) || isGenericIndexType(omitKeyType)) {
|
|
54077
|
+
if (unspreadableToRestKeys.length) {
|
|
54078
|
+
// If the type we're spreading from has properties that cannot
|
|
54079
|
+
// be spread into the rest type (e.g. getters, methods), ensure
|
|
54080
|
+
// they are explicitly omitted, as they would in the non-generic case.
|
|
54081
|
+
omitKeyType = getUnionType(__spreadArray([omitKeyType], unspreadableToRestKeys, true));
|
|
54082
|
+
}
|
|
54057
54083
|
if (omitKeyType.flags & 131072 /* Never */) {
|
|
54058
54084
|
return source;
|
|
54059
54085
|
}
|
|
@@ -54064,13 +54090,9 @@ var ts;
|
|
|
54064
54090
|
return getTypeAliasInstantiation(omitTypeAlias, [source, omitKeyType]);
|
|
54065
54091
|
}
|
|
54066
54092
|
var members = ts.createSymbolTable();
|
|
54067
|
-
for (var
|
|
54068
|
-
var prop =
|
|
54069
|
-
|
|
54070
|
-
&& !(ts.getDeclarationModifierFlagsFromSymbol(prop) & (8 /* Private */ | 16 /* Protected */))
|
|
54071
|
-
&& isSpreadableProperty(prop)) {
|
|
54072
|
-
members.set(prop.escapedName, getSpreadSymbol(prop, /*readonly*/ false));
|
|
54073
|
-
}
|
|
54093
|
+
for (var _b = 0, spreadableProperties_1 = spreadableProperties; _b < spreadableProperties_1.length; _b++) {
|
|
54094
|
+
var prop = spreadableProperties_1[_b];
|
|
54095
|
+
members.set(prop.escapedName, getSpreadSymbol(prop, /*readonly*/ false));
|
|
54074
54096
|
}
|
|
54075
54097
|
var result = createAnonymousType(symbol, members, ts.emptyArray, ts.emptyArray, getIndexInfosOfType(source));
|
|
54076
54098
|
result.objectFlags |= 8388608 /* ObjectRestType */;
|
|
@@ -65581,7 +65603,7 @@ var ts;
|
|
|
65581
65603
|
}
|
|
65582
65604
|
function getBaseTypeOfLiteralType(type) {
|
|
65583
65605
|
return type.flags & 1024 /* EnumLiteral */ ? getBaseTypeOfEnumLiteralType(type) :
|
|
65584
|
-
type.flags & 128 /* StringLiteral */ ? stringType :
|
|
65606
|
+
type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ? stringType :
|
|
65585
65607
|
type.flags & 256 /* NumberLiteral */ ? numberType :
|
|
65586
65608
|
type.flags & 2048 /* BigIntLiteral */ ? bigintType :
|
|
65587
65609
|
type.flags & 512 /* BooleanLiteral */ ? booleanType :
|
|
@@ -74337,7 +74359,7 @@ var ts;
|
|
|
74337
74359
|
typeArguments.pop();
|
|
74338
74360
|
}
|
|
74339
74361
|
while (typeArguments.length < typeParameters.length) {
|
|
74340
|
-
typeArguments.push(getConstraintOfTypeParameter(typeParameters[typeArguments.length]) || getDefaultTypeArgumentType(isJs));
|
|
74362
|
+
typeArguments.push(getDefaultFromTypeParameter(typeParameters[typeArguments.length]) || getConstraintOfTypeParameter(typeParameters[typeArguments.length]) || getDefaultTypeArgumentType(isJs));
|
|
74341
74363
|
}
|
|
74342
74364
|
return typeArguments;
|
|
74343
74365
|
}
|
|
@@ -74993,8 +75015,7 @@ var ts;
|
|
|
74993
75015
|
*/
|
|
74994
75016
|
function checkCallExpression(node, checkMode) {
|
|
74995
75017
|
var _a;
|
|
74996
|
-
|
|
74997
|
-
checkGrammarArguments(node.arguments);
|
|
75018
|
+
checkGrammarTypeArguments(node, node.typeArguments);
|
|
74998
75019
|
var signature = getResolvedSignature(node, /*candidatesOutArray*/ undefined, checkMode);
|
|
74999
75020
|
if (signature === resolvingSignature) {
|
|
75000
75021
|
// CheckMode.SkipGenericFunctions is enabled and this is a call to a generic function that
|
|
@@ -75099,8 +75120,7 @@ var ts;
|
|
|
75099
75120
|
}
|
|
75100
75121
|
function checkImportCallExpression(node) {
|
|
75101
75122
|
// Check grammar of dynamic import
|
|
75102
|
-
|
|
75103
|
-
checkGrammarImportCallExpression(node);
|
|
75123
|
+
checkGrammarImportCallExpression(node);
|
|
75104
75124
|
if (node.arguments.length === 0) {
|
|
75105
75125
|
return createPromiseReturnType(node, anyType);
|
|
75106
75126
|
}
|
|
@@ -85761,20 +85781,6 @@ var ts;
|
|
|
85761
85781
|
}
|
|
85762
85782
|
return false;
|
|
85763
85783
|
}
|
|
85764
|
-
function checkGrammarForOmittedArgument(args) {
|
|
85765
|
-
if (args) {
|
|
85766
|
-
for (var _i = 0, args_4 = args; _i < args_4.length; _i++) {
|
|
85767
|
-
var arg = args_4[_i];
|
|
85768
|
-
if (arg.kind === 226 /* OmittedExpression */) {
|
|
85769
|
-
return grammarErrorAtPos(arg, arg.pos, 0, ts.Diagnostics.Argument_expression_expected);
|
|
85770
|
-
}
|
|
85771
|
-
}
|
|
85772
|
-
}
|
|
85773
|
-
return false;
|
|
85774
|
-
}
|
|
85775
|
-
function checkGrammarArguments(args) {
|
|
85776
|
-
return checkGrammarForOmittedArgument(args);
|
|
85777
|
-
}
|
|
85778
85784
|
function checkGrammarHeritageClause(node) {
|
|
85779
85785
|
var types = node.types;
|
|
85780
85786
|
if (checkGrammarForDisallowedTrailingComma(types)) {
|
|
@@ -85949,9 +85955,12 @@ var ts;
|
|
|
85949
85955
|
seen.set(effectiveName, currentKind);
|
|
85950
85956
|
}
|
|
85951
85957
|
else {
|
|
85952
|
-
if ((currentKind &
|
|
85958
|
+
if ((currentKind & 8 /* Method */) && (existingKind & 8 /* Method */)) {
|
|
85953
85959
|
grammarErrorOnNode(name, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name));
|
|
85954
85960
|
}
|
|
85961
|
+
else if ((currentKind & 4 /* PropertyAssignment */) && (existingKind & 4 /* PropertyAssignment */)) {
|
|
85962
|
+
grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_multiple_properties_with_the_same_name, ts.getTextOfNode(name));
|
|
85963
|
+
}
|
|
85955
85964
|
else if ((currentKind & 3 /* GetOrSetAccessor */) && (existingKind & 3 /* GetOrSetAccessor */)) {
|
|
85956
85965
|
if (existingKind !== 3 /* GetOrSetAccessor */ && currentKind !== existingKind) {
|
|
85957
85966
|
seen.set(effectiveName, currentKind | existingKind);
|
|
@@ -103019,7 +103028,7 @@ var ts;
|
|
|
103019
103028
|
if (ts.isIdentifier(node.expression)) {
|
|
103020
103029
|
var expression = substituteExpressionIdentifier(node.expression);
|
|
103021
103030
|
noSubstitution[ts.getNodeId(expression)] = true;
|
|
103022
|
-
if (!ts.isIdentifier(expression)) {
|
|
103031
|
+
if (!ts.isIdentifier(expression) && !(ts.getEmitFlags(node.expression) & 4096 /* HelperName */)) {
|
|
103023
103032
|
return ts.addEmitFlags(factory.updateCallExpression(node, expression,
|
|
103024
103033
|
/*typeArguments*/ undefined, node.arguments), 536870912 /* IndirectCall */);
|
|
103025
103034
|
}
|
|
@@ -103030,7 +103039,7 @@ var ts;
|
|
|
103030
103039
|
if (ts.isIdentifier(node.tag)) {
|
|
103031
103040
|
var tag = substituteExpressionIdentifier(node.tag);
|
|
103032
103041
|
noSubstitution[ts.getNodeId(tag)] = true;
|
|
103033
|
-
if (!ts.isIdentifier(tag)) {
|
|
103042
|
+
if (!ts.isIdentifier(tag) && !(ts.getEmitFlags(node.tag) & 4096 /* HelperName */)) {
|
|
103034
103043
|
return ts.addEmitFlags(factory.updateTaggedTemplateExpression(node, tag,
|
|
103035
103044
|
/*typeArguments*/ undefined, node.template), 536870912 /* IndirectCall */);
|
|
103036
103045
|
}
|
|
@@ -113656,6 +113665,7 @@ var ts;
|
|
|
113656
113665
|
ts.getImpliedNodeFormatForFile = getImpliedNodeFormatForFile;
|
|
113657
113666
|
/** @internal */
|
|
113658
113667
|
ts.plainJSErrors = new ts.Set([
|
|
113668
|
+
// binder errors
|
|
113659
113669
|
ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0.code,
|
|
113660
113670
|
ts.Diagnostics.A_module_cannot_have_multiple_default_exports.code,
|
|
113661
113671
|
ts.Diagnostics.Another_export_default_is_here.code,
|
|
@@ -113671,6 +113681,81 @@ var ts;
|
|
|
113671
113681
|
ts.Diagnostics.A_label_is_not_allowed_here.code,
|
|
113672
113682
|
ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode.code,
|
|
113673
113683
|
ts.Diagnostics.with_statements_are_not_allowed_in_strict_mode.code,
|
|
113684
|
+
// grammar errors
|
|
113685
|
+
ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement.code,
|
|
113686
|
+
ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement.code,
|
|
113687
|
+
ts.Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name.code,
|
|
113688
|
+
ts.Diagnostics.A_class_member_cannot_have_the_0_keyword.code,
|
|
113689
|
+
ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name.code,
|
|
113690
|
+
ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement.code,
|
|
113691
|
+
ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement.code,
|
|
113692
|
+
ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement.code,
|
|
113693
|
+
ts.Diagnostics.A_default_clause_cannot_appear_more_than_once_in_a_switch_statement.code,
|
|
113694
|
+
ts.Diagnostics.A_default_export_must_be_at_the_top_level_of_a_file_or_module_declaration.code,
|
|
113695
|
+
ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context.code,
|
|
113696
|
+
ts.Diagnostics.A_destructuring_declaration_must_have_an_initializer.code,
|
|
113697
|
+
ts.Diagnostics.A_get_accessor_cannot_have_parameters.code,
|
|
113698
|
+
ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern.code,
|
|
113699
|
+
ts.Diagnostics.A_rest_element_cannot_have_a_property_name.code,
|
|
113700
|
+
ts.Diagnostics.A_rest_element_cannot_have_an_initializer.code,
|
|
113701
|
+
ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern.code,
|
|
113702
|
+
ts.Diagnostics.A_rest_parameter_cannot_have_an_initializer.code,
|
|
113703
|
+
ts.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list.code,
|
|
113704
|
+
ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma.code,
|
|
113705
|
+
ts.Diagnostics.A_return_statement_can_only_be_used_within_a_function_body.code,
|
|
113706
|
+
ts.Diagnostics.A_return_statement_cannot_be_used_inside_a_class_static_block.code,
|
|
113707
|
+
ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter.code,
|
|
113708
|
+
ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter.code,
|
|
113709
|
+
ts.Diagnostics.An_export_declaration_can_only_be_used_in_a_module.code,
|
|
113710
|
+
ts.Diagnostics.An_export_declaration_cannot_have_modifiers.code,
|
|
113711
|
+
ts.Diagnostics.An_import_declaration_can_only_be_used_in_a_namespace_or_module.code,
|
|
113712
|
+
ts.Diagnostics.An_import_declaration_cannot_have_modifiers.code,
|
|
113713
|
+
ts.Diagnostics.An_object_member_cannot_be_declared_optional.code,
|
|
113714
|
+
ts.Diagnostics.Argument_of_dynamic_import_cannot_be_spread_element.code,
|
|
113715
|
+
ts.Diagnostics.Cannot_assign_to_private_method_0_Private_methods_are_not_writable.code,
|
|
113716
|
+
ts.Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause.code,
|
|
113717
|
+
ts.Diagnostics.Catch_clause_variable_cannot_have_an_initializer.code,
|
|
113718
|
+
ts.Diagnostics.Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_decorator.code,
|
|
113719
|
+
ts.Diagnostics.Classes_can_only_extend_a_single_class.code,
|
|
113720
|
+
ts.Diagnostics.Classes_may_not_have_a_field_named_constructor.code,
|
|
113721
|
+
ts.Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern.code,
|
|
113722
|
+
ts.Diagnostics.Duplicate_label_0.code,
|
|
113723
|
+
ts.Diagnostics.Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments.code,
|
|
113724
|
+
ts.Diagnostics.For_await_loops_cannot_be_used_inside_a_class_static_block.code,
|
|
113725
|
+
ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression.code,
|
|
113726
|
+
ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name.code,
|
|
113727
|
+
ts.Diagnostics.JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array.code,
|
|
113728
|
+
ts.Diagnostics.JSX_property_access_expressions_cannot_include_JSX_namespace_names.code,
|
|
113729
|
+
ts.Diagnostics.Jump_target_cannot_cross_function_boundary.code,
|
|
113730
|
+
ts.Diagnostics.Line_terminator_not_permitted_before_arrow.code,
|
|
113731
|
+
ts.Diagnostics.Modifiers_cannot_appear_here.code,
|
|
113732
|
+
ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement.code,
|
|
113733
|
+
ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement.code,
|
|
113734
|
+
ts.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies.code,
|
|
113735
|
+
ts.Diagnostics.Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression.code,
|
|
113736
|
+
ts.Diagnostics.Property_0_is_not_accessible_outside_class_1_because_it_has_a_private_identifier.code,
|
|
113737
|
+
ts.Diagnostics.Tagged_template_expressions_are_not_permitted_in_an_optional_chain.code,
|
|
113738
|
+
ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_may_not_be_async.code,
|
|
113739
|
+
ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer.code,
|
|
113740
|
+
ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer.code,
|
|
113741
|
+
ts.Diagnostics.Trailing_comma_not_allowed.code,
|
|
113742
|
+
ts.Diagnostics.Variable_declaration_list_cannot_be_empty.code,
|
|
113743
|
+
ts.Diagnostics._0_and_1_operations_cannot_be_mixed_without_parentheses.code,
|
|
113744
|
+
ts.Diagnostics._0_expected.code,
|
|
113745
|
+
ts.Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2.code,
|
|
113746
|
+
ts.Diagnostics._0_list_cannot_be_empty.code,
|
|
113747
|
+
ts.Diagnostics._0_modifier_already_seen.code,
|
|
113748
|
+
ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration.code,
|
|
113749
|
+
ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element.code,
|
|
113750
|
+
ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter.code,
|
|
113751
|
+
ts.Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind.code,
|
|
113752
|
+
ts.Diagnostics._0_modifier_cannot_be_used_here.code,
|
|
113753
|
+
ts.Diagnostics._0_modifier_must_precede_1_modifier.code,
|
|
113754
|
+
ts.Diagnostics.const_declarations_can_only_be_declared_inside_a_block.code,
|
|
113755
|
+
ts.Diagnostics.const_declarations_must_be_initialized.code,
|
|
113756
|
+
ts.Diagnostics.extends_clause_already_seen.code,
|
|
113757
|
+
ts.Diagnostics.let_declarations_can_only_be_declared_inside_a_block.code,
|
|
113758
|
+
ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations.code,
|
|
113674
113759
|
]);
|
|
113675
113760
|
/**
|
|
113676
113761
|
* Determine if source file needs to be re-created even if its text hasn't changed
|
|
@@ -114700,9 +114785,10 @@ var ts;
|
|
|
114700
114785
|
var includeBindAndCheckDiagnostics = !isTsNoCheck && (sourceFile.scriptKind === 3 /* TS */ || sourceFile.scriptKind === 4 /* TSX */
|
|
114701
114786
|
|| sourceFile.scriptKind === 5 /* External */ || isPlainJs || isCheckJs || sourceFile.scriptKind === 7 /* Deferred */);
|
|
114702
114787
|
var bindDiagnostics = includeBindAndCheckDiagnostics ? sourceFile.bindDiagnostics : ts.emptyArray;
|
|
114703
|
-
var checkDiagnostics = includeBindAndCheckDiagnostics
|
|
114788
|
+
var checkDiagnostics = includeBindAndCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : ts.emptyArray;
|
|
114704
114789
|
if (isPlainJs) {
|
|
114705
114790
|
bindDiagnostics = ts.filter(bindDiagnostics, function (d) { return ts.plainJSErrors.has(d.code); });
|
|
114791
|
+
checkDiagnostics = ts.filter(checkDiagnostics, function (d) { return ts.plainJSErrors.has(d.code); });
|
|
114706
114792
|
}
|
|
114707
114793
|
// skip ts-expect-error errors in plain JS files, and skip JSDoc errors except in checked JS
|
|
114708
114794
|
return getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics && !isPlainJs, bindDiagnostics, checkDiagnostics, isCheckJs ? sourceFile.jsDocDiagnostics : undefined);
|
|
@@ -119720,7 +119806,7 @@ var ts;
|
|
|
119720
119806
|
getCanonicalFileName: ts.createGetCanonicalFileName(ts.sys.useCaseSensitiveFileNames)
|
|
119721
119807
|
} : undefined;
|
|
119722
119808
|
/**
|
|
119723
|
-
* Create a function that reports error by writing to the system and handles the
|
|
119809
|
+
* Create a function that reports error by writing to the system and handles the formatting of the diagnostic
|
|
119724
119810
|
*/
|
|
119725
119811
|
function createDiagnosticReporter(system, pretty) {
|
|
119726
119812
|
var host = system === ts.sys && sysFormatDiagnosticsHost ? sysFormatDiagnosticsHost : {
|
|
@@ -119806,19 +119892,74 @@ var ts;
|
|
|
119806
119892
|
return ts.countWhere(diagnostics, function (diagnostic) { return diagnostic.category === ts.DiagnosticCategory.Error; });
|
|
119807
119893
|
}
|
|
119808
119894
|
ts.getErrorCountForSummary = getErrorCountForSummary;
|
|
119895
|
+
function getFilesInErrorForSummary(diagnostics) {
|
|
119896
|
+
var filesInError = ts.filter(diagnostics, function (diagnostic) { return diagnostic.category === ts.DiagnosticCategory.Error; })
|
|
119897
|
+
.map(function (errorDiagnostic) {
|
|
119898
|
+
if (errorDiagnostic.file === undefined)
|
|
119899
|
+
return;
|
|
119900
|
+
return "" + errorDiagnostic.file.fileName;
|
|
119901
|
+
});
|
|
119902
|
+
return filesInError.map(function (fileName) {
|
|
119903
|
+
var diagnosticForFileName = ts.find(diagnostics, function (diagnostic) {
|
|
119904
|
+
return diagnostic.file !== undefined && diagnostic.file.fileName === fileName;
|
|
119905
|
+
});
|
|
119906
|
+
if (diagnosticForFileName !== undefined) {
|
|
119907
|
+
var line = ts.getLineAndCharacterOfPosition(diagnosticForFileName.file, diagnosticForFileName.start).line;
|
|
119908
|
+
return {
|
|
119909
|
+
fileName: fileName,
|
|
119910
|
+
line: line + 1,
|
|
119911
|
+
};
|
|
119912
|
+
}
|
|
119913
|
+
});
|
|
119914
|
+
}
|
|
119915
|
+
ts.getFilesInErrorForSummary = getFilesInErrorForSummary;
|
|
119809
119916
|
function getWatchErrorSummaryDiagnosticMessage(errorCount) {
|
|
119810
119917
|
return errorCount === 1 ?
|
|
119811
119918
|
ts.Diagnostics.Found_1_error_Watching_for_file_changes :
|
|
119812
119919
|
ts.Diagnostics.Found_0_errors_Watching_for_file_changes;
|
|
119813
119920
|
}
|
|
119814
119921
|
ts.getWatchErrorSummaryDiagnosticMessage = getWatchErrorSummaryDiagnosticMessage;
|
|
119815
|
-
function getErrorSummaryText(errorCount, newLine) {
|
|
119922
|
+
function getErrorSummaryText(errorCount, filesInError, newLine) {
|
|
119816
119923
|
if (errorCount === 0)
|
|
119817
119924
|
return "";
|
|
119818
|
-
var
|
|
119819
|
-
|
|
119925
|
+
var nonNilFiles = filesInError.filter(function (fileInError) { return fileInError !== undefined; });
|
|
119926
|
+
var distinctFileNamesWithLines = nonNilFiles.map(function (fileInError) { return fileInError.fileName + ":" + fileInError.line; })
|
|
119927
|
+
.filter(function (value, index, self) { return self.indexOf(value) === index; });
|
|
119928
|
+
var d = errorCount === 1 ?
|
|
119929
|
+
ts.createCompilerDiagnostic(filesInError[0] !== undefined ?
|
|
119930
|
+
ts.Diagnostics.Found_1_error_in_1 :
|
|
119931
|
+
ts.Diagnostics.Found_1_error, errorCount, distinctFileNamesWithLines[0]) :
|
|
119932
|
+
ts.createCompilerDiagnostic(distinctFileNamesWithLines.length === 0 ?
|
|
119933
|
+
ts.Diagnostics.Found_0_errors :
|
|
119934
|
+
distinctFileNamesWithLines.length === 1 ?
|
|
119935
|
+
ts.Diagnostics.Found_0_errors_in_1_file :
|
|
119936
|
+
ts.Diagnostics.Found_0_errors_in_1_files, errorCount, distinctFileNamesWithLines.length);
|
|
119937
|
+
return "" + newLine + ts.flattenDiagnosticMessageText(d.messageText, newLine) + newLine + newLine + (errorCount > 1 ? createTabularErrorsDisplay(nonNilFiles) : "");
|
|
119820
119938
|
}
|
|
119821
119939
|
ts.getErrorSummaryText = getErrorSummaryText;
|
|
119940
|
+
function createTabularErrorsDisplay(filesInError) {
|
|
119941
|
+
var distinctFiles = filesInError.filter(function (value, index, self) { return index === self.findIndex(function (file) { return (file === null || file === void 0 ? void 0 : file.fileName) === (value === null || value === void 0 ? void 0 : value.fileName); }); });
|
|
119942
|
+
if (distinctFiles.length === 0)
|
|
119943
|
+
return "";
|
|
119944
|
+
var numberLength = function (num) { return Math.log(num) * Math.LOG10E + 1; };
|
|
119945
|
+
var fileToErrorCount = distinctFiles.map(function (file) { return [file, ts.countWhere(filesInError, function (fileInError) { return fileInError.fileName === file.fileName; })]; });
|
|
119946
|
+
var maxErrors = fileToErrorCount.reduce(function (acc, value) { return Math.max(acc, value[1] || 0); }, 0);
|
|
119947
|
+
var headerRow = ts.Diagnostics.Errors_Files.message;
|
|
119948
|
+
var leftColumnHeadingLength = headerRow.split(" ")[0].length;
|
|
119949
|
+
var leftPaddingGoal = Math.max(leftColumnHeadingLength, numberLength(maxErrors));
|
|
119950
|
+
var headerPadding = Math.max(numberLength(maxErrors) - leftColumnHeadingLength, 0);
|
|
119951
|
+
var tabularData = "";
|
|
119952
|
+
tabularData += " ".repeat(headerPadding) + headerRow + "\n";
|
|
119953
|
+
fileToErrorCount.forEach(function (row) {
|
|
119954
|
+
var file = row[0], errorCount = row[1];
|
|
119955
|
+
var errorCountDigitsLength = Math.log(errorCount) * Math.LOG10E + 1 | 0;
|
|
119956
|
+
var leftPadding = errorCountDigitsLength < leftPaddingGoal ?
|
|
119957
|
+
" ".repeat(leftPaddingGoal - errorCountDigitsLength)
|
|
119958
|
+
: "";
|
|
119959
|
+
tabularData += "" + leftPadding + errorCount + " " + file.fileName + ":" + file.line + "\n";
|
|
119960
|
+
});
|
|
119961
|
+
return tabularData;
|
|
119962
|
+
}
|
|
119822
119963
|
function isBuilderProgram(program) {
|
|
119823
119964
|
return !!program.getState;
|
|
119824
119965
|
}
|
|
@@ -120022,7 +120163,7 @@ var ts;
|
|
|
120022
120163
|
listFiles(program, write);
|
|
120023
120164
|
}
|
|
120024
120165
|
if (reportSummary) {
|
|
120025
|
-
reportSummary(getErrorCountForSummary(diagnostics));
|
|
120166
|
+
reportSummary(getErrorCountForSummary(diagnostics), getFilesInErrorForSummary(diagnostics));
|
|
120026
120167
|
}
|
|
120027
120168
|
return {
|
|
120028
120169
|
emitResult: emitResult,
|
|
@@ -120233,7 +120374,7 @@ var ts;
|
|
|
120233
120374
|
var system = input.system || ts.sys;
|
|
120234
120375
|
var host = input.host || (input.host = ts.createIncrementalCompilerHost(input.options, system));
|
|
120235
120376
|
var builderProgram = ts.createIncrementalProgram(input);
|
|
120236
|
-
var exitStatus = emitFilesAndReportErrorsAndGetExitStatus(builderProgram, input.reportDiagnostic || createDiagnosticReporter(system), function (s) { return host.trace && host.trace(s); }, input.reportErrorSummary || input.options.pretty ? function (errorCount) { return system.write(getErrorSummaryText(errorCount, system.newLine)); } : undefined);
|
|
120377
|
+
var exitStatus = emitFilesAndReportErrorsAndGetExitStatus(builderProgram, input.reportDiagnostic || createDiagnosticReporter(system), function (s) { return host.trace && host.trace(s); }, input.reportErrorSummary || input.options.pretty ? function (errorCount, filesInError) { return system.write(getErrorSummaryText(errorCount, filesInError, system.newLine)); } : undefined);
|
|
120237
120378
|
if (input.afterProgramEmitAndDiagnostics)
|
|
120238
120379
|
input.afterProgramEmitAndDiagnostics(builderProgram);
|
|
120239
120380
|
return exitStatus;
|
|
@@ -122452,11 +122593,14 @@ var ts;
|
|
|
122452
122593
|
var canReportSummary = state.watch || !!state.host.reportErrorSummary;
|
|
122453
122594
|
var diagnostics = state.diagnostics;
|
|
122454
122595
|
var totalErrors = 0;
|
|
122596
|
+
var filesInError = [];
|
|
122455
122597
|
if (isCircularBuildOrder(buildOrder)) {
|
|
122456
122598
|
reportBuildQueue(state, buildOrder.buildOrder);
|
|
122457
122599
|
reportErrors(state, buildOrder.circularDiagnostics);
|
|
122458
122600
|
if (canReportSummary)
|
|
122459
122601
|
totalErrors += ts.getErrorCountForSummary(buildOrder.circularDiagnostics);
|
|
122602
|
+
if (canReportSummary)
|
|
122603
|
+
filesInError = __spreadArray(__spreadArray([], filesInError, true), ts.getFilesInErrorForSummary(buildOrder.circularDiagnostics), true);
|
|
122460
122604
|
}
|
|
122461
122605
|
else {
|
|
122462
122606
|
// Report errors from the other projects
|
|
@@ -122468,12 +122612,14 @@ var ts;
|
|
|
122468
122612
|
});
|
|
122469
122613
|
if (canReportSummary)
|
|
122470
122614
|
diagnostics.forEach(function (singleProjectErrors) { return totalErrors += ts.getErrorCountForSummary(singleProjectErrors); });
|
|
122615
|
+
if (canReportSummary)
|
|
122616
|
+
diagnostics.forEach(function (singleProjectErrors) { return __spreadArray(__spreadArray([], filesInError, true), ts.getFilesInErrorForSummary(singleProjectErrors), true); });
|
|
122471
122617
|
}
|
|
122472
122618
|
if (state.watch) {
|
|
122473
122619
|
reportWatchStatus(state, ts.getWatchErrorSummaryDiagnosticMessage(totalErrors), totalErrors);
|
|
122474
122620
|
}
|
|
122475
122621
|
else if (state.host.reportErrorSummary) {
|
|
122476
|
-
state.host.reportErrorSummary(totalErrors);
|
|
122622
|
+
state.host.reportErrorSummary(totalErrors, filesInError);
|
|
122477
122623
|
}
|
|
122478
122624
|
}
|
|
122479
122625
|
/**
|
|
@@ -127330,6 +127476,9 @@ var ts;
|
|
|
127330
127476
|
}
|
|
127331
127477
|
return;
|
|
127332
127478
|
}
|
|
127479
|
+
if (ts.isConstTypeReference(token.parent)) {
|
|
127480
|
+
return 3 /* keyword */;
|
|
127481
|
+
}
|
|
127333
127482
|
}
|
|
127334
127483
|
return 2 /* identifier */;
|
|
127335
127484
|
}
|
|
@@ -131150,8 +131299,10 @@ var ts;
|
|
|
131150
131299
|
}
|
|
131151
131300
|
/** Get the corresponding JSDocTag node if the position is in a jsDoc comment */
|
|
131152
131301
|
function getJsDocTagAtPosition(node, position) {
|
|
131153
|
-
|
|
131154
|
-
|
|
131302
|
+
return ts.findAncestor(node, function (n) {
|
|
131303
|
+
return ts.isJSDocTag(n) && ts.rangeContainsPosition(n, position) ? true :
|
|
131304
|
+
ts.isJSDoc(n) ? "quit" : false;
|
|
131305
|
+
});
|
|
131155
131306
|
}
|
|
131156
131307
|
function getPropertiesForObjectExpression(contextualType, completionsType, obj, checker) {
|
|
131157
131308
|
var hasCompletionsType = completionsType && completionsType !== contextualType;
|
|
@@ -140907,7 +141058,7 @@ var ts;
|
|
|
140907
141058
|
displayParts.push(ts.spacePart());
|
|
140908
141059
|
displayParts.push(ts.operatorPart(63 /* EqualsToken */));
|
|
140909
141060
|
displayParts.push(ts.spacePart());
|
|
140910
|
-
ts.addRange(displayParts, ts.typeToDisplayParts(typeChecker, typeChecker.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration, 8388608 /* InTypeAlias */));
|
|
141061
|
+
ts.addRange(displayParts, ts.typeToDisplayParts(typeChecker, ts.isConstTypeReference(location.parent) ? typeChecker.getTypeAtLocation(location.parent) : typeChecker.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration, 8388608 /* InTypeAlias */));
|
|
140911
141062
|
}
|
|
140912
141063
|
if (symbolFlags & 384 /* Enum */) {
|
|
140913
141064
|
prefixNextMeaning();
|
package/lib/tsserverlibrary.d.ts
CHANGED
|
@@ -5352,7 +5352,11 @@ declare namespace ts {
|
|
|
5352
5352
|
traceResolution?: boolean;
|
|
5353
5353
|
[option: string]: CompilerOptionsValue | undefined;
|
|
5354
5354
|
}
|
|
5355
|
-
type ReportEmitErrorSummary = (errorCount: number) => void;
|
|
5355
|
+
type ReportEmitErrorSummary = (errorCount: number, filesInError: (ReportFileInError | undefined)[]) => void;
|
|
5356
|
+
interface ReportFileInError {
|
|
5357
|
+
fileName: string;
|
|
5358
|
+
line: number;
|
|
5359
|
+
}
|
|
5356
5360
|
interface SolutionBuilderHostBase<T extends BuilderProgram> extends ProgramHost<T> {
|
|
5357
5361
|
createDirectory?(path: string): void;
|
|
5358
5362
|
/**
|