Wow, I’m super disappointed in dukat. I stopped us...
# javascript
s
Wow, I’m super disappointed in dukat. I stopped using kotlin-js 2 years ago because I’d always encounter issues with
ts2kt
and the bindings that they generate. I was excited a year or so back when I read about dukat because it was recognition that ts2kt was broken, and needed to be more than just a side project, but rather a core part of the experience. I’ve sunk about 6 hours now into dukat, and I’m walking away with about the same level experience I had with ts2kt. I’m getting several random crashes for popular js libs (like firebase), and the lib that I did get to work (twilio) has the majority of the API libs stubbed out incorrectly with
Any
, defeating the entire point.
r
In my humble opinion, as long as the languages are incompatible (no union types in Kotlin) the task that dukat is trying to do is simply too complicated. I've made Kotlin wrappers for many JS libraries by hand and very often to get usable results you just have to choose one of the possibilities (the most needed one) and drop others. The machine can't handle it.
Of course I'd like to be wrong :-)
s
when you have union return types, it can be difficult, but if you have union function parameters, that can be achieved (I think) with multiple overloaded functions.
r
for simple cases yes, but not when parameter is an object with union type fields
g
I think it will get there eventually. The ducat repo is pretty active. For more companies to adopt Kotlin/js its almost required. The only reason my company is not using Kotlin/Js right now is because of tooling. Typescript with its type definitions just makes life easier. We are using Kotlin on the backend now though after I brought it forward.
r
DefinitelyTyped repo was created by hand by the TS community. They just got to work instead of waiting for someone to write a js2ts tool 😉 IMHO Kotlin/JS community should do the same.
j
The thing is, inferring types from JS is next to impossible. JS doesn’t have types in its syntax. So there can’t really be a js2ts tool. Here, we already have TypeScript definitions, and more will come and evolve. It would be a pity to maintain a separate ecosystem of manually written definitions of the same set of JavaScript libraries.
s
@Robert Jaros Also - TS is wayyyy more popular. TS is similar enough to JS that it was easy for a large number of devs to swap over, which drove this transition over years. The difference is that without a tool like this, no one will use kotlin-js.
r
I am 😉
And the 16k people on this channel are probably interested as well ;-)