Skip to content

Commit 845a45b

Browse files
authored
Merge pull request #878 from gabelevi/flow
Avoid new Flow errors with v0.47.0
2 parents 87b24ee + fe5f544 commit 845a45b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/utilities/typeFromAST.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,19 @@ import type { GraphQLSchema } from '../type/schema';
2929
* found in the schema, then undefined will be returned.
3030
*/
3131
/* eslint-disable no-redeclare */
32-
declare function typeFromAST(
32+
declare function typeFromASTType(
3333
schema: GraphQLSchema,
3434
typeNode: NamedTypeNode
3535
): void | GraphQLNamedType;
36-
declare function typeFromAST(
36+
declare function typeFromASTType(
3737
schema: GraphQLSchema,
3838
typeNode: ListTypeNode
3939
): void | GraphQLList<*>;
40-
declare function typeFromAST(
40+
declare function typeFromASTType(
4141
schema: GraphQLSchema,
4242
typeNode: NonNullTypeNode
4343
): void | GraphQLNonNull<*>;
44-
export function typeFromAST(schema, typeNode) {
44+
function typeFromASTImpl(schema, typeNode) {
4545
/* eslint-enable no-redeclare */
4646
let innerType;
4747
if (typeNode.kind === LIST_TYPE) {
@@ -55,3 +55,7 @@ export function typeFromAST(schema, typeNode) {
5555
invariant(typeNode.kind === NAMED_TYPE, 'Must be a named type.');
5656
return schema.getType(typeNode.name.value);
5757
}
58+
// This will export typeFromAST with the correct type, but currently exposes
59+
// ~26 errors: https://gist.github.com/4a29403a99a8186fcb15064d69c5f3ae
60+
// export var typeFromAST: typeof typeFromASTType = typeFromASTImpl;
61+
export const typeFromAST: $FlowFixMe = typeFromASTImpl;

0 commit comments

Comments
 (0)