I am working on upgrading our kotlin version from ...
# javascript
p
I am working on upgrading our kotlin version from
2.1.20
->
2.2.10
. Previously, we used
KtMap.getInstance().fromJsMap()
to convert a JS Map to a Kotlin map so that the client can send some data back to KM. However, in
2.2.10
getInstance()
is not available anymore. Is there a more preferred way to do these sorts of operators for objects like
KtMap
or
KtList
?
e
Are you compiling to CJS or ESM?
With ESM export, it appears the generated JS code correctly contains a
KtMap.getInstance()
. However the generated TS declarations are incorrect. This might be https://youtrack.jetbrains.com/issue/KT-79926, @Artem Kobzar should be able to confirm.
a
+1 to @Edoardo Luppi There was a bug that inside the d.ts file dropped
getInstance
from the
d.ts
. However, since the 2.3.0 for the
KtMap
and
KtList
the
getInstance
will be dropped and you could use just
KtMap.fromJsMap
from both ESM and CJS (we did it to eliminate differences between the module systems to make the migration smoother)
gratitude thank you 3
p
I appreciate the detailed answers! Good to know that in 2.3.0 there will be a better solution! We are compiling to ESM, for now, I have added an annotation to ignore the TS error