xxfast
06/11/2021, 7:15 AMTypeError: elements.iterator_62 is not a function
while trying to consume koin from a typescript client. More code in the threadxxfast
06/11/2021, 7:15 AM:core
multi platform module that has this extension in commonMain
@JsExport
fun initKoin(modules: List<Module>): KoinApplication = startKoin {
modules(modules)
}
:core
build script looks like this
kotlin {
...
js(IR) {
useCommonJs()
binaries.library()
browser()
}
sourceSets {
val commonMain by getting {
dependencies {
api(InsertKoin.koinCore)
...
}
}
...
val jsMain by getting {
dependencies {
...
}
}
}
}
npmPublishing {
organization = organisation
version = Version.name
}
and i have a react-ts app whose npm dependencies are set up like
"dependencies": {
"@org/core": "file:../../core/build/publications/npm/js",
...
"kotlin": "^1.5.10",
}
When i use the exported function like this,
// App.tsx
import {core} from "@org/core";
const initKoin = core.di.initKoin;
const coreDataModule = core.data.coreDataModule;
const koin = initKoin([
coreDataModule
]);
i get this exception thrown from the browser
TypeError: elements.iterator_62 is not a function
HashSet.push.../../core/build/publications/npm/js/PSCore-core.js.AbstractMutableCollection.addAll_23
.../core/build/publications/npm/js/core.js:6311
Am i missing something here? 🤔