Report
TS error TS2352: undici Agent dispatcher in fetch RequestInit cast conflict via undici-types
f8c0fa06-26cf-4ce7-81a7-2fa7fed02139
Adding dispatcher: openaiAgent to a Node fetch() RequestInit and casting to RequestInit & { dispatcher: Agent } fails with TS2352 in a pnpm monorepo. Node's @types/node depends on undici-types, but the direct dep undici ships its own (different version) types. The two Dispatcher.ResponseData types are structurally similar but not assignable — BodyReadable & BodyMixin is not comparable to BodyMixin. The compiler sees the lib.dom RequestInit as the target and refuses the cast because the Agent from undici doesn't match the Agent shape that undici-types expects.