mirror of
https://github.com/swc-project/swc.git
synced 2024-12-18 11:11:30 +03:00
75 lines
964 B
TypeScript
75 lines
964 B
TypeScript
// merged interfaces behave as if all extends clauses from each declaration are merged together
|
|
// no errors expected
|
|
|
|
class C {
|
|
a: number;
|
|
}
|
|
|
|
class C2 {
|
|
b: number;
|
|
}
|
|
|
|
class C3 {
|
|
c: string;
|
|
}
|
|
|
|
class C4 {
|
|
d: string;
|
|
}
|
|
|
|
|
|
interface A extends C, C3 {
|
|
y: string;
|
|
}
|
|
|
|
interface A extends C2, C4 {
|
|
z: string;
|
|
}
|
|
|
|
class D implements A {
|
|
a: number;
|
|
b: number;
|
|
c: string;
|
|
d: string;
|
|
y: string;
|
|
z: string;
|
|
}
|
|
|
|
var a: A;
|
|
var r = a.a;
|
|
|
|
// generic interfaces in a module
|
|
module M {
|
|
class C<T> {
|
|
a: T;
|
|
}
|
|
|
|
class C2<T> {
|
|
b: T;
|
|
}
|
|
|
|
class C3<T> {
|
|
c: T;
|
|
}
|
|
|
|
class C4<T> {
|
|
d: T;
|
|
}
|
|
|
|
interface A<T> extends C<T>, C3<T> {
|
|
y: T;
|
|
}
|
|
|
|
interface A<T> extends C2<string>, C4<string> {
|
|
z: T;
|
|
}
|
|
|
|
class D implements A<boolean> {
|
|
a: boolean;
|
|
b: string;
|
|
c: boolean;
|
|
d: string;
|
|
y: boolean;
|
|
z: boolean;
|
|
}
|
|
} |