I was wondering if I could get some guidance on th...
# javascript
h
I was wondering if I could get some guidance on the JS IR-backend and its behaviour in this example (https://pl.kotl.in/diCAOrw0L) - when run using the legacy backend this gives the expected names, but the IR backend has modified field names with _ prefixes etc. I noticed this ticket (https://youtrack.jetbrains.com/issue/KT-45944) but was wondering if I'm just missing something?
I've used the @JsName annotation which behaves as expected in the legacy backend but is seemingly ignored by the IR
d
The IR compiler generates non-enumerable computed properties backed by some normal property/field. At runtime
Foo.Car
still has an
xxxx
property backed by
_x
, but it's non-enumerable so it doesn't show up when stringified.
h
aha
My use-case is sending objects to/from web workers but I guess this is a general case when trying to JSON serialize types built with the IR backend, then.
I can always wrap these in some other way
d
There's another issue here that specifically mentions workers: https://youtrack.jetbrains.com/issue/KT-41162
👍 1
h
Thanks. I did try searching around but didn't spot that one