The future of ts2kt?


#1

Is the tool ts2kt getting any attention by the Kotlin team at Jetbrains?
There hasn’t been a commit in 5 months and ImportDeclaration and NamespaceExportDeclaration still isn’t supported.

Interoperability with java-script will be the deciding factor for the future of kotlinjs; making the future of ts2kt crucial.


#2

Kotlin Native supports Web Assembly, which makes JavaScript one of many languages for browsers. Likely there will be a more general mechanism for interop via WA in the future.


#3

I’m by no means an expert in Web Assembly, but this probably wont remove the need for wrappers.

A library like Bootstrap’s JS or framework like React will probably not be compiled to Web Assembly in such a way that other languages compiled to Web Assembly can use them in the way they were intended, and that one can look up in their documentation. Instead you will have something akin to external/dynamic. That is my guess anyway. - Even interop with C++ from C ruins any beauty of a C++ library.

Good typed wrappers are needed. TypeScript has a bunch of good typed wrappers. ts2kt tries to exploit that but is not quite there yet.


#4

Is ts2kt even an official jetbrains product? I mean it is referenced in the documentation but it’s github repro does not have the official jetbrains badge.
If it is not a product officially developed by jetbrains it would explain why there are not as many updates to it.


#5

It is official. I remember that it is tracked in the main Kotlin issue tracker and it is hosted among JetBrains projects.


#6

It was part of their sales pitch for using Kotlin for front-end web development and as such referenced in the documentation as you point out.


#7

I thought it was. It’s just wired that it’s the only project without a jetbrains badge. Maybe they just forgot to add it to the readme.


#8

If you want to preserve some type or semantic information from TypeScipt then I guess so. But WebAssembly maintains type and parameter information and will likely become the point of interop in the future. This gives you some idea of how it might be used:

https://developer.mozilla.org/en-US/docs/WebAssembly/Exported_functions

So I don’t think this is true. I’m guessing JetBrains is waiting for WA to mature to see if it will allow effective interop with any WA compatible language before pursuing wrapper generators for specific languages any further.


#9

WebAssembly hardly will replace JS in nearest future. At least while it does not have garbage collection.


#10

It’s still a work in progress, although it’s live in most browsers. GC is currently being worked on and should arrive soon.


#11

It will be a long time before WebAssembly en masse replace java-script. We need this tool now.
Also, we will probably still need headers and wrappers for Kotlin to interoperate with java-script even though both Kotlin and java-script is compiled to a WebAssembly world. ts2kt gives us headers where we otherwise would have none.