Does `@JsExport` work in wasm? If yes, could the `...
# webassembly
m
Does
@JsExport
work in wasm? If yes, could the
JsAny
bound of
unsafeCast
be removed (source)? Reason is I have
@JsExport
classes that I want to unsafe cast in common code and I don't have
JsAny
available in
commonMain
. Or is there another way?
a
m
Welp, that settles it, thanks!
s
@JsExports
currently does work for package-level functions, but classes are not supported yet.
unsafeCast
upper bound will likely remain because we can’t unsafely cast Wasm values, while we can easily do this with JS values (they don’t care about static types).
thank you color 1
a
Shouldn't we introduce a different annotation WasmExport??
👀 1
Coz sometimes, I'd want to export my Js definition but no need to export my Typescript one. And I wan't to do all this from common code.
s
We have @WasmExport/@WasmImport pair, but they are a bit different. They used for exporting and importing raw functions to/from other .wasm modules instead of adapting values for JS.
I understand and agree with @andylamax use-case, JsExport shouldn’t apply additional restrictions for K/JS when used in common code. We remember it, but haven’t managed to fix it yet.
👍 1
m
Thanks a lot for the details!
a
Thanks a lot @Svyatoslav Kuzmich [JB]