2014-10-28 08:28:59 +01:00
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classIsSubtypeOfBaseType.ts(11,7): error TS2415: Class 'Derived2' incorrectly extends base class 'Base<{ bar: string; }>'.
Types of property 'foo' are incompatible.
Type '{ bar?: string; }' is not assignable to type '{ bar: string; }'.
2014-09-18 02:05:45 +02:00
Property 'bar' is optional in type '{ bar?: string; }' but required in type '{ bar: string; }'.
2014-09-12 22:35:07 +02:00
2014-07-13 01:04:16 +02:00
==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classIsSubtypeOfBaseType.ts (1 errors) ====
class Base<T> {
foo: T;
}
class Derived extends Base<{ bar: string; }> {
foo: {
bar: string; baz: number; // ok
}
}
class Derived2 extends Base<{ bar: string; }> {
~~~~~~~~
2014-10-28 08:28:59 +01:00
!!! error TS2415: Class 'Derived2' incorrectly extends base class 'Base<{ bar: string; }>'.
!!! error TS2415: Types of property 'foo' are incompatible.
!!! error TS2415: Type '{ bar?: string; }' is not assignable to type '{ bar: string; }'.
!!! error TS2415: Property 'bar' is optional in type '{ bar?: string; }' but required in type '{ bar: string; }'.
2014-07-13 01:04:16 +02:00
foo: {
bar?: string; // error
}
}