tinyplex / tinybase

The reactive data store for local‑first apps.
https://tinybase.org
MIT License
3.72k stars 78 forks source link

Better types for `setValues` & `useStore` #58

Closed dillondotzip closed 1 year ago

dillondotzip commented 1 year ago

Currently, setValues & setValue will ignore updating the store if a property doesn't match the set schema. This is great.

But would be very helpful to also have some info on the type side when setting the values (or row/cell). Would also be nice to get the schema types from useStore.

jamesgpearce commented 1 year ago

Yes! The tools module generates type definitions to do this today. See https://tinybase.org/guides/developer-tools/generating-apis/

Also see #50 (and the v3.1 beta) where the type generation is being provided for the React UI module too.

Finally, see https://twitter.com/jamespearce/status/1631406755082117121 - this will let you refine the API to match the schema without having to generate an ORM layer. Also coming in v3.1

jamesgpearce commented 1 year ago

Please kick the tires on https://github.com/tinyplex/tinybase/releases/tag/v3.1.0-beta.3

jamesgpearce commented 1 year ago

Closed out with v3.1! https://tinybase.org/guides/releases/#v3-1