Anyone here has experience with Gradle kotlin-fron...
# javascript
j
Anyone here has experience with Gradle kotlin-frontend-plugin? I'm wondering whether npm dependencies with typescript definitions are directly usable from Kotlin without manual declaration of
external
declarations. I guess I could generate Kotlin externals using ts2kt, but is it done out-of-the box by the plugin?
l
If you want to use them in a typesafe manner you must declare externals.
j
Thanks for your reply. That's a pity, this would be a nice feature for the plugin. Do you know if create-react-kotlin-app provides this on the other hand? I'm trying to compare both approaches in the context of react apps development
l
Yeah, the CRKA provides wrappers for react and react-dom, you can also get the wrappers individually (among others): https://github.com/JetBrains/kotlin-wrappers
j
This I understood, but what I wonder is whether adding an npm dependency to the package.json of a CRKA will automatically trigger ts2kt on it and allow Kotlin files to use it without ceremony
l
I am not sure about that (never used CRKA myself) I think I read a while ago that JetBrains is working on making Kotlin compatible directly with TS definitions though.
j
I believe that would be a huge boost in Kotlin's adoption in the JS scene
l
Actually, they said "better interop with JS" and didn't mention TS definitions specifically. See this thread: https://kotlinlang.slack.com/archives/C0B8L3U69/p1554827960039400
j
Thanks for pointing that out!
It doesn't seem that Kotlin is really ready to eat the frontend scene like it has done for Java, but there does seem to be hope here 🙂
t
also check this one: https://github.com/Kotlin/dukat
yesterday it was presented on Kotlin meetup and should a replacement for ts2kt
j
Thanks, I will take a look. My main concern so far is really about the integration of this kind of conversion tool into the build plugins