Hi, is there a kmp example project with JS target using classes with kotlinx.datetime types as properties like Instant which are exported to a TS definition using js-joda? (Iām new to kmp)
a
Artem Kobzar
02/28/2025, 1:07 PM
Hi, Mira.
Unfortunately, if the library (like kotlinx.datetime) didn't mark its types with a special @JsExport annotation, those types would not be visible in TS definitions.
We consider the problem and try to find a solution for such an issue.
m
mira
02/28/2025, 1:08 PM
Thanks, Artem! Is there a workaround for this issue? Something to configure manually?
a
Artem Kobzar
02/28/2025, 1:11 PM
You can write a wrapper for the class you are interested in.
Imagine there is a class
Foo
which is not exported from a third-party library.
You can write something like this:
Copy code
package my.own.project
import third.party.library.Foo as LibraryFoo
@JsExport
class Foo(private val foo: LibraryFoo) {
...
}
And work with such a class in your project.
So, your service which returns
Foo
will be available from JS to interact with all the methods inside