Skip to content

Type 'ArrayBufferLike' is not assignable to type 'BlobPart'. #60579

Closed as not planned
@Yonom

Description

@Yonom

🔎 Search Terms

ArrayBufferLike BlobPart SharedArrayBuffer ES2024

🕗 Version & Regression Information

  • This changed between versions 5.7.2 and 5.6.3
  • This changed in commit or PR _______
  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________
  • I was unable to test this on prior versions because _______

⏯ Playground Link

https://www.typescriptlang.org/play/?target=11&ts=5.7.2#code/MYewdgzgLgBFICEA2IBGMC8MAUATAhlPgFwwCqAlmFABwCCATg-gJ4A0cLADgKanQMqAcwCUmAHwwA3jABQMGAx5QArgzAwwPAO4xkabAG0CRAHSoVAM0s8GAXQ4yo3HjAC+IgNyy3QA

💻 Code

When targetting ES2024, the following code throws a type error:

const toBlob = (data: Uint8Array, type: string) => { 
  return new Blob([data.buffer], { type });
}

🙁 Actual behavior

Type 'ArrayBufferLike' is not assignable to type 'BlobPart'.
  Type 'SharedArrayBuffer' is not assignable to type 'BlobPart'.
    Type 'SharedArrayBuffer' is missing the following properties from type 'ArrayBuffer': resizable, resize, detached, transfer, transferToFixedLength

🙂 Expected behavior

Backwards compatibility with ES2023

Additional information about the issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions