Is it possible to have a typealias that's serializ...
# serialization
c
Is it possible to have a typealias that's serializable? I thought this would work, but no go
Copy code
@Serializable
typealias BOOP = String
the docs seem to say that String is a primitive that's supported but I can't seem to even get String.serializer() either
e
Copy code
typealias BOOP = @Serializable String
c
intesting. i could've sworn i tried that and it did't compile. but it did this time. i thought it would send it wrapped in json, but it just sends a raw string literal over the wire. So looks like I'll just do
Copy code
@Serializable
data class Thing(val boop: BOOP)

typealias BOOP = String
thanks @ephemient
e
if it's literally
String
there's no need anyway
1
it's more useful when you have
typealias SerializableFoo = @Serializable(with = ExternalFooSerializer::class) Foo
or other more meaningful annotations
👍 1
b