Files
scriptc/tests/corpus/primitive-union-string.ts
Chris Tate 08772d01c8 Preserve narrowed class values and collection composition
- Preserve narrowed class and generic values, abstract properties, and standalone caught-class identity.
- Support identity-preserving array concatenation and typed-array collection values, with focused differential and sanitizer coverage.
- Share revision-matched bootstrap seeds across CI jobs while retaining command, rebuild, packaging, and sanitizer checks.
2026-10-08 01:21:43 -05:00

15 lines
597 B
TypeScript

class Label {
text = "label";
}
function render(value: boolean | number | bigint | Label): string {
if (typeof value === "number" || typeof value === "boolean") return String(value);
if (typeof value === "bigint") return `${value}`;
return value.text;
}
function template(value: string | number | Label): string {
if (typeof value === "number" || typeof value === "string") return `value=${value}`;
return value.text;
}
console.log(render(true), render(false), render(-0), render(NaN), render(Infinity));
console.log(render(12n), render(new Label()), template(2.5), template("text"));