Files
scriptc/tests/corpus/local-class-inheritance.ts
Chris Tate c257368c5e Compile Effect generators statically (#589)
* Compile Effect generators statically

* test: declare the dormant array write's expected fence
2026-09-30 14:25:29 -05:00

24 lines
676 B
TypeScript

function base(label: string) {
class Base {
value = 2;
read(): string { return label + this.value; }
}
return Base;
}
function extend(Base: ReturnType<typeof base>, increment: number) {
class Derived extends Base {
constructor() { super(); this.value += increment; }
read(): string { return super.read() + "!"; }
}
return Derived;
}
const A = base("a");
const B = base("b");
const C = extend(A, 3);
const D = extend(B, 7);
const c = new C();
const d = new D();
console.log(c.read(), d.read());
console.log(c instanceof A, c instanceof B, c instanceof C, c instanceof D);
console.log(d instanceof A, d instanceof B, d instanceof C, d instanceof D);