type system is implemented backwards #766
factoidforrest
started this conversation in
General
Replies: 1 comment
-
I had considered this, but you might not have all the necessary typing available. Take for instance the following case; createStore({
session: null,
}) The type inference will be;
Where really you were likely intending;
There could be an opportunity to use inference in the case that no model was provided though, as a better fallback, but IMO it will be brittle to optional / union field cases. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Instead of making the user define the types that the store will implement, why don't you just have the compiler figure out the typing from the implimentation itself? That would greatly reduce boilerplate, which is a goal of this library.
createStore<StoreModel>({
doesn't need to take a generic, it can figure it out itself if you write the typescript definition right.Beta Was this translation helpful? Give feedback.
All reactions