typescript 5.5.0-dev.20240312 → 5.5.0-dev.20240313
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tsc.js +53 -49
- package/lib/tsserver.js +61 -52
- package/lib/typescript.js +61 -52
- package/lib/typingsInstaller.js +6 -3
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.5";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20240313`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -6342,7 +6342,7 @@ var Diagnostics = {
|
|
|
6342
6342
|
Overload_signatures_must_all_be_abstract_or_non_abstract: diag(2512, 1 /* Error */, "Overload_signatures_must_all_be_abstract_or_non_abstract_2512", "Overload signatures must all be abstract or non-abstract."),
|
|
6343
6343
|
Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression: diag(2513, 1 /* Error */, "Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression_2513", "Abstract method '{0}' in class '{1}' cannot be accessed via super expression."),
|
|
6344
6344
|
A_tuple_type_cannot_be_indexed_with_a_negative_value: diag(2514, 1 /* Error */, "A_tuple_type_cannot_be_indexed_with_a_negative_value_2514", "A tuple type cannot be indexed with a negative value."),
|
|
6345
|
-
Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2: diag(2515, 1 /* Error */, "Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2_2515", "Non-abstract class '{0}' does not implement inherited abstract member
|
|
6345
|
+
Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2: diag(2515, 1 /* Error */, "Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2_2515", "Non-abstract class '{0}' does not implement inherited abstract member {1} from class '{2}'."),
|
|
6346
6346
|
All_declarations_of_an_abstract_method_must_be_consecutive: diag(2516, 1 /* Error */, "All_declarations_of_an_abstract_method_must_be_consecutive_2516", "All declarations of an abstract method must be consecutive."),
|
|
6347
6347
|
Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type: diag(2517, 1 /* Error */, "Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type_2517", "Cannot assign an abstract constructor type to a non-abstract constructor type."),
|
|
6348
6348
|
A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard: diag(2518, 1 /* Error */, "A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard_2518", "A 'this'-based type guard is not compatible with a parameter-based type guard."),
|
|
@@ -6452,9 +6452,13 @@ var Diagnostics = {
|
|
|
6452
6452
|
Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator: diag(2638, 1 /* Error */, "Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operato_2638", "Type '{0}' may represent a primitive value, which is not permitted as the right operand of the 'in' operator."),
|
|
6453
6453
|
React_components_cannot_include_JSX_namespace_names: diag(2639, 1 /* Error */, "React_components_cannot_include_JSX_namespace_names_2639", "React components cannot include JSX namespace names"),
|
|
6454
6454
|
Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: diag(2649, 1 /* Error */, "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", "Cannot augment module '{0}' with value exports because it resolves to a non-module entity."),
|
|
6455
|
+
Non_abstract_class_expression_is_missing_implementations_for_the_following_members_of_0_Colon_1_and_2_more: diag(2650, 1 /* Error */, "Non_abstract_class_expression_is_missing_implementations_for_the_following_members_of_0_Colon_1_and__2650", "Non-abstract class expression is missing implementations for the following members of '{0}': {1} and {2} more."),
|
|
6455
6456
|
A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: diag(2651, 1 /* Error */, "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums."),
|
|
6456
6457
|
Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: diag(2652, 1 /* Error */, "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead."),
|
|
6457
6458
|
Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1: diag(2653, 1 /* Error */, "Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1_2653", "Non-abstract class expression does not implement inherited abstract member '{0}' from class '{1}'."),
|
|
6459
|
+
Non_abstract_class_0_is_missing_implementations_for_the_following_members_of_1_Colon_2: diag(2654, 1 /* Error */, "Non_abstract_class_0_is_missing_implementations_for_the_following_members_of_1_Colon_2_2654", "Non-abstract class '{0}' is missing implementations for the following members of '{1}': {2}."),
|
|
6460
|
+
Non_abstract_class_0_is_missing_implementations_for_the_following_members_of_1_Colon_2_and_3_more: diag(2655, 1 /* Error */, "Non_abstract_class_0_is_missing_implementations_for_the_following_members_of_1_Colon_2_and_3_more_2655", "Non-abstract class '{0}' is missing implementations for the following members of '{1}': {2} and {3} more."),
|
|
6461
|
+
Non_abstract_class_expression_is_missing_implementations_for_the_following_members_of_0_Colon_1: diag(2656, 1 /* Error */, "Non_abstract_class_expression_is_missing_implementations_for_the_following_members_of_0_Colon_1_2656", "Non-abstract class expression is missing implementations for the following members of '{0}': {1}."),
|
|
6458
6462
|
JSX_expressions_must_have_one_parent_element: diag(2657, 1 /* Error */, "JSX_expressions_must_have_one_parent_element_2657", "JSX expressions must have one parent element."),
|
|
6459
6463
|
Type_0_provides_no_match_for_the_signature_1: diag(2658, 1 /* Error */, "Type_0_provides_no_match_for_the_signature_1_2658", "Type '{0}' provides no match for the signature '{1}'."),
|
|
6460
6464
|
super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher: diag(2659, 1 /* Error */, "super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_highe_2659", "'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher."),
|
|
@@ -7783,7 +7787,6 @@ var Diagnostics = {
|
|
|
7783
7787
|
_0_is_possibly_null_or_undefined: diag(18049, 1 /* Error */, "_0_is_possibly_null_or_undefined_18049", "'{0}' is possibly 'null' or 'undefined'."),
|
|
7784
7788
|
The_value_0_cannot_be_used_here: diag(18050, 1 /* Error */, "The_value_0_cannot_be_used_here_18050", "The value '{0}' cannot be used here."),
|
|
7785
7789
|
Compiler_option_0_cannot_be_given_an_empty_string: diag(18051, 1 /* Error */, "Compiler_option_0_cannot_be_given_an_empty_string_18051", "Compiler option '{0}' cannot be given an empty string."),
|
|
7786
|
-
Non_abstract_class_0_does_not_implement_all_abstract_members_of_1: diag(18052, 1 /* Error */, "Non_abstract_class_0_does_not_implement_all_abstract_members_of_1_18052", "Non-abstract class '{0}' does not implement all abstract members of '{1}'"),
|
|
7787
7790
|
Its_type_0_is_not_a_valid_JSX_element_type: diag(18053, 1 /* Error */, "Its_type_0_is_not_a_valid_JSX_element_type_18053", "Its type '{0}' is not a valid JSX element type."),
|
|
7788
7791
|
await_using_statements_cannot_be_used_inside_a_class_static_block: diag(18054, 1 /* Error */, "await_using_statements_cannot_be_used_inside_a_class_static_block_18054", "'await using' statements cannot be used inside a class static block.")
|
|
7789
7792
|
};
|
|
@@ -17570,7 +17573,7 @@ function canUsePropertyAccess(name, languageVersion) {
|
|
|
17570
17573
|
}
|
|
17571
17574
|
function isJSDocOptionalParameter(node) {
|
|
17572
17575
|
return isInJSFile(node) && // node.type should only be a JSDocOptionalType when node is a parameter of a JSDocFunctionType
|
|
17573
|
-
(node.type && node.type.kind === 316 /* JSDocOptionalType */ || getJSDocParameterTags(node).some(
|
|
17576
|
+
(node.type && node.type.kind === 316 /* JSDocOptionalType */ || getJSDocParameterTags(node).some(isOptionalJSDocPropertyLikeTag));
|
|
17574
17577
|
}
|
|
17575
17578
|
function isOptionalDeclaration(declaration) {
|
|
17576
17579
|
switch (declaration.kind) {
|
|
@@ -55356,10 +55359,16 @@ function createTypeChecker(host) {
|
|
|
55356
55359
|
const symbol = getSymbol(globals, '"' + moduleName + '"', 512 /* ValueModule */);
|
|
55357
55360
|
return symbol && withAugmentations ? getMergedSymbol(symbol) : symbol;
|
|
55358
55361
|
}
|
|
55362
|
+
function hasEffectiveQuestionToken(node) {
|
|
55363
|
+
return hasQuestionToken(node) || isOptionalJSDocPropertyLikeTag(node) || isParameter(node) && isJSDocOptionalParameter(node);
|
|
55364
|
+
}
|
|
55359
55365
|
function isOptionalParameter(node) {
|
|
55360
|
-
if (
|
|
55366
|
+
if (hasEffectiveQuestionToken(node)) {
|
|
55361
55367
|
return true;
|
|
55362
55368
|
}
|
|
55369
|
+
if (!isParameter(node)) {
|
|
55370
|
+
return false;
|
|
55371
|
+
}
|
|
55363
55372
|
if (node.initializer) {
|
|
55364
55373
|
const signature = getSignatureFromDeclaration(node.parent);
|
|
55365
55374
|
const parameterIndex = node.parent.parameters.indexOf(node);
|
|
@@ -55459,7 +55468,7 @@ function createTypeChecker(host) {
|
|
|
55459
55468
|
if (type && type.kind === 201 /* LiteralType */) {
|
|
55460
55469
|
flags |= 2 /* HasLiteralTypes */;
|
|
55461
55470
|
}
|
|
55462
|
-
const isOptionalParameter2 =
|
|
55471
|
+
const isOptionalParameter2 = hasEffectiveQuestionToken(param) || isParameter(param) && param.initializer || isRestParameter(param) || iife && parameters.length > iife.arguments.length && !type;
|
|
55463
55472
|
if (!isOptionalParameter2) {
|
|
55464
55473
|
minArgumentCount = parameters.length;
|
|
55465
55474
|
}
|
|
@@ -72147,7 +72156,7 @@ function createTypeChecker(host) {
|
|
|
72147
72156
|
}
|
|
72148
72157
|
return resolveErrorCall(node);
|
|
72149
72158
|
}
|
|
72150
|
-
if (checkMode & 8 /* SkipGenericFunctions */ && !node.typeArguments && callSignatures.some(
|
|
72159
|
+
if (checkMode & 8 /* SkipGenericFunctions */ && !node.typeArguments && callSignatures.some(isGenericFunctionReturningFunction)) {
|
|
72151
72160
|
skippedGenericFunction(node, checkMode);
|
|
72152
72161
|
return resolvingSignature;
|
|
72153
72162
|
}
|
|
@@ -72157,12 +72166,8 @@ function createTypeChecker(host) {
|
|
|
72157
72166
|
}
|
|
72158
72167
|
return resolveCall(node, callSignatures, candidatesOutArray, checkMode, callChainFlags);
|
|
72159
72168
|
}
|
|
72160
|
-
function
|
|
72161
|
-
|
|
72162
|
-
return false;
|
|
72163
|
-
}
|
|
72164
|
-
const returnType = getReturnTypeOfSignature(signature);
|
|
72165
|
-
return isFunctionType(returnType) || isConstructorType(returnType);
|
|
72169
|
+
function isGenericFunctionReturningFunction(signature) {
|
|
72170
|
+
return !!(signature.typeParameters && isFunctionType(getReturnTypeOfSignature(signature)));
|
|
72166
72171
|
}
|
|
72167
72172
|
function isUntypedFunctionCall(funcType, apparentFuncType, numCallSignatures, numConstructSignatures) {
|
|
72168
72173
|
return isTypeAny(funcType) || isTypeAny(apparentFuncType) && !!(funcType.flags & 262144 /* TypeParameter */) || !numCallSignatures && !numConstructSignatures && !(apparentFuncType.flags & 1048576 /* Union */) && !(getReducedType(apparentFuncType).flags & 131072 /* Never */) && isTypeAssignableTo(funcType, globalFunctionType);
|
|
@@ -80036,9 +80041,9 @@ function createTypeChecker(host) {
|
|
|
80036
80041
|
return filter(symbol.declarations, (d) => d.kind === 263 /* ClassDeclaration */ || d.kind === 264 /* InterfaceDeclaration */);
|
|
80037
80042
|
}
|
|
80038
80043
|
function checkKindsOfPropertyMemberOverrides(type, baseType) {
|
|
80039
|
-
var _a, _b, _c, _d;
|
|
80044
|
+
var _a, _b, _c, _d, _e;
|
|
80040
80045
|
const baseProperties = getPropertiesOfType(baseType);
|
|
80041
|
-
|
|
80046
|
+
const notImplementedInfo = /* @__PURE__ */ new Map();
|
|
80042
80047
|
basePropertyCheck:
|
|
80043
80048
|
for (const baseProperty of baseProperties) {
|
|
80044
80049
|
const base = getTargetSymbol(baseProperty);
|
|
@@ -80064,36 +80069,11 @@ function createTypeChecker(host) {
|
|
|
80064
80069
|
continue basePropertyCheck;
|
|
80065
80070
|
}
|
|
80066
80071
|
}
|
|
80067
|
-
|
|
80068
|
-
|
|
80069
|
-
|
|
80070
|
-
|
|
80071
|
-
|
|
80072
|
-
typeToString(baseType)
|
|
80073
|
-
);
|
|
80074
|
-
}
|
|
80075
|
-
if (derivedClassDecl.kind === 231 /* ClassExpression */) {
|
|
80076
|
-
addRelatedInfo(
|
|
80077
|
-
inheritedAbstractMemberNotImplementedError,
|
|
80078
|
-
createDiagnosticForNode(
|
|
80079
|
-
baseProperty.valueDeclaration ?? (baseProperty.declarations && first(baseProperty.declarations)) ?? derivedClassDecl,
|
|
80080
|
-
Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1,
|
|
80081
|
-
symbolToString(baseProperty),
|
|
80082
|
-
typeToString(baseType)
|
|
80083
|
-
)
|
|
80084
|
-
);
|
|
80085
|
-
} else {
|
|
80086
|
-
addRelatedInfo(
|
|
80087
|
-
inheritedAbstractMemberNotImplementedError,
|
|
80088
|
-
createDiagnosticForNode(
|
|
80089
|
-
baseProperty.valueDeclaration ?? (baseProperty.declarations && first(baseProperty.declarations)) ?? derivedClassDecl,
|
|
80090
|
-
Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2,
|
|
80091
|
-
typeToString(type),
|
|
80092
|
-
symbolToString(baseProperty),
|
|
80093
|
-
typeToString(baseType)
|
|
80094
|
-
)
|
|
80095
|
-
);
|
|
80096
|
-
}
|
|
80072
|
+
const baseTypeName = typeToString(baseType);
|
|
80073
|
+
const typeName = typeToString(type);
|
|
80074
|
+
const basePropertyName = symbolToString(baseProperty);
|
|
80075
|
+
const missedProperties = append((_a = notImplementedInfo.get(derivedClassDecl)) == null ? void 0 : _a.missedProperties, basePropertyName);
|
|
80076
|
+
notImplementedInfo.set(derivedClassDecl, { baseTypeName, typeName, missedProperties });
|
|
80097
80077
|
}
|
|
80098
80078
|
} else {
|
|
80099
80079
|
const derivedDeclarationFlags = getDeclarationModifierFlagsFromSymbol(derived);
|
|
@@ -80104,7 +80084,7 @@ function createTypeChecker(host) {
|
|
|
80104
80084
|
const basePropertyFlags = base.flags & 98308 /* PropertyOrAccessor */;
|
|
80105
80085
|
const derivedPropertyFlags = derived.flags & 98308 /* PropertyOrAccessor */;
|
|
80106
80086
|
if (basePropertyFlags && derivedPropertyFlags) {
|
|
80107
|
-
if ((getCheckFlags(base) & 6 /* Synthetic */ ? (
|
|
80087
|
+
if ((getCheckFlags(base) & 6 /* Synthetic */ ? (_b = base.declarations) == null ? void 0 : _b.some((d) => isPropertyAbstractOrInterface(d, baseDeclarationFlags)) : (_c = base.declarations) == null ? void 0 : _c.every((d) => isPropertyAbstractOrInterface(d, baseDeclarationFlags))) || getCheckFlags(base) & 262144 /* Mapped */ || derived.valueDeclaration && isBinaryExpression(derived.valueDeclaration)) {
|
|
80108
80088
|
continue;
|
|
80109
80089
|
}
|
|
80110
80090
|
const overriddenInstanceProperty = basePropertyFlags !== 4 /* Property */ && derivedPropertyFlags === 4 /* Property */;
|
|
@@ -80113,8 +80093,8 @@ function createTypeChecker(host) {
|
|
|
80113
80093
|
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;
|
|
80114
80094
|
error(getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage2, symbolToString(base), typeToString(baseType), typeToString(type));
|
|
80115
80095
|
} else if (useDefineForClassFields) {
|
|
80116
|
-
const uninitialized = (
|
|
80117
|
-
if (uninitialized && !(derived.flags & 33554432 /* Transient */) && !(baseDeclarationFlags & 64 /* Abstract */) && !(derivedDeclarationFlags & 64 /* Abstract */) && !((
|
|
80096
|
+
const uninitialized = (_d = derived.declarations) == null ? void 0 : _d.find((d) => d.kind === 172 /* PropertyDeclaration */ && !d.initializer);
|
|
80097
|
+
if (uninitialized && !(derived.flags & 33554432 /* Transient */) && !(baseDeclarationFlags & 64 /* Abstract */) && !(derivedDeclarationFlags & 64 /* Abstract */) && !((_e = derived.declarations) == null ? void 0 : _e.some((d) => !!(d.flags & 33554432 /* Ambient */)))) {
|
|
80118
80098
|
const constructor = findConstructorDeclaration(getClassLikeDeclarationOfSymbol(type.symbol));
|
|
80119
80099
|
const propName = uninitialized.name;
|
|
80120
80100
|
if (uninitialized.exclamationToken || !constructor || !isIdentifier(propName) || !strictNullChecks || !isPropertyInitializedInConstructor(propName, type, constructor)) {
|
|
@@ -80139,6 +80119,30 @@ function createTypeChecker(host) {
|
|
|
80139
80119
|
error(getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type));
|
|
80140
80120
|
}
|
|
80141
80121
|
}
|
|
80122
|
+
for (const [errorNode, memberInfo] of notImplementedInfo) {
|
|
80123
|
+
if (length(memberInfo.missedProperties) === 1) {
|
|
80124
|
+
if (isClassExpression(errorNode)) {
|
|
80125
|
+
error(errorNode, Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, first(memberInfo.missedProperties), memberInfo.baseTypeName);
|
|
80126
|
+
} else {
|
|
80127
|
+
error(errorNode, Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2, memberInfo.typeName, first(memberInfo.missedProperties), memberInfo.baseTypeName);
|
|
80128
|
+
}
|
|
80129
|
+
} else if (length(memberInfo.missedProperties) > 5) {
|
|
80130
|
+
const missedProperties = map(memberInfo.missedProperties.slice(0, 4), (prop) => `'${prop}'`).join(", ");
|
|
80131
|
+
const remainingMissedProperties = length(memberInfo.missedProperties) - 4;
|
|
80132
|
+
if (isClassExpression(errorNode)) {
|
|
80133
|
+
error(errorNode, Diagnostics.Non_abstract_class_expression_is_missing_implementations_for_the_following_members_of_0_Colon_1_and_2_more, memberInfo.baseTypeName, missedProperties, remainingMissedProperties);
|
|
80134
|
+
} else {
|
|
80135
|
+
error(errorNode, Diagnostics.Non_abstract_class_0_is_missing_implementations_for_the_following_members_of_1_Colon_2_and_3_more, memberInfo.typeName, memberInfo.baseTypeName, missedProperties, remainingMissedProperties);
|
|
80136
|
+
}
|
|
80137
|
+
} else {
|
|
80138
|
+
const missedProperties = map(memberInfo.missedProperties, (prop) => `'${prop}'`).join(", ");
|
|
80139
|
+
if (isClassExpression(errorNode)) {
|
|
80140
|
+
error(errorNode, Diagnostics.Non_abstract_class_expression_is_missing_implementations_for_the_following_members_of_0_Colon_1, memberInfo.baseTypeName, missedProperties);
|
|
80141
|
+
} else {
|
|
80142
|
+
error(errorNode, Diagnostics.Non_abstract_class_0_is_missing_implementations_for_the_following_members_of_1_Colon_2, memberInfo.typeName, memberInfo.baseTypeName, missedProperties);
|
|
80143
|
+
}
|
|
80144
|
+
}
|
|
80145
|
+
}
|
|
80142
80146
|
}
|
|
80143
80147
|
function isPropertyAbstractOrInterface(declaration, baseDeclarationFlags) {
|
|
80144
80148
|
return baseDeclarationFlags & 64 /* Abstract */ && (!isPropertyDeclaration(declaration) || !declaration.initializer) || isInterfaceDeclaration(declaration.parent);
|
|
@@ -83863,7 +83867,7 @@ function createTypeChecker(host) {
|
|
|
83863
83867
|
if (parameter.initializer) {
|
|
83864
83868
|
return grammarErrorOnNode(parameter.name, Diagnostics.A_rest_parameter_cannot_have_an_initializer);
|
|
83865
83869
|
}
|
|
83866
|
-
} else if (
|
|
83870
|
+
} else if (hasEffectiveQuestionToken(parameter)) {
|
|
83867
83871
|
seenOptionalParameter = true;
|
|
83868
83872
|
if (parameter.questionToken && parameter.initializer) {
|
|
83869
83873
|
return grammarErrorOnNode(parameter.name, Diagnostics.Parameter_cannot_have_question_mark_and_initializer);
|
package/lib/tsserver.js
CHANGED
|
@@ -2326,7 +2326,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2326
2326
|
|
|
2327
2327
|
// src/compiler/corePublic.ts
|
|
2328
2328
|
var versionMajorMinor = "5.5";
|
|
2329
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2329
|
+
var version = `${versionMajorMinor}.0-dev.20240313`;
|
|
2330
2330
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2331
2331
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2332
2332
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -3633,7 +3633,7 @@ var createUIStringComparer = /* @__PURE__ */ (() => {
|
|
|
3633
3633
|
return value < 0 ? -1 /* LessThan */ : value > 0 ? 1 /* GreaterThan */ : 0 /* EqualTo */;
|
|
3634
3634
|
}
|
|
3635
3635
|
function createIntlCollatorStringComparer(locale) {
|
|
3636
|
-
const comparer = new Intl.Collator(locale, { usage: "sort", sensitivity: "variant" }).compare;
|
|
3636
|
+
const comparer = new Intl.Collator(locale, { usage: "sort", sensitivity: "variant", numeric: true }).compare;
|
|
3637
3637
|
return (a, b) => compareWithCallback(a, b, comparer);
|
|
3638
3638
|
}
|
|
3639
3639
|
})();
|
|
@@ -9921,7 +9921,7 @@ var Diagnostics = {
|
|
|
9921
9921
|
Overload_signatures_must_all_be_abstract_or_non_abstract: diag(2512, 1 /* Error */, "Overload_signatures_must_all_be_abstract_or_non_abstract_2512", "Overload signatures must all be abstract or non-abstract."),
|
|
9922
9922
|
Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression: diag(2513, 1 /* Error */, "Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression_2513", "Abstract method '{0}' in class '{1}' cannot be accessed via super expression."),
|
|
9923
9923
|
A_tuple_type_cannot_be_indexed_with_a_negative_value: diag(2514, 1 /* Error */, "A_tuple_type_cannot_be_indexed_with_a_negative_value_2514", "A tuple type cannot be indexed with a negative value."),
|
|
9924
|
-
Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2: diag(2515, 1 /* Error */, "Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2_2515", "Non-abstract class '{0}' does not implement inherited abstract member
|
|
9924
|
+
Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2: diag(2515, 1 /* Error */, "Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2_2515", "Non-abstract class '{0}' does not implement inherited abstract member {1} from class '{2}'."),
|
|
9925
9925
|
All_declarations_of_an_abstract_method_must_be_consecutive: diag(2516, 1 /* Error */, "All_declarations_of_an_abstract_method_must_be_consecutive_2516", "All declarations of an abstract method must be consecutive."),
|
|
9926
9926
|
Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type: diag(2517, 1 /* Error */, "Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type_2517", "Cannot assign an abstract constructor type to a non-abstract constructor type."),
|
|
9927
9927
|
A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard: diag(2518, 1 /* Error */, "A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard_2518", "A 'this'-based type guard is not compatible with a parameter-based type guard."),
|
|
@@ -10031,9 +10031,13 @@ var Diagnostics = {
|
|
|
10031
10031
|
Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator: diag(2638, 1 /* Error */, "Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operato_2638", "Type '{0}' may represent a primitive value, which is not permitted as the right operand of the 'in' operator."),
|
|
10032
10032
|
React_components_cannot_include_JSX_namespace_names: diag(2639, 1 /* Error */, "React_components_cannot_include_JSX_namespace_names_2639", "React components cannot include JSX namespace names"),
|
|
10033
10033
|
Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: diag(2649, 1 /* Error */, "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", "Cannot augment module '{0}' with value exports because it resolves to a non-module entity."),
|
|
10034
|
+
Non_abstract_class_expression_is_missing_implementations_for_the_following_members_of_0_Colon_1_and_2_more: diag(2650, 1 /* Error */, "Non_abstract_class_expression_is_missing_implementations_for_the_following_members_of_0_Colon_1_and__2650", "Non-abstract class expression is missing implementations for the following members of '{0}': {1} and {2} more."),
|
|
10034
10035
|
A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: diag(2651, 1 /* Error */, "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums."),
|
|
10035
10036
|
Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: diag(2652, 1 /* Error */, "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead."),
|
|
10036
10037
|
Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1: diag(2653, 1 /* Error */, "Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1_2653", "Non-abstract class expression does not implement inherited abstract member '{0}' from class '{1}'."),
|
|
10038
|
+
Non_abstract_class_0_is_missing_implementations_for_the_following_members_of_1_Colon_2: diag(2654, 1 /* Error */, "Non_abstract_class_0_is_missing_implementations_for_the_following_members_of_1_Colon_2_2654", "Non-abstract class '{0}' is missing implementations for the following members of '{1}': {2}."),
|
|
10039
|
+
Non_abstract_class_0_is_missing_implementations_for_the_following_members_of_1_Colon_2_and_3_more: diag(2655, 1 /* Error */, "Non_abstract_class_0_is_missing_implementations_for_the_following_members_of_1_Colon_2_and_3_more_2655", "Non-abstract class '{0}' is missing implementations for the following members of '{1}': {2} and {3} more."),
|
|
10040
|
+
Non_abstract_class_expression_is_missing_implementations_for_the_following_members_of_0_Colon_1: diag(2656, 1 /* Error */, "Non_abstract_class_expression_is_missing_implementations_for_the_following_members_of_0_Colon_1_2656", "Non-abstract class expression is missing implementations for the following members of '{0}': {1}."),
|
|
10037
10041
|
JSX_expressions_must_have_one_parent_element: diag(2657, 1 /* Error */, "JSX_expressions_must_have_one_parent_element_2657", "JSX expressions must have one parent element."),
|
|
10038
10042
|
Type_0_provides_no_match_for_the_signature_1: diag(2658, 1 /* Error */, "Type_0_provides_no_match_for_the_signature_1_2658", "Type '{0}' provides no match for the signature '{1}'."),
|
|
10039
10043
|
super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher: diag(2659, 1 /* Error */, "super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_highe_2659", "'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher."),
|
|
@@ -11362,7 +11366,6 @@ var Diagnostics = {
|
|
|
11362
11366
|
_0_is_possibly_null_or_undefined: diag(18049, 1 /* Error */, "_0_is_possibly_null_or_undefined_18049", "'{0}' is possibly 'null' or 'undefined'."),
|
|
11363
11367
|
The_value_0_cannot_be_used_here: diag(18050, 1 /* Error */, "The_value_0_cannot_be_used_here_18050", "The value '{0}' cannot be used here."),
|
|
11364
11368
|
Compiler_option_0_cannot_be_given_an_empty_string: diag(18051, 1 /* Error */, "Compiler_option_0_cannot_be_given_an_empty_string_18051", "Compiler option '{0}' cannot be given an empty string."),
|
|
11365
|
-
Non_abstract_class_0_does_not_implement_all_abstract_members_of_1: diag(18052, 1 /* Error */, "Non_abstract_class_0_does_not_implement_all_abstract_members_of_1_18052", "Non-abstract class '{0}' does not implement all abstract members of '{1}'"),
|
|
11366
11369
|
Its_type_0_is_not_a_valid_JSX_element_type: diag(18053, 1 /* Error */, "Its_type_0_is_not_a_valid_JSX_element_type_18053", "Its type '{0}' is not a valid JSX element type."),
|
|
11367
11370
|
await_using_statements_cannot_be_used_inside_a_class_static_block: diag(18054, 1 /* Error */, "await_using_statements_cannot_be_used_inside_a_class_static_block_18054", "'await using' statements cannot be used inside a class static block.")
|
|
11368
11371
|
};
|
|
@@ -21830,7 +21833,7 @@ function hasTabstop(node) {
|
|
|
21830
21833
|
}
|
|
21831
21834
|
function isJSDocOptionalParameter(node) {
|
|
21832
21835
|
return isInJSFile(node) && // node.type should only be a JSDocOptionalType when node is a parameter of a JSDocFunctionType
|
|
21833
|
-
(node.type && node.type.kind === 316 /* JSDocOptionalType */ || getJSDocParameterTags(node).some(
|
|
21836
|
+
(node.type && node.type.kind === 316 /* JSDocOptionalType */ || getJSDocParameterTags(node).some(isOptionalJSDocPropertyLikeTag));
|
|
21834
21837
|
}
|
|
21835
21838
|
function isOptionalDeclaration(declaration) {
|
|
21836
21839
|
switch (declaration.kind) {
|
|
@@ -60108,10 +60111,16 @@ function createTypeChecker(host) {
|
|
|
60108
60111
|
const symbol = getSymbol2(globals, '"' + moduleName + '"', 512 /* ValueModule */);
|
|
60109
60112
|
return symbol && withAugmentations ? getMergedSymbol(symbol) : symbol;
|
|
60110
60113
|
}
|
|
60114
|
+
function hasEffectiveQuestionToken(node) {
|
|
60115
|
+
return hasQuestionToken(node) || isOptionalJSDocPropertyLikeTag(node) || isParameter(node) && isJSDocOptionalParameter(node);
|
|
60116
|
+
}
|
|
60111
60117
|
function isOptionalParameter(node) {
|
|
60112
|
-
if (
|
|
60118
|
+
if (hasEffectiveQuestionToken(node)) {
|
|
60113
60119
|
return true;
|
|
60114
60120
|
}
|
|
60121
|
+
if (!isParameter(node)) {
|
|
60122
|
+
return false;
|
|
60123
|
+
}
|
|
60115
60124
|
if (node.initializer) {
|
|
60116
60125
|
const signature = getSignatureFromDeclaration(node.parent);
|
|
60117
60126
|
const parameterIndex = node.parent.parameters.indexOf(node);
|
|
@@ -60211,7 +60220,7 @@ function createTypeChecker(host) {
|
|
|
60211
60220
|
if (type && type.kind === 201 /* LiteralType */) {
|
|
60212
60221
|
flags |= 2 /* HasLiteralTypes */;
|
|
60213
60222
|
}
|
|
60214
|
-
const isOptionalParameter2 =
|
|
60223
|
+
const isOptionalParameter2 = hasEffectiveQuestionToken(param) || isParameter(param) && param.initializer || isRestParameter(param) || iife && parameters.length > iife.arguments.length && !type;
|
|
60215
60224
|
if (!isOptionalParameter2) {
|
|
60216
60225
|
minArgumentCount = parameters.length;
|
|
60217
60226
|
}
|
|
@@ -76899,7 +76908,7 @@ function createTypeChecker(host) {
|
|
|
76899
76908
|
}
|
|
76900
76909
|
return resolveErrorCall(node);
|
|
76901
76910
|
}
|
|
76902
|
-
if (checkMode & 8 /* SkipGenericFunctions */ && !node.typeArguments && callSignatures.some(
|
|
76911
|
+
if (checkMode & 8 /* SkipGenericFunctions */ && !node.typeArguments && callSignatures.some(isGenericFunctionReturningFunction)) {
|
|
76903
76912
|
skippedGenericFunction(node, checkMode);
|
|
76904
76913
|
return resolvingSignature;
|
|
76905
76914
|
}
|
|
@@ -76909,12 +76918,8 @@ function createTypeChecker(host) {
|
|
|
76909
76918
|
}
|
|
76910
76919
|
return resolveCall(node, callSignatures, candidatesOutArray, checkMode, callChainFlags);
|
|
76911
76920
|
}
|
|
76912
|
-
function
|
|
76913
|
-
|
|
76914
|
-
return false;
|
|
76915
|
-
}
|
|
76916
|
-
const returnType = getReturnTypeOfSignature(signature);
|
|
76917
|
-
return isFunctionType(returnType) || isConstructorType(returnType);
|
|
76921
|
+
function isGenericFunctionReturningFunction(signature) {
|
|
76922
|
+
return !!(signature.typeParameters && isFunctionType(getReturnTypeOfSignature(signature)));
|
|
76918
76923
|
}
|
|
76919
76924
|
function isUntypedFunctionCall(funcType, apparentFuncType, numCallSignatures, numConstructSignatures) {
|
|
76920
76925
|
return isTypeAny(funcType) || isTypeAny(apparentFuncType) && !!(funcType.flags & 262144 /* TypeParameter */) || !numCallSignatures && !numConstructSignatures && !(apparentFuncType.flags & 1048576 /* Union */) && !(getReducedType(apparentFuncType).flags & 131072 /* Never */) && isTypeAssignableTo(funcType, globalFunctionType);
|
|
@@ -84788,9 +84793,9 @@ function createTypeChecker(host) {
|
|
|
84788
84793
|
return filter(symbol.declarations, (d) => d.kind === 263 /* ClassDeclaration */ || d.kind === 264 /* InterfaceDeclaration */);
|
|
84789
84794
|
}
|
|
84790
84795
|
function checkKindsOfPropertyMemberOverrides(type, baseType) {
|
|
84791
|
-
var _a, _b, _c, _d;
|
|
84796
|
+
var _a, _b, _c, _d, _e;
|
|
84792
84797
|
const baseProperties = getPropertiesOfType(baseType);
|
|
84793
|
-
|
|
84798
|
+
const notImplementedInfo = /* @__PURE__ */ new Map();
|
|
84794
84799
|
basePropertyCheck:
|
|
84795
84800
|
for (const baseProperty of baseProperties) {
|
|
84796
84801
|
const base = getTargetSymbol(baseProperty);
|
|
@@ -84816,36 +84821,11 @@ function createTypeChecker(host) {
|
|
|
84816
84821
|
continue basePropertyCheck;
|
|
84817
84822
|
}
|
|
84818
84823
|
}
|
|
84819
|
-
|
|
84820
|
-
|
|
84821
|
-
|
|
84822
|
-
|
|
84823
|
-
|
|
84824
|
-
typeToString(baseType)
|
|
84825
|
-
);
|
|
84826
|
-
}
|
|
84827
|
-
if (derivedClassDecl.kind === 231 /* ClassExpression */) {
|
|
84828
|
-
addRelatedInfo(
|
|
84829
|
-
inheritedAbstractMemberNotImplementedError,
|
|
84830
|
-
createDiagnosticForNode(
|
|
84831
|
-
baseProperty.valueDeclaration ?? (baseProperty.declarations && first(baseProperty.declarations)) ?? derivedClassDecl,
|
|
84832
|
-
Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1,
|
|
84833
|
-
symbolToString(baseProperty),
|
|
84834
|
-
typeToString(baseType)
|
|
84835
|
-
)
|
|
84836
|
-
);
|
|
84837
|
-
} else {
|
|
84838
|
-
addRelatedInfo(
|
|
84839
|
-
inheritedAbstractMemberNotImplementedError,
|
|
84840
|
-
createDiagnosticForNode(
|
|
84841
|
-
baseProperty.valueDeclaration ?? (baseProperty.declarations && first(baseProperty.declarations)) ?? derivedClassDecl,
|
|
84842
|
-
Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2,
|
|
84843
|
-
typeToString(type),
|
|
84844
|
-
symbolToString(baseProperty),
|
|
84845
|
-
typeToString(baseType)
|
|
84846
|
-
)
|
|
84847
|
-
);
|
|
84848
|
-
}
|
|
84824
|
+
const baseTypeName = typeToString(baseType);
|
|
84825
|
+
const typeName = typeToString(type);
|
|
84826
|
+
const basePropertyName = symbolToString(baseProperty);
|
|
84827
|
+
const missedProperties = append((_a = notImplementedInfo.get(derivedClassDecl)) == null ? void 0 : _a.missedProperties, basePropertyName);
|
|
84828
|
+
notImplementedInfo.set(derivedClassDecl, { baseTypeName, typeName, missedProperties });
|
|
84849
84829
|
}
|
|
84850
84830
|
} else {
|
|
84851
84831
|
const derivedDeclarationFlags = getDeclarationModifierFlagsFromSymbol(derived);
|
|
@@ -84856,7 +84836,7 @@ function createTypeChecker(host) {
|
|
|
84856
84836
|
const basePropertyFlags = base.flags & 98308 /* PropertyOrAccessor */;
|
|
84857
84837
|
const derivedPropertyFlags = derived.flags & 98308 /* PropertyOrAccessor */;
|
|
84858
84838
|
if (basePropertyFlags && derivedPropertyFlags) {
|
|
84859
|
-
if ((getCheckFlags(base) & 6 /* Synthetic */ ? (
|
|
84839
|
+
if ((getCheckFlags(base) & 6 /* Synthetic */ ? (_b = base.declarations) == null ? void 0 : _b.some((d) => isPropertyAbstractOrInterface(d, baseDeclarationFlags)) : (_c = base.declarations) == null ? void 0 : _c.every((d) => isPropertyAbstractOrInterface(d, baseDeclarationFlags))) || getCheckFlags(base) & 262144 /* Mapped */ || derived.valueDeclaration && isBinaryExpression(derived.valueDeclaration)) {
|
|
84860
84840
|
continue;
|
|
84861
84841
|
}
|
|
84862
84842
|
const overriddenInstanceProperty = basePropertyFlags !== 4 /* Property */ && derivedPropertyFlags === 4 /* Property */;
|
|
@@ -84865,8 +84845,8 @@ function createTypeChecker(host) {
|
|
|
84865
84845
|
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;
|
|
84866
84846
|
error2(getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage2, symbolToString(base), typeToString(baseType), typeToString(type));
|
|
84867
84847
|
} else if (useDefineForClassFields) {
|
|
84868
|
-
const uninitialized = (
|
|
84869
|
-
if (uninitialized && !(derived.flags & 33554432 /* Transient */) && !(baseDeclarationFlags & 64 /* Abstract */) && !(derivedDeclarationFlags & 64 /* Abstract */) && !((
|
|
84848
|
+
const uninitialized = (_d = derived.declarations) == null ? void 0 : _d.find((d) => d.kind === 172 /* PropertyDeclaration */ && !d.initializer);
|
|
84849
|
+
if (uninitialized && !(derived.flags & 33554432 /* Transient */) && !(baseDeclarationFlags & 64 /* Abstract */) && !(derivedDeclarationFlags & 64 /* Abstract */) && !((_e = derived.declarations) == null ? void 0 : _e.some((d) => !!(d.flags & 33554432 /* Ambient */)))) {
|
|
84870
84850
|
const constructor = findConstructorDeclaration(getClassLikeDeclarationOfSymbol(type.symbol));
|
|
84871
84851
|
const propName = uninitialized.name;
|
|
84872
84852
|
if (uninitialized.exclamationToken || !constructor || !isIdentifier(propName) || !strictNullChecks || !isPropertyInitializedInConstructor(propName, type, constructor)) {
|
|
@@ -84891,6 +84871,30 @@ function createTypeChecker(host) {
|
|
|
84891
84871
|
error2(getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type));
|
|
84892
84872
|
}
|
|
84893
84873
|
}
|
|
84874
|
+
for (const [errorNode, memberInfo] of notImplementedInfo) {
|
|
84875
|
+
if (length(memberInfo.missedProperties) === 1) {
|
|
84876
|
+
if (isClassExpression(errorNode)) {
|
|
84877
|
+
error2(errorNode, Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, first(memberInfo.missedProperties), memberInfo.baseTypeName);
|
|
84878
|
+
} else {
|
|
84879
|
+
error2(errorNode, Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2, memberInfo.typeName, first(memberInfo.missedProperties), memberInfo.baseTypeName);
|
|
84880
|
+
}
|
|
84881
|
+
} else if (length(memberInfo.missedProperties) > 5) {
|
|
84882
|
+
const missedProperties = map(memberInfo.missedProperties.slice(0, 4), (prop) => `'${prop}'`).join(", ");
|
|
84883
|
+
const remainingMissedProperties = length(memberInfo.missedProperties) - 4;
|
|
84884
|
+
if (isClassExpression(errorNode)) {
|
|
84885
|
+
error2(errorNode, Diagnostics.Non_abstract_class_expression_is_missing_implementations_for_the_following_members_of_0_Colon_1_and_2_more, memberInfo.baseTypeName, missedProperties, remainingMissedProperties);
|
|
84886
|
+
} else {
|
|
84887
|
+
error2(errorNode, Diagnostics.Non_abstract_class_0_is_missing_implementations_for_the_following_members_of_1_Colon_2_and_3_more, memberInfo.typeName, memberInfo.baseTypeName, missedProperties, remainingMissedProperties);
|
|
84888
|
+
}
|
|
84889
|
+
} else {
|
|
84890
|
+
const missedProperties = map(memberInfo.missedProperties, (prop) => `'${prop}'`).join(", ");
|
|
84891
|
+
if (isClassExpression(errorNode)) {
|
|
84892
|
+
error2(errorNode, Diagnostics.Non_abstract_class_expression_is_missing_implementations_for_the_following_members_of_0_Colon_1, memberInfo.baseTypeName, missedProperties);
|
|
84893
|
+
} else {
|
|
84894
|
+
error2(errorNode, Diagnostics.Non_abstract_class_0_is_missing_implementations_for_the_following_members_of_1_Colon_2, memberInfo.typeName, memberInfo.baseTypeName, missedProperties);
|
|
84895
|
+
}
|
|
84896
|
+
}
|
|
84897
|
+
}
|
|
84894
84898
|
}
|
|
84895
84899
|
function isPropertyAbstractOrInterface(declaration, baseDeclarationFlags) {
|
|
84896
84900
|
return baseDeclarationFlags & 64 /* Abstract */ && (!isPropertyDeclaration(declaration) || !declaration.initializer) || isInterfaceDeclaration(declaration.parent);
|
|
@@ -88615,7 +88619,7 @@ function createTypeChecker(host) {
|
|
|
88615
88619
|
if (parameter.initializer) {
|
|
88616
88620
|
return grammarErrorOnNode(parameter.name, Diagnostics.A_rest_parameter_cannot_have_an_initializer);
|
|
88617
88621
|
}
|
|
88618
|
-
} else if (
|
|
88622
|
+
} else if (hasEffectiveQuestionToken(parameter)) {
|
|
88619
88623
|
seenOptionalParameter = true;
|
|
88620
88624
|
if (parameter.questionToken && parameter.initializer) {
|
|
88621
88625
|
return grammarErrorOnNode(parameter.name, Diagnostics.Parameter_cannot_have_question_mark_and_initializer);
|
|
@@ -153524,7 +153528,12 @@ function getTypesPackageNameToInstall(packageName, host, diagCode) {
|
|
|
153524
153528
|
|
|
153525
153529
|
// src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts
|
|
153526
153530
|
var errorCodes31 = [
|
|
153527
|
-
Diagnostics.
|
|
153531
|
+
Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2.code,
|
|
153532
|
+
Diagnostics.Non_abstract_class_0_is_missing_implementations_for_the_following_members_of_1_Colon_2.code,
|
|
153533
|
+
Diagnostics.Non_abstract_class_0_is_missing_implementations_for_the_following_members_of_1_Colon_2_and_3_more.code,
|
|
153534
|
+
Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1.code,
|
|
153535
|
+
Diagnostics.Non_abstract_class_expression_is_missing_implementations_for_the_following_members_of_0_Colon_1.code,
|
|
153536
|
+
Diagnostics.Non_abstract_class_expression_is_missing_implementations_for_the_following_members_of_0_Colon_1_and_2_more.code
|
|
153528
153537
|
];
|
|
153529
153538
|
var fixId25 = "fixClassDoesntImplementInheritedAbstractMember";
|
|
153530
153539
|
registerCodeFix({
|
|
@@ -165553,7 +165562,7 @@ function provideInlayHints(context) {
|
|
|
165553
165562
|
return type.symbol && type.symbol.flags & 1536 /* Module */;
|
|
165554
165563
|
}
|
|
165555
165564
|
function visitVariableLikeDeclaration(decl) {
|
|
165556
|
-
if (
|
|
165565
|
+
if (decl.initializer === void 0 && !(isPropertyDeclaration(decl) && !(checker.getTypeAtLocation(decl).flags & 1 /* Any */)) || isBindingPattern(decl.name) || isVariableDeclaration(decl) && !isHintableDeclaration(decl)) {
|
|
165557
165566
|
return;
|
|
165558
165567
|
}
|
|
165559
165568
|
const effectiveTypeAnnotation = getEffectiveTypeAnnotationNode(decl);
|
package/lib/typescript.js
CHANGED
|
@@ -2326,7 +2326,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
2326
2326
|
|
|
2327
2327
|
// src/compiler/corePublic.ts
|
|
2328
2328
|
var versionMajorMinor = "5.5";
|
|
2329
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2329
|
+
var version = `${versionMajorMinor}.0-dev.20240313`;
|
|
2330
2330
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2331
2331
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2332
2332
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -3633,7 +3633,7 @@ var createUIStringComparer = /* @__PURE__ */ (() => {
|
|
|
3633
3633
|
return value < 0 ? -1 /* LessThan */ : value > 0 ? 1 /* GreaterThan */ : 0 /* EqualTo */;
|
|
3634
3634
|
}
|
|
3635
3635
|
function createIntlCollatorStringComparer(locale) {
|
|
3636
|
-
const comparer = new Intl.Collator(locale, { usage: "sort", sensitivity: "variant" }).compare;
|
|
3636
|
+
const comparer = new Intl.Collator(locale, { usage: "sort", sensitivity: "variant", numeric: true }).compare;
|
|
3637
3637
|
return (a, b) => compareWithCallback(a, b, comparer);
|
|
3638
3638
|
}
|
|
3639
3639
|
})();
|
|
@@ -9921,7 +9921,7 @@ var Diagnostics = {
|
|
|
9921
9921
|
Overload_signatures_must_all_be_abstract_or_non_abstract: diag(2512, 1 /* Error */, "Overload_signatures_must_all_be_abstract_or_non_abstract_2512", "Overload signatures must all be abstract or non-abstract."),
|
|
9922
9922
|
Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression: diag(2513, 1 /* Error */, "Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression_2513", "Abstract method '{0}' in class '{1}' cannot be accessed via super expression."),
|
|
9923
9923
|
A_tuple_type_cannot_be_indexed_with_a_negative_value: diag(2514, 1 /* Error */, "A_tuple_type_cannot_be_indexed_with_a_negative_value_2514", "A tuple type cannot be indexed with a negative value."),
|
|
9924
|
-
Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2: diag(2515, 1 /* Error */, "Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2_2515", "Non-abstract class '{0}' does not implement inherited abstract member
|
|
9924
|
+
Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2: diag(2515, 1 /* Error */, "Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2_2515", "Non-abstract class '{0}' does not implement inherited abstract member {1} from class '{2}'."),
|
|
9925
9925
|
All_declarations_of_an_abstract_method_must_be_consecutive: diag(2516, 1 /* Error */, "All_declarations_of_an_abstract_method_must_be_consecutive_2516", "All declarations of an abstract method must be consecutive."),
|
|
9926
9926
|
Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type: diag(2517, 1 /* Error */, "Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type_2517", "Cannot assign an abstract constructor type to a non-abstract constructor type."),
|
|
9927
9927
|
A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard: diag(2518, 1 /* Error */, "A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard_2518", "A 'this'-based type guard is not compatible with a parameter-based type guard."),
|
|
@@ -10031,9 +10031,13 @@ var Diagnostics = {
|
|
|
10031
10031
|
Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator: diag(2638, 1 /* Error */, "Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operato_2638", "Type '{0}' may represent a primitive value, which is not permitted as the right operand of the 'in' operator."),
|
|
10032
10032
|
React_components_cannot_include_JSX_namespace_names: diag(2639, 1 /* Error */, "React_components_cannot_include_JSX_namespace_names_2639", "React components cannot include JSX namespace names"),
|
|
10033
10033
|
Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: diag(2649, 1 /* Error */, "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", "Cannot augment module '{0}' with value exports because it resolves to a non-module entity."),
|
|
10034
|
+
Non_abstract_class_expression_is_missing_implementations_for_the_following_members_of_0_Colon_1_and_2_more: diag(2650, 1 /* Error */, "Non_abstract_class_expression_is_missing_implementations_for_the_following_members_of_0_Colon_1_and__2650", "Non-abstract class expression is missing implementations for the following members of '{0}': {1} and {2} more."),
|
|
10034
10035
|
A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: diag(2651, 1 /* Error */, "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums."),
|
|
10035
10036
|
Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: diag(2652, 1 /* Error */, "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead."),
|
|
10036
10037
|
Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1: diag(2653, 1 /* Error */, "Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1_2653", "Non-abstract class expression does not implement inherited abstract member '{0}' from class '{1}'."),
|
|
10038
|
+
Non_abstract_class_0_is_missing_implementations_for_the_following_members_of_1_Colon_2: diag(2654, 1 /* Error */, "Non_abstract_class_0_is_missing_implementations_for_the_following_members_of_1_Colon_2_2654", "Non-abstract class '{0}' is missing implementations for the following members of '{1}': {2}."),
|
|
10039
|
+
Non_abstract_class_0_is_missing_implementations_for_the_following_members_of_1_Colon_2_and_3_more: diag(2655, 1 /* Error */, "Non_abstract_class_0_is_missing_implementations_for_the_following_members_of_1_Colon_2_and_3_more_2655", "Non-abstract class '{0}' is missing implementations for the following members of '{1}': {2} and {3} more."),
|
|
10040
|
+
Non_abstract_class_expression_is_missing_implementations_for_the_following_members_of_0_Colon_1: diag(2656, 1 /* Error */, "Non_abstract_class_expression_is_missing_implementations_for_the_following_members_of_0_Colon_1_2656", "Non-abstract class expression is missing implementations for the following members of '{0}': {1}."),
|
|
10037
10041
|
JSX_expressions_must_have_one_parent_element: diag(2657, 1 /* Error */, "JSX_expressions_must_have_one_parent_element_2657", "JSX expressions must have one parent element."),
|
|
10038
10042
|
Type_0_provides_no_match_for_the_signature_1: diag(2658, 1 /* Error */, "Type_0_provides_no_match_for_the_signature_1_2658", "Type '{0}' provides no match for the signature '{1}'."),
|
|
10039
10043
|
super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher: diag(2659, 1 /* Error */, "super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_highe_2659", "'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher."),
|
|
@@ -11362,7 +11366,6 @@ var Diagnostics = {
|
|
|
11362
11366
|
_0_is_possibly_null_or_undefined: diag(18049, 1 /* Error */, "_0_is_possibly_null_or_undefined_18049", "'{0}' is possibly 'null' or 'undefined'."),
|
|
11363
11367
|
The_value_0_cannot_be_used_here: diag(18050, 1 /* Error */, "The_value_0_cannot_be_used_here_18050", "The value '{0}' cannot be used here."),
|
|
11364
11368
|
Compiler_option_0_cannot_be_given_an_empty_string: diag(18051, 1 /* Error */, "Compiler_option_0_cannot_be_given_an_empty_string_18051", "Compiler option '{0}' cannot be given an empty string."),
|
|
11365
|
-
Non_abstract_class_0_does_not_implement_all_abstract_members_of_1: diag(18052, 1 /* Error */, "Non_abstract_class_0_does_not_implement_all_abstract_members_of_1_18052", "Non-abstract class '{0}' does not implement all abstract members of '{1}'"),
|
|
11366
11369
|
Its_type_0_is_not_a_valid_JSX_element_type: diag(18053, 1 /* Error */, "Its_type_0_is_not_a_valid_JSX_element_type_18053", "Its type '{0}' is not a valid JSX element type."),
|
|
11367
11370
|
await_using_statements_cannot_be_used_inside_a_class_static_block: diag(18054, 1 /* Error */, "await_using_statements_cannot_be_used_inside_a_class_static_block_18054", "'await using' statements cannot be used inside a class static block.")
|
|
11368
11371
|
};
|
|
@@ -21830,7 +21833,7 @@ function hasTabstop(node) {
|
|
|
21830
21833
|
}
|
|
21831
21834
|
function isJSDocOptionalParameter(node) {
|
|
21832
21835
|
return isInJSFile(node) && // node.type should only be a JSDocOptionalType when node is a parameter of a JSDocFunctionType
|
|
21833
|
-
(node.type && node.type.kind === 316 /* JSDocOptionalType */ || getJSDocParameterTags(node).some(
|
|
21836
|
+
(node.type && node.type.kind === 316 /* JSDocOptionalType */ || getJSDocParameterTags(node).some(isOptionalJSDocPropertyLikeTag));
|
|
21834
21837
|
}
|
|
21835
21838
|
function isOptionalDeclaration(declaration) {
|
|
21836
21839
|
switch (declaration.kind) {
|
|
@@ -60108,10 +60111,16 @@ function createTypeChecker(host) {
|
|
|
60108
60111
|
const symbol = getSymbol2(globals, '"' + moduleName + '"', 512 /* ValueModule */);
|
|
60109
60112
|
return symbol && withAugmentations ? getMergedSymbol(symbol) : symbol;
|
|
60110
60113
|
}
|
|
60114
|
+
function hasEffectiveQuestionToken(node) {
|
|
60115
|
+
return hasQuestionToken(node) || isOptionalJSDocPropertyLikeTag(node) || isParameter(node) && isJSDocOptionalParameter(node);
|
|
60116
|
+
}
|
|
60111
60117
|
function isOptionalParameter(node) {
|
|
60112
|
-
if (
|
|
60118
|
+
if (hasEffectiveQuestionToken(node)) {
|
|
60113
60119
|
return true;
|
|
60114
60120
|
}
|
|
60121
|
+
if (!isParameter(node)) {
|
|
60122
|
+
return false;
|
|
60123
|
+
}
|
|
60115
60124
|
if (node.initializer) {
|
|
60116
60125
|
const signature = getSignatureFromDeclaration(node.parent);
|
|
60117
60126
|
const parameterIndex = node.parent.parameters.indexOf(node);
|
|
@@ -60211,7 +60220,7 @@ function createTypeChecker(host) {
|
|
|
60211
60220
|
if (type && type.kind === 201 /* LiteralType */) {
|
|
60212
60221
|
flags |= 2 /* HasLiteralTypes */;
|
|
60213
60222
|
}
|
|
60214
|
-
const isOptionalParameter2 =
|
|
60223
|
+
const isOptionalParameter2 = hasEffectiveQuestionToken(param) || isParameter(param) && param.initializer || isRestParameter(param) || iife && parameters.length > iife.arguments.length && !type;
|
|
60215
60224
|
if (!isOptionalParameter2) {
|
|
60216
60225
|
minArgumentCount = parameters.length;
|
|
60217
60226
|
}
|
|
@@ -76899,7 +76908,7 @@ function createTypeChecker(host) {
|
|
|
76899
76908
|
}
|
|
76900
76909
|
return resolveErrorCall(node);
|
|
76901
76910
|
}
|
|
76902
|
-
if (checkMode & 8 /* SkipGenericFunctions */ && !node.typeArguments && callSignatures.some(
|
|
76911
|
+
if (checkMode & 8 /* SkipGenericFunctions */ && !node.typeArguments && callSignatures.some(isGenericFunctionReturningFunction)) {
|
|
76903
76912
|
skippedGenericFunction(node, checkMode);
|
|
76904
76913
|
return resolvingSignature;
|
|
76905
76914
|
}
|
|
@@ -76909,12 +76918,8 @@ function createTypeChecker(host) {
|
|
|
76909
76918
|
}
|
|
76910
76919
|
return resolveCall(node, callSignatures, candidatesOutArray, checkMode, callChainFlags);
|
|
76911
76920
|
}
|
|
76912
|
-
function
|
|
76913
|
-
|
|
76914
|
-
return false;
|
|
76915
|
-
}
|
|
76916
|
-
const returnType = getReturnTypeOfSignature(signature);
|
|
76917
|
-
return isFunctionType(returnType) || isConstructorType(returnType);
|
|
76921
|
+
function isGenericFunctionReturningFunction(signature) {
|
|
76922
|
+
return !!(signature.typeParameters && isFunctionType(getReturnTypeOfSignature(signature)));
|
|
76918
76923
|
}
|
|
76919
76924
|
function isUntypedFunctionCall(funcType, apparentFuncType, numCallSignatures, numConstructSignatures) {
|
|
76920
76925
|
return isTypeAny(funcType) || isTypeAny(apparentFuncType) && !!(funcType.flags & 262144 /* TypeParameter */) || !numCallSignatures && !numConstructSignatures && !(apparentFuncType.flags & 1048576 /* Union */) && !(getReducedType(apparentFuncType).flags & 131072 /* Never */) && isTypeAssignableTo(funcType, globalFunctionType);
|
|
@@ -84788,9 +84793,9 @@ function createTypeChecker(host) {
|
|
|
84788
84793
|
return filter(symbol.declarations, (d) => d.kind === 263 /* ClassDeclaration */ || d.kind === 264 /* InterfaceDeclaration */);
|
|
84789
84794
|
}
|
|
84790
84795
|
function checkKindsOfPropertyMemberOverrides(type, baseType) {
|
|
84791
|
-
var _a, _b, _c, _d;
|
|
84796
|
+
var _a, _b, _c, _d, _e;
|
|
84792
84797
|
const baseProperties = getPropertiesOfType(baseType);
|
|
84793
|
-
|
|
84798
|
+
const notImplementedInfo = /* @__PURE__ */ new Map();
|
|
84794
84799
|
basePropertyCheck:
|
|
84795
84800
|
for (const baseProperty of baseProperties) {
|
|
84796
84801
|
const base = getTargetSymbol(baseProperty);
|
|
@@ -84816,36 +84821,11 @@ function createTypeChecker(host) {
|
|
|
84816
84821
|
continue basePropertyCheck;
|
|
84817
84822
|
}
|
|
84818
84823
|
}
|
|
84819
|
-
|
|
84820
|
-
|
|
84821
|
-
|
|
84822
|
-
|
|
84823
|
-
|
|
84824
|
-
typeToString(baseType)
|
|
84825
|
-
);
|
|
84826
|
-
}
|
|
84827
|
-
if (derivedClassDecl.kind === 231 /* ClassExpression */) {
|
|
84828
|
-
addRelatedInfo(
|
|
84829
|
-
inheritedAbstractMemberNotImplementedError,
|
|
84830
|
-
createDiagnosticForNode(
|
|
84831
|
-
baseProperty.valueDeclaration ?? (baseProperty.declarations && first(baseProperty.declarations)) ?? derivedClassDecl,
|
|
84832
|
-
Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1,
|
|
84833
|
-
symbolToString(baseProperty),
|
|
84834
|
-
typeToString(baseType)
|
|
84835
|
-
)
|
|
84836
|
-
);
|
|
84837
|
-
} else {
|
|
84838
|
-
addRelatedInfo(
|
|
84839
|
-
inheritedAbstractMemberNotImplementedError,
|
|
84840
|
-
createDiagnosticForNode(
|
|
84841
|
-
baseProperty.valueDeclaration ?? (baseProperty.declarations && first(baseProperty.declarations)) ?? derivedClassDecl,
|
|
84842
|
-
Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2,
|
|
84843
|
-
typeToString(type),
|
|
84844
|
-
symbolToString(baseProperty),
|
|
84845
|
-
typeToString(baseType)
|
|
84846
|
-
)
|
|
84847
|
-
);
|
|
84848
|
-
}
|
|
84824
|
+
const baseTypeName = typeToString(baseType);
|
|
84825
|
+
const typeName = typeToString(type);
|
|
84826
|
+
const basePropertyName = symbolToString(baseProperty);
|
|
84827
|
+
const missedProperties = append((_a = notImplementedInfo.get(derivedClassDecl)) == null ? void 0 : _a.missedProperties, basePropertyName);
|
|
84828
|
+
notImplementedInfo.set(derivedClassDecl, { baseTypeName, typeName, missedProperties });
|
|
84849
84829
|
}
|
|
84850
84830
|
} else {
|
|
84851
84831
|
const derivedDeclarationFlags = getDeclarationModifierFlagsFromSymbol(derived);
|
|
@@ -84856,7 +84836,7 @@ function createTypeChecker(host) {
|
|
|
84856
84836
|
const basePropertyFlags = base.flags & 98308 /* PropertyOrAccessor */;
|
|
84857
84837
|
const derivedPropertyFlags = derived.flags & 98308 /* PropertyOrAccessor */;
|
|
84858
84838
|
if (basePropertyFlags && derivedPropertyFlags) {
|
|
84859
|
-
if ((getCheckFlags(base) & 6 /* Synthetic */ ? (
|
|
84839
|
+
if ((getCheckFlags(base) & 6 /* Synthetic */ ? (_b = base.declarations) == null ? void 0 : _b.some((d) => isPropertyAbstractOrInterface(d, baseDeclarationFlags)) : (_c = base.declarations) == null ? void 0 : _c.every((d) => isPropertyAbstractOrInterface(d, baseDeclarationFlags))) || getCheckFlags(base) & 262144 /* Mapped */ || derived.valueDeclaration && isBinaryExpression(derived.valueDeclaration)) {
|
|
84860
84840
|
continue;
|
|
84861
84841
|
}
|
|
84862
84842
|
const overriddenInstanceProperty = basePropertyFlags !== 4 /* Property */ && derivedPropertyFlags === 4 /* Property */;
|
|
@@ -84865,8 +84845,8 @@ function createTypeChecker(host) {
|
|
|
84865
84845
|
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;
|
|
84866
84846
|
error2(getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage2, symbolToString(base), typeToString(baseType), typeToString(type));
|
|
84867
84847
|
} else if (useDefineForClassFields) {
|
|
84868
|
-
const uninitialized = (
|
|
84869
|
-
if (uninitialized && !(derived.flags & 33554432 /* Transient */) && !(baseDeclarationFlags & 64 /* Abstract */) && !(derivedDeclarationFlags & 64 /* Abstract */) && !((
|
|
84848
|
+
const uninitialized = (_d = derived.declarations) == null ? void 0 : _d.find((d) => d.kind === 172 /* PropertyDeclaration */ && !d.initializer);
|
|
84849
|
+
if (uninitialized && !(derived.flags & 33554432 /* Transient */) && !(baseDeclarationFlags & 64 /* Abstract */) && !(derivedDeclarationFlags & 64 /* Abstract */) && !((_e = derived.declarations) == null ? void 0 : _e.some((d) => !!(d.flags & 33554432 /* Ambient */)))) {
|
|
84870
84850
|
const constructor = findConstructorDeclaration(getClassLikeDeclarationOfSymbol(type.symbol));
|
|
84871
84851
|
const propName = uninitialized.name;
|
|
84872
84852
|
if (uninitialized.exclamationToken || !constructor || !isIdentifier(propName) || !strictNullChecks || !isPropertyInitializedInConstructor(propName, type, constructor)) {
|
|
@@ -84891,6 +84871,30 @@ function createTypeChecker(host) {
|
|
|
84891
84871
|
error2(getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type));
|
|
84892
84872
|
}
|
|
84893
84873
|
}
|
|
84874
|
+
for (const [errorNode, memberInfo] of notImplementedInfo) {
|
|
84875
|
+
if (length(memberInfo.missedProperties) === 1) {
|
|
84876
|
+
if (isClassExpression(errorNode)) {
|
|
84877
|
+
error2(errorNode, Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, first(memberInfo.missedProperties), memberInfo.baseTypeName);
|
|
84878
|
+
} else {
|
|
84879
|
+
error2(errorNode, Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2, memberInfo.typeName, first(memberInfo.missedProperties), memberInfo.baseTypeName);
|
|
84880
|
+
}
|
|
84881
|
+
} else if (length(memberInfo.missedProperties) > 5) {
|
|
84882
|
+
const missedProperties = map(memberInfo.missedProperties.slice(0, 4), (prop) => `'${prop}'`).join(", ");
|
|
84883
|
+
const remainingMissedProperties = length(memberInfo.missedProperties) - 4;
|
|
84884
|
+
if (isClassExpression(errorNode)) {
|
|
84885
|
+
error2(errorNode, Diagnostics.Non_abstract_class_expression_is_missing_implementations_for_the_following_members_of_0_Colon_1_and_2_more, memberInfo.baseTypeName, missedProperties, remainingMissedProperties);
|
|
84886
|
+
} else {
|
|
84887
|
+
error2(errorNode, Diagnostics.Non_abstract_class_0_is_missing_implementations_for_the_following_members_of_1_Colon_2_and_3_more, memberInfo.typeName, memberInfo.baseTypeName, missedProperties, remainingMissedProperties);
|
|
84888
|
+
}
|
|
84889
|
+
} else {
|
|
84890
|
+
const missedProperties = map(memberInfo.missedProperties, (prop) => `'${prop}'`).join(", ");
|
|
84891
|
+
if (isClassExpression(errorNode)) {
|
|
84892
|
+
error2(errorNode, Diagnostics.Non_abstract_class_expression_is_missing_implementations_for_the_following_members_of_0_Colon_1, memberInfo.baseTypeName, missedProperties);
|
|
84893
|
+
} else {
|
|
84894
|
+
error2(errorNode, Diagnostics.Non_abstract_class_0_is_missing_implementations_for_the_following_members_of_1_Colon_2, memberInfo.typeName, memberInfo.baseTypeName, missedProperties);
|
|
84895
|
+
}
|
|
84896
|
+
}
|
|
84897
|
+
}
|
|
84894
84898
|
}
|
|
84895
84899
|
function isPropertyAbstractOrInterface(declaration, baseDeclarationFlags) {
|
|
84896
84900
|
return baseDeclarationFlags & 64 /* Abstract */ && (!isPropertyDeclaration(declaration) || !declaration.initializer) || isInterfaceDeclaration(declaration.parent);
|
|
@@ -88615,7 +88619,7 @@ function createTypeChecker(host) {
|
|
|
88615
88619
|
if (parameter.initializer) {
|
|
88616
88620
|
return grammarErrorOnNode(parameter.name, Diagnostics.A_rest_parameter_cannot_have_an_initializer);
|
|
88617
88621
|
}
|
|
88618
|
-
} else if (
|
|
88622
|
+
} else if (hasEffectiveQuestionToken(parameter)) {
|
|
88619
88623
|
seenOptionalParameter = true;
|
|
88620
88624
|
if (parameter.questionToken && parameter.initializer) {
|
|
88621
88625
|
return grammarErrorOnNode(parameter.name, Diagnostics.Parameter_cannot_have_question_mark_and_initializer);
|
|
@@ -153524,7 +153528,12 @@ function getTypesPackageNameToInstall(packageName, host, diagCode) {
|
|
|
153524
153528
|
|
|
153525
153529
|
// src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts
|
|
153526
153530
|
var errorCodes31 = [
|
|
153527
|
-
Diagnostics.
|
|
153531
|
+
Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2.code,
|
|
153532
|
+
Diagnostics.Non_abstract_class_0_is_missing_implementations_for_the_following_members_of_1_Colon_2.code,
|
|
153533
|
+
Diagnostics.Non_abstract_class_0_is_missing_implementations_for_the_following_members_of_1_Colon_2_and_3_more.code,
|
|
153534
|
+
Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1.code,
|
|
153535
|
+
Diagnostics.Non_abstract_class_expression_is_missing_implementations_for_the_following_members_of_0_Colon_1.code,
|
|
153536
|
+
Diagnostics.Non_abstract_class_expression_is_missing_implementations_for_the_following_members_of_0_Colon_1_and_2_more.code
|
|
153528
153537
|
];
|
|
153529
153538
|
var fixId25 = "fixClassDoesntImplementInheritedAbstractMember";
|
|
153530
153539
|
registerCodeFix({
|
|
@@ -165553,7 +165562,7 @@ function provideInlayHints(context) {
|
|
|
165553
165562
|
return type.symbol && type.symbol.flags & 1536 /* Module */;
|
|
165554
165563
|
}
|
|
165555
165564
|
function visitVariableLikeDeclaration(decl) {
|
|
165556
|
-
if (
|
|
165565
|
+
if (decl.initializer === void 0 && !(isPropertyDeclaration(decl) && !(checker.getTypeAtLocation(decl).flags & 1 /* Any */)) || isBindingPattern(decl.name) || isVariableDeclaration(decl) && !isHintableDeclaration(decl)) {
|
|
165557
165566
|
return;
|
|
165558
165567
|
}
|
|
165559
165568
|
const effectiveTypeAnnotation = getEffectiveTypeAnnotationNode(decl);
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
|
|
|
54
54
|
|
|
55
55
|
// src/compiler/corePublic.ts
|
|
56
56
|
var versionMajorMinor = "5.5";
|
|
57
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
57
|
+
var version = `${versionMajorMinor}.0-dev.20240313`;
|
|
58
58
|
|
|
59
59
|
// src/compiler/core.ts
|
|
60
60
|
var emptyArray = [];
|
|
@@ -5727,7 +5727,7 @@ var Diagnostics = {
|
|
|
5727
5727
|
Overload_signatures_must_all_be_abstract_or_non_abstract: diag(2512, 1 /* Error */, "Overload_signatures_must_all_be_abstract_or_non_abstract_2512", "Overload signatures must all be abstract or non-abstract."),
|
|
5728
5728
|
Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression: diag(2513, 1 /* Error */, "Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression_2513", "Abstract method '{0}' in class '{1}' cannot be accessed via super expression."),
|
|
5729
5729
|
A_tuple_type_cannot_be_indexed_with_a_negative_value: diag(2514, 1 /* Error */, "A_tuple_type_cannot_be_indexed_with_a_negative_value_2514", "A tuple type cannot be indexed with a negative value."),
|
|
5730
|
-
Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2: diag(2515, 1 /* Error */, "Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2_2515", "Non-abstract class '{0}' does not implement inherited abstract member
|
|
5730
|
+
Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2: diag(2515, 1 /* Error */, "Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2_2515", "Non-abstract class '{0}' does not implement inherited abstract member {1} from class '{2}'."),
|
|
5731
5731
|
All_declarations_of_an_abstract_method_must_be_consecutive: diag(2516, 1 /* Error */, "All_declarations_of_an_abstract_method_must_be_consecutive_2516", "All declarations of an abstract method must be consecutive."),
|
|
5732
5732
|
Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type: diag(2517, 1 /* Error */, "Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type_2517", "Cannot assign an abstract constructor type to a non-abstract constructor type."),
|
|
5733
5733
|
A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard: diag(2518, 1 /* Error */, "A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard_2518", "A 'this'-based type guard is not compatible with a parameter-based type guard."),
|
|
@@ -5837,9 +5837,13 @@ var Diagnostics = {
|
|
|
5837
5837
|
Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator: diag(2638, 1 /* Error */, "Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operato_2638", "Type '{0}' may represent a primitive value, which is not permitted as the right operand of the 'in' operator."),
|
|
5838
5838
|
React_components_cannot_include_JSX_namespace_names: diag(2639, 1 /* Error */, "React_components_cannot_include_JSX_namespace_names_2639", "React components cannot include JSX namespace names"),
|
|
5839
5839
|
Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: diag(2649, 1 /* Error */, "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", "Cannot augment module '{0}' with value exports because it resolves to a non-module entity."),
|
|
5840
|
+
Non_abstract_class_expression_is_missing_implementations_for_the_following_members_of_0_Colon_1_and_2_more: diag(2650, 1 /* Error */, "Non_abstract_class_expression_is_missing_implementations_for_the_following_members_of_0_Colon_1_and__2650", "Non-abstract class expression is missing implementations for the following members of '{0}': {1} and {2} more."),
|
|
5840
5841
|
A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: diag(2651, 1 /* Error */, "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums."),
|
|
5841
5842
|
Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: diag(2652, 1 /* Error */, "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead."),
|
|
5842
5843
|
Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1: diag(2653, 1 /* Error */, "Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1_2653", "Non-abstract class expression does not implement inherited abstract member '{0}' from class '{1}'."),
|
|
5844
|
+
Non_abstract_class_0_is_missing_implementations_for_the_following_members_of_1_Colon_2: diag(2654, 1 /* Error */, "Non_abstract_class_0_is_missing_implementations_for_the_following_members_of_1_Colon_2_2654", "Non-abstract class '{0}' is missing implementations for the following members of '{1}': {2}."),
|
|
5845
|
+
Non_abstract_class_0_is_missing_implementations_for_the_following_members_of_1_Colon_2_and_3_more: diag(2655, 1 /* Error */, "Non_abstract_class_0_is_missing_implementations_for_the_following_members_of_1_Colon_2_and_3_more_2655", "Non-abstract class '{0}' is missing implementations for the following members of '{1}': {2} and {3} more."),
|
|
5846
|
+
Non_abstract_class_expression_is_missing_implementations_for_the_following_members_of_0_Colon_1: diag(2656, 1 /* Error */, "Non_abstract_class_expression_is_missing_implementations_for_the_following_members_of_0_Colon_1_2656", "Non-abstract class expression is missing implementations for the following members of '{0}': {1}."),
|
|
5843
5847
|
JSX_expressions_must_have_one_parent_element: diag(2657, 1 /* Error */, "JSX_expressions_must_have_one_parent_element_2657", "JSX expressions must have one parent element."),
|
|
5844
5848
|
Type_0_provides_no_match_for_the_signature_1: diag(2658, 1 /* Error */, "Type_0_provides_no_match_for_the_signature_1_2658", "Type '{0}' provides no match for the signature '{1}'."),
|
|
5845
5849
|
super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher: diag(2659, 1 /* Error */, "super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_highe_2659", "'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher."),
|
|
@@ -7168,7 +7172,6 @@ var Diagnostics = {
|
|
|
7168
7172
|
_0_is_possibly_null_or_undefined: diag(18049, 1 /* Error */, "_0_is_possibly_null_or_undefined_18049", "'{0}' is possibly 'null' or 'undefined'."),
|
|
7169
7173
|
The_value_0_cannot_be_used_here: diag(18050, 1 /* Error */, "The_value_0_cannot_be_used_here_18050", "The value '{0}' cannot be used here."),
|
|
7170
7174
|
Compiler_option_0_cannot_be_given_an_empty_string: diag(18051, 1 /* Error */, "Compiler_option_0_cannot_be_given_an_empty_string_18051", "Compiler option '{0}' cannot be given an empty string."),
|
|
7171
|
-
Non_abstract_class_0_does_not_implement_all_abstract_members_of_1: diag(18052, 1 /* Error */, "Non_abstract_class_0_does_not_implement_all_abstract_members_of_1_18052", "Non-abstract class '{0}' does not implement all abstract members of '{1}'"),
|
|
7172
7175
|
Its_type_0_is_not_a_valid_JSX_element_type: diag(18053, 1 /* Error */, "Its_type_0_is_not_a_valid_JSX_element_type_18053", "Its type '{0}' is not a valid JSX element type."),
|
|
7173
7176
|
await_using_statements_cannot_be_used_inside_a_class_static_block: diag(18054, 1 /* Error */, "await_using_statements_cannot_be_used_inside_a_class_static_block_18054", "'await using' statements cannot be used inside a class static block.")
|
|
7174
7177
|
};
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "typescript",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.5.0-dev.
|
|
5
|
+
"version": "5.5.0-dev.20240313",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -112,5 +112,5 @@
|
|
|
112
112
|
"node": "20.1.0",
|
|
113
113
|
"npm": "8.19.4"
|
|
114
114
|
},
|
|
115
|
-
"gitHead": "
|
|
115
|
+
"gitHead": "c1f0f7cb58b12232d5e9de3e7560376e8a70ce56"
|
|
116
116
|
}
|