Skip to content

Type usages of Uint8Array as Uint8Array<ArrayBuffer> #738

@peter-cardenas-ai

Description

@peter-cardenas-ai

Describe the bug
With the most recent version of TypeScript, there was a change to make the type of Uint8Array such that the buffer can be either ArrayBuffer or SharedArrayBuffer. While controversial, it seems as though this change will stick. Thus, to minimize burden on usages of this package and from a cursory look at the implementation, it seems as though we should change our usages of Uint8Array to Uint8Array<ArrayBuffer>.

To Reproduce
Steps to reproduce the behavior:
See how this causes a type error in TypeScript 5.9+

message Test {
  bytes test = 1;
}
const response = await rpcClient.method(...);
new Blob([response.response.test]); // type error

Expected behavior
Should not have a type error

Environment:

  • TypeScript 5.9+

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions