kotlin-inject icon indicating copy to clipboard operation
kotlin-inject copied to clipboard

"No type arguments expected for typealias..."

Open dgomolka opened this issue 2 years ago • 1 comments

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 avatar Sep 19 '22 08:09 dgomolka

@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.

evant avatar Sep 23 '22 05:09 evant

Closing for lack of info, feel free to re-open if you are still having this issue.

evant avatar Feb 03 '23 05:02 evant