TypeScript/tests/baselines/reference/classIsSubtypeOfBaseType.errors.txt
2014-09-11 16:11:08 -07:00

21 lines
826 B
Plaintext

==== 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; }> {
~~~~~~~~
!!! error TS2416: Class 'Derived2' incorrectly extends base class 'Base<{ bar: string; }>':
!!! error TS2416: Types of property 'foo' are incompatible:
!!! error TS2416: Type '{ bar?: string; }' is not assignable to type '{ bar: string; }':
!!! error TS2416: Required property 'bar' cannot be reimplemented with optional property in '{ bar?: string; }'.
foo: {
bar?: string; // error
}
}