Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Koin wasmJs IllegalCast #2079

Open
toffeantyri opened this issue Dec 16, 2024 · 1 comment
Open

Koin wasmJs IllegalCast #2079

toffeantyri opened this issue Dec 16, 2024 · 1 comment
Labels
status:checking currently in analysis - discussion or need more detailed specs

Comments

@toffeantyri
Copy link

build success ->but run wasmJs application in browser throw
(android, ios,jvm - success)
Uncaught runtime errors:
ERROR illegal cast
RuntimeError: illegal cast

koin: 4.0.1-Beta1

class RootComponent : KoinComponent { val loginComponent = LoginComponentImpl( dependencies = get() ) }

class LoginComponentImpl( private val dependencies: ILoginComponent.Dependencies, ) : ILoginComponent { val viewModel = LoginViewModel(loginRepo = dependencies.loginRepo) }

interface ILoginComponent { interface Dependencies { val loginRepo: ILoginRepository } }

`
val loginDependenciesModule = module {
factoryOf(::LoginComponentDependenciesImpl) bind ILoginComponent.Dependencies::class
}

private class LoginComponentDependenciesImpl(
override val loginRepo: ILoginRepository,
) : ILoginComponent.Dependencies
`

this variant throw Uncaught runtime errors:
ERROR illegal cast
RuntimeError: illegal cast for wasmJs project

but variant 2 - success worked:

class LoginComponentImpl( private val dependencies: LoginDependencies, ) : ILoginComponent { val viewModel = LoginViewModel(loginRepo = dependencies.loginRepo) }

interface ILoginComponent

`
interface LoginDependencies{
val loginRepo: ILoginRepository
}

`

`val loginDependenciesModule = module {
factoryOf(::LoginComponentDependenciesImpl) bind LoginDependencies::class
}

private class LoginComponentDependenciesImpl(
override val loginRepo: ILoginRepository,
) : LoginDependencies
`

it variant work - success

@arnaudgiuliani
Copy link
Member

do you have anyway to help reproduce? (complete sample)

@arnaudgiuliani arnaudgiuliani added the status:checking currently in analysis - discussion or need more detailed specs label Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:checking currently in analysis - discussion or need more detailed specs
Projects
None yet
Development

No branches or pull requests

2 participants