mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-23 06:10:02 +08:00
- Compile mesh, line, and point picking with perspective and orthographic camera rays. - Preserve JavaScript override arguments, array identity, and native subclass values across checked calls. - Specialize package class helpers and handle unsupported JSDoc namepaths.
25 lines
832 B
TypeScript
25 lines
832 B
TypeScript
class Base {
|
|
value = 2;
|
|
read(): number { return this.value; }
|
|
}
|
|
class Middle extends Base {}
|
|
class Derived extends Middle {
|
|
extra = 3;
|
|
read(): number { return this.value + this.extra; }
|
|
}
|
|
class Unrelated { value = 8; }
|
|
const derived = new Derived();
|
|
const boxed: unknown = derived;
|
|
const base = boxed as Base;
|
|
console.log('base', base === derived, base instanceof Derived, base.read());
|
|
base.value = 7;
|
|
console.log('shared', derived.value, base.read());
|
|
const array: unknown = [derived];
|
|
const bases = array as Base[];
|
|
console.log('array', bases[0] === derived, bases[0]!.read());
|
|
const candidate: unknown = derived;
|
|
const optional = candidate as Base | undefined;
|
|
console.log('union', optional === derived, optional!.read());
|
|
const unrelated: unknown = new Unrelated();
|
|
console.log('unrelated', unrelated instanceof Base);
|