21 lines
No EOL
770 B
Text
21 lines
No EOL
770 B
Text
==== 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; }> {
|
|
~~~~~~~~
|
|
!!! 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; }':
|
|
!!! Required property 'bar' cannot be reimplemented with optional property in '{ bar?: string; }'.
|
|
foo: {
|
|
bar?: string; // error
|
|
}
|
|
} |