One more newbie question :slightly_smiling_face:. ...
# javascript
j
One more newbie question 🙂. I have defined a List in the external interface. Except it doesn't behave like a kotlin list as I'm hitting a lot of
Uncaught TypeError: ensureNotNull(...).iterator_0_k$ is not a function
errors (same for `ìsEmpty`and any other idiomatic List function).
Copy code
external interface FirestoreMessage{
    val id: String
    val content: String
}

@JsModule("@jlengrand/firebase-ports")
@JsNonModule
external object FirebasePorts{
    fun logIn() : Promise<FirebaseUser>
    fun logOut()

    fun saveMessage(uid: String, message: String)
    fun getMessages(uid: String) : Promise<List<FirestoreMessage>>
}
Do you have a reference on how to use lists in external interfaces by any chance?
Ok, It looks like
Array
does the job, but
List
do not seem to be supported
b
You can't with IR backend for now. Use Arrays instead.
The reason is that List is not external nor mapped to a native js type
🙌 1
g
You can have a look at KustomExport, it's an experimental library I'm writing to support this kind of missing features.
🙌 1
t
1. In simple cases you will write the same code for
Array
and
List
2.
Array
is faster than
List
(it was research in this channel -
x10
in some cases) 3. Immutable
Array
also exists
j
Thanks all! nice to see that Deezer uses Kotlin JS @Grégory Lureau 🙂
❤️ 1