Skip to content

Generate bytes fields as Uint8Array<ArrayBuffer> #1227

@haines

Description

@haines

At the moment bytes fields are Uint8Array but that becomes awkward when passing them onwards - for example, we have an RPC that produces an archive to be downloaded in the browser.

const { archive } = client.export({ id });

return new Response(archive, { status: 200, headers: [...] });

This used to be fine, but in TS 5.9 it breaks

Argument of type 'Uint8Array<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.

We now have to cast it with archive as Uint8Array<ArrayBuffer>.

It'd be nice if we could generate the code with the bytes fields typed as Uint8Array<ArrayBuffer> to avoid this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions