join-element-alias-write-through.ts 568 B

1234567891011121314
  1. // Alias an element of a Promise.all result and write a NEW field through the alias, then
  2. // read it back by static index. Confirms aliasing write-through into a join element AND
  3. // join-port precision survive together (port=0 preserved on the join edge).
  4. interface R {
  5. g: string;
  6. }
  7. const a = agent("wa");
  8. const b = agent("wb");
  9. const res = await Promise.all([a.ask<R>("x"), b.ask<R>("y")]);
  10. const first = res[0];
  11. const secret = await agent("wc").ask<string>("secret");
  12. first.g = secret;
  13. const out = await agent("reader").ask<string>(`use ${res[0].g}`);
  14. return out;