From 2baa0564d82ff29aafd4f8bdbec06143acbfd939 Mon Sep 17 00:00:00 2001 From: James Baxley Date: Sat, 3 Jun 2017 22:47:32 -0400 Subject: [PATCH] Flow tweaks (#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 --- .flowconfig | 2 ++ Changelog.md | 3 +++ index.js.flow | 17 +++++++---------- package.json | 2 +- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/.flowconfig b/.flowconfig index c2a4545473..d4a4047f68 100644 --- a/.flowconfig +++ b/.flowconfig @@ -2,10 +2,12 @@ .*/examples/**/.* .*/node_modules/art/.* .*/node_modules/react-native/**/.* +.*/node_modules/apollo-client/test/**/.* [include] [libs] +./node_modules/apollo-client/index.js.flow ./index.js.flow [options] diff --git a/Changelog.md b/Changelog.md index f7e7c0687c..5b356eac23 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,6 +2,9 @@ ### vNext +### 1.4.2 +- Fix: Fix component reference and variable statement for flow types + ### 1.4.1 - Fix: Fix compilation of test-utils from move to ES bundles diff --git a/index.js.flow b/index.js.flow index dca467b241..5e10ba85fa 100644 --- a/index.js.flow +++ b/index.js.flow @@ -11,6 +11,7 @@ import type { } from "apollo-client"; import type { Store } from "redux"; import type { DocumentNode, VariableDefinitionNode } from "graphql"; +import type { Component } from "react"; declare module "react-apollo" { declare type StatelessComponent

= (props: P) => ?React$Element; @@ -45,16 +46,14 @@ declare module "react-apollo" { } & P; declare export interface MutationOpts { - variables?: { [key: string]: mixed }, + variables?: Object, optimisticResponse?: Object, updateQueries?: MutationQueryReducersMap, } declare export interface QueryOpts { ssr?: boolean, - variables?: { - [key: string]: mixed, - }, + variables?: Object, fetchPolicy?: FetchPolicy, pollInterval?: number, skip?: boolean, @@ -64,13 +63,11 @@ declare module "react-apollo" { error?: ApolloError, networkStatus: number, loading: boolean, - variables: { - [variable: string]: any, - }, + variables: Object, fetchMore: ( fetchMoreOptions: FetchMoreQueryOptions & FetchMoreOptions ) => Promise>, - refetch: (variables?: any) => Promise>, + refetch: (variables?: Object) => Promise>, startPolling: (pollInterval: number) => void, stopPolling: () => void, subscribeToMore: (options: SubscribeToMoreOptions) => () => void, @@ -107,8 +104,8 @@ declare module "react-apollo" { ( component: | StatelessComponent - | React$Component<*, TMergedProps, *> - ): React$Component<*, TOwnProps, *>, + | React$Component + ): Class>, } declare export function graphql( diff --git a/package.json b/package.json index 519c1763fa..a1e40d8713 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-apollo", - "version": "1.4.1", + "version": "1.4.2", "description": "React data container for Apollo Client", "main": "lib/react-apollo.umd.js", "module": "./lib/index.js",