Skip to content

[TypeScript 5.9] Change type of Bytes from Uint8Array to Uint8Array<ArrayBuffer> #27854

@darthmaim

Description

@darthmaim

Feature Summary

TypeScript 5.9 changed the default type of Uint8Array to be Uint8Array<ArrayBufferLike> (src). Prisma should generate the type for Bytes properties as Uint8Array<ArrayBuffer> now, to make it easier to work with APIs expecting an ArrayBuffer.

Use Cases & Problem Description

Bytes properties can't be directly passed to APIs that expect ArrayBuffer anymore when using TypeScript 5.9.

Proposed Solution

Change the generated type to Uint8Array<ArrayBuffer>.

I've also seen a few libs (example) use something like this to keep a non-generic Uint8Array in TypeScript 5.7 and below:

type Uint8Array_ = ReturnType<Uint8Array["slice"]>;

Alternative Solutions

As a workaround, Bytes properties can be casted as Uint8Array<ArrayBuffer> or converted new Uint8Array(data) in user-code.

Potential Considerations

No response

Prisma Version

6.*

What part of Prisma does this affect?

Prisma Client

Additional Context

Pre-Submission Checklist

  • I have searched existing issues to make sure this is not a duplicate
  • I have checked the Prisma roadmap to see if this is already planned
  • I have described why this belongs in Prisma Core rather than a solution in application code

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureA request for a new feature.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions