Tests for interfaces merged w/classes
Both interfaces and classes have base classes/interfaces; all members are available on an instance of the merged child.
This commit is contained in:
parent
c072a5fd4b
commit
36ddd022a1
4 changed files with 218 additions and 0 deletions
39
tests/baselines/reference/mergedInheritedClassInterface.js
Normal file
39
tests/baselines/reference/mergedInheritedClassInterface.js
Normal file
|
@ -0,0 +1,39 @@
|
|||
//// [mergedInheritedClassInterface.ts]
|
||||
interface BaseInterface {
|
||||
required: number;
|
||||
optional?: number;
|
||||
}
|
||||
|
||||
declare class BaseClass {
|
||||
baseMethod();
|
||||
x2: number;
|
||||
}
|
||||
|
||||
interface Child extends BaseInterface {
|
||||
x3: number;
|
||||
}
|
||||
|
||||
declare class Child extends BaseClass {
|
||||
x4: number;
|
||||
method();
|
||||
}
|
||||
|
||||
// checks if properties actually were merged
|
||||
var child : Child;
|
||||
child.required;
|
||||
child.optional;
|
||||
child.x3;
|
||||
child.x4;
|
||||
child.baseMethod();
|
||||
child.method();
|
||||
|
||||
|
||||
//// [mergedInheritedClassInterface.js]
|
||||
// checks if properties actually were merged
|
||||
var child;
|
||||
child.required;
|
||||
child.optional;
|
||||
child.x3;
|
||||
child.x4;
|
||||
child.baseMethod();
|
||||
child.method();
|
|
@ -0,0 +1,75 @@
|
|||
=== tests/cases/conformance/classes/classDeclarations/mergedInheritedClassInterface.ts ===
|
||||
interface BaseInterface {
|
||||
>BaseInterface : Symbol(BaseInterface, Decl(mergedInheritedClassInterface.ts, 0, 0))
|
||||
|
||||
required: number;
|
||||
>required : Symbol(required, Decl(mergedInheritedClassInterface.ts, 0, 25))
|
||||
|
||||
optional?: number;
|
||||
>optional : Symbol(optional, Decl(mergedInheritedClassInterface.ts, 1, 21))
|
||||
}
|
||||
|
||||
declare class BaseClass {
|
||||
>BaseClass : Symbol(BaseClass, Decl(mergedInheritedClassInterface.ts, 3, 1))
|
||||
|
||||
baseMethod();
|
||||
>baseMethod : Symbol(baseMethod, Decl(mergedInheritedClassInterface.ts, 5, 25))
|
||||
|
||||
x2: number;
|
||||
>x2 : Symbol(x2, Decl(mergedInheritedClassInterface.ts, 6, 17))
|
||||
}
|
||||
|
||||
interface Child extends BaseInterface {
|
||||
>Child : Symbol(Child, Decl(mergedInheritedClassInterface.ts, 8, 1), Decl(mergedInheritedClassInterface.ts, 12, 1))
|
||||
>BaseInterface : Symbol(BaseInterface, Decl(mergedInheritedClassInterface.ts, 0, 0))
|
||||
|
||||
x3: number;
|
||||
>x3 : Symbol(x3, Decl(mergedInheritedClassInterface.ts, 10, 39))
|
||||
}
|
||||
|
||||
declare class Child extends BaseClass {
|
||||
>Child : Symbol(Child, Decl(mergedInheritedClassInterface.ts, 8, 1), Decl(mergedInheritedClassInterface.ts, 12, 1))
|
||||
>BaseClass : Symbol(BaseClass, Decl(mergedInheritedClassInterface.ts, 3, 1))
|
||||
|
||||
x4: number;
|
||||
>x4 : Symbol(x4, Decl(mergedInheritedClassInterface.ts, 14, 39))
|
||||
|
||||
method();
|
||||
>method : Symbol(method, Decl(mergedInheritedClassInterface.ts, 15, 15))
|
||||
}
|
||||
|
||||
// checks if properties actually were merged
|
||||
var child : Child;
|
||||
>child : Symbol(child, Decl(mergedInheritedClassInterface.ts, 20, 3))
|
||||
>Child : Symbol(Child, Decl(mergedInheritedClassInterface.ts, 8, 1), Decl(mergedInheritedClassInterface.ts, 12, 1))
|
||||
|
||||
child.required;
|
||||
>child.required : Symbol(BaseInterface.required, Decl(mergedInheritedClassInterface.ts, 0, 25))
|
||||
>child : Symbol(child, Decl(mergedInheritedClassInterface.ts, 20, 3))
|
||||
>required : Symbol(BaseInterface.required, Decl(mergedInheritedClassInterface.ts, 0, 25))
|
||||
|
||||
child.optional;
|
||||
>child.optional : Symbol(BaseInterface.optional, Decl(mergedInheritedClassInterface.ts, 1, 21))
|
||||
>child : Symbol(child, Decl(mergedInheritedClassInterface.ts, 20, 3))
|
||||
>optional : Symbol(BaseInterface.optional, Decl(mergedInheritedClassInterface.ts, 1, 21))
|
||||
|
||||
child.x3;
|
||||
>child.x3 : Symbol(Child.x3, Decl(mergedInheritedClassInterface.ts, 10, 39))
|
||||
>child : Symbol(child, Decl(mergedInheritedClassInterface.ts, 20, 3))
|
||||
>x3 : Symbol(Child.x3, Decl(mergedInheritedClassInterface.ts, 10, 39))
|
||||
|
||||
child.x4;
|
||||
>child.x4 : Symbol(Child.x4, Decl(mergedInheritedClassInterface.ts, 14, 39))
|
||||
>child : Symbol(child, Decl(mergedInheritedClassInterface.ts, 20, 3))
|
||||
>x4 : Symbol(Child.x4, Decl(mergedInheritedClassInterface.ts, 14, 39))
|
||||
|
||||
child.baseMethod();
|
||||
>child.baseMethod : Symbol(BaseClass.baseMethod, Decl(mergedInheritedClassInterface.ts, 5, 25))
|
||||
>child : Symbol(child, Decl(mergedInheritedClassInterface.ts, 20, 3))
|
||||
>baseMethod : Symbol(BaseClass.baseMethod, Decl(mergedInheritedClassInterface.ts, 5, 25))
|
||||
|
||||
child.method();
|
||||
>child.method : Symbol(Child.method, Decl(mergedInheritedClassInterface.ts, 15, 15))
|
||||
>child : Symbol(child, Decl(mergedInheritedClassInterface.ts, 20, 3))
|
||||
>method : Symbol(Child.method, Decl(mergedInheritedClassInterface.ts, 15, 15))
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
=== tests/cases/conformance/classes/classDeclarations/mergedInheritedClassInterface.ts ===
|
||||
interface BaseInterface {
|
||||
>BaseInterface : BaseInterface
|
||||
|
||||
required: number;
|
||||
>required : number
|
||||
|
||||
optional?: number;
|
||||
>optional : number
|
||||
}
|
||||
|
||||
declare class BaseClass {
|
||||
>BaseClass : BaseClass
|
||||
|
||||
baseMethod();
|
||||
>baseMethod : () => any
|
||||
|
||||
x2: number;
|
||||
>x2 : number
|
||||
}
|
||||
|
||||
interface Child extends BaseInterface {
|
||||
>Child : Child
|
||||
>BaseInterface : BaseInterface
|
||||
|
||||
x3: number;
|
||||
>x3 : number
|
||||
}
|
||||
|
||||
declare class Child extends BaseClass {
|
||||
>Child : Child
|
||||
>BaseClass : BaseClass
|
||||
|
||||
x4: number;
|
||||
>x4 : number
|
||||
|
||||
method();
|
||||
>method : () => any
|
||||
}
|
||||
|
||||
// checks if properties actually were merged
|
||||
var child : Child;
|
||||
>child : Child
|
||||
>Child : Child
|
||||
|
||||
child.required;
|
||||
>child.required : number
|
||||
>child : Child
|
||||
>required : number
|
||||
|
||||
child.optional;
|
||||
>child.optional : number
|
||||
>child : Child
|
||||
>optional : number
|
||||
|
||||
child.x3;
|
||||
>child.x3 : number
|
||||
>child : Child
|
||||
>x3 : number
|
||||
|
||||
child.x4;
|
||||
>child.x4 : number
|
||||
>child : Child
|
||||
>x4 : number
|
||||
|
||||
child.baseMethod();
|
||||
>child.baseMethod() : any
|
||||
>child.baseMethod : () => any
|
||||
>child : Child
|
||||
>baseMethod : () => any
|
||||
|
||||
child.method();
|
||||
>child.method() : any
|
||||
>child.method : () => any
|
||||
>child : Child
|
||||
>method : () => any
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
interface BaseInterface {
|
||||
required: number;
|
||||
optional?: number;
|
||||
}
|
||||
|
||||
declare class BaseClass {
|
||||
baseMethod();
|
||||
x2: number;
|
||||
}
|
||||
|
||||
interface Child extends BaseInterface {
|
||||
x3: number;
|
||||
}
|
||||
|
||||
declare class Child extends BaseClass {
|
||||
x4: number;
|
||||
method();
|
||||
}
|
||||
|
||||
// checks if properties actually were merged
|
||||
var child : Child;
|
||||
child.required;
|
||||
child.optional;
|
||||
child.x3;
|
||||
child.x4;
|
||||
child.baseMethod();
|
||||
child.method();
|
Loading…
Reference in a new issue