Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

No types for the Websocket Hibernation APIs #846

Closed
evanderkoogh opened this issue Jul 9, 2023 · 3 comments · Fixed by #847
Closed

No types for the Websocket Hibernation APIs #846

evanderkoogh opened this issue Jul 9, 2023 · 3 comments · Fixed by #847
Assignees
Labels
types Related to @cloudflare/workers-types

Comments

@evanderkoogh
Copy link

The APIs for the Hibernation API do not seem to be available in the latest worker-types packages.

neither the methods on the Durable Object as the one on the DurableObjectState.

@SamyPesse
Copy link

@evanderkoogh What version are you testing with ? I have them in version 4.20230518.0, at least the ones for DurableObjectState:

Screenshot 2023-07-09 at 11 41 28

For methods on the durable object class, it's unclear how to type it, I see no mention of webSocketMessage / webSocketClose / webSocketError in the module.

@DaniFoldi
Copy link
Contributor

DaniFoldi commented Jul 9, 2023

I believe it is a simple case of adding them in the override for DurableObject here:

JSG_TS_DEFINE(interface DurableObject {
fetch(request: Request): Response | Promise<Response>;
alarm?(): void | Promise<void>;
});

@evanderkoogh
Copy link
Author

@evanderkoogh What version are you testing with ? I have them in version 4.20230518.0, at least the ones for DurableObjectState:

Hmm.. Looks like it might have been an issue with my IDE and a cached TS definition. I can now see the State methods indeed.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
types Related to @cloudflare/workers-types
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants