class-field-initializer-ask.ts 382 B

123456789
  1. // A facade call inside a class field initializer must be evaluated (the initializer runs
  2. // at construction). The instance carries the artifact; reading the field surfaces it.
  3. // Expected: source -> ask#1, ask#1 -> ask#2, ask#2 -> sink.
  4. const seed = await agent("a").ask<string>("seed");
  5. class C {
  6. field = agent("b").ask<string>(seed);
  7. }
  8. const c = new C();
  9. return await c.field;