Trying out the preview version of `.d.ts` generati...
# javascript
d
Trying out the preview version of
.d.ts
generation, ran into issues / unsupported things very fast (can't even export enums 😕). Off to youtrack I go...
👍 2
t
Kotlin enum doesn’t have direct analog in TypeScript, isn’t it?
d
It doesn't, but I'd expect it to generate a matching declaration file... Not just... nothing.
And yes, we need inline enums (or something like that) badly, for JS interop.
t
Do you use
serialization
for enums?
d
No, why?
t
In my cases union type can be generated according serialization annotation
d
Can you elaborate? Is this about
kotlinx.serialization
?
👌 1
t
Copy code
@Serializable
enum class Mode {
    @SerialName("normal") NORMAL
    @SerialName("undefined") UNDEFINED
}
In
d.ts
I want to see
Copy code
type Mode = 'normal' | 'undefined'
d
How does that help with .d.ts generation and calling Kotlin from Typescript?
t
I will send you related ticket if you have same case
d
My use case is writing Common code in Kotlin and using it in Backend and also from Frontend written in typescript
I am not sure how serialization can help there, but I am all ears
t
How it works now in your cases?
d
It doesn't work at all yet, the current backend is written in PHP and code is duplicated. This is an experiment for a potential future rewrite of the backend in Kotlin
t
If TypeScript is only load data (no transformation), then you can avoid redundant enum declaring
d
What do you mean?