Skip to content

Commit

Permalink
Merge pull request #554 from graphql/export-types
Browse files Browse the repository at this point in the history
Export flow types from index.js
  • Loading branch information
leebyron authored Nov 3, 2016
2 parents c6a6388 + d79b71d commit c7af6cb
Show file tree
Hide file tree
Showing 37 changed files with 1,080 additions and 822 deletions.
4 changes: 2 additions & 2 deletions src/error/GraphQLError.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/

import { getLocation } from '../language';
import type { Node } from '../language/ast';
import type { ASTNode } from '../language/ast';
import type { Source } from '../language/source';

/**
Expand Down Expand Up @@ -50,7 +50,7 @@ declare class GraphQLError extends Error {
/**
* An array of GraphQL AST Nodes corresponding to this error.
*/
nodes: Array<Node> | void;
nodes: Array<ASTNode> | void;

/**
* The source GraphQL document corresponding to this error.
Expand Down
12 changes: 6 additions & 6 deletions src/error/__tests__/GraphQLError-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ describe('GraphQLError', () => {
field
}`);
const ast = parse(source);
const fieldAST = ast.definitions[0].selectionSet.selections[0];
const e = new GraphQLError('msg', [ fieldAST ]);
expect(e.nodes).to.deep.equal([ fieldAST ]);
const fieldNode = ast.definitions[0].selectionSet.selections[0];
const e = new GraphQLError('msg', [ fieldNode ]);
expect(e.nodes).to.deep.equal([ fieldNode ]);
expect(e.source).to.equal(source);
expect(e.positions).to.deep.equal([ 8 ]);
expect(e.locations).to.deep.equal([ { line: 2, column: 7 } ]);
Expand All @@ -77,9 +77,9 @@ describe('GraphQLError', () => {
field
}`);
const ast = parse(source);
const operationAST = ast.definitions[0];
const e = new GraphQLError('msg', [ operationAST ]);
expect(e.nodes).to.deep.equal([ operationAST ]);
const operationNode = ast.definitions[0];
const e = new GraphQLError('msg', [ operationNode ]);
expect(e.nodes).to.deep.equal([ operationNode ]);
expect(e.source).to.equal(source);
expect(e.positions).to.deep.equal([ 0 ]);
expect(e.locations).to.deep.equal([ { line: 1, column: 1 } ]);
Expand Down
5 changes: 5 additions & 0 deletions src/error/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,8 @@ export { GraphQLError } from './GraphQLError';
export { syntaxError } from './syntaxError';
export { locatedError } from './locatedError';
export { formatError } from './formatError';

export type {
GraphQLFormattedError,
GraphQLErrorLocation
} from './formatError';
6 changes: 3 additions & 3 deletions src/execution/__tests__/executor-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ describe('Execute: Handles basic execution tasks', () => {

expect(Object.keys(info)).to.deep.equal([
'fieldName',
'fieldASTs',
'fieldNodes',
'returnType',
'parentType',
'path',
Expand All @@ -219,8 +219,8 @@ describe('Execute: Handles basic execution tasks', () => {
'variableValues',
]);
expect(info.fieldName).to.equal('test');
expect(info.fieldASTs).to.have.lengthOf(1);
expect(info.fieldASTs[0]).to.equal(
expect(info.fieldNodes).to.have.lengthOf(1);
expect(info.fieldNodes[0]).to.equal(
ast.definitions[0].selectionSet.selections[0]
);
expect(info.returnType).to.equal(GraphQLString);
Expand Down
Loading

0 comments on commit c7af6cb

Please sign in to comment.