Hi folks,: ```typealias RSocketData<T> = Byt...
# getting-started
g
Hi folks,:
Copy code
typealias RSocketData<T> = ByteArray

@OptIn(ExperimentalSerializationApi::class)
inline fun <reified T> ProtoBuf.decodeFromRSocketData(value: RSocketData<T>): T {
    return this.decodeFromByteArray(value)
}

@OptIn(ExperimentalSerializationApi::class)
fun testT() {
    val protoBuf = ProtoBuf
    val data: RSocketData<String> //= TODO()
    val request = protoBuf.decodeFromRSocketData(data) // Not enough information to infer type variable T
}
Does anyone knows why the compiler cannot infer type of T through data? Thanks in advance for any answers !
Though, if i create a class:
Copy code
class TypedRSocketData<T>(val data: ByteArray)
It seems to work. I guess after the compilation typealias turns to
ByteArray
which does not have any info about T?
Yup, as per my understanding this is also explained in typealias-keep. hope this thread helps if anyone has the same question as me :p
🫡 1