is it possible to declare a generic type that is k...
# announcements
p
is it possible to declare a generic type that is kotlinx-serializable? something like. <T : “i am serializable”>
🚫 2
r
Depending on what you need it for, you could create and use your own "marker" interface.
m
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
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
@Marc Knaup ok makes sense - thanks
@rocketraman thanks