Luv Kumar
06/13/2025, 7:53 PMsuspend fun foo(): String
should get converted to foo(): Promise<string>;
in Js. From what i know there is no native support for this. I was able to reach a Js signature fooAsync(): Promise<String>;
using kotlin-suspend-transform-compiler-plugin , but i would want to have the same signature(without async) as it would be easier for all 3 targets(android, ios and js) to follow the generated docs and use it.
Is there a way to achieve this ? other obv option is to have duplicate exported api interfaces for only js, but i really don't wish to go that route.
I was also thinking if this plugin or some other plugin could help me generate a synthetic function
@JsExport
@JsName("foo")
fun fooSynthetic(): Promise<String> // generated synthetic function
@JsName("_foo")
suspend fun foo(): String // original function defined in api
If somehow above could be achieved, i was thinking it could work ? (Please correct me if my thought process is wrong here, i am new to KMP)
Thanks.Edoardo Luppi
06/13/2025, 11:37 PMdefaultSuffix
property if I'm not mistaken. You might want to experiment with an empty suffix and see what happens.Luv Kumar
06/14/2025, 9:58 AM@JsPromise(suffix = "")
but it doesn't work, because the synthetic kotlin function generated due to that will have same signature as the actual function(only differs on return type).Edoardo Luppi
06/15/2025, 9:35 AM