-
-
Notifications
You must be signed in to change notification settings - Fork 190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@types/react 18.0.0 not compatible with Easy Peasy #741
Comments
Here is an example of how to temporarily workaround this issue until the fix is published: ...
import { StoreProvider } from 'easy-peasy';
const StoreProviderOverride = StoreProvider as any;
function WebAppContainer() {
return (
<StoreProviderOverride store={webAppStore}>
...
</StoreProviderOverride>
)
} |
Wouldn't this disable Typescript if you cast the provider as any? |
I believe the more correct way to augment the type is to do the following:
This will keep all the strong typing and add the children prop back to the type. |
For convenience until a new rev is published, I pushed a fork to github with @magicdawn's fix. You can use the fork from package.json like this:
|
Just noting that from my findings another change is needed for react 18 support In React 18 the FunctionalComponent interface has changed. The PropsWithChildren type is omitted which means a similar issue for https://github.com/ctrlplusb/easy-peasy/blob/master/index.d.ts#L1093-L1096 Provider: React.FC<PropsWithChildren{
runtimeModel?: RuntimeModel;
injections?: Injections | ((previousInjections: Injections) => Injections);
}>>; |
We have also an error when trying to use Store Provider as JSX element, created with
|
FYI please see; |
Fixed in v5.1.0 🎉 |
I am getting a Typescript error if I upgrade @types/react to version 18.0.0 and use Easy Peasy:
The text was updated successfully, but these errors were encountered: