Hello, I’m making a multiplatform java/js lib
I have issue to use static method in kotlin to js : They are not added to the class
my code:
package mu;
class A {
fun aa() = "aa"
}
class B {
fun bb() = "bb"
companion object {
fun cc() = "cc"
}
}
the compile:
(function (_, Kotlin) {
'use strict';
var Kind_CLASS = Kotlin.Kind.CLASS;
var Kind_OBJECT = Kotlin.Kind.OBJECT;
function A() {
}
A.prototype.aa = function () {
return 'aa';
};
A.$metadata$ = {
kind: Kind_CLASS,
simpleName: 'A',
interfaces: []
};
function B() {
B$Companion_getInstance();
}
B.prototype.bb = function () {
return 'bb';
};
function B$Companion() {
B$Companion_instance = this;
}
B$Companion.prototype.cc = function () {
return 'cc';
};
B$Companion.$metadata$ = {
kind: Kind_OBJECT,
simpleName: 'Companion',
interfaces: []
};
var B$Companion_instance = null;
function B$Companion_getInstance() {
if (B$Companion_instance === null) {
new B$Companion();
}
return B$Companion_instance;
}
B.$metadata$ = {
kind: Kind_CLASS,
simpleName: 'B',
interfaces: []
};
var package$mu = _.mu || (_.mu = {});
package$mu.A = A;
Object.defineProperty(B, 'Companion', {
get: B$Companion_getInstance
});
package$mu.B = B;
Kotlin.defineModule('M1', _);
return _;
}(module.exports, require('kotlin')));
//# sourceMappingURL=M1.js.map
The issue:
new AA().aa is defined
new BB().bb in defined
BB.cc is undefined ( and i need it)
can you help me?