is it possible to declare a generic type that is kotlinx-serializable? something like. <T : “i am serializable”>
🚫 2
r
rocketraman
12/17/2020, 2:19 PM
Depending on what you need it for, you could create and use your own "marker" interface.
m
Marc Knaup
12/17/2020, 2:19 PM
You can’t know at compile-time if a type is serializable. In part because other modules could add their own serializers for otherwise non-serializable types.
p
Peter Ertl
12/17/2020, 2:20 PM
that what I currently do ( something like “interface Foo { fun json(): String }” to enforce I can generate json from it ) - I was just wondering if it can also be done with generics