From 3da0b0d33b68db74f7aad37d4fb45f7f90df6781 Mon Sep 17 00:00:00 2001 From: James Conkling Date: Wed, 22 Aug 2018 14:04:07 -0400 Subject: [PATCH] type graphql.options.skip HOC property (#2208) * type graphql.options.skip HOC property * Changelog update * Test adjustment to accommodate type change --- Changelog.md | 2 ++ src/types.ts | 2 +- test/client/getDataFromTree.test.tsx | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Changelog.md b/Changelog.md index 52a246a3c8..a4ef72cf04 100644 --- a/Changelog.md +++ b/Changelog.md @@ -32,6 +32,8 @@ - Remove duplicate `FetchMoreOptions` and `FetchMoreQueryOptions` types, and instead import them from Apollo Client.
[@skovy](https://github.com/skovy) in [#2281](https://github.com/apollographql/react-apollo/pull/2281) +- Type changes for the `graphql` HOC `options.skip` property.
+ [@jameslaneconkling](https://github.com/jameslaneconkling) in [#2208](https://github.com/apollographql/react-apollo/pull/2208) ## 2.1.11 (August 9, 2018) diff --git a/src/types.ts b/src/types.ts index 4fa14c8978..6ae1ad6328 100644 --- a/src/types.ts +++ b/src/types.ts @@ -119,7 +119,7 @@ export interface OperationOption< props: OptionProps, lastProps?: TChildProps | void, ) => TChildProps; - skip?: boolean | ((props: any) => boolean); + skip?: boolean | ((props: TProps) => boolean); name?: string; withRef?: boolean; shouldResubscribe?: (props: TProps, nextProps: TProps) => boolean; diff --git a/test/client/getDataFromTree.test.tsx b/test/client/getDataFromTree.test.tsx index 06cbd7677c..be333bb6cb 100644 --- a/test/client/getDataFromTree.test.tsx +++ b/test/client/getDataFromTree.test.tsx @@ -754,7 +754,7 @@ describe('SSR', () => { type WithUserChildProps = ChildProps; const withUser = graphql(userQuery, { - skip: ({ data: { loading } }) => loading, + skip: ({ data }) => data!.loading, options: ({ data }) => ({ variables: { id: data!.currentUser!.id }, }),