Should `new Uint8Array(arr)` take `ReadonlyArray<number>` ?
Author: mnsaglamCreated Mar 2, 2026Updated Mar 2, 2026
Currently TypedArray constructors do not accept ReadonlyArray<number> even though the .from() static method only requires IArrayLike<number>. Here is the constructor and the static method for Uint8Array for instance. Is this intentional? Can we allow ReadonlyArray<number> in the constructor?
If this is consistent with the intended typing and design, I will send a PR.
Source: google/closure-compiler