withStorage: fix typings

This commit is contained in:
Liam Fitzgerald 2021-04-28 13:50:19 +10:00
parent 22645b9814
commit 163d94e5a8
No known key found for this signature in database
GPG Key ID: D390E12C61D1CFFB

View File

@ -1,8 +1,8 @@
import React from 'react';
import useStorage from '~/logic/lib/useStorage';
import useStorage, {IuseStorage} from '~/logic/lib/useStorage';
const withStorage = (Component, params = {}) => {
return React.forwardRef((props: any, ref) => {
const withStorage = <P, C extends React.ComponentType<P>>(Component: C, params = {}) => {
return React.forwardRef<C, Omit<C, keyof IuseStorage>>((props, ref) => {
const storage = useStorage(params);
return <Component ref={ref} {...storage} {...props} />;