Join Slack
Powered by
Hi, what's the best way to generate Typescript def...
# announcements
h
hho
12/09/2020, 5:30 PM
Hi, what's the best way to generate Typescript definitions for some Kotlin data classes? (a bit like Dukat in reverse?)
s
Sebastian Aigner
12/09/2020, 5:41 PM
This is probably best asked in
#C0B8L3U69
🙂 Short answer – new IR compiler.
https://kotlinlang.org/docs/reference/js-ir-compiler.html#preview-generation-of-typescript-declaration-files-dts
Compiler itself is in Alpha, TS generation is a preview feature, so use at your own risk 😉
h
hho
12/09/2020, 5:44 PM
Thank you!
l
lorefnon
12/09/2020, 8:29 PM
An alternative solution would be to use Thrift IDL and generate both Kotlin & TS from it.
https://github.com/microsoft/thrifty
generates idiomatic kotlin data classes. You don't necessarily have to use thrift rpc - you can use just the IDL alone.
h
hho
12/10/2020, 8:47 AM
Thank you too!
2
Views
Open in Slack
Previous
Next