map-set.ts 342 B

123456789101112
  1. // Map / Set 不可 JSON 序列化 —— 拒绝。两个独立 ask 各报一条。
  2. interface WithMap {
  3. index: Map<string, number>;
  4. }
  5. interface WithSet {
  6. seen: Set<string>;
  7. }
  8. const g = agent("g");
  9. const a = await g.ask<WithMap>("map"); // error
  10. const b = await g.ask<WithSet>("set"); // error
  11. log(JSON.stringify(a) + JSON.stringify(b));