atlassian / react-sweet-state

Shared state management solution for React
https://atlassian.github.io/react-sweet-state/
MIT License
871 stars 55 forks source link

[typescript] Wrong type for StoreState.key #149

Closed tonai closed 2 years ago

tonai commented 2 years ago

StoreState.key is defined as string[] (https://github.com/atlassian/react-sweet-state/blob/master/types/index.d.ts#L36) But it seems that in the StoreState object it is only a string.

tonai commented 2 years ago

Also actions are accessible inside the OnInit function of a Container (and in other lifecycle functions as well), but it is typed as as a simple Action which sends StoreActionApi as first argument but StoreActionApi does not contains the actions property.

albertogasparin commented 2 years ago

Thanks for noticing. I've fixed the key type in #155 . Regarding actions, they are still accessible for compatibility reasons, but they are deprecated. Hence why they are missing from both TS types and docs. The main reason is due to the complexity of having it properly typed and linted. The next minor will add a warning for people still using it, and the next mayor will remove it completely.