pronoun
CDCloudflare Developers
•Created by pronoun on 6/14/2024 in #workers-help
@cloudflare/worker-types ReadableStream incompatible with TypeScript default
I'm trying to use the
body
property of a Response
object, but it seems like the type declarations in @cloudflare/worker-types conflict with those in @types/node for ReadableStream
. I'm a bit stumped as to why TypeScript is looking for types from @types/node. Anyone else run into this issue before?
Here's some simple code to reproduce the issue with the default TypeScript starter:
which produces the error:
Not sure what's going on because my tsconfig should ensure TypeScript is only reading from the worker types package:
I can do res.body as ReadableStream
and it's resolved to the ReadableStream from the worker types, so I think the problem is that the type of fetch
is being pulled from @types/node for some reason (I can see that overload if I go to definition in VSCode)9 replies