Files
scriptc/tests/corpus/1944-class-values-modules/main.ts
2026-07-22 18:08:04 -05:00

13 lines
570 B
TypeScript

// Class values keep identity and .name across modules; construction and
// statics through imported values are the local story exactly.
import { Shape, Hexagon, registry, DefaultShape } from "./lib.ts";
console.log(DefaultShape === Hexagon, DefaultShape === (Shape as typeof Shape));
console.log(DefaultShape.name, Shape.name);
const h = new DefaultShape();
console.log(h.label(), h.sides, h instanceof Shape, h instanceof Hexagon);
console.log(DefaultShape.family, Hexagon.family);
for (const K of registry) {
console.log(K.name, new K().label(), K === Hexagon);
}