2014-09-12 22:35:07 +02:00
|
|
|
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembers3.ts(17,15): error TS2429: Interface 'B' incorrectly extends interface 'A':
|
|
|
|
Types of property 'bar' are incompatible:
|
|
|
|
Type 'Base' is not assignable to type 'Derived':
|
|
|
|
Property 'bar' is missing in type 'Base'.
|
|
|
|
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembers3.ts(27,15): error TS2429: Interface 'B2' incorrectly extends interface 'A2':
|
|
|
|
Types of property '2.0' are incompatible:
|
|
|
|
Type 'Base' is not assignable to type 'Derived':
|
|
|
|
Property 'bar' is missing in type 'Base'.
|
|
|
|
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembers3.ts(37,15): error TS2429: Interface 'B3' incorrectly extends interface 'A3':
|
|
|
|
Types of property ''2.0'' are incompatible:
|
|
|
|
Type 'Base' is not assignable to type 'Derived':
|
|
|
|
Property 'bar' is missing in type 'Base'.
|
|
|
|
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembers3.ts(49,15): error TS2429: Interface 'B' incorrectly extends interface 'A':
|
|
|
|
Types of property 'bar' are incompatible:
|
|
|
|
Type 'Base' is not assignable to type 'Derived':
|
|
|
|
Property 'bar' is missing in type 'Base'.
|
|
|
|
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembers3.ts(59,15): error TS2429: Interface 'B2' incorrectly extends interface 'A2':
|
|
|
|
Types of property '2.0' are incompatible:
|
|
|
|
Type 'Base' is not assignable to type 'Derived':
|
|
|
|
Property 'bar' is missing in type 'Base'.
|
|
|
|
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembers3.ts(69,15): error TS2429: Interface 'B3' incorrectly extends interface 'A3':
|
|
|
|
Types of property ''2.0'' are incompatible:
|
|
|
|
Type 'Base' is not assignable to type 'Derived':
|
|
|
|
Property 'bar' is missing in type 'Base'.
|
|
|
|
|
|
|
|
|
2014-07-13 01:04:16 +02:00
|
|
|
==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembers3.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: Derived;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface B extends A {
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2429: Interface 'B' incorrectly extends interface 'A':
|
|
|
|
!!! error TS2429: Types of property 'bar' are incompatible:
|
|
|
|
!!! error TS2429: Type 'Base' is not assignable to type 'Derived':
|
|
|
|
!!! error TS2429: Property 'bar' is missing in type 'Base'.
|
2014-07-13 01:04:16 +02:00
|
|
|
foo: Derived; // ok
|
|
|
|
bar: Base; // error
|
|
|
|
}
|
|
|
|
|
|
|
|
interface A2 {
|
|
|
|
1: Base;
|
|
|
|
2.0: Derived;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface B2 extends A2 {
|
|
|
|
~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2429: Interface 'B2' incorrectly extends interface 'A2':
|
|
|
|
!!! error TS2429: Types of property '2.0' are incompatible:
|
|
|
|
!!! error TS2429: Type 'Base' is not assignable to type 'Derived':
|
|
|
|
!!! error TS2429: Property 'bar' is missing in type 'Base'.
|
2014-07-13 01:04:16 +02:00
|
|
|
1: Derived; // ok
|
|
|
|
2: Base; // error
|
|
|
|
}
|
|
|
|
|
|
|
|
interface A3 {
|
|
|
|
'1': Base;
|
|
|
|
'2.0': Derived;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface B3 extends A3 {
|
|
|
|
~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2429: Interface 'B3' incorrectly extends interface 'A3':
|
|
|
|
!!! error TS2429: Types of property ''2.0'' are incompatible:
|
|
|
|
!!! error TS2429: Type 'Base' is not assignable to type 'Derived':
|
|
|
|
!!! error TS2429: Property 'bar' is missing in type 'Base'.
|
2014-07-13 01:04:16 +02:00
|
|
|
'1': Derived; // ok
|
|
|
|
'2.0': Base; // error
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module Optional {
|
|
|
|
interface A {
|
|
|
|
foo?: Base;
|
|
|
|
bar?: Derived;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface B extends A {
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2429: Interface 'B' incorrectly extends interface 'A':
|
|
|
|
!!! error TS2429: Types of property 'bar' are incompatible:
|
|
|
|
!!! error TS2429: Type 'Base' is not assignable to type 'Derived':
|
|
|
|
!!! error TS2429: Property 'bar' is missing in type 'Base'.
|
2014-07-13 01:04:16 +02:00
|
|
|
foo?: Derived; // ok
|
|
|
|
bar?: Base; // error
|
|
|
|
}
|
|
|
|
|
|
|
|
interface A2 {
|
|
|
|
1?: Base;
|
|
|
|
2.0?: Derived;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface B2 extends A2 {
|
|
|
|
~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2429: Interface 'B2' incorrectly extends interface 'A2':
|
|
|
|
!!! error TS2429: Types of property '2.0' are incompatible:
|
|
|
|
!!! error TS2429: Type 'Base' is not assignable to type 'Derived':
|
|
|
|
!!! error TS2429: Property 'bar' is missing in type 'Base'.
|
2014-07-13 01:04:16 +02:00
|
|
|
1?: Derived; // ok
|
|
|
|
2?: Base; // error
|
|
|
|
}
|
|
|
|
|
|
|
|
interface A3 {
|
|
|
|
'1'?: Base;
|
|
|
|
'2.0'?: Derived;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface B3 extends A3 {
|
|
|
|
~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2429: Interface 'B3' incorrectly extends interface 'A3':
|
|
|
|
!!! error TS2429: Types of property ''2.0'' are incompatible:
|
|
|
|
!!! error TS2429: Type 'Base' is not assignable to type 'Derived':
|
|
|
|
!!! error TS2429: Property 'bar' is missing in type 'Base'.
|
2014-07-13 01:04:16 +02:00
|
|
|
'1'?: Derived; // ok
|
|
|
|
'2.0'?: Base; // error
|
|
|
|
}
|
|
|
|
}
|