Does Kotlin JS have a website similar to Definitel...
# javascript
n
Does Kotlin JS have a website similar to Definitely Typed (aka Kotlinly Typed) where Kotlin definitions for JS libraries/frameworks are hosted?
t
n
Not the same thing. What you have referred to is a Kotlin link aggregator website.
g
There is, but it not active. Probably it should be promoted somehow https://github.com/Kotlin/js-externals
👍 1
c
👍 3
there’s quite some wrapper projects on github: https://github.com/search?q=kotlin+wrapper+js there should definately be a list
u
Current situation is following: we don't have actively supported monorepository liked Definitely Typed and investing heavily into a tool that will make it easier to convert any arbitrary declaration. When we'll feel that this tool is good enough and works seamlessly in theory one of options would revisit the possibility of having such repository. Our previous experience was -and we can not blame community for not willing to perform similar job twice - that, comparing to the situation with Definitely Typed community was not as actively contributing to our counterpart.
c
ok but if the tool works good enough why do you still need such a repository?
👍 2
n
My theory is that the Definitely Typed repository doesn't cover the libraries that are covered by the Kotlin Wrappers.
u
@christophsturm even when tool will work ideally there can be reasons why having a repository would be a reasonable option to consider. I'm not saying that this is definitely a way to go - I'd rather not, but having prebuilt artefacts sometimes is a viable option.
c
btw, is there a way to fine tune wrapper generating when using
kotlin.js.experimental.generateKotlinExternals=true
? I tried with 2 different libs (
@types/charts.js
, and
recharts
) and both did not create compilable kotlin code.
u
@christophsturm we acknowledge that the tool is still far from being flawless all scenarios and I apologise for this personally - however you always can translate via command line (just point the file you needed to be translated - all it's dependencies will be translated automatically if they are present - that is exist in node_modules or accessible via relative paths) and then tune the code generated.
c
ok. no problem. why does it work better if i invoke it manually?
u
@christophsturm it does work exactly the same with the only difference that dukat tends to be published as frequently as possible and for very understandable reasons kotlin has longer lifecycle - that said, the default version bundled with kotlin can be older. The other thing is that so far it's a bit more convenient to fined and edit the files generated. in all other aspects it's the same, of course
n
In the case of Charts.js the generated Kotlin source files from Dukat had so many errors that it was much easier to do the mappings from scratch (just cover a small part of the API), while looking at what Dukat was doing in the generated code for clues on implementing the mappings. All the generated code from Dukat was using some outdated Kotlin JS stuff, and much of the code wasn't very readable.
1
c
@napperley can you share your charts.js mappings?
n
The mappings can be found in this link: https://kotlinlang.slack.com/archives/C0B8L3U69/p1591679153480100?thread_ts=1591509277.461800&cid=C0B8L3U69 Note: Not all of the API is covered since the JS library is reasonably large.