mirror of
https://github.com/swc-project/swc.git
synced 2024-12-23 05:32:09 +03:00
46 lines
807 B
TypeScript
46 lines
807 B
TypeScript
|
interface BaseInterface {
|
||
|
required: number;
|
||
|
optional?: number;
|
||
|
}
|
||
|
|
||
|
class BaseClass {
|
||
|
baseMethod() { }
|
||
|
baseNumber: number;
|
||
|
}
|
||
|
|
||
|
interface Child extends BaseInterface {
|
||
|
additional: number;
|
||
|
}
|
||
|
|
||
|
class Child extends BaseClass {
|
||
|
classNumber: number;
|
||
|
method() { }
|
||
|
}
|
||
|
|
||
|
interface ChildNoBaseClass extends BaseInterface {
|
||
|
additional2: string;
|
||
|
}
|
||
|
class ChildNoBaseClass {
|
||
|
classString: string;
|
||
|
method2() { }
|
||
|
}
|
||
|
class Grandchild extends ChildNoBaseClass {
|
||
|
}
|
||
|
|
||
|
// checks if properties actually were merged
|
||
|
var child : Child;
|
||
|
child.required;
|
||
|
child.optional;
|
||
|
child.additional;
|
||
|
child.baseNumber;
|
||
|
child.classNumber;
|
||
|
child.baseMethod();
|
||
|
child.method();
|
||
|
|
||
|
var grandchild: Grandchild;
|
||
|
grandchild.required;
|
||
|
grandchild.optional;
|
||
|
grandchild.additional2;
|
||
|
grandchild.classString;
|
||
|
grandchild.method2();
|