mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-20 13:45:34 -05:00
Error messages and tests
This commit is contained in:
@@ -5773,7 +5773,7 @@ namespace ts {
|
||||
return type.resolvedBaseTypes = emptyArray;
|
||||
}
|
||||
if (!isValidBaseType(baseType)) {
|
||||
error(baseTypeNode.expression, Diagnostics.Base_constructor_return_type_0_is_not_a_class_or_interface_type, typeToString(baseType));
|
||||
error(baseTypeNode.expression, Diagnostics.Base_constructor_return_type_0_is_not_an_object_type_or_intersection_of_object_types_with_statically_known_members, typeToString(baseType));
|
||||
return type.resolvedBaseTypes = emptyArray;
|
||||
}
|
||||
if (type === baseType || hasBaseType(baseType, type)) {
|
||||
@@ -5831,7 +5831,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
else {
|
||||
error(node, Diagnostics.An_interface_can_only_extend_an_object_or_intersection_type_with_statically_known_members);
|
||||
error(node, Diagnostics.An_interface_can_only_extend_an_object_type_or_intersection_of_object_types_with_statically_known_members);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25979,7 +25979,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
else {
|
||||
error(typeRefNode, Diagnostics.A_class_can_only_implement_an_object_or_intersection_type_with_statically_known_members);
|
||||
error(typeRefNode, Diagnostics.A_class_can_only_implement_an_object_type_or_intersection_of_object_types_with_statically_known_members);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1056,7 +1056,7 @@
|
||||
"category": "Error",
|
||||
"code": 2311
|
||||
},
|
||||
"An interface can only extend an object or intersection type with statically known members.": {
|
||||
"An interface can only extend an object type or intersection of object types with statically known members.": {
|
||||
"category": "Error",
|
||||
"code": 2312
|
||||
},
|
||||
@@ -1484,7 +1484,7 @@
|
||||
"category": "Error",
|
||||
"code": 2420
|
||||
},
|
||||
"A class can only implement an object or intersection type with statically known members.": {
|
||||
"A class can only implement an object type or intersection of object types with statically known members.": {
|
||||
"category": "Error",
|
||||
"code": 2422
|
||||
},
|
||||
@@ -1816,7 +1816,7 @@
|
||||
"category": "Error",
|
||||
"code": 2508
|
||||
},
|
||||
"Base constructor return type '{0}' is not a class or interface type.": {
|
||||
"Base constructor return type '{0}' is not an object type or intersection of object types with statically known members.": {
|
||||
"category": "Error",
|
||||
"code": 2509
|
||||
},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/inheritFromGenericTypeParameter.ts(1,20): error TS2304: Cannot find name 'T'.
|
||||
tests/cases/compiler/inheritFromGenericTypeParameter.ts(2,24): error TS2312: An interface may only extend a class or another interface.
|
||||
tests/cases/compiler/inheritFromGenericTypeParameter.ts(2,24): error TS2312: An interface can only extend an object type or intersection of object types with statically known members.
|
||||
|
||||
|
||||
==== tests/cases/compiler/inheritFromGenericTypeParameter.ts (2 errors) ====
|
||||
@@ -8,4 +8,4 @@ tests/cases/compiler/inheritFromGenericTypeParameter.ts(2,24): error TS2312: An
|
||||
!!! error TS2304: Cannot find name 'T'.
|
||||
interface I<T> extends T { }
|
||||
~
|
||||
!!! error TS2312: An interface may only extend a class or another interface.
|
||||
!!! error TS2312: An interface can only extend an object type or intersection of object types with statically known members.
|
||||
@@ -51,8 +51,8 @@ tests/cases/conformance/interfaces/interfaceDeclarations/interfaceExtendsObjectI
|
||||
Type 'I23' is not assignable to type 'T1'.
|
||||
Types of property 'a' are incompatible.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersectionErrors.ts(46,23): error TS2312: An interface may only extend a class or another interface.
|
||||
tests/cases/conformance/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersectionErrors.ts(47,26): error TS2312: An interface may only extend a class or another interface.
|
||||
tests/cases/conformance/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersectionErrors.ts(46,23): error TS2312: An interface can only extend an object type or intersection of object types with statically known members.
|
||||
tests/cases/conformance/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersectionErrors.ts(47,26): error TS2312: An interface can only extend an object type or intersection of object types with statically known members.
|
||||
|
||||
|
||||
==== tests/cases/conformance/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersectionErrors.ts (23 errors) ====
|
||||
@@ -177,8 +177,8 @@ tests/cases/conformance/interfaces/interfaceDeclarations/interfaceExtendsObjectI
|
||||
|
||||
interface I30 extends U { x: string }
|
||||
~
|
||||
!!! error TS2312: An interface may only extend a class or another interface.
|
||||
!!! error TS2312: An interface can only extend an object type or intersection of object types with statically known members.
|
||||
interface I31<T> extends T { x: string }
|
||||
~
|
||||
!!! error TS2312: An interface may only extend a class or another interface.
|
||||
!!! error TS2312: An interface can only extend an object type or intersection of object types with statically known members.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/typeParameterAsBaseClass.ts(1,20): error TS2304: Cannot find name 'T'.
|
||||
tests/cases/compiler/typeParameterAsBaseClass.ts(2,24): error TS2422: A class may only implement another class or interface.
|
||||
tests/cases/compiler/typeParameterAsBaseClass.ts(2,24): error TS2422: A class can only implement an object type or intersection of object types with statically known members.
|
||||
|
||||
|
||||
==== tests/cases/compiler/typeParameterAsBaseClass.ts (2 errors) ====
|
||||
@@ -8,4 +8,4 @@ tests/cases/compiler/typeParameterAsBaseClass.ts(2,24): error TS2422: A class ma
|
||||
!!! error TS2304: Cannot find name 'T'.
|
||||
class C2<T> implements T {}
|
||||
~
|
||||
!!! error TS2422: A class may only implement another class or interface.
|
||||
!!! error TS2422: A class can only implement an object type or intersection of object types with statically known members.
|
||||
@@ -1,7 +1,7 @@
|
||||
tests/cases/conformance/types/typeParameters/typeParameterAsBaseType.ts(4,20): error TS2304: Cannot find name 'T'.
|
||||
tests/cases/conformance/types/typeParameters/typeParameterAsBaseType.ts(5,24): error TS2304: Cannot find name 'U'.
|
||||
tests/cases/conformance/types/typeParameters/typeParameterAsBaseType.ts(7,24): error TS2312: An interface may only extend a class or another interface.
|
||||
tests/cases/conformance/types/typeParameters/typeParameterAsBaseType.ts(8,28): error TS2312: An interface may only extend a class or another interface.
|
||||
tests/cases/conformance/types/typeParameters/typeParameterAsBaseType.ts(7,24): error TS2312: An interface can only extend an object type or intersection of object types with statically known members.
|
||||
tests/cases/conformance/types/typeParameters/typeParameterAsBaseType.ts(8,28): error TS2312: An interface can only extend an object type or intersection of object types with statically known members.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/typeParameters/typeParameterAsBaseType.ts (4 errors) ====
|
||||
@@ -17,9 +17,9 @@ tests/cases/conformance/types/typeParameters/typeParameterAsBaseType.ts(8,28): e
|
||||
|
||||
interface I<T> extends T { }
|
||||
~
|
||||
!!! error TS2312: An interface may only extend a class or another interface.
|
||||
!!! error TS2312: An interface can only extend an object type or intersection of object types with statically known members.
|
||||
interface I2<T, U> extends U { }
|
||||
~
|
||||
!!! error TS2312: An interface may only extend a class or another interface.
|
||||
!!! error TS2312: An interface can only extend an object type or intersection of object types with statically known members.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user