6e77e2e810
Also got rid of the 'terminalMessages' concept.
131 lines
No EOL
5.4 KiB
Text
131 lines
No EOL
5.4 KiB
Text
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembers2.ts(17,15): error TS2430: Interface 'B' incorrectly extends interface 'A'.
|
|
Types of property 'bar' are incompatible.
|
|
Type 'string' is not assignable to type 'Base'.
|
|
Property 'foo' is missing in type 'String'.
|
|
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembers2.ts(27,15): error TS2430: Interface 'B2' incorrectly extends interface 'A2'.
|
|
Types of property '2.0' are incompatible.
|
|
Type 'string' is not assignable to type 'Base'.
|
|
Property 'foo' is missing in type 'String'.
|
|
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembers2.ts(37,15): error TS2430: Interface 'B3' incorrectly extends interface 'A3'.
|
|
Types of property ''2.0'' are incompatible.
|
|
Type 'string' is not assignable to type 'Base'.
|
|
Property 'foo' is missing in type 'String'.
|
|
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembers2.ts(50,15): error TS2430: Interface 'B' incorrectly extends interface 'A'.
|
|
Types of property 'bar' are incompatible.
|
|
Type 'string' is not assignable to type 'Base'.
|
|
Property 'foo' is missing in type 'String'.
|
|
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembers2.ts(60,15): error TS2430: Interface 'B2' incorrectly extends interface 'A2'.
|
|
Types of property '2.0' are incompatible.
|
|
Type 'string' is not assignable to type 'Base'.
|
|
Property 'foo' is missing in type 'String'.
|
|
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembers2.ts(70,15): error TS2430: Interface 'B3' incorrectly extends interface 'A3'.
|
|
Types of property ''2.0'' are incompatible.
|
|
Type 'string' is not assignable to type 'Base'.
|
|
Property 'foo' is missing in type 'String'.
|
|
|
|
|
|
==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembers2.ts (6 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;
|
|
bar: Base;
|
|
}
|
|
|
|
interface B extends A {
|
|
~
|
|
!!! error TS2430: Interface 'B' incorrectly extends interface 'A'.
|
|
!!! error TS2430: Types of property 'bar' are incompatible.
|
|
!!! error TS2430: Type 'string' is not assignable to type 'Base'.
|
|
!!! error TS2430: Property 'foo' is missing in type 'String'.
|
|
foo: Derived; // ok
|
|
bar: string; // error
|
|
}
|
|
|
|
interface A2 {
|
|
1: Base;
|
|
2.0: Base;
|
|
}
|
|
|
|
interface B2 extends A2 {
|
|
~~
|
|
!!! error TS2430: Interface 'B2' incorrectly extends interface 'A2'.
|
|
!!! error TS2430: Types of property '2.0' are incompatible.
|
|
!!! error TS2430: Type 'string' is not assignable to type 'Base'.
|
|
!!! error TS2430: Property 'foo' is missing in type 'String'.
|
|
1: Derived; // ok
|
|
2: string; // error
|
|
}
|
|
|
|
interface A3 {
|
|
'1': Base;
|
|
'2.0': Base;
|
|
}
|
|
|
|
interface B3 extends A3 {
|
|
~~
|
|
!!! error TS2430: Interface 'B3' incorrectly extends interface 'A3'.
|
|
!!! error TS2430: Types of property ''2.0'' are incompatible.
|
|
!!! error TS2430: Type 'string' is not assignable to type 'Base'.
|
|
!!! error TS2430: Property 'foo' is missing in type 'String'.
|
|
'1': Derived; // ok
|
|
'2.0': string; // error
|
|
}
|
|
}
|
|
|
|
// same cases as above but with optional
|
|
module Optional {
|
|
interface A {
|
|
foo?: Base;
|
|
bar?: Base;
|
|
}
|
|
|
|
interface B extends A {
|
|
~
|
|
!!! error TS2430: Interface 'B' incorrectly extends interface 'A'.
|
|
!!! error TS2430: Types of property 'bar' are incompatible.
|
|
!!! error TS2430: Type 'string' is not assignable to type 'Base'.
|
|
!!! error TS2430: Property 'foo' is missing in type 'String'.
|
|
foo?: Derived; // ok
|
|
bar?: string; // error
|
|
}
|
|
|
|
interface A2 {
|
|
1?: Base;
|
|
2.0?: Base;
|
|
}
|
|
|
|
interface B2 extends A2 {
|
|
~~
|
|
!!! error TS2430: Interface 'B2' incorrectly extends interface 'A2'.
|
|
!!! error TS2430: Types of property '2.0' are incompatible.
|
|
!!! error TS2430: Type 'string' is not assignable to type 'Base'.
|
|
!!! error TS2430: Property 'foo' is missing in type 'String'.
|
|
1?: Derived; // ok
|
|
2?: string; // error
|
|
}
|
|
|
|
interface A3 {
|
|
'1'?: Base;
|
|
'2.0'?: Base;
|
|
}
|
|
|
|
interface B3 extends A3 {
|
|
~~
|
|
!!! error TS2430: Interface 'B3' incorrectly extends interface 'A3'.
|
|
!!! error TS2430: Types of property ''2.0'' are incompatible.
|
|
!!! error TS2430: Type 'string' is not assignable to type 'Base'.
|
|
!!! error TS2430: Property 'foo' is missing in type 'String'.
|
|
'1'?: Derived; // ok
|
|
'2.0'?: string; // error
|
|
}
|
|
} |