I have the following Kotlin class:
data class ModelId(val stringId: String) {
fun asValue(): ValuePropertyValue {
return ModelIdValue(this)
}
}
Which results in in the following JS code:
function ModelId(stringId) {
this.stringId = stringId;
}
ModelId.prototype.asValue = function () {
return new ModelIdValue(this);
};
ModelId.$metadata$ = {
kind: Kotlin.Kind.CLASS,
simpleName: 'ModelId',
interfaces: []
};
ModelId.prototype.component1 = function () {
return this.stringId;
};
ModelId.prototype.copy_61zpoe$ = function (stringId) {
return new ModelId(stringId === void 0 ? this.stringId : stringId);
};
ModelId.prototype.toString = function () {
return 'ModelId(stringId=' + Kotlin.toString(this.stringId) + ')';
};
ModelId.prototype.hashCode = function () {
var result = 0;
result = result * 31 + Kotlin.hashCode(this.stringId) | 0;
return result;
};
ModelId.prototype.equals = function (other) {
return this === other || (other !== null && (typeof other === 'object' && (Object.getPrototypeOf(this) === Object.getPrototypeOf(other) && Kotlin.equals(this.stringId, other.stringId))));
};
(The whole thing is a UMD module)
But this resutls in an error
Uncaught TypeError: _openorcaJsClient.ModelId is not a constructor
Generate code by webpack
var modelId = new _openorcaJsClient.MtodelId("Hallo");