Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add toPlainMessage #511

Merged
merged 4 commits into from
Jun 28, 2023
Merged

Add toPlainMessage #511

merged 4 commits into from
Jun 28, 2023

Conversation

srikrsna-buf
Copy link
Member

Add toPlainMessage to convert Message objects to their PlainMessage variants.

Helps in cases like connectrpc/connect-es#505.

Copy link
Member

@timostamm timostamm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, but I don't think we're handling wrapper messages correctly yet, and we should keep behavior consistent whether structuredClone is available or not.

packages/protobuf/src/to-plain-message.ts Outdated Show resolved Hide resolved
packages/protobuf/src/to-plain-message.ts Outdated Show resolved Hide resolved
@srikrsna-buf srikrsna-buf merged commit e279d20 into main Jun 28, 2023
3 checks passed
@srikrsna-buf srikrsna-buf deleted the sk/toplainmessage branch June 28, 2023 21:19
@smaye81 smaye81 mentioned this pull request Jul 14, 2023
smaye81 added a commit that referenced this pull request Jul 14, 2023
## What's Changed
* Add `toPlainMessage` to convert `Message` objects to their
`PlainMessage` variants by @srikrsna-buf in
#511
* Remove usage of globalThis in generated code by @smaye81 in
#504
* Use `typeof BigInt` to check for BigInt support by @lukasIO in
#488

## New Contributors
* @lukasIO made their first contribution in #488.

**Full Changelog**:
https://github.com/bufbuild/protobuf-es/compare/v1.2.1..v1.3.0
srikrsna-buf added a commit that referenced this pull request Jul 26, 2023
Follow up work to #511. This doesn't change the types but loosens the
runtime to also accept `number[]` alongside `Uint8Array` values for
`bytes` fields.

---------

Co-authored-by: Timo Stamm <ts@timostamm.de>
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.

None yet

3 participants