gregorbg
03/16/2020, 11:11 PMsrc/main/kotlin
you can simply add src/main/java
and the Kotlin code will understand the Java class FooBar
defined in src/main/java/FooBar.java
. I understand that JS is different because of the type system (or lack thereof), but there is support for NPM packages (which are written in pure JS for the most part) as well as the external
modifier which leads me to believe some feature like this must exist in the Kotlin/JS world. It would be awesome if I can gradually migrate my project that way, similar to Kotlin/JVM. Thanks 😄Robert Jaros
03/16/2020, 11:16 PMdukat
, which can automatically generate Kotlin declarations based on TypeScript definitions. But it's still immature, and works fine only for very simple npm libraries.gregorbg
03/17/2020, 7:38 AMgregorbg
03/17/2020, 7:43 AMexternal
modifier. This means that internally, Gradle resolves and downloads the dependency to some folder where Kotlin can "see" (sorry I'm really lacking a better word to explain what I mean here) that JS code after transpiling to JS. I want to do the same with my project code - think of it as adding a dependency without going through NPM.gregorbg
03/17/2020, 7:45 AMdiesieben07
03/17/2020, 8:54 AMdiesieben07
03/17/2020, 8:58 AMRobert Jaros
03/17/2020, 9:50 AMdynamic
typing. You don't have to write external declarations at all. But of course it's not perfect solution, because we always would like to have static typing in Kotlin.gregorbg
03/17/2020, 9:52 AMRobert Jaros
03/17/2020, 12:11 PM*.js
file) with your code and any npm code declared as dependencies. You just use this bundle (e.g. by including it in a html page).gregorbg
03/17/2020, 1:12 PMRobert Jaros
03/19/2020, 10:52 AM*.js
files in webpack.config.d
directory.