Skip to content

Commit 2baa056

Browse files
author
James Baxley
authored
Flow tweaks (apollographql#752)
* increase setTimeout for intermittent test failre * fix some flow types from usage * update changelog and version * better tupe respone * ignore apollo client flow tests
1 parent 62459c9 commit 2baa056

File tree

4 files changed

+13
-11
lines changed

4 files changed

+13
-11
lines changed

.flowconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
.*/examples/**/.*
33
.*/node_modules/art/.*
44
.*/node_modules/react-native/**/.*
5+
.*/node_modules/apollo-client/test/**/.*
56

67
[include]
78

89
[libs]
10+
./node_modules/apollo-client/index.js.flow
911
./index.js.flow
1012

1113
[options]

Changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
### vNext
44

5+
### 1.4.2
6+
- Fix: Fix component reference and variable statement for flow types
7+
58
### 1.4.1
69
- Fix: Fix compilation of test-utils from move to ES bundles
710

index.js.flow

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import type {
1111
} from "apollo-client";
1212
import type { Store } from "redux";
1313
import type { DocumentNode, VariableDefinitionNode } from "graphql";
14+
import type { Component } from "react";
1415

1516
declare module "react-apollo" {
1617
declare type StatelessComponent<P> = (props: P) => ?React$Element<any>;
@@ -45,16 +46,14 @@ declare module "react-apollo" {
4546
} & P;
4647

4748
declare export interface MutationOpts {
48-
variables?: { [key: string]: mixed },
49+
variables?: Object,
4950
optimisticResponse?: Object,
5051
updateQueries?: MutationQueryReducersMap,
5152
}
5253

5354
declare export interface QueryOpts {
5455
ssr?: boolean,
55-
variables?: {
56-
[key: string]: mixed,
57-
},
56+
variables?: Object,
5857
fetchPolicy?: FetchPolicy,
5958
pollInterval?: number,
6059
skip?: boolean,
@@ -64,13 +63,11 @@ declare module "react-apollo" {
6463
error?: ApolloError,
6564
networkStatus: number,
6665
loading: boolean,
67-
variables: {
68-
[variable: string]: any,
69-
},
66+
variables: Object,
7067
fetchMore: (
7168
fetchMoreOptions: FetchMoreQueryOptions & FetchMoreOptions
7269
) => Promise<ApolloQueryResult<any>>,
73-
refetch: (variables?: any) => Promise<ApolloQueryResult<any>>,
70+
refetch: (variables?: Object) => Promise<ApolloQueryResult<any>>,
7471
startPolling: (pollInterval: number) => void,
7572
stopPolling: () => void,
7673
subscribeToMore: (options: SubscribeToMoreOptions) => () => void,
@@ -107,8 +104,8 @@ declare module "react-apollo" {
107104
(
108105
component:
109106
| StatelessComponent<TMergedProps>
110-
| React$Component<*, TMergedProps, *>
111-
): React$Component<*, TOwnProps, *>,
107+
| React$Component<void, TMergedProps, void>
108+
): Class<React$Component<void, TOwnProps, void>>,
112109
}
113110

114111
declare export function graphql<TResult, TProps, TChildProps>(

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-apollo",
3-
"version": "1.4.1",
3+
"version": "1.4.2",
44
"description": "React data container for Apollo Client",
55
"main": "lib/react-apollo.umd.js",
66
"module": "./lib/index.js",

0 commit comments

Comments
 (0)