mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-23 06:10:02 +08:00
15 lines
445 B
TypeScript
15 lines
445 B
TypeScript
// @dynamic
|
|
// `new X(...)` on a package-declared class: the construct op
|
|
// (JS_CallConstructor); the instance stays an island handle, methods
|
|
// chain, results exit at the declared types.
|
|
import { Counter } from "counter";
|
|
|
|
const c = new Counter(10);
|
|
c.inc(5).inc(2);
|
|
const v: number = c.value();
|
|
console.log(v);
|
|
const tag: string = c.label("n");
|
|
console.log(tag);
|
|
const fresh: number = new Counter(0.5).inc(0.25).value();
|
|
console.log(fresh);
|