mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-28 06:53:42 +08:00
- 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.
15 lines
597 B
TypeScript
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"));
|