atlassian / react-sweet-state

Shared state management solution for React

Home Page:https://atlassian.github.io/react-sweet-state/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[typescript] Wrong type for StoreState.key

tonai opened this issue · comments

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.

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.

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.