async-promise-node-field-alias-await.ts 367 B

12345678
  1. // A Node<T> stored in an object field after creation, awaited later through a
  2. // DIFFERENT alias of the container.
  3. // Expected: ask#1 -> ask#2 data; ask#2 -> sink.
  4. const box: { pending?: Node<string> } = {};
  5. box.pending = agent("writer").ask<string>("draft");
  6. const alias = box;
  7. const text = await alias.pending!;
  8. return agent("editor").ask<string>(`edit ${text}`);