Skip to content

5.9.0-beta - Type 'Buffer<ArrayBuffer>' is not assignable to type 'ArrayBuffer' #62109

@maschwenk

Description

@maschwenk

🔎 Search Terms

ArrayBuffer
Type 'Buffer' is not assignable to type 'ArrayBuffer'.`
5.9.0-beta

🕗 Version & Regression Information

https://stackblitz.com/edit/vitejs-vite-ymeftbvq?file=tsconfig.json

With @types/node set to 20.19.4 as a constant, this code below is fine in 5.8.3

const test: ArrayBuffer = Buffer.from('test', 'utf-8');

errors with error TS2322: Type 'Buffer<ArrayBuffer>' is not assignable to type 'ArrayBuffer'. in 5.9.0-beta

  • This changed between versions 5.8.3 and 5.9.0-beta

It appears to be fixable by switching to

const test: ArrayBuffer = Buffer.from('test', 'utf-8').buffer

⏯ Playground Link

https://stackblitz.com/edit/vitejs-vite-ymeftbvq?file=tsconfig.json

🙁 Actual behavior

Failed typechecking

🙂 Expected behavior

Expected this to pass

Additional information about the issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions