Is it me or `Uint8Array` (and any `TypedArray`) fr...
# javascript
e
Is it me or
Uint8Array
(and any
TypedArray
) from Kotlin Wrappers doesn't let you set a byte at a specific index? Doing
Copy code
myArray[i] = myByte
results in an error. Am I overlooking a specific method?
t
Which error you receive?
e
@turansky like, the method doesn't exists.
The og class has a method
set
that does something else and the wrapper code doesn't have a normal
set(index, element)
method.
Looks to me that this class requires some manual work that is missing, so might be a bug.
ArrayLike
that it extends defines the
get
operator but not
set
. It seems like at this point there's no way to modify one elementwise at all?
e
@Ilya P yup, no way at all
Currently I'm using
js('...')
and
asDynamic
, but it's not a long term solution
t
cc @Sergei Grishchenko
e
Hi @turansky, let me know if it's better I create an issue in the wrappers repo to keep track of it.
t
Issue required
Not only
TypedArray
affected
No issue detected :)
e
@turansky oh yeah forgot about it, will create it in 5 mins, sorry
t
It will be helpful if you will highlight all types with similar problem
It's 40+ array like types, some of them support mutations
e
@turansky looked around a bit but it seems it's only related to the TypedArray hierarchy
Which means also Buffer from Node, but then it should get it for free from Uint8Array
t
@turansky looked around a bit but it seems it's only related to the TypedArray hierarchy
Magic? :) 0 additional candidates?
e
It would seem so, I'm browsing the code from the IDE where I have both kotlin-js and kotlin-node, and can't seem to find any other wrong code Not sure where exactly the set method should be placed tho, maybe into ArrayLike as suggested above
t
Original
ArrayLike
has no setter
e
Yeah I can see now that it's all readonly
Copy code
interface ArrayLike<T> {
    readonly length: number;
    readonly [n: number]: T;
}
t
Most child types located in browser types
e
In the TypeScript sources they're using
Copy code
[index: number]: number;
For each
TypedArray
type. Maybe it should just be added to every one of them.
t
NodeList
doesn't have setter for example :)
e
I'll create the issue as related to typed arrays only as of now. If other types needs to be adjusted they can be added there
t
😞