Skip to content

Standard WebSocket type returned instead of type from @cloudflare/workers-types #1775

@missinglink

Description

@missinglink

Version

"@cloudflare/workers-types": "4.20240222.0"

Expected

deserializeAttachment() exists on WebSocket type returned by DurableState.getWebSockets()

Screenshot 2024-03-07 at 11 43 29

Actual

DurableState.getWebSockets() returns type globalThis.WebSocket (standard type as defined by MDN Reference):

Screenshot 2024-03-07 at 11 39 50

Suggestion

The types file does in fact include a type for the Cloudflare implementation of WebSocket which includes this signature, but this is not the Type which is returned.

Screenshot 2024-03-07 at 11 40 16

Anecdote

Could this be due to the WebSocket type definition coming later in the types file than the DurableObjectState definition?

Metadata

Metadata

Labels

typesRelated to @cloudflare/workers-types

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions