Open
Description
Thank you all for this great library! I appreciate using it in my project. I just tried to update my TypeScript version from 5.6.3
to 5.7.2
.
Starting with Typescript 5.7 typed arrays become generic. See:
- https://devblogs.microsoft.com/typescript/announcing-typescript-5-7/#support-for---target-es2024-and---lib-es2024
- Make typed arrays generic over
ArrayBufferLike
microsoft/TypeScript#59417
This affects for example the type definition of Uint8ArrayWriter
Previously with TypeScript 5.6.3 the following code typed data
as ArrayBuffer
, but starting with TypeScript > 5.7 data
has type ArrayBufferLike
.
// TypeScript < 5.7
const data: ArrayBuffer = await entry.getData(new Uint8ArrayWriter());
// TypeScript >= 5.7
const data: ArrayBufferLike = await entry.getData(new Uint8ArrayWriter());
My tsconfig compiler target is and has been set to ES2021.
I'm not sure how this is solved properly. My guess would be to add generic type explicitly to all TypedArrays
usages, since they use Uint8Array (Example) actually. Effectively changing type definition here into this:
export class Uint8ArrayWriter extends Writer<Uint8Array<ArrayBuffer>> { }
What do you think?
Metadata
Assignees
Labels
No labels