File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,14 @@ export class InterfaceClass {
8
8
}
9
9
export class InterfacePrototype { }
10
10
export function Interface ( ...interfaces ) {
11
- return class extends InterfacePrototype {
11
+ let name ;
12
+ if ( typeof interfaces [ 0 ] === 'string' || typeof interfaces [ 0 ] === 'symbol' ) {
13
+ name = interfaces . shift ( ) ;
14
+ }
15
+ else {
16
+ name = Symbol ( ) ;
17
+ }
18
+ return class InterfaceClassIntance extends InterfacePrototype {
12
19
static [ Symbol . hasInstance ] ( instance ) {
13
20
return interfaces . some ( interfaceDef => {
14
21
if ( interfaceDef instanceof InterfaceClass ) {
@@ -24,6 +31,15 @@ export function Interface(...interfaces){
24
31
static getInterfaces ( ) {
25
32
return interfaces ;
26
33
}
34
+ static getName ( ) {
35
+ return name ;
36
+ }
37
+ static setName ( v ) {
38
+ name = v ;
39
+ }
40
+ static toString ( ) {
41
+ return name ;
42
+ }
27
43
} ;
28
44
}
29
45
You can’t perform that action at this time.
0 commit comments