undefined-member.ts 253 B

12345678
  1. // 非可选位置上的 undefined 成员 —— 拒绝(可选性应通过 `?` 表达,而不是 `| undefined`)。
  2. interface R {
  3. value: string | undefined;
  4. }
  5. const g = agent("g");
  6. const v = await g.ask<R>("go"); // error
  7. log(JSON.stringify(v));