mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-23 06:10:02 +08:00
* Compile Effect generators statically * test: declare the dormant array write's expected fence
14 lines
409 B
TypeScript
14 lines
409 B
TypeScript
import * as Keys from "./keys.ts";
|
|
|
|
class Base {
|
|
value = 7;
|
|
[Keys.read](extra: number) { return this.value + extra; }
|
|
}
|
|
class Derived extends Base {
|
|
[Keys.read](extra: number) { return this.value * extra; }
|
|
}
|
|
function invoke(value: Base) { return value[Keys.read](3); }
|
|
console.log(invoke(new Base()), invoke(new Derived()));
|
|
const key: typeof Keys.read = Keys.read;
|
|
console.log(new Derived()[key](4));
|