I have an expect declaration `LocalDateTime`with `...
# serialization
l
I have an expect declaration `LocalDateTime`with
@Serializable(Serializer::class)
, and the actual implementation is a typealias to
java.time.LocalDateTime
. Now it complains about the missing companion object on the actual implementation. And when I move the `@Serializable`to the typealias, it complains that no serializer found for
LocalDateTime
. How to solve this?
m
Do you have a concrete code snippet? I'm not sure I understood the issue correctly...
l
Sure.
Copy code
// common

@Serializable(Serializer::class)
expect class LocalDateTime

object Serializer : KSerializer<LocalDateTime>

// jvm

actual typealias LocalDateTime = java.time.LocalDateTime // ERROR
l
Found a solution. Just create another typealias with the serializer for
LocalDateTime
, and leave the raw `LocalDateTime`as is.
🦜 1