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

Better types and/or docs for the Byte scalar #2550

Open
zach-betz-hln opened this issue Sep 30, 2024 · 0 comments
Open

Better types and/or docs for the Byte scalar #2550

zach-betz-hln opened this issue Sep 30, 2024 · 0 comments

Comments

@zach-betz-hln
Copy link

Is your feature request related to a problem? Please describe.

The Byte scalar allows us to send binary data from server to client, which is sweet. But, the generated types took some investigation in order to use properly.

For example, the generated type is Scalars['Byte']['output'] which equates to any.

Upon inspecting the source code, should the output type actually be this instead?

type BufferJson = { type: 'Buffer'; data: number[] };

This is more useful when creating a Blob on the client, since the data prop is used in the Uint8Array constructor. For example:

// get the `byteBuffer` and `contentType` from your query...
const blob = new Blob([new Uint8Array(byteBuffer.data)], { type: contentType });
// do something with your blob...

Describe the solution you'd like
Do one or all of the following:

  • Update the docs
  • Update the generated type

Describe alternatives you've considered
For now, we're using a custom type in our project that mirrors the linked type above.

Additional context
None.

@zach-betz-hln zach-betz-hln changed the title Betters types and/or docs for the Byte scalar Better types and/or docs for the Byte scalar Oct 22, 2024
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

No branches or pull requests

1 participant