96 lines
No EOL
2.5 KiB
Text
96 lines
No EOL
2.5 KiB
Text
==== tests/cases/compiler/inheritance1.ts (12 errors) ====
|
|
class Control {
|
|
private state: any;
|
|
}
|
|
interface SelectableControl extends Control {
|
|
select(): void;
|
|
}
|
|
|
|
class Button extends Control implements SelectableControl {
|
|
select() { }
|
|
}
|
|
class TextBox extends Control {
|
|
select() { }
|
|
}
|
|
class ImageBase extends Control implements SelectableControl{
|
|
~~~~~~~~~
|
|
!!! Class 'ImageBase' incorrectly implements interface 'SelectableControl':
|
|
!!! Property 'select' is missing in type 'ImageBase'.
|
|
}
|
|
class Image1 extends Control {
|
|
}
|
|
class Locations implements SelectableControl {
|
|
~~~~~~~~~
|
|
!!! Class 'Locations' incorrectly implements interface 'SelectableControl':
|
|
!!! Property 'state' is missing in type 'Locations'.
|
|
select() { }
|
|
}
|
|
class Locations1 {
|
|
select() { }
|
|
}
|
|
var sc: SelectableControl;
|
|
var c: Control;
|
|
|
|
var b: Button;
|
|
sc = b;
|
|
c = b;
|
|
b = sc;
|
|
b = c;
|
|
~
|
|
!!! Type 'Control' is not assignable to type 'Button':
|
|
!!! Property 'select' is missing in type 'Control'.
|
|
|
|
var t: TextBox;
|
|
sc = t;
|
|
c = t;
|
|
t = sc;
|
|
t = c;
|
|
~
|
|
!!! Type 'Control' is not assignable to type 'TextBox':
|
|
!!! Property 'select' is missing in type 'Control'.
|
|
|
|
var i: ImageBase;
|
|
sc = i;
|
|
~~
|
|
!!! Type 'ImageBase' is not assignable to type 'SelectableControl'.
|
|
c = i;
|
|
i = sc;
|
|
i = c;
|
|
|
|
var i1: Image1;
|
|
sc = i1;
|
|
~~
|
|
!!! Type 'Image1' is not assignable to type 'SelectableControl':
|
|
!!! Property 'select' is missing in type 'Image1'.
|
|
c = i1;
|
|
i1 = sc;
|
|
i1 = c;
|
|
|
|
var l: Locations;
|
|
sc = l;
|
|
~~
|
|
!!! Type 'Locations' is not assignable to type 'SelectableControl'.
|
|
c = l;
|
|
~
|
|
!!! Type 'Locations' is not assignable to type 'Control':
|
|
!!! Property 'state' is missing in type 'Locations'.
|
|
l = sc;
|
|
l = c;
|
|
~
|
|
!!! Type 'Control' is not assignable to type 'Locations':
|
|
!!! Property 'select' is missing in type 'Control'.
|
|
|
|
var l1: Locations1;
|
|
sc = l1;
|
|
~~
|
|
!!! Type 'Locations1' is not assignable to type 'SelectableControl':
|
|
!!! Property 'state' is missing in type 'Locations1'.
|
|
c = l1;
|
|
~
|
|
!!! Type 'Locations1' is not assignable to type 'Control':
|
|
!!! Property 'state' is missing in type 'Locations1'.
|
|
l1 = sc;
|
|
l1 = c;
|
|
~~
|
|
!!! Type 'Control' is not assignable to type 'Locations1':
|
|
!!! Property 'select' is missing in type 'Control'. |