Skip to content

Remove unique symbol from RPC types - #2034

Merged
penalosa merged 1 commit into
mainfrom
penalosa/remove-unique-symbol
Apr 18, 2024
Merged

Remove unique symbol from RPC types#2034
penalosa merged 1 commit into
mainfrom
penalosa/remove-unique-symbol

Conversation

@penalosa

@penalosa penalosa commented Apr 18, 2024

Copy link
Copy Markdown
Contributor

Fixes #1996

Previously, the RPC types used unique symbol to enforce nominal typing rather than structural typing for Durable Object and Service binding entrypoints. While this works, it's slightly too strict. It meant that different versions of DurableObject and WorkerEntrypoint were not compatible (e.g. across workers-types entrypoints, and across ambient and exported types. This PR relaxes that constraint to use a well-known string instead, which will preserve nominal typing unless someone goes out of their way to add a specific property.

cc @Skye-31

@penalosa
penalosa requested review from a team as code owners April 18, 2024 13:49
@penalosa
penalosa requested review from byule and garrettgu10 April 18, 2024 13:49
@penalosa

Copy link
Copy Markdown
Contributor Author

@mrbbot you may have some thoughts here...

@Skye-31

Skye-31 commented Apr 18, 2024

Copy link
Copy Markdown
Contributor

This change does fix the issue I was seeing here!

@penalosa
penalosa merged commit aec53dc into main Apr 18, 2024
@mrbbot

mrbbot commented Apr 21, 2024

Copy link
Copy Markdown
Contributor

you may have some thoughts here...

Seems reasonable. I'm kinda surprised different entrypoints/ambient/exported types works without lots of other conflicts. FWIW, it would've been possible for someone to go out of their way to use the unique symbols before, since they were exported from the Rpc namespace. 👍

@kentonv
kentonv deleted the penalosa/remove-unique-symbol branch April 25, 2024 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Durable Object RPC Type Errors

4 participants