mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-20 05:40:17 +08:00
* Expand static Effect support across common APIs * Preserve compiler parity across expanded Effect patterns * Fix compiler regressions exposed by Effect coverage * Bound shared type conversion traversal * Clarify conversion contracts and tidy fixtures * Run every Effect fixture in CI shards * Preserve inferred array assignments in concurrent Effect programs * Record inferred array fixture compiler ordering
20 lines
670 B
TypeScript
20 lines
670 B
TypeScript
function select(reverse: boolean, first: string, second: string): string {
|
|
const [left, right] = reverse ? [second, first] : [first, second];
|
|
return left.toUpperCase() + ":" + right.toLowerCase();
|
|
}
|
|
console.log(select(false, "One", "Two"), select(true, "One", "Two"));
|
|
|
|
function choose(reverse: boolean) {
|
|
const a = { value: 1 }, b = { value: 2 };
|
|
const [left, right, amount] = reverse ? [b, a, 3] : [a, b, 4];
|
|
left.value += amount;
|
|
console.log(a.value, b.value, right.value);
|
|
}
|
|
choose(false);
|
|
choose(true);
|
|
|
|
const [only] = [...new Set(["one"])];
|
|
console.log(only);
|
|
const [first, ...rest] = [...new Set(["a", "b", "c"])];
|
|
console.log(first, rest.join(","));
|