Hello, I tried to write my HTTP calls in kotlin th...
# javascript
m
Hello, I tried to write my HTTP calls in kotlin then generate JS with typescript definitions. I want to use KTOR client to do that. But It seems I need to use serialization lib which doesn’t work with IR compiler (failed to generate typescript definition when annotate my entities with @Serializable). In JS world, we don’t need a serializer lib (just a JSON.parse()). Do you have solutions ? Or ideas to write my HTTP calls without serialization lib dependency ?
At this moment, I create a jsMain and use fetch to perform my requests. But, I can’t use it for Android/IOS platforms.
a
I resorted to duplicating my data classes. One
@Serializable
class for communicating with the server, which I then convert to a non-serializable class that I return to the consuming code.
m
Thank you for your feedback ! At this moment, I use jackson lib to deserialize the class in my backend. So I can put all my classes definitions in a mpp module. I can’t wait to use more kotlin to typescript to write more code in kotlin !