https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
m

mike.holler

10/08/2020, 9:52 PM
In Kotlin JVM,
.kt
and
.java
files can exist side-by-side in the file system and you can access Kotlin functions from the Java file and vice versa. Are there any examples of doing that with JS? I'm talking within the same source set and file structure. I can't seem to figure it out.
b

Big Chungus

10/08/2020, 10:07 PM
Not in a way that ide supports it. You have to go blind with js
Just add your js files to resources and they'll be packaged along with your kotlin compiled js file
Again, while you can mak e this work, no IDE autocompletion yet
m

mike.holler

10/08/2020, 11:17 PM
Ah that's sad. Thanks for the answer.
j

jw

10/08/2020, 11:48 PM
It would be doable with .ts, .js is a crap shoot as to what is supported
m

mike.holler

10/09/2020, 1:28 PM
@jw
.ts
can directly interop and call into Kotlin now? I completely missed this. Our existing application is a TS application so I just imagined this would be impossible. Can you point me to any example or documentation?
j

jw

10/09/2020, 1:28 PM
It cannot, but it would be doable. Today you have to use dukat to pre-process the .ts into .kt "headers" ahead of time.
m

mike.holler

10/09/2020, 1:32 PM
So @jw it sounds like you're talking about calling TS from KT, whereas I'm interested in the opposite. Unless I'm misreading...
j

jw

10/09/2020, 1:32 PM
the new JS IR compiler in 1.4 can emit .ts files to enable the reverse, but again it's not integrated as seamlessly as the .java/.kt support.
m

mike.holler

10/09/2020, 1:33 PM
(just to be clear) I'm interested in
somefile.js
functions to call into
Base64.kt
can emit .ts files to enable the reverse
Ah... okay. So it might come to be more abstracted and easy in time but the tooling is there if we really wanted to push it.
Thanks for the response!
2 Views