Skip to content

Commit

Permalink
Export "SubscriptionArgs" type (#1942)
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov committed Jun 2, 2019
1 parent acf95e1 commit 376f1fd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
1 change: 1 addition & 0 deletions src/index.js
Expand Up @@ -295,6 +295,7 @@ export {
export type { ExecutionArgs, ExecutionResult } from './execution';

export { subscribe, createSourceEventStream } from './subscription';
export type { SubscriptionArgs } from './subscription';

// Validate GraphQL documents.
export {
Expand Down
1 change: 1 addition & 0 deletions src/subscription/index.js
Expand Up @@ -8,3 +8,4 @@
*/

export { subscribe, createSourceEventStream } from './subscribe';
export type { SubscriptionArgs } from './subscribe';
22 changes: 12 additions & 10 deletions src/subscription/subscribe.js
Expand Up @@ -30,6 +30,17 @@ import { type DocumentNode } from '../language/ast';
import { type GraphQLFieldResolver } from '../type/definition';
import { getOperationRootType } from '../utilities/getOperationRootType';

export type SubscriptionArgs = {|
schema: GraphQLSchema,
document: DocumentNode,
rootValue?: mixed,
contextValue?: mixed,
variableValues?: ?{ [variable: string]: mixed },
operationName?: ?string,
fieldResolver?: ?GraphQLFieldResolver<any, any>,
subscribeFieldResolver?: ?GraphQLFieldResolver<any, any>,
|};

/**
* Implements the "Subscribe" algorithm described in the GraphQL specification.
*
Expand All @@ -51,16 +62,7 @@ import { getOperationRootType } from '../utilities/getOperationRootType';
* Accepts either an object with named arguments, or individual arguments.
*/
declare function subscribe(
{|
schema: GraphQLSchema,
document: DocumentNode,
rootValue?: mixed,
contextValue?: mixed,
variableValues?: ?{ [variable: string]: mixed },
operationName?: ?string,
fieldResolver?: ?GraphQLFieldResolver<any, any>,
subscribeFieldResolver?: ?GraphQLFieldResolver<any, any>,
|},
SubscriptionArgs,
..._: []
): Promise<AsyncIterator<ExecutionResult> | ExecutionResult>;
/* eslint-disable no-redeclare */
Expand Down

0 comments on commit 376f1fd

Please sign in to comment.