Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Commit

Permalink
Flow fixes (#952)
Browse files Browse the repository at this point in the history
* Fix(flow) Added missing NamedProps to exports

* Fix(flow) Make skip covariant

- because fix is an interface and has two types, it needs to be set as
covariant (using read-only notation)
- see facebook/flow#4084

* Fix(flow) Component should not be restricted on default props & state

- this allows for containers to have state or default props.
  • Loading branch information
dozoisch authored and James Baxley committed Aug 4, 2017
1 parent c6a6517 commit 1c66c65
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/index.js.flow
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,14 @@ export interface OptionProps<TProps, TResult> {

export type OptionDescription<P> = (props: P) => QueryOpts | MutationOpts;

export type NamedProps<P, R> = P & {
ownProps: R;
};

export interface OperationOption<TProps: {}, TResult: {}> {
options?: OptionDescription<TProps>,
props?: (props: OptionProps<TProps, TResult>) => any,
skip?: boolean | ((props: any) => boolean),
+skip?: boolean | ((props: any) => boolean),
name?: string,
withRef?: boolean,
shouldResubscribe?: (props: TProps, nextProps: TProps) => boolean,
Expand All @@ -117,7 +121,7 @@ export interface OperationComponent<
(
component:
| StatelessComponent<TMergedProps>
| Class<React$Component<void, TMergedProps, void>>,
| Class<React$Component<any, TMergedProps, any>>,
): Class<React$Component<void, TOwnProps, void>>,
}

Expand All @@ -129,7 +133,7 @@ declare export function graphql<TResult, TProps, TChildProps>(
declare export function withApollo<TProps>(
component:
| StatelessComponent<TProps & ApolloClient>
| Class<React$Component<void, TProps & ApolloClient, void>>,
| Class<React$Component<any, TProps & ApolloClient, any>>,
): Class<React$Component<void, TProps & ApolloClient, void>>;

export interface IDocumentDefinition {
Expand Down

0 comments on commit 1c66c65

Please sign in to comment.