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/tsserverlibrary.js
CHANGED
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20211210";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -8131,7 +8131,7 @@ var ts;
|
|
|
8131
8131
|
Duplicate_label_0: diag(1114, ts.DiagnosticCategory.Error, "Duplicate_label_0_1114", "Duplicate label '{0}'."),
|
|
8132
8132
|
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."),
|
|
8133
8133
|
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."),
|
|
8134
|
-
|
|
8134
|
+
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."),
|
|
8135
8135
|
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."),
|
|
8136
8136
|
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."),
|
|
8137
8137
|
An_export_assignment_cannot_have_modifiers: diag(1120, ts.DiagnosticCategory.Error, "An_export_assignment_cannot_have_modifiers_1120", "An export assignment cannot have modifiers."),
|
|
@@ -9083,6 +9083,7 @@ var ts;
|
|
|
9083
9083
|
DIRECTORY: diag(6038, ts.DiagnosticCategory.Message, "DIRECTORY_6038", "DIRECTORY"),
|
|
9084
9084
|
STRATEGY: diag(6039, ts.DiagnosticCategory.Message, "STRATEGY_6039", "STRATEGY"),
|
|
9085
9085
|
FILE_OR_DIRECTORY: diag(6040, ts.DiagnosticCategory.Message, "FILE_OR_DIRECTORY_6040", "FILE OR DIRECTORY"),
|
|
9086
|
+
Errors_Files: diag(6041, ts.DiagnosticCategory.Message, "Errors_Files_6041", "Errors Files"),
|
|
9086
9087
|
Generates_corresponding_map_file: diag(6043, ts.DiagnosticCategory.Message, "Generates_corresponding_map_file_6043", "Generates corresponding '.map' file."),
|
|
9087
9088
|
Compiler_option_0_expects_an_argument: diag(6044, ts.DiagnosticCategory.Error, "Compiler_option_0_expects_an_argument_6044", "Compiler option '{0}' expects an argument."),
|
|
9088
9089
|
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}'."),
|
|
@@ -9276,6 +9277,9 @@ var ts;
|
|
|
9276
9277
|
Output_Formatting: diag(6256, ts.DiagnosticCategory.Message, "Output_Formatting_6256", "Output Formatting"),
|
|
9277
9278
|
Completeness: diag(6257, ts.DiagnosticCategory.Message, "Completeness_6257", "Completeness"),
|
|
9278
9279
|
_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"),
|
|
9280
|
+
Found_1_error_in_1: diag(6259, ts.DiagnosticCategory.Message, "Found_1_error_in_1_6259", "Found 1 error in {1}"),
|
|
9281
|
+
Found_0_errors_in_1_file: diag(6260, ts.DiagnosticCategory.Message, "Found_0_errors_in_1_file_6260", "Found {0} errors in 1 file."),
|
|
9282
|
+
Found_0_errors_in_1_files: diag(6261, ts.DiagnosticCategory.Message, "Found_0_errors_in_1_files_6261", "Found {0} errors in {1} files."),
|
|
9279
9283
|
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."),
|
|
9280
9284
|
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}'."),
|
|
9281
9285
|
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."),
|
|
@@ -24628,7 +24632,7 @@ var ts;
|
|
|
24628
24632
|
// @api
|
|
24629
24633
|
function createAssertClause(elements, multiLine) {
|
|
24630
24634
|
var node = createBaseNode(292 /* AssertClause */);
|
|
24631
|
-
node.elements = elements;
|
|
24635
|
+
node.elements = createNodeArray(elements);
|
|
24632
24636
|
node.multiLine = multiLine;
|
|
24633
24637
|
node.transformFlags |= 4 /* ContainsESNext */;
|
|
24634
24638
|
return node;
|
|
@@ -33814,10 +33818,14 @@ var ts;
|
|
|
33814
33818
|
// - "(x,y)" is a comma expression parsed as a signature with two parameters.
|
|
33815
33819
|
// - "a ? (b): c" will have "(b):" parsed as a signature with a return type annotation.
|
|
33816
33820
|
// - "a ? (b): function() {}" will too, since function() is a valid JSDoc function type.
|
|
33817
|
-
// - "a ? (b): (function() {})" as well, but inside of a parenthesized type.
|
|
33821
|
+
// - "a ? (b): (function() {})" as well, but inside of a parenthesized type with an arbitrary amount of nesting.
|
|
33818
33822
|
//
|
|
33819
33823
|
// So we need just a bit of lookahead to ensure that it can only be a signature.
|
|
33820
|
-
var
|
|
33824
|
+
var unwrappedType = type;
|
|
33825
|
+
while ((unwrappedType === null || unwrappedType === void 0 ? void 0 : unwrappedType.kind) === 190 /* ParenthesizedType */) {
|
|
33826
|
+
unwrappedType = unwrappedType.type; // Skip parens if need be
|
|
33827
|
+
}
|
|
33828
|
+
var hasJSDocFunctionType = unwrappedType && ts.isJSDocFunctionType(unwrappedType);
|
|
33821
33829
|
if (!allowAmbiguity && token() !== 38 /* EqualsGreaterThanToken */ && (hasJSDocFunctionType || token() !== 18 /* OpenBraceToken */)) {
|
|
33822
33830
|
// Returning undefined here will cause our caller to rewind to where we started from.
|
|
33823
33831
|
return undefined;
|
|
@@ -45148,10 +45156,6 @@ var ts;
|
|
|
45148
45156
|
seen.set(identifier.escapedText, currentKind);
|
|
45149
45157
|
continue;
|
|
45150
45158
|
}
|
|
45151
|
-
if (currentKind === 1 /* Property */ && existingKind === 1 /* Property */) {
|
|
45152
|
-
var span = ts.getErrorSpanForNode(file, identifier);
|
|
45153
|
-
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));
|
|
45154
|
-
}
|
|
45155
45159
|
}
|
|
45156
45160
|
}
|
|
45157
45161
|
return bindAnonymousDeclaration(node, 4096 /* ObjectLiteral */, "__object" /* Object */);
|
|
@@ -45385,7 +45389,7 @@ var ts;
|
|
|
45385
45389
|
}
|
|
45386
45390
|
}
|
|
45387
45391
|
function checkStrictModeNumericLiteral(node) {
|
|
45388
|
-
if (inStrictMode && node.numericLiteralFlags & 32 /* Octal */) {
|
|
45392
|
+
if (languageVersion < 1 /* ES5 */ && inStrictMode && node.numericLiteralFlags & 32 /* Octal */) {
|
|
45389
45393
|
file.bindDiagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode));
|
|
45390
45394
|
}
|
|
45391
45395
|
}
|
|
@@ -48990,10 +48994,12 @@ var ts;
|
|
|
48990
48994
|
}
|
|
48991
48995
|
/* Starting from 'initial' node walk up the parent chain until 'stopAt' node is reached.
|
|
48992
48996
|
* If at any point current node is equal to 'parent' node - return true.
|
|
48997
|
+
* If current node is an IIFE, continue walking up.
|
|
48993
48998
|
* Return false if 'stopAt' node is reached or isFunctionLike(current) === true.
|
|
48994
48999
|
*/
|
|
48995
49000
|
function isSameScopeDescendentOf(initial, parent, stopAt) {
|
|
48996
|
-
return !!parent && !!ts.findAncestor(initial, function (n) { return n ===
|
|
49001
|
+
return !!parent && !!ts.findAncestor(initial, function (n) { return n === parent
|
|
49002
|
+
|| (n === stopAt || ts.isFunctionLike(n) && !ts.getImmediatelyInvokedFunctionExpression(n) ? "quit" : false); });
|
|
48997
49003
|
}
|
|
48998
49004
|
function getAnyImportSyntax(node) {
|
|
48999
49005
|
switch (node.kind) {
|
|
@@ -54247,7 +54253,27 @@ var ts;
|
|
|
54247
54253
|
return mapType(source, function (t) { return getRestType(t, properties, symbol); });
|
|
54248
54254
|
}
|
|
54249
54255
|
var omitKeyType = getUnionType(ts.map(properties, getLiteralTypeFromPropertyName));
|
|
54256
|
+
var spreadableProperties = [];
|
|
54257
|
+
var unspreadableToRestKeys = [];
|
|
54258
|
+
for (var _i = 0, _a = getPropertiesOfType(source); _i < _a.length; _i++) {
|
|
54259
|
+
var prop = _a[_i];
|
|
54260
|
+
var literalTypeFromProperty = getLiteralTypeFromProperty(prop, 8576 /* StringOrNumberLiteralOrUnique */);
|
|
54261
|
+
if (!isTypeAssignableTo(literalTypeFromProperty, omitKeyType)
|
|
54262
|
+
&& !(ts.getDeclarationModifierFlagsFromSymbol(prop) & (8 /* Private */ | 16 /* Protected */))
|
|
54263
|
+
&& isSpreadableProperty(prop)) {
|
|
54264
|
+
spreadableProperties.push(prop);
|
|
54265
|
+
}
|
|
54266
|
+
else {
|
|
54267
|
+
unspreadableToRestKeys.push(literalTypeFromProperty);
|
|
54268
|
+
}
|
|
54269
|
+
}
|
|
54250
54270
|
if (isGenericObjectType(source) || isGenericIndexType(omitKeyType)) {
|
|
54271
|
+
if (unspreadableToRestKeys.length) {
|
|
54272
|
+
// If the type we're spreading from has properties that cannot
|
|
54273
|
+
// be spread into the rest type (e.g. getters, methods), ensure
|
|
54274
|
+
// they are explicitly omitted, as they would in the non-generic case.
|
|
54275
|
+
omitKeyType = getUnionType(__spreadArray([omitKeyType], unspreadableToRestKeys, true));
|
|
54276
|
+
}
|
|
54251
54277
|
if (omitKeyType.flags & 131072 /* Never */) {
|
|
54252
54278
|
return source;
|
|
54253
54279
|
}
|
|
@@ -54258,13 +54284,9 @@ var ts;
|
|
|
54258
54284
|
return getTypeAliasInstantiation(omitTypeAlias, [source, omitKeyType]);
|
|
54259
54285
|
}
|
|
54260
54286
|
var members = ts.createSymbolTable();
|
|
54261
|
-
for (var
|
|
54262
|
-
var prop =
|
|
54263
|
-
|
|
54264
|
-
&& !(ts.getDeclarationModifierFlagsFromSymbol(prop) & (8 /* Private */ | 16 /* Protected */))
|
|
54265
|
-
&& isSpreadableProperty(prop)) {
|
|
54266
|
-
members.set(prop.escapedName, getSpreadSymbol(prop, /*readonly*/ false));
|
|
54267
|
-
}
|
|
54287
|
+
for (var _b = 0, spreadableProperties_1 = spreadableProperties; _b < spreadableProperties_1.length; _b++) {
|
|
54288
|
+
var prop = spreadableProperties_1[_b];
|
|
54289
|
+
members.set(prop.escapedName, getSpreadSymbol(prop, /*readonly*/ false));
|
|
54268
54290
|
}
|
|
54269
54291
|
var result = createAnonymousType(symbol, members, ts.emptyArray, ts.emptyArray, getIndexInfosOfType(source));
|
|
54270
54292
|
result.objectFlags |= 8388608 /* ObjectRestType */;
|
|
@@ -65775,7 +65797,7 @@ var ts;
|
|
|
65775
65797
|
}
|
|
65776
65798
|
function getBaseTypeOfLiteralType(type) {
|
|
65777
65799
|
return type.flags & 1024 /* EnumLiteral */ ? getBaseTypeOfEnumLiteralType(type) :
|
|
65778
|
-
type.flags & 128 /* StringLiteral */ ? stringType :
|
|
65800
|
+
type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ? stringType :
|
|
65779
65801
|
type.flags & 256 /* NumberLiteral */ ? numberType :
|
|
65780
65802
|
type.flags & 2048 /* BigIntLiteral */ ? bigintType :
|
|
65781
65803
|
type.flags & 512 /* BooleanLiteral */ ? booleanType :
|
|
@@ -74531,7 +74553,7 @@ var ts;
|
|
|
74531
74553
|
typeArguments.pop();
|
|
74532
74554
|
}
|
|
74533
74555
|
while (typeArguments.length < typeParameters.length) {
|
|
74534
|
-
typeArguments.push(getConstraintOfTypeParameter(typeParameters[typeArguments.length]) || getDefaultTypeArgumentType(isJs));
|
|
74556
|
+
typeArguments.push(getDefaultFromTypeParameter(typeParameters[typeArguments.length]) || getConstraintOfTypeParameter(typeParameters[typeArguments.length]) || getDefaultTypeArgumentType(isJs));
|
|
74535
74557
|
}
|
|
74536
74558
|
return typeArguments;
|
|
74537
74559
|
}
|
|
@@ -75187,8 +75209,7 @@ var ts;
|
|
|
75187
75209
|
*/
|
|
75188
75210
|
function checkCallExpression(node, checkMode) {
|
|
75189
75211
|
var _a;
|
|
75190
|
-
|
|
75191
|
-
checkGrammarArguments(node.arguments);
|
|
75212
|
+
checkGrammarTypeArguments(node, node.typeArguments);
|
|
75192
75213
|
var signature = getResolvedSignature(node, /*candidatesOutArray*/ undefined, checkMode);
|
|
75193
75214
|
if (signature === resolvingSignature) {
|
|
75194
75215
|
// CheckMode.SkipGenericFunctions is enabled and this is a call to a generic function that
|
|
@@ -75293,8 +75314,7 @@ var ts;
|
|
|
75293
75314
|
}
|
|
75294
75315
|
function checkImportCallExpression(node) {
|
|
75295
75316
|
// Check grammar of dynamic import
|
|
75296
|
-
|
|
75297
|
-
checkGrammarImportCallExpression(node);
|
|
75317
|
+
checkGrammarImportCallExpression(node);
|
|
75298
75318
|
if (node.arguments.length === 0) {
|
|
75299
75319
|
return createPromiseReturnType(node, anyType);
|
|
75300
75320
|
}
|
|
@@ -85955,20 +85975,6 @@ var ts;
|
|
|
85955
85975
|
}
|
|
85956
85976
|
return false;
|
|
85957
85977
|
}
|
|
85958
|
-
function checkGrammarForOmittedArgument(args) {
|
|
85959
|
-
if (args) {
|
|
85960
|
-
for (var _i = 0, args_4 = args; _i < args_4.length; _i++) {
|
|
85961
|
-
var arg = args_4[_i];
|
|
85962
|
-
if (arg.kind === 226 /* OmittedExpression */) {
|
|
85963
|
-
return grammarErrorAtPos(arg, arg.pos, 0, ts.Diagnostics.Argument_expression_expected);
|
|
85964
|
-
}
|
|
85965
|
-
}
|
|
85966
|
-
}
|
|
85967
|
-
return false;
|
|
85968
|
-
}
|
|
85969
|
-
function checkGrammarArguments(args) {
|
|
85970
|
-
return checkGrammarForOmittedArgument(args);
|
|
85971
|
-
}
|
|
85972
85978
|
function checkGrammarHeritageClause(node) {
|
|
85973
85979
|
var types = node.types;
|
|
85974
85980
|
if (checkGrammarForDisallowedTrailingComma(types)) {
|
|
@@ -86143,9 +86149,12 @@ var ts;
|
|
|
86143
86149
|
seen.set(effectiveName, currentKind);
|
|
86144
86150
|
}
|
|
86145
86151
|
else {
|
|
86146
|
-
if ((currentKind &
|
|
86152
|
+
if ((currentKind & 8 /* Method */) && (existingKind & 8 /* Method */)) {
|
|
86147
86153
|
grammarErrorOnNode(name, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name));
|
|
86148
86154
|
}
|
|
86155
|
+
else if ((currentKind & 4 /* PropertyAssignment */) && (existingKind & 4 /* PropertyAssignment */)) {
|
|
86156
|
+
grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_multiple_properties_with_the_same_name, ts.getTextOfNode(name));
|
|
86157
|
+
}
|
|
86149
86158
|
else if ((currentKind & 3 /* GetOrSetAccessor */) && (existingKind & 3 /* GetOrSetAccessor */)) {
|
|
86150
86159
|
if (existingKind !== 3 /* GetOrSetAccessor */ && currentKind !== existingKind) {
|
|
86151
86160
|
seen.set(effectiveName, currentKind | existingKind);
|
|
@@ -103213,7 +103222,7 @@ var ts;
|
|
|
103213
103222
|
if (ts.isIdentifier(node.expression)) {
|
|
103214
103223
|
var expression = substituteExpressionIdentifier(node.expression);
|
|
103215
103224
|
noSubstitution[ts.getNodeId(expression)] = true;
|
|
103216
|
-
if (!ts.isIdentifier(expression)) {
|
|
103225
|
+
if (!ts.isIdentifier(expression) && !(ts.getEmitFlags(node.expression) & 4096 /* HelperName */)) {
|
|
103217
103226
|
return ts.addEmitFlags(factory.updateCallExpression(node, expression,
|
|
103218
103227
|
/*typeArguments*/ undefined, node.arguments), 536870912 /* IndirectCall */);
|
|
103219
103228
|
}
|
|
@@ -103224,7 +103233,7 @@ var ts;
|
|
|
103224
103233
|
if (ts.isIdentifier(node.tag)) {
|
|
103225
103234
|
var tag = substituteExpressionIdentifier(node.tag);
|
|
103226
103235
|
noSubstitution[ts.getNodeId(tag)] = true;
|
|
103227
|
-
if (!ts.isIdentifier(tag)) {
|
|
103236
|
+
if (!ts.isIdentifier(tag) && !(ts.getEmitFlags(node.tag) & 4096 /* HelperName */)) {
|
|
103228
103237
|
return ts.addEmitFlags(factory.updateTaggedTemplateExpression(node, tag,
|
|
103229
103238
|
/*typeArguments*/ undefined, node.template), 536870912 /* IndirectCall */);
|
|
103230
103239
|
}
|
|
@@ -113850,6 +113859,7 @@ var ts;
|
|
|
113850
113859
|
ts.getImpliedNodeFormatForFile = getImpliedNodeFormatForFile;
|
|
113851
113860
|
/** @internal */
|
|
113852
113861
|
ts.plainJSErrors = new ts.Set([
|
|
113862
|
+
// binder errors
|
|
113853
113863
|
ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0.code,
|
|
113854
113864
|
ts.Diagnostics.A_module_cannot_have_multiple_default_exports.code,
|
|
113855
113865
|
ts.Diagnostics.Another_export_default_is_here.code,
|
|
@@ -113865,6 +113875,81 @@ var ts;
|
|
|
113865
113875
|
ts.Diagnostics.A_label_is_not_allowed_here.code,
|
|
113866
113876
|
ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode.code,
|
|
113867
113877
|
ts.Diagnostics.with_statements_are_not_allowed_in_strict_mode.code,
|
|
113878
|
+
// grammar errors
|
|
113879
|
+
ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement.code,
|
|
113880
|
+
ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement.code,
|
|
113881
|
+
ts.Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name.code,
|
|
113882
|
+
ts.Diagnostics.A_class_member_cannot_have_the_0_keyword.code,
|
|
113883
|
+
ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name.code,
|
|
113884
|
+
ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement.code,
|
|
113885
|
+
ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement.code,
|
|
113886
|
+
ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement.code,
|
|
113887
|
+
ts.Diagnostics.A_default_clause_cannot_appear_more_than_once_in_a_switch_statement.code,
|
|
113888
|
+
ts.Diagnostics.A_default_export_must_be_at_the_top_level_of_a_file_or_module_declaration.code,
|
|
113889
|
+
ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context.code,
|
|
113890
|
+
ts.Diagnostics.A_destructuring_declaration_must_have_an_initializer.code,
|
|
113891
|
+
ts.Diagnostics.A_get_accessor_cannot_have_parameters.code,
|
|
113892
|
+
ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern.code,
|
|
113893
|
+
ts.Diagnostics.A_rest_element_cannot_have_a_property_name.code,
|
|
113894
|
+
ts.Diagnostics.A_rest_element_cannot_have_an_initializer.code,
|
|
113895
|
+
ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern.code,
|
|
113896
|
+
ts.Diagnostics.A_rest_parameter_cannot_have_an_initializer.code,
|
|
113897
|
+
ts.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list.code,
|
|
113898
|
+
ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma.code,
|
|
113899
|
+
ts.Diagnostics.A_return_statement_can_only_be_used_within_a_function_body.code,
|
|
113900
|
+
ts.Diagnostics.A_return_statement_cannot_be_used_inside_a_class_static_block.code,
|
|
113901
|
+
ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter.code,
|
|
113902
|
+
ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter.code,
|
|
113903
|
+
ts.Diagnostics.An_export_declaration_can_only_be_used_in_a_module.code,
|
|
113904
|
+
ts.Diagnostics.An_export_declaration_cannot_have_modifiers.code,
|
|
113905
|
+
ts.Diagnostics.An_import_declaration_can_only_be_used_in_a_namespace_or_module.code,
|
|
113906
|
+
ts.Diagnostics.An_import_declaration_cannot_have_modifiers.code,
|
|
113907
|
+
ts.Diagnostics.An_object_member_cannot_be_declared_optional.code,
|
|
113908
|
+
ts.Diagnostics.Argument_of_dynamic_import_cannot_be_spread_element.code,
|
|
113909
|
+
ts.Diagnostics.Cannot_assign_to_private_method_0_Private_methods_are_not_writable.code,
|
|
113910
|
+
ts.Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause.code,
|
|
113911
|
+
ts.Diagnostics.Catch_clause_variable_cannot_have_an_initializer.code,
|
|
113912
|
+
ts.Diagnostics.Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_decorator.code,
|
|
113913
|
+
ts.Diagnostics.Classes_can_only_extend_a_single_class.code,
|
|
113914
|
+
ts.Diagnostics.Classes_may_not_have_a_field_named_constructor.code,
|
|
113915
|
+
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,
|
|
113916
|
+
ts.Diagnostics.Duplicate_label_0.code,
|
|
113917
|
+
ts.Diagnostics.Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments.code,
|
|
113918
|
+
ts.Diagnostics.For_await_loops_cannot_be_used_inside_a_class_static_block.code,
|
|
113919
|
+
ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression.code,
|
|
113920
|
+
ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name.code,
|
|
113921
|
+
ts.Diagnostics.JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array.code,
|
|
113922
|
+
ts.Diagnostics.JSX_property_access_expressions_cannot_include_JSX_namespace_names.code,
|
|
113923
|
+
ts.Diagnostics.Jump_target_cannot_cross_function_boundary.code,
|
|
113924
|
+
ts.Diagnostics.Line_terminator_not_permitted_before_arrow.code,
|
|
113925
|
+
ts.Diagnostics.Modifiers_cannot_appear_here.code,
|
|
113926
|
+
ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement.code,
|
|
113927
|
+
ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement.code,
|
|
113928
|
+
ts.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies.code,
|
|
113929
|
+
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,
|
|
113930
|
+
ts.Diagnostics.Property_0_is_not_accessible_outside_class_1_because_it_has_a_private_identifier.code,
|
|
113931
|
+
ts.Diagnostics.Tagged_template_expressions_are_not_permitted_in_an_optional_chain.code,
|
|
113932
|
+
ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_may_not_be_async.code,
|
|
113933
|
+
ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer.code,
|
|
113934
|
+
ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer.code,
|
|
113935
|
+
ts.Diagnostics.Trailing_comma_not_allowed.code,
|
|
113936
|
+
ts.Diagnostics.Variable_declaration_list_cannot_be_empty.code,
|
|
113937
|
+
ts.Diagnostics._0_and_1_operations_cannot_be_mixed_without_parentheses.code,
|
|
113938
|
+
ts.Diagnostics._0_expected.code,
|
|
113939
|
+
ts.Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2.code,
|
|
113940
|
+
ts.Diagnostics._0_list_cannot_be_empty.code,
|
|
113941
|
+
ts.Diagnostics._0_modifier_already_seen.code,
|
|
113942
|
+
ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration.code,
|
|
113943
|
+
ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element.code,
|
|
113944
|
+
ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter.code,
|
|
113945
|
+
ts.Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind.code,
|
|
113946
|
+
ts.Diagnostics._0_modifier_cannot_be_used_here.code,
|
|
113947
|
+
ts.Diagnostics._0_modifier_must_precede_1_modifier.code,
|
|
113948
|
+
ts.Diagnostics.const_declarations_can_only_be_declared_inside_a_block.code,
|
|
113949
|
+
ts.Diagnostics.const_declarations_must_be_initialized.code,
|
|
113950
|
+
ts.Diagnostics.extends_clause_already_seen.code,
|
|
113951
|
+
ts.Diagnostics.let_declarations_can_only_be_declared_inside_a_block.code,
|
|
113952
|
+
ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations.code,
|
|
113868
113953
|
]);
|
|
113869
113954
|
/**
|
|
113870
113955
|
* Determine if source file needs to be re-created even if its text hasn't changed
|
|
@@ -114894,9 +114979,10 @@ var ts;
|
|
|
114894
114979
|
var includeBindAndCheckDiagnostics = !isTsNoCheck && (sourceFile.scriptKind === 3 /* TS */ || sourceFile.scriptKind === 4 /* TSX */
|
|
114895
114980
|
|| sourceFile.scriptKind === 5 /* External */ || isPlainJs || isCheckJs || sourceFile.scriptKind === 7 /* Deferred */);
|
|
114896
114981
|
var bindDiagnostics = includeBindAndCheckDiagnostics ? sourceFile.bindDiagnostics : ts.emptyArray;
|
|
114897
|
-
var checkDiagnostics = includeBindAndCheckDiagnostics
|
|
114982
|
+
var checkDiagnostics = includeBindAndCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : ts.emptyArray;
|
|
114898
114983
|
if (isPlainJs) {
|
|
114899
114984
|
bindDiagnostics = ts.filter(bindDiagnostics, function (d) { return ts.plainJSErrors.has(d.code); });
|
|
114985
|
+
checkDiagnostics = ts.filter(checkDiagnostics, function (d) { return ts.plainJSErrors.has(d.code); });
|
|
114900
114986
|
}
|
|
114901
114987
|
// skip ts-expect-error errors in plain JS files, and skip JSDoc errors except in checked JS
|
|
114902
114988
|
return getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics && !isPlainJs, bindDiagnostics, checkDiagnostics, isCheckJs ? sourceFile.jsDocDiagnostics : undefined);
|
|
@@ -119914,7 +120000,7 @@ var ts;
|
|
|
119914
120000
|
getCanonicalFileName: ts.createGetCanonicalFileName(ts.sys.useCaseSensitiveFileNames)
|
|
119915
120001
|
} : undefined;
|
|
119916
120002
|
/**
|
|
119917
|
-
* Create a function that reports error by writing to the system and handles the
|
|
120003
|
+
* Create a function that reports error by writing to the system and handles the formatting of the diagnostic
|
|
119918
120004
|
*/
|
|
119919
120005
|
function createDiagnosticReporter(system, pretty) {
|
|
119920
120006
|
var host = system === ts.sys && sysFormatDiagnosticsHost ? sysFormatDiagnosticsHost : {
|
|
@@ -120000,19 +120086,74 @@ var ts;
|
|
|
120000
120086
|
return ts.countWhere(diagnostics, function (diagnostic) { return diagnostic.category === ts.DiagnosticCategory.Error; });
|
|
120001
120087
|
}
|
|
120002
120088
|
ts.getErrorCountForSummary = getErrorCountForSummary;
|
|
120089
|
+
function getFilesInErrorForSummary(diagnostics) {
|
|
120090
|
+
var filesInError = ts.filter(diagnostics, function (diagnostic) { return diagnostic.category === ts.DiagnosticCategory.Error; })
|
|
120091
|
+
.map(function (errorDiagnostic) {
|
|
120092
|
+
if (errorDiagnostic.file === undefined)
|
|
120093
|
+
return;
|
|
120094
|
+
return "" + errorDiagnostic.file.fileName;
|
|
120095
|
+
});
|
|
120096
|
+
return filesInError.map(function (fileName) {
|
|
120097
|
+
var diagnosticForFileName = ts.find(diagnostics, function (diagnostic) {
|
|
120098
|
+
return diagnostic.file !== undefined && diagnostic.file.fileName === fileName;
|
|
120099
|
+
});
|
|
120100
|
+
if (diagnosticForFileName !== undefined) {
|
|
120101
|
+
var line = ts.getLineAndCharacterOfPosition(diagnosticForFileName.file, diagnosticForFileName.start).line;
|
|
120102
|
+
return {
|
|
120103
|
+
fileName: fileName,
|
|
120104
|
+
line: line + 1,
|
|
120105
|
+
};
|
|
120106
|
+
}
|
|
120107
|
+
});
|
|
120108
|
+
}
|
|
120109
|
+
ts.getFilesInErrorForSummary = getFilesInErrorForSummary;
|
|
120003
120110
|
function getWatchErrorSummaryDiagnosticMessage(errorCount) {
|
|
120004
120111
|
return errorCount === 1 ?
|
|
120005
120112
|
ts.Diagnostics.Found_1_error_Watching_for_file_changes :
|
|
120006
120113
|
ts.Diagnostics.Found_0_errors_Watching_for_file_changes;
|
|
120007
120114
|
}
|
|
120008
120115
|
ts.getWatchErrorSummaryDiagnosticMessage = getWatchErrorSummaryDiagnosticMessage;
|
|
120009
|
-
function getErrorSummaryText(errorCount, newLine) {
|
|
120116
|
+
function getErrorSummaryText(errorCount, filesInError, newLine) {
|
|
120010
120117
|
if (errorCount === 0)
|
|
120011
120118
|
return "";
|
|
120012
|
-
var
|
|
120013
|
-
|
|
120119
|
+
var nonNilFiles = filesInError.filter(function (fileInError) { return fileInError !== undefined; });
|
|
120120
|
+
var distinctFileNamesWithLines = nonNilFiles.map(function (fileInError) { return fileInError.fileName + ":" + fileInError.line; })
|
|
120121
|
+
.filter(function (value, index, self) { return self.indexOf(value) === index; });
|
|
120122
|
+
var d = errorCount === 1 ?
|
|
120123
|
+
ts.createCompilerDiagnostic(filesInError[0] !== undefined ?
|
|
120124
|
+
ts.Diagnostics.Found_1_error_in_1 :
|
|
120125
|
+
ts.Diagnostics.Found_1_error, errorCount, distinctFileNamesWithLines[0]) :
|
|
120126
|
+
ts.createCompilerDiagnostic(distinctFileNamesWithLines.length === 0 ?
|
|
120127
|
+
ts.Diagnostics.Found_0_errors :
|
|
120128
|
+
distinctFileNamesWithLines.length === 1 ?
|
|
120129
|
+
ts.Diagnostics.Found_0_errors_in_1_file :
|
|
120130
|
+
ts.Diagnostics.Found_0_errors_in_1_files, errorCount, distinctFileNamesWithLines.length);
|
|
120131
|
+
return "" + newLine + ts.flattenDiagnosticMessageText(d.messageText, newLine) + newLine + newLine + (errorCount > 1 ? createTabularErrorsDisplay(nonNilFiles) : "");
|
|
120014
120132
|
}
|
|
120015
120133
|
ts.getErrorSummaryText = getErrorSummaryText;
|
|
120134
|
+
function createTabularErrorsDisplay(filesInError) {
|
|
120135
|
+
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); }); });
|
|
120136
|
+
if (distinctFiles.length === 0)
|
|
120137
|
+
return "";
|
|
120138
|
+
var numberLength = function (num) { return Math.log(num) * Math.LOG10E + 1; };
|
|
120139
|
+
var fileToErrorCount = distinctFiles.map(function (file) { return [file, ts.countWhere(filesInError, function (fileInError) { return fileInError.fileName === file.fileName; })]; });
|
|
120140
|
+
var maxErrors = fileToErrorCount.reduce(function (acc, value) { return Math.max(acc, value[1] || 0); }, 0);
|
|
120141
|
+
var headerRow = ts.Diagnostics.Errors_Files.message;
|
|
120142
|
+
var leftColumnHeadingLength = headerRow.split(" ")[0].length;
|
|
120143
|
+
var leftPaddingGoal = Math.max(leftColumnHeadingLength, numberLength(maxErrors));
|
|
120144
|
+
var headerPadding = Math.max(numberLength(maxErrors) - leftColumnHeadingLength, 0);
|
|
120145
|
+
var tabularData = "";
|
|
120146
|
+
tabularData += " ".repeat(headerPadding) + headerRow + "\n";
|
|
120147
|
+
fileToErrorCount.forEach(function (row) {
|
|
120148
|
+
var file = row[0], errorCount = row[1];
|
|
120149
|
+
var errorCountDigitsLength = Math.log(errorCount) * Math.LOG10E + 1 | 0;
|
|
120150
|
+
var leftPadding = errorCountDigitsLength < leftPaddingGoal ?
|
|
120151
|
+
" ".repeat(leftPaddingGoal - errorCountDigitsLength)
|
|
120152
|
+
: "";
|
|
120153
|
+
tabularData += "" + leftPadding + errorCount + " " + file.fileName + ":" + file.line + "\n";
|
|
120154
|
+
});
|
|
120155
|
+
return tabularData;
|
|
120156
|
+
}
|
|
120016
120157
|
function isBuilderProgram(program) {
|
|
120017
120158
|
return !!program.getState;
|
|
120018
120159
|
}
|
|
@@ -120216,7 +120357,7 @@ var ts;
|
|
|
120216
120357
|
listFiles(program, write);
|
|
120217
120358
|
}
|
|
120218
120359
|
if (reportSummary) {
|
|
120219
|
-
reportSummary(getErrorCountForSummary(diagnostics));
|
|
120360
|
+
reportSummary(getErrorCountForSummary(diagnostics), getFilesInErrorForSummary(diagnostics));
|
|
120220
120361
|
}
|
|
120221
120362
|
return {
|
|
120222
120363
|
emitResult: emitResult,
|
|
@@ -120427,7 +120568,7 @@ var ts;
|
|
|
120427
120568
|
var system = input.system || ts.sys;
|
|
120428
120569
|
var host = input.host || (input.host = ts.createIncrementalCompilerHost(input.options, system));
|
|
120429
120570
|
var builderProgram = ts.createIncrementalProgram(input);
|
|
120430
|
-
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);
|
|
120571
|
+
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);
|
|
120431
120572
|
if (input.afterProgramEmitAndDiagnostics)
|
|
120432
120573
|
input.afterProgramEmitAndDiagnostics(builderProgram);
|
|
120433
120574
|
return exitStatus;
|
|
@@ -122646,11 +122787,14 @@ var ts;
|
|
|
122646
122787
|
var canReportSummary = state.watch || !!state.host.reportErrorSummary;
|
|
122647
122788
|
var diagnostics = state.diagnostics;
|
|
122648
122789
|
var totalErrors = 0;
|
|
122790
|
+
var filesInError = [];
|
|
122649
122791
|
if (isCircularBuildOrder(buildOrder)) {
|
|
122650
122792
|
reportBuildQueue(state, buildOrder.buildOrder);
|
|
122651
122793
|
reportErrors(state, buildOrder.circularDiagnostics);
|
|
122652
122794
|
if (canReportSummary)
|
|
122653
122795
|
totalErrors += ts.getErrorCountForSummary(buildOrder.circularDiagnostics);
|
|
122796
|
+
if (canReportSummary)
|
|
122797
|
+
filesInError = __spreadArray(__spreadArray([], filesInError, true), ts.getFilesInErrorForSummary(buildOrder.circularDiagnostics), true);
|
|
122654
122798
|
}
|
|
122655
122799
|
else {
|
|
122656
122800
|
// Report errors from the other projects
|
|
@@ -122662,12 +122806,14 @@ var ts;
|
|
|
122662
122806
|
});
|
|
122663
122807
|
if (canReportSummary)
|
|
122664
122808
|
diagnostics.forEach(function (singleProjectErrors) { return totalErrors += ts.getErrorCountForSummary(singleProjectErrors); });
|
|
122809
|
+
if (canReportSummary)
|
|
122810
|
+
diagnostics.forEach(function (singleProjectErrors) { return __spreadArray(__spreadArray([], filesInError, true), ts.getFilesInErrorForSummary(singleProjectErrors), true); });
|
|
122665
122811
|
}
|
|
122666
122812
|
if (state.watch) {
|
|
122667
122813
|
reportWatchStatus(state, ts.getWatchErrorSummaryDiagnosticMessage(totalErrors), totalErrors);
|
|
122668
122814
|
}
|
|
122669
122815
|
else if (state.host.reportErrorSummary) {
|
|
122670
|
-
state.host.reportErrorSummary(totalErrors);
|
|
122816
|
+
state.host.reportErrorSummary(totalErrors, filesInError);
|
|
122671
122817
|
}
|
|
122672
122818
|
}
|
|
122673
122819
|
/**
|
|
@@ -127912,6 +128058,9 @@ var ts;
|
|
|
127912
128058
|
}
|
|
127913
128059
|
return;
|
|
127914
128060
|
}
|
|
128061
|
+
if (ts.isConstTypeReference(token.parent)) {
|
|
128062
|
+
return 3 /* keyword */;
|
|
128063
|
+
}
|
|
127915
128064
|
}
|
|
127916
128065
|
return 2 /* identifier */;
|
|
127917
128066
|
}
|
|
@@ -131732,8 +131881,10 @@ var ts;
|
|
|
131732
131881
|
}
|
|
131733
131882
|
/** Get the corresponding JSDocTag node if the position is in a jsDoc comment */
|
|
131734
131883
|
function getJsDocTagAtPosition(node, position) {
|
|
131735
|
-
|
|
131736
|
-
|
|
131884
|
+
return ts.findAncestor(node, function (n) {
|
|
131885
|
+
return ts.isJSDocTag(n) && ts.rangeContainsPosition(n, position) ? true :
|
|
131886
|
+
ts.isJSDoc(n) ? "quit" : false;
|
|
131887
|
+
});
|
|
131737
131888
|
}
|
|
131738
131889
|
function getPropertiesForObjectExpression(contextualType, completionsType, obj, checker) {
|
|
131739
131890
|
var hasCompletionsType = completionsType && completionsType !== contextualType;
|
|
@@ -141489,7 +141640,7 @@ var ts;
|
|
|
141489
141640
|
displayParts.push(ts.spacePart());
|
|
141490
141641
|
displayParts.push(ts.operatorPart(63 /* EqualsToken */));
|
|
141491
141642
|
displayParts.push(ts.spacePart());
|
|
141492
|
-
ts.addRange(displayParts, ts.typeToDisplayParts(typeChecker, typeChecker.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration, 8388608 /* InTypeAlias */));
|
|
141643
|
+
ts.addRange(displayParts, ts.typeToDisplayParts(typeChecker, ts.isConstTypeReference(location.parent) ? typeChecker.getTypeAtLocation(location.parent) : typeChecker.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration, 8388608 /* InTypeAlias */));
|
|
141493
141644
|
}
|
|
141494
141645
|
if (symbolFlags & 384 /* Enum */) {
|
|
141495
141646
|
prefixNextMeaning();
|
package/lib/typescript.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
|
/**
|