New to RxDB here.
I've read through the RxDB document and seems there's no elegant way to store types in RxDB. For example,
- Sum types
type Animal = {kind: 'horse', pawColor: Color} | {kind: 'bird', speed: number}
- Simple OR types (or enums):
type User = {ClientStatus: ClientStatus}
type ClientStatus = 'ONLINE'|'OFFLINE'
If I understand correctly, since the RxDB schema is similar to json-schema, we can think of the RxDB documents as raw json, therefore the serialization/deserialization from/to our Typescript types are own our own.
Is this assumption correct? Or am I missing some RxDB tooling that can help us?
Your assumtion is not correct. For example you can use enum types in JsonSchema and also in RxDB https://json-schema.org/understanding-json-schema/reference/generic.html#enumerated-values