FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

More specific data types - ArrayBuffer instead of ArrayBufferLike by joshkel · Pull Request #279 · msgpack/msgpack-javascript · GitHub

More specific data types - ArrayBuffer instead of ArrayBufferLike - #279

Merged
gfx merged 1 commit into
msgpack:mainfrom
joshkel:ArrayBuffer-type
Dec 26, 2025
Merged

gfx merged 1 commit into
msgpack:mainfrom
joshkel:ArrayBuffer-type

Conversation

joshkel commented Aug 4, 2025 •
edited
Loading

Copy link
Copy Markdown
Contributor

By default, TypeScript interfaces like DataView and Uint8Array are used with the more generic ArrayBufferLike type, representing that they can work with either ArrayBuffer or SharedArrayBuffer. TypeScript 5.9 now uses stricter types for interfaces such as the DOM fetch method: a DOM BufferSource is now (correctly) marked as requiring ArrayBuffer, not SharedArrayBuffer. As a result of that change, trying to use a @msgpack/msgpack encode result with a fetch call will result in a type error. This change updates the types in the Encoder class to use ArrayBuffer instead of ArrayBufferLike, which reflects their implementation and prevents issues with the newer, stricter interfaces.

See microsoft/TypeScript#62168 for more info.

By default, TypeScript interfaces like `DataView` and `Uint8Array` are used with the more generic `ArrayBufferLike` type, representing that they can work with either `ArrayBuffer` or `SharedArrayBuffer`. TypeScript 5.9 now uses stricter types for interfaces such as the DOM `fetch` method: a DOM `BufferSource` is now (correctly) marked as requiring `ArrayBuffer`, not `SharedArrayBuffer`.  As a result of that change, trying to use a @msgpack/msgpack `encode` result with a `fetch` call will result in a type error. This change updates the types in the `Encoder` class to use `ArrayBuffer` instead of `ArrayBufferLike`, which reflects their implementation and prevents issues with the newer, stricter interfaces.

gfx commented Dec 26, 2025

Copy link
Copy Markdown
Member

Thanks. I don't understand why TypeScript has such imcomptible changes, but I'm willing to merge it.

gfx merged commit 9f7909a into msgpack:main Dec 26, 2025
joshkel deleted the ArrayBuffer-type branch December 29, 2025 15:19
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL