6e77e2e810
Also got rid of the 'terminalMessages' concept.
80 lines
2.5 KiB
Plaintext
80 lines
2.5 KiB
Plaintext
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembers5.ts(16,11): error TS2420: Class 'B' incorrectly implements interface 'A'.
|
|
Property 'foo' is missing in type 'B'.
|
|
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembers5.ts(24,11): error TS2420: Class 'B2' incorrectly implements interface 'A2'.
|
|
Property '1' is missing in type 'B2'.
|
|
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembers5.ts(32,11): error TS2420: Class 'B3' incorrectly implements interface 'A3'.
|
|
Property ''1'' is missing in type 'B3'.
|
|
|
|
|
|
==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembers5.ts (3 errors) ====
|
|
interface Base {
|
|
foo: string;
|
|
}
|
|
|
|
interface Derived extends Base {
|
|
bar: string;
|
|
}
|
|
|
|
// N and M have the same name, same accessibility, same optionality, and N is a subtype of M
|
|
// foo properties are valid, bar properties cause errors in the derived class declarations
|
|
module NotOptional {
|
|
interface A {
|
|
foo: Base;
|
|
}
|
|
|
|
class B implements A {
|
|
~
|
|
!!! error TS2420: Class 'B' incorrectly implements interface 'A'.
|
|
!!! error TS2420: Property 'foo' is missing in type 'B'.
|
|
fooo: Derived; // error
|
|
}
|
|
|
|
interface A2 {
|
|
1: Base;
|
|
}
|
|
|
|
class B2 implements A2 {
|
|
~~
|
|
!!! error TS2420: Class 'B2' incorrectly implements interface 'A2'.
|
|
!!! error TS2420: Property '1' is missing in type 'B2'.
|
|
2: Derived; // error
|
|
}
|
|
|
|
interface A3 {
|
|
'1': Base;
|
|
}
|
|
|
|
class B3 implements A3 {
|
|
~~
|
|
!!! error TS2420: Class 'B3' incorrectly implements interface 'A3'.
|
|
!!! error TS2420: Property ''1'' is missing in type 'B3'.
|
|
'1.0': Derived; // error
|
|
}
|
|
}
|
|
|
|
// same cases as above but with optional
|
|
module Optional {
|
|
interface A {
|
|
foo?: Base;
|
|
}
|
|
|
|
class B implements A {
|
|
fooo: Derived; // ok
|
|
}
|
|
|
|
interface A2 {
|
|
1?: Base;
|
|
}
|
|
|
|
class B2 implements A2 {
|
|
2: Derived; // ok
|
|
}
|
|
|
|
interface A3 {
|
|
'1'?: Base;
|
|
}
|
|
|
|
class B3 implements A3 {
|
|
'1.0': Derived; // ok
|
|
}
|
|
} |