I cant get the example of external serializers to compile. It fails with : `Type mismatch: inferred ...
s
I cant get the example of external serializers to compile. It fails with :
Copy code
Type mismatch: inferred type is ProjectSerializer but S
erializationStrategy<TypeVariable(T)> was expected
. What could I be doing wrong ?
Copy code
import kotlinx.serialization.*
import kotlinx.serialization.json.*
import kotlinx.serialization.encoding.*
import kotlinx.serialization.descriptors.*

// NOT @Serializable
class Project(val name: String, val language: String)

@Serializer(forClass = Project::class)
object ProjectSerializer

fun main() {
    val data = Project("kotlinx.serialization", "Kotlin")
    println(Json.encodeToString(ProjectSerializer, data))
}