mirror of
https://github.com/swc-project/swc.git
synced 2024-12-22 21:21:31 +03:00
31 lines
571 B
TypeScript
31 lines
571 B
TypeScript
class A<T> {
|
|
genericVar: T
|
|
}
|
|
function B1<U>() {
|
|
// class expression can use T
|
|
return class extends A<U> { }
|
|
}
|
|
class B2<V> {
|
|
anon = class extends A<V> { }
|
|
}
|
|
function B3<W>() {
|
|
return class Inner<TInner> extends A<W> { }
|
|
}
|
|
// extends can call B
|
|
class K extends B1<number>() {
|
|
namae: string;
|
|
}
|
|
class C extends (new B2<number>().anon) {
|
|
name: string;
|
|
}
|
|
let b3Number = B3<number>();
|
|
class S extends b3Number<string> {
|
|
nom: string;
|
|
}
|
|
var c = new C();
|
|
var k = new K();
|
|
var s = new S();
|
|
c.genericVar = 12;
|
|
k.genericVar = 12;
|
|
s.genericVar = 12;
|