functions-summaries-rest-call.ts 488 B

12345678910
  1. // .call on a function whose ONLY formal is a rest parameter: the rest placeholder
  2. // gathers every actual at index >= 0, which accidentally includes the shifted
  3. // secret at index 1 — probing that rest params neutralize the .call misalignment.
  4. const judge = agent("judge");
  5. const secret = await agent("s").ask<string>("make secret");
  6. function f(...xs: string[]): Node<string> {
  7. return judge.ask<string>(`judge ${xs.join(" ")}`);
  8. }
  9. const out = await f.call(null, secret);
  10. return out;