István Mészáros
07/14/2024, 8:32 AMArray.isArray()
returns false
for an instance returned by KtList.asJsReadonlyArrayView()
? I'm trying to migrate classes from Array
to List
but I use Array.isArray
quite frequently so this a bit annoying.
I checked the JS exported source of the stdlib, and this could be fixed by replacing new Proxy(arrayView, ...)
with new Proxy([], ...)
here:
function createJsArrayViewWith(listSize, listGet, listSet, listDecreaseSize, listIncreaseSize) {
var arrayView = objectCreate(protoOf(JsArrayView));
return new Proxy(arrayView, {get: function (target, prop, receiver) {
My current workaround is to proxy the proxy:
function proxy<E>(arg: ReadonlyArray<E>) { return new Proxy([], {
get(_target, prop: any, _receiver) {
return arg[prop];
},
has(_target, prop: any) {
return prop in arg;
}
})}
Artem Kobzar
07/14/2024, 7:05 PMIstván Mészáros
07/14/2024, 10:11 PMEdoardo Luppi
07/15/2024, 9:31 AMdoLast
step to the link task to enhance the .d.ts file
binaries.withType<JsIrBinary>().configureEach {
linkTask.configure {
doLast { ... }
}
}
István Mészáros
07/15/2024, 6:10 PMEdoardo Luppi
07/15/2024, 6:12 PMEdoardo Luppi
07/15/2024, 6:13 PMIstván Mészáros
07/15/2024, 6:14 PMIstván Mészáros
07/15/2024, 6:15 PMEdoardo Luppi
07/15/2024, 6:19 PM