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
{{ message }}
Repository navigation
5.9.0-beta - Type 'Buffer<ArrayBuffer>' is not assignable to type 'ArrayBuffer' #62109
Based on a private Discord discussion, this appears to be intentional, though I am curious if this should be flagging with @types/node 20.19.x. Also just curious which commit/PR changed this, I tried scanning through v5.8.3...v5.9-beta but was having trouble finding.
The quirk of the array buffer view (TypedArray/DataView) interfaces being assignable to ArrayBuffer was a complete accident previously. Mistaking array buffer views for ArrayBuffers is a very common mishap, and one that the checker was previously blind to.
The divergence between the ArrayBuffer and array buffer view interfaces has existed since TS5.7, but only previously applied if targeting es2024+. Since #60150, it now applies universally.
Reacted by Kenta Moriuchi, Jake Bailey, Ryan Cavanaugh and Max Schwenk
Node.js's Buffer does NOT inherit from ArrayBuffer, but rather inherits from Uint8Array, so I think the problem is due to incorrect usage in the first place.
Activity
jakebailey commentedon Jul 23, 2025
Given Buffer isn't an ArrayBuffer, I'm pretty sure this is intentional. https://nodejs.org/api/buffer.html#bufbuffer is an ArrayBuffer.
Unless I'm really missing something.
maschwenk commentedon Jul 23, 2025
Based on a private Discord discussion, this appears to be intentional, though I am curious if this should be flagging with
@types/node20.19.x. Also just curious which commit/PR changed this, I tried scanning through v5.8.3...v5.9-beta but was having trouble finding.jakebailey commentedon Jul 23, 2025
#61647 and related PRs.
All currently supported Node types pass with the last 10 versions of TS, so I would think this would behave correctly.
Renegade334 commentedon Jul 24, 2025
The quirk of the array buffer view (TypedArray/DataView) interfaces being assignable to
ArrayBufferwas a complete accident previously. Mistaking array buffer views forArrayBuffers is a very common mishap, and one that the checker was previously blind to.The divergence between the
ArrayBufferand array buffer view interfaces has existed since TS5.7, but only previously applied if targeting es2024+. Since #60150, it now applies universally.petamoriken commentedon Jul 24, 2025
Node.js's
Bufferdoes NOT inherit fromArrayBuffer, but rather inherits fromUint8Array, so I think the problem is due to incorrect usage in the first place.maschwenk commentedon Jul 24, 2025
Thanks all! Appreciate all that context!
Fix ArrayBuffer type errors with TypeScript 5.9
Fix ArrayBuffer type errors with TypeScript 5.9