we are using KMP and export a JS module. but when ...
# javascript
n
we are using KMP and export a JS module. but when we console.log an object from kotlin we get this
Copy code
$r {g35_1: Be, h35_1: vh, emitter: {…}, callbacks: Map, __doNotUseOrImplementIt: undefined}
callbacks: Map
emitter: Buffer
g35_1: Object
h35_1: Object
__doNotUseOrImplementIt: undefined
__proto__: Object
in this case, we extended a Kotlin class in our TS code ,
g35_1
and
h35_1
are properties declared in our Kotlin code
a
And what do you expect to get?
n
Sorry, I got interrupted i was wondering if theres any nice way to keep the properties actual names,
a
Sure, there are two ways to do that. If you want to have less impact on the generated code (if the class will be not in usage, this class will be deleted) you can use @JsName annotation with the name you want to keep on the properties. For some special cases (if you want to have ability to extend the class from the TS code) you could use @JsExport on the whole class, but the @JsExport annotation also adds a few restrictions, so, I feel that the @JsName will be more prefered.