kanwren / augustus

Serialization/data validation combinator library for TypeScript
MIT License
1 stars 1 forks source link

Support subclass serialization #2

Open kanwren opened 4 years ago

kanwren commented 4 years ago

Subclass serialization is probably best done by tagging a structure with the name of its constructor, like { tag: string; value: S; }, where S is the representational type in Schema<T, S> for the subclass. This could be easy to track with a decorator, since every constructor implicitly extends { name: string; }. A few potential difficulties: