3 ms·
Looks very interesting. Does it have TypeScript definitions so the schema are type safe?
by danr4 5y ago
Looks very interesting.
Does it have TypeScript definitions so the schema are type safe?
- jamesgpearce 5y agoThe definition of a Schema itself is typed of course (https://tinybase.org/api/store/type-aliases/schema/schema/ https://tinybase.org/api/store/type-aliases/schema/schema/) but I haven't thought of a way to then magically create developer-time definitions of a Schema on a Store. There is also a way to 'programmatically' enforce a Schema (https://tinybase.org/guides/schemas-and-persistence/mutating-data-with-listeners/ https://tinybase.org/guides/schemas-and-persistence/mutating...) so you could (in theory) implement all sorts of wild and wonderful constraints. I think for now you'll need to create your own local type definition that models the data you know is in the Store. But let me think a bit more about this.