TypeScript errors for ReadableStream
in npm create cloudflare "Hello World" worker
#6211
Labels
bug
Something that isn't working
Which Cloudflare product(s) does this pertain to?
Impacts C3 "Hello World" TypeScript users - suspected bug in Workers Vitest Integration
What version(s) of the tool(s) are you using?
@cloudflare/vitest-pool-workers: ^0.4.5
What version of Node are you using?
v20.11.1
What operating system and version are you using?
Sonoma 14.5
Describe the Bug
Observed behavior
Typescript errors if you use the response.body of a fetch in a worker generated by
npm create cloudlare@latest
.The root cause appears to be this import which replaces the @cloudflare/workers-types for fetch() with @types/node types.
import { defineWorkersConfig } from '@cloudflare/vitest-pool-workers/config'
Credit should go to
@pronoun
who figured this out and posted in discord https://discord.com/channels/595317990191398933/1251292244766621787/1251292244766621787Expected behavior
vitest-pool-workers should not override fetch.
Steps to reproduce
npm create cloudflare@latest
with default "Hello World" worker with typescriptfetch()
. This leads tonode_modules/.pnpm/@[email protected]/node_modules/@types/node/globals.d.ts
vitest.config.mts
tovitest.config.mts_
fetch()
leads tonode_modules/.pnpm/@[email protected]/node_modules/@cloudflare/workers-types/2023-07-01/index.d.ts
Screenshots showing different fetch types.
Please provide a link to a minimal reproduction
https://github.com/jldec/cloudflare-worker-fetch-type-issue
Please provide any relevant error logs
No response
The text was updated successfully, but these errors were encountered: