2014-10-28 08:28:59 +01:00
|
|
|
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembersOptionality2.ts(10,11): error TS2430: Interface 'S' incorrectly extends interface 'T'.
|
2014-09-18 02:05:45 +02:00
|
|
|
Property 'Foo' is optional in type 'S' but required in type 'T'.
|
2014-10-28 08:28:59 +01:00
|
|
|
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembersOptionality2.ts(18,11): error TS2430: Interface 'S2' incorrectly extends interface 'T2'.
|
2014-09-18 02:05:45 +02:00
|
|
|
Property '1' is optional in type 'S2' but required in type 'T2'.
|
2014-10-28 08:28:59 +01:00
|
|
|
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembersOptionality2.ts(26,11): error TS2430: Interface 'S3' incorrectly extends interface 'T3'.
|
2014-09-18 02:05:45 +02:00
|
|
|
Property ''1'' is optional in type 'S3' but required in type 'T3'.
|
2014-09-12 22:35:07 +02:00
|
|
|
|
|
|
|
|
2014-10-10 23:41:14 +02:00
|
|
|
==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembersOptionality2.ts (3 errors) ====
|
2014-07-13 01:04:16 +02:00
|
|
|
// Derived member is optional but base member is not, should be an error
|
|
|
|
|
|
|
|
interface Base { foo: string; }
|
|
|
|
interface Derived extends Base { bar: string; }
|
|
|
|
|
|
|
|
interface T {
|
|
|
|
Foo: Base;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface S extends T {
|
|
|
|
~
|
2014-10-28 08:28:59 +01:00
|
|
|
!!! error TS2430: Interface 'S' incorrectly extends interface 'T'.
|
|
|
|
!!! error TS2430: Property 'Foo' is optional in type 'S' but required in type 'T'.
|
2014-07-13 01:04:16 +02:00
|
|
|
Foo?: Derived // error
|
|
|
|
}
|
|
|
|
|
|
|
|
interface T2 {
|
|
|
|
1: Base;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface S2 extends T2 {
|
|
|
|
~~
|
2014-10-28 08:28:59 +01:00
|
|
|
!!! error TS2430: Interface 'S2' incorrectly extends interface 'T2'.
|
|
|
|
!!! error TS2430: Property '1' is optional in type 'S2' but required in type 'T2'.
|
2014-07-13 01:04:16 +02:00
|
|
|
1?: Derived; // error
|
|
|
|
}
|
|
|
|
|
|
|
|
interface T3 {
|
|
|
|
'1': Base;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface S3 extends T3 {
|
|
|
|
~~
|
2014-10-28 08:28:59 +01:00
|
|
|
!!! error TS2430: Interface 'S3' incorrectly extends interface 'T3'.
|
|
|
|
!!! error TS2430: Property ''1'' is optional in type 'S3' but required in type 'T3'.
|
2014-07-13 01:04:16 +02:00
|
|
|
'1'?: Derived; // error
|
|
|
|
}
|
|
|
|
|
|
|
|
// object literal case
|
|
|
|
var a: { Foo: Base; }
|
|
|
|
var b: { Foo?: Derived; }
|
2014-10-10 23:41:14 +02:00
|
|
|
var r = true ? a : b; // ok
|