In Kotlin JVM, `.kt` and `.java` files can exist s...
# multiplatform
m
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
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
Ah that's sad. Thanks for the answer.
j
It would be doable with .ts, .js is a crap shoot as to what is supported
m
@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
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
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
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
(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!