Skip to content

Remove flow option experimental.const_params #1160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
[libs]

[options]
experimental.const_params=true

[version]
^0.61.0
3 changes: 2 additions & 1 deletion src/error/GraphQLError.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ export function GraphQLError( // eslint-disable-line no-redeclare

let _locations;
if (positions && source) {
_locations = positions.map(pos => getLocation(source, pos));
const providedSource = source;
_locations = positions.map(pos => getLocation(providedSource, pos));
} else if (_nodes) {
_locations = _nodes.reduce((list, node) => {
if (node.loc) {
Expand Down
17 changes: 12 additions & 5 deletions src/type/introspection.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
import { GraphQLList, GraphQLNonNull } from '../type/wrappers';
import { GraphQLString, GraphQLBoolean } from './scalars';
import { DirectiveLocation } from '../language/directiveLocation';
import type { GraphQLField, GraphQLType } from './definition';
import type { GraphQLField } from './definition';

export const __Schema = new GraphQLObjectType({
name: '__Schema',
Expand Down Expand Up @@ -465,11 +465,18 @@ export const introspectionTypes: $ReadOnlyArray<*> = [
__TypeKind,
];

export function isIntrospectionType(type: ?GraphQLType): boolean %checks {
export function isIntrospectionType(type: mixed): boolean %checks {
return (
isNamedType(type) &&
introspectionTypes.some(
introspectionType => introspectionType.name === type.name,
)
// Would prefer to use introspectionTypes.some(), however %checks needs
// a simple expression.
(type.name === __Schema.name ||
type.name === __Directive.name ||
type.name === __DirectiveLocation.name ||
type.name === __Type.name ||
type.name === __Field.name ||
type.name === __InputValue.name ||
type.name === __EnumValue.name ||
type.name === __TypeKind.name)
);
}
13 changes: 8 additions & 5 deletions src/type/scalars.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

import { GraphQLScalarType, isNamedType } from './definition';
import * as Kind from '../language/kinds';
import type { GraphQLType } from './definition';

// As per the GraphQL Spec, Integers are only treated as valid when a valid
// 32-bit signed integer, providing the broadest support across platforms.
Expand Down Expand Up @@ -145,11 +144,15 @@ export const specifiedScalarTypes: $ReadOnlyArray<*> = [
GraphQLID,
];

export function isSpecifiedScalarType(type: ?GraphQLType): boolean %checks {
export function isSpecifiedScalarType(type: mixed): boolean %checks {
return (
isNamedType(type) &&
specifiedScalarTypes.some(
specifiedScalarType => specifiedScalarType.name === type.name,
)
// Would prefer to use specifiedScalarTypes.some(), however %checks needs
// a simple expression.
(type.name === GraphQLString.name ||
type.name === GraphQLInt.name ||
type.name === GraphQLFloat.name ||
type.name === GraphQLBoolean.name ||
type.name === GraphQLID.name)
);
}