diff --git a/packages/components/src/types.ts b/packages/components/src/types.ts index f294fefe31..8da7942bd6 100644 --- a/packages/components/src/types.ts +++ b/packages/components/src/types.ts @@ -14,7 +14,7 @@ export interface QueryComponentOptions< TData = any, TVariables = OperationVariables > extends QueryFunctionOptions { - children: (result: QueryResult) => JSX.Element | null; + children: (result: QueryResult) => React.ReactNode query: DocumentNode; } @@ -32,7 +32,7 @@ export interface MutationComponentOptions< export interface SubscriptionComponentOptions< TData = any, TVariables = OperationVariables -> extends BaseSubscriptionOptions { + > extends BaseSubscriptionOptions { subscription: DocumentNode; children?: null | ((result: SubscriptionResult) => JSX.Element | null); } diff --git a/packages/hoc/src/withApollo.tsx b/packages/hoc/src/withApollo.tsx index ce32741b40..6acd433604 100644 --- a/packages/hoc/src/withApollo.tsx +++ b/packages/hoc/src/withApollo.tsx @@ -9,10 +9,8 @@ function getDisplayName

(WrappedComponent: React.ComponentType

) { return WrappedComponent.displayName || WrappedComponent.name || 'Component'; } -export function withApollo( - WrappedComponent: React.ComponentType< - WithApolloClient> - >, +export function withApollo, TResult = any>( + WrappedComponent: React.ComponentType, operationOptions: OperationOption = {} ): React.ComponentClass> { const withDisplayName = `withApollo(${getDisplayName(WrappedComponent)})`; @@ -53,7 +51,7 @@ export function withApollo( ? this.setWrappedInstance : undefined }); - return ; + return ; }} );