:wave: Hi everyone! :slightly_smiling_face: In our...
# javascript
i
👋 Hi everyone! 🙂 In our first KMP (JS) project we're just experimenting everything and tried to enable ES6 classes via:
Copy code
tasks.withType<KotlinJsCompile>().configureEach {
    kotlinOptions {
        useEsClasses = true
    }
}
In the generated typescript definitions we see:
Copy code
static fromString(value: string, $box: Nullable<BigDecimal>): BigDecimal;
The corresponding Kotlin source is:
Copy code
@JsName("fromString")
    actual constructor(value: String) : this(BigNumber(value), scaleOf(value))
Why the argument
$box
is added to the generated TS code? It's not there if ES6 classes are disabled. We use Kotlin
1.9.21
Thanks in advance!
👀 2
a
Hey. Could you share please the code that you annotated with the JsExport annotation. It could be added inside inner classes constructors.
i
Hi Artem! I created a repo to demonstrate the issue: https://github.com/imeszaros/box-issue I also pushed the dist directory to see what output I got: https://github.com/imeszaros/box-issue/blob/master/build/dist/js/productionLibrary/box-issue.d.ts I hope this helps! Thaks a lot for your effort!
e
That's some neat way of declaring static methods without a companion, it seems. I'm not sure that use case was ever intended to be applicable.
If it indeed wasn't, I like it! But maybe proper support for statics would be better.