Skip to content

Type structuredClone typed arrays as ArrayBuffer-backed - #59147

Closed
SamChou19815 wants to merge 1 commit into
mainfrom
export-D125721761
Closed

SamChou19815 wants to merge 1 commit into
mainfrom
export-D125721761

Conversation

@SamChou19815

Copy link
Copy Markdown
Member

Summary:
cloneTypedArray passes value.buffer to cloneArrayBuffer(value: ArrayBuffer). With TypeScript's ES2024 ArrayBuffer definitions, $TypedArray (meaning $TypedArray<ArrayBufferLike>) has an ArrayBufferLike buffer, which is no longer an ArrayBuffer. Hermes, React Native's default engine, has no SharedArrayBuffer, and cloneArrayBuffer already treats its input and its slice(0) copy as an ArrayBuffer. This narrows isTypedArray's refinement and cloneTypedArray's parameter to $TypedArray<ArrayBuffer>. It is a type-only change.

Changelog: [Internal]

Differential Revision: D125721761

Summary:
`cloneTypedArray` passes `value.buffer` to `cloneArrayBuffer(value: ArrayBuffer)`. With TypeScript's ES2024 `ArrayBuffer` definitions, `$TypedArray` (meaning `$TypedArray<ArrayBufferLike>`) has an `ArrayBufferLike` buffer, which is no longer an `ArrayBuffer`. Hermes, React Native's default engine, has no `SharedArrayBuffer`, and `cloneArrayBuffer` already treats its input and its `slice(0)` copy as an `ArrayBuffer`. This narrows `isTypedArray`'s refinement and `cloneTypedArray`'s parameter to `$TypedArray<ArrayBuffer>`. It is a type-only change.

Changelog: [Internal]

Differential Revision: D125721761
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 16, 2026
@meta-codesync

meta-codesync Bot commented Oct 16, 2026

Copy link
Copy Markdown

@SamChou19815 has exported this pull request. If you are a Meta employee, you can view the originating Diff in D125721761.

@meta-codesync meta-codesync Bot closed this in 96dddb0 Oct 16, 2026
@meta-codesync meta-codesync Bot added the Merged This PR has been merged. label Oct 16, 2026
@meta-codesync

meta-codesync Bot commented Oct 16, 2026

Copy link
Copy Markdown

This pull request has been merged in 96dddb0.

@react-native-bot

Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @SamChou19815 in 96dddb0

When will my fix make it into a release? | How to file a pick request?

@SamChou19815
SamChou19815 deleted the export-D125721761 branch October 16, 2026 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants