workers types issue with Response

trying to make a simple websocket server with durable objects, passing the websocket as a ResponseInit parameter was causing issues, so I imported the types for DurableObject, Request, and Response from '@cloudflare/workers-types/experimental', that makes the typescript error go away, but when I try to run or deploy I get the following error: No matching export in "node_modules/@cloudflare/workers-types/experimental/index.ts" for import "Response", but the file clearly exports a Response class, any ideas?
3 Replies
Hello, I’m Allie!
Are you running
import { Request, Response, DurableObject } from "@cloudflare/workers-types/experimental";
import { Request, Response, DurableObject } from "@cloudflare/workers-types/experimental";
or
import type { Request, Response, DurableObject } from "@cloudflare/workers-types/experimental";
import type { Request, Response, DurableObject } from "@cloudflare/workers-types/experimental";
?
athomas
athomasOP14mo ago
@HardlySpookin’ the first, just importing them as types gives a separate error since im using Response as a constructor
Hello, I’m Allie!
Yeah, that's the issue. The error above is saying that Response doesn't have an implementation, which is true, since @cloudflare/workers-types only provides type definitions, not implementations.
Want results from more Discord servers?
Add your server