ctrlplusb / easy-peasy

Vegetarian friendly state for React

Home Page:https://easy-peasy.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Extensive Typescript Support claim deceiving

ZeroPie opened this issue · comments

commented

Maybe it's just me but just going through the "Quick Start" i already ran into 2 Typescript problems.

  1. Store Provider types have to be extended manually
  2. Properties defined in the store are not correctly typed or even found

Screenshot 2022-06-05 at 10 31 36

2/3 Steps of the Quickstart don't work out of the box. Cannot comment further because at this point i decided to not give easy peasy a try. I think under circumstances Typescript support is an inaccurate claim?

@ZeroPie your code example does not give quite enough context of where you are trying to access this property from. There may be something wrong with how you've set things up or how you're utilizing the types. Certainly easy-peasy does work well with TypeScript for most use-cases (some caveats are called out in the docs). If your code example is from within a useStoreState hook, are you creating and using the typed version?

It sounds like you've already decided not to use easy-peasy, however if you take a look at this codesandbox you can see that within thunks, actions, state hooks, etc. store properties are in fact typed correctly.