With gradle kts dsl, there are generated sources t...
# javascript
p
With gradle kts dsl, there are generated sources that are very useful. so that instead of doing
"implementation"("dependency")
we can do
implementation("dependency")
. Does anyone (maybe from JB) knows if there are plans to, similarly, generate type safe mappings from npm dependencies on Kt JS? It would make it significantly easier to interop with js without having to create all the mappings manually (or wait for someone else to make a wrapper 🙃)
b
There's dukat and as of 1.3.60 it can be enabled on gradle to automatically look for @types/<package> on npm and generate kotlin bindings. Don;t remember what the flag is, but google around. It should be listed in 1.3.60 release notes
🎉 1
p
b
That's the one. It can be uses as standalone or as part of kotlin gradle plugin since 1.3.60
p
ah! there we go, this is the required prop:
Copy code
kotlin.js.experimental.generateKotlinExternals=true
And here is the announcement 🙂 https://blog.jetbrains.com/kotlin/2019/08/kotlin-1-3-50-released
b
Oh, so it was 1.3.50. my bad
p
Not by far 😅 Thanks for the tip @Big Chungus
🎉 1
p
is it possible to enable the flag only for a specific module in a multi-module project?
b
There should be a gradle DSL block for that, check release notes above
p
it is not documented
b
Then there's not yet. It's still experimental
But you can always generate them manually with dukat
p
I know
I’ll dig around for a bit
b
Let us know if you can prove me wrong