Skip to content

Commit

Permalink
Fix some flow types
Browse files Browse the repository at this point in the history
Marks the type resolver as optional, and updates the flow types for mutations
to include info.

Fixes #9.
  • Loading branch information
dschafer committed Aug 18, 2015
1 parent e310435 commit b775e51
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/mutation/mutation.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ import {

import type {
GraphQLFieldConfig,
GraphQLFieldConfigMap
GraphQLFieldConfigMap,
GraphQLResolveInfo
} from 'graphql';

type mutationFn = (object: Object) => Object |
(object: Object) => Promise<Object>;
type mutationFn = (object: Object, info: GraphQLResolveInfo) => Object |
(object: Object, info: GraphQLResolveInfo) => Promise<Object>;

/**
* A description of a mutation consumable by mutationWithClientMutationId
Expand Down
6 changes: 5 additions & 1 deletion src/node/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,14 @@ type typeResolverFn = (object: any) => ?GraphQLObjectType |
* to map from an underlying object to the concrete GraphQLObjectType it
* corresponds to, constructs a `Node` interface that objects can implement,
* and a field config for a `node` root field.
*
* If the typeResolver is omitted, object resolution on the interface will be
* handled with the `isTypeOf` method on object types, as with any GraphQL
* interface without a provided `resolveType` method.
*/
export function nodeDefinitions(
idFetcher: ((id: string, info: GraphQLResolveInfo) => any),
typeResolver: typeResolverFn
typeResolver?: ?typeResolverFn
): GraphQLNodeDefinitions {
var nodeInterface = new GraphQLInterfaceType({
name: 'Node',
Expand Down

0 comments on commit b775e51

Please sign in to comment.