You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
useQueryHook()'s return type should be one of the following:
all of the component's props
a subset of the component's props
In addition, the parameter for the WithQueryHOC component should also be one of the two cases:
all of the component's props
a subset of the component's props
Considering these two requirements, a possible type definition would be to use Partial<T> for both useQueryHook()'s return value and the parameter for the WithQueryHOC component:
kevinydhan
changed the title
WithQueryHOC type definition expects all props from parent component
WithQueryHOC type definition expects all props from parent component
Dec 17, 2020
In the following type definition for
WithQuery
:useQueryHook()
's return type should be one of the following:props
props
In addition, the parameter for the
WithQueryHOC
component should also be one of the two cases:props
props
Considering these two requirements, a possible type definition would be to use
Partial<T>
for bothuseQueryHook()
's return value and the parameter for theWithQueryHOC
component:However, this poses the problem where calling
React.createElement()
with partial props will trigger a TypeScript warning.The text was updated successfully, but these errors were encountered: