Hi. The definition of Promise<T> in the Kot...
# javascript
n
Hi. The definition of Promise<T> in the Kotlin JS runtime library is incorrect — it doesn’t handle the case when a function passed to
then
returns a “thenable” result (usually another Promise). I’ve implemented a version that does: https://try.kotlinlang.org/#/UserProjects/hi5gtn3e98h5ivrpve1b193j80/e7m31fl1smt0r00jd1ii7pe9nv
b
I think it can be done in more typesafe way, look my version alongside your https://try.kotlinlang.org/#/UserProjects/om0j50odh7l7qmt1lnnvqrvqqi/na4e9uj4ko13o07702f460cp6s
n
That is better. I didn’t expect the static overloads to work, but it looks like they do
I made the unsafe version of
then
in my implementation internal so it couldn’t leak out to client code
but type safe all the way is better
I’ve raised an issue in YouTrack to track this bug https://youtrack.jetbrains.com/issue/KT-19672
b
👍