Hello. I'm trying to make a Ring UI Table mappings...
# javascript
p
Hello. I'm trying to make a Ring UI Table mappings for Kotlin. There is a class named "Selection". It contains set of selected items (which is represented by JS class Set). However, when I tried to map it like that:
Copy code
fun getSelected(): Set<RowData>
fun getActive(): Set<RowData>
and then trying to access this set using
for (selected in selection.getSelected()){..}
in browser it throws
Uncaught TypeError: it.getSelected().iterator is not a function
. By looking at Kotlin/JS documentation I see that Kotlin collections does not map to any specific class in JS ("Kotlin collections (
List
,
Set
,
Map
, and so on) are not mapped to any specific JavaScript type."). So, my question: is it okay to publish mapping like that or is there a better way to do that mapping? (like custom Set class, or anything else...)
b
Kotlin array maps to js array
From there you can declare js set as external and initiate it with that array
t
Copy code
@JsName("Set")
external class JsSet
...
👀 1
p
So, did I understood you correctly that I need to create a typing for a JS Set?
👍 1
t
cc @Sergei Grishchenko
lib.dom.d.ts
(and similar) from IDEA is fine as source