Hello. How can I implement "thisArg" (Value to use...
# javascript
p
Hello. How can I implement "thisArg" (Value to use as
this
when executing
callback
) from JS Set? My current implementation is
Copy code
@JsName("Set")
external class JsSet<T> {
...
fun <A> forEach(callback: (value: T, key: T, set: JsSet<T>, thisArg: A) -> Unit, thisArg: A)
...
}
However, when calling this function
Copy code
forEach({ key, value, set, thisArg ->
                            console.log("1", key, "2", value, "3", set, thisArg)
                        }, "thisArgValue")
thisArg is
undefined
, when it should be
"thisArgValue"
Thanks.
t
In Kotlin world it won’t be single signature You can describe first signature for start:
Copy code
forEach(action: (T) -> Unit)
Second -
forEachIndexed
has no direct mapping, by can be declared with magic
Suppress