Skip to content

Commit a5e7409

Browse files
authored
Merge pull request #479 from iamchenxin/flow-r7
Update to Flow 0.32
2 parents 3142d87 + 4c16c2b commit a5e7409

File tree

10 files changed

+15
-13
lines changed

10 files changed

+15
-13
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
"eslint-plugin-babel": "3.3.0",
7070
"eslint-plugin-flow-vars": "0.4.0",
7171
"eslint-plugin-flowtype": "2.3.1",
72-
"flow-bin": "0.29.0",
72+
"flow-bin": "0.32.0",
7373
"isparta": "4.0.0",
7474
"mocha": "2.5.3",
7575
"sane": "1.3.4"

src/error/GraphQLError.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,9 @@ export function GraphQLError( // eslint-disable-line no-redeclare
108108
}
109109

110110
let _locations;
111-
if (_source && _positions) {
112-
_locations = _positions.map(pos => getLocation(_source, pos));
111+
const _source2 = _source; // seems here Flow need a const to resolve type.
112+
if (_source2 && _positions) {
113+
_locations = _positions.map(pos => getLocation(_source2, pos));
113114
}
114115

115116
Object.defineProperties(this, {

src/execution/execute.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import find from '../jsutils/find';
1515
import invariant from '../jsutils/invariant';
1616
import isNullish from '../jsutils/isNullish';
1717
import { typeFromAST } from '../utilities/typeFromAST';
18-
import { Kind } from '../language';
18+
import * as Kind from '../language/kinds';
1919
import { getVariableValues, getArgumentValues } from './values';
2020
import {
2121
GraphQLScalarType,

src/language/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/**
1+
/** @flow
22
* Copyright (c) 2015, Facebook, Inc.
33
* All rights reserved.
44
*

src/language/kinds.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/**
1+
/** @flow
22
* Copyright (c) 2015, Facebook, Inc.
33
* All rights reserved.
44
*

src/type/scalars.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*/
1010

1111
import { GraphQLScalarType } from './definition';
12-
import { Kind } from '../language';
12+
import * as Kind from '../language/kinds';
1313

1414
// As per the GraphQL Spec, Integers are only treated as valid when a valid
1515
// 32-bit signed integer, providing the broadest support across platforms.

src/type/schema.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ function typeMapReducer(map: TypeMap, type: ?GraphQLType): TypeMap {
262262
Object.keys(fieldMap).forEach(fieldName => {
263263
const field = fieldMap[fieldName];
264264

265-
if (field.args) {
265+
if ((typeof field.args === 'object') && Array.isArray(field.args)) {
266266
const fieldArgTypes = field.args.map(arg => arg.type);
267267
reducedMap = fieldArgTypes.reduce(typeMapReducer, reducedMap);
268268
}

src/utilities/isValidJSValue.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,13 @@ import type { GraphQLInputType } from '../type/definition';
2727
* accepted for that type. This is primarily useful for validating the
2828
* runtime values of query variables.
2929
*/
30-
export function isValidJSValue(value: mixed, type: GraphQLInputType): [string] {
30+
export function isValidJSValue(value: mixed, type: GraphQLInputType):
31+
Array<string> {
3132
// A value must be provided if the type is non-null.
3233
if (type instanceof GraphQLNonNull) {
3334
if (isNullish(value)) {
3435
if (type.ofType.name) {
35-
return [ `Expected "${type.ofType.name}!", found null.` ];
36+
return [ `Expected "${String(type.ofType.name)}!", found null.` ];
3637
}
3738
return [ 'Expected non-null value, found null.' ];
3839
}

src/utilities/isValidLiteralValue.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ import isNullish from '../jsutils/isNullish';
3838
export function isValidLiteralValue(
3939
type: GraphQLInputType,
4040
valueAST: Value
41-
): [ string ] {
41+
): Array<string> {
4242
// A value must be provided if the type is non-null.
4343
if (type instanceof GraphQLNonNull) {
4444
if (!valueAST) {
4545
if (type.ofType.name) {
46-
return [ `Expected "${type.ofType.name}!", found null.` ];
46+
return [ `Expected "${String(type.ofType.name)}!", found null.` ];
4747
}
4848
return [ 'Expected non-null value, found null.' ];
4949
}

src/validation/rules/OverlappingFieldsCanBeMerged.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ function _collectFieldsAndFragmentNames(
732732
case INLINE_FRAGMENT:
733733
const typeCondition = selection.typeCondition;
734734
const inlineFragmentType = typeCondition ?
735-
typeFromAST(context.getSchema(), selection.typeCondition) :
735+
typeFromAST(context.getSchema(), typeCondition) :
736736
parentType;
737737
_collectFieldsAndFragmentNames(
738738
context,

0 commit comments

Comments
 (0)