You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When targetting ES2024, the following code throws a type error:
consttoBlob=(data: Uint8Array,type: string)=>{returnnewBlob([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
The text was updated successfully, but these errors were encountered:
The TS 5.7 release notes and #59417 explain what's going on here. If you want a Uint8Array whose buffer property is a suitable BlobPart you'll have to ask for it explicitly like
consttoBlob=(data: Uint8Array<ArrayBuffer>,type: string)=>{returnnewBlob([data.buffer],{ type });}
And of course that might have to propagate throughout your code base. Maybe the TS team has a recommendation for how to proceed in general with this sort of thing; the release notes only mention updating node.
🔎 Search Terms
ArrayBufferLike BlobPart SharedArrayBuffer ES2024
🕗 Version & Regression Information
5.7.2
and5.6.3
⏯ 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:
🙁 Actual behavior
🙂 Expected behavior
Backwards compatibility with ES2023
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: