Closed tvardero closed 2 years ago
Ouch, that is a change in React 18 types. As with @types/react^17
things are fine: createContainer
return type is ComponentType
, which alias FunctionComponent
which in turn has PropsWithChildren<P>
.
Seems like they removed it in v18, and now FunctionComponent
just uses P
.
Would you be happy to raise a PR to improve the return type?
Can't declare store container using simple
createContainer(MyStore)
, using this container results in error:Apparently, container doesn't have
children
field on it's props.The only solution i found for myself is to explicitly declare
children?: any
:export const MyStoreContainer = createContainer<MyStoreState, MyStoreActions, { children?: any }>(MyStore);
Full store code (counter example from your docs, but in typescript):
Dependencies in
package.json
:I'm new to React, Redux and Sweet State, maybe I'm doing something wrong? Or was it intended to explicitly declare props for containers? Container tag is useless with self-closing html tag (
<Container />
), so it expected to have children anyway.