swc/crates/swc_ecma_parser/tests/tsc/genericClassExpressionInFunction.ts

31 lines
571 B
TypeScript
Raw Normal View History

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;