Does SAM conversion for `fun interface` with `@Composable` works or still WIP? I encountered this: `...
l
Does SAM conversion for
fun interface
with
@Composable
works or still WIP? I encountered this:
Copy code
fun interface SomeComposable {
    @Composable fun Content()
}

val content = SomeComposable { Text("hi") } // <- @Composable invocations can only happen from the context of a @Composable function
val content = SomeComposable @Composable { Text("hi") } // <- type mismatch: inferred @Composable () -> Unit but () -> Unit is expected
h
only from curiosity what is the benefit using fun interface and no typealias?
j
With typealias you can pass whatever type which is the same than that typealias. With a fun interface you can only pass that specific type
h
I know, but if you only hold a composable, personally, I don't see a big advantage
l
I also think I don't have to do this thing; however, regardless of advantage it should just work. + Note that I initially needed this for inheritance.