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
For ES2023 or lower targets, it is acceptable to assign SharedArrayBuffer to an ArrayBuffer type. On the other hand, the reverse is not possible because Symbol.toStringTag of SharedArrayBuffer is a string literal type.
This problem can be solved by making Symbol.toStringTag of ArrayBuffer a string literal type. Set, Map, and Promise use the string type for library compatibility (#19006), while ArrayBuffer is not intended to be extended by the user, and indeed Symbol.species support for InitializeTypedArrayFromTypedArray has been removed (tc39/ecma262#2719), so there should be no problem.
This issue was reported by #59417 and has been addressed by making TypedArrays generic for the ES2024 target.
Sample Code
// ES2023 or lower targets, no type errorconstbuffer: ArrayBuffer=newSharedArrayBuffer(256);
Documentation Link
No response
The text was updated successfully, but these errors were encountered:
RyanCavanaugh
added
Needs Proposal
This issue needs a plan that clarifies the finer details of how it could be implemented.
Needs Investigation
This issue needs a team member to investigate its status.
and removed
Needs Proposal
This issue needs a plan that clarifies the finer details of how it could be implemented.
labels
Oct 7, 2024
⚙ Compilation target
ES2023
⚙ Library
N/A
Missing / Incorrect Definition
For ES2023 or lower targets, it is acceptable to assign
SharedArrayBuffer
to anArrayBuffer
type. On the other hand, the reverse is not possible becauseSymbol.toStringTag
ofSharedArrayBuffer
is a string literal type.This problem can be solved by making
Symbol.toStringTag
ofArrayBuffer
a string literal type.Set
,Map
, andPromise
use thestring
type for library compatibility (#19006), whileArrayBuffer
is not intended to be extended by the user, and indeedSymbol.species
support forInitializeTypedArrayFromTypedArray
has been removed (tc39/ecma262#2719), so there should be no problem.This issue was reported by #59417 and has been addressed by making TypedArrays generic for the ES2024 target.
Sample Code
Documentation Link
No response
The text was updated successfully, but these errors were encountered: