kotlin-inject
kotlin-inject copied to clipboard
"No type arguments expected for typealias..."
Having
typealias SplashScreen = @Composable (onSplashFinished: () -> Unit) -> Unit
@Inject
@Composable
fun SplashScreen(
provideSplashViewModel: () -> SplashViewModel,
onSplashFinished: () -> Unit
) { ... }
interface ScreenComponent {
val splashScreen: SplashScreen
}
@Component
abstract class ApplicationComponent(
@get:Provides val context: Context
) : ScreenComponent
generates the following:
public override val splashScreen: SplashScreen<Function0<Unit>, Unit>
get() = { arg0 ->
somepackage.SplashScreen(
provideSplashViewModel = {
SplashViewModel()
},
onSplashFinished = arg0
)
}
with build error No type arguments expected for typealias SplashScreen
Version 0.5.2-SNAPSHOT
Edit:
It works when I override it directly in ApplicationComponent:
abstract override val splashScreen: SplashScreen
I'm not sure if this should be treated as a solution or a temporary workaround 🤔
@dgomolka Hm, seems to work for me, can you provide a sample project with the issue or a failing test? When I copied your example in I got
public class InjectApplicationComponent(
context: Context
) : ApplicationComponent(context) {
public override val splashScreen: SplashScreen
get() = { arg0 ->
SplashScreen(
provideSplashViewModel = {
SplashViewModel()
},
onSplashFinished = arg0
)
}
}
which seems correct.
Closing for lack of info, feel free to re-open if you are still having this issue.