Skip to content

Commit 9c6e5e5

Browse files
committed
Convert 'GraphQL*Config' to exact types
1 parent 3521e14 commit 9c6e5e5

File tree

3 files changed

+20
-29
lines changed

3 files changed

+20
-29
lines changed

src/type/definition.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ export class GraphQLScalarType {
586586
defineToStringTag(GraphQLScalarType);
587587
defineToJSON(GraphQLScalarType);
588588

589-
export type GraphQLScalarTypeConfig<TInternal, TExternal> = {
589+
export type GraphQLScalarTypeConfig<TInternal, TExternal> = {|
590590
name: string,
591591
description?: ?string,
592592
astNode?: ?ScalarTypeDefinitionNode,
@@ -596,7 +596,7 @@ export type GraphQLScalarTypeConfig<TInternal, TExternal> = {
596596
valueNode: ValueNode,
597597
variables: ?ObjMap<mixed>,
598598
) => ?TInternal,
599-
};
599+
|};
600600

601601
/**
602602
* Object Type Definition
@@ -765,15 +765,15 @@ function isValidResolver(resolver: mixed): boolean {
765765
return resolver == null || typeof resolver === 'function';
766766
}
767767

768-
export type GraphQLObjectTypeConfig<TSource, TContext> = {
768+
export type GraphQLObjectTypeConfig<TSource, TContext> = {|
769769
name: string,
770770
interfaces?: Thunk<?Array<GraphQLInterfaceType>>,
771771
fields: Thunk<GraphQLFieldConfigMap<TSource, TContext>>,
772772
isTypeOf?: ?GraphQLIsTypeOfFn<TSource, TContext>,
773773
description?: ?string,
774774
astNode?: ?ObjectTypeDefinitionNode,
775775
extensionASTNodes?: ?$ReadOnlyArray<ObjectTypeExtensionNode>,
776-
};
776+
|};
777777

778778
export type GraphQLTypeResolver<TSource, TContext> = (
779779
value: TSource,
@@ -820,24 +820,24 @@ export type GraphQLFieldConfig<
820820
TSource,
821821
TContext,
822822
TArgs = { [argument: string]: any },
823-
> = {
823+
> = {|
824824
type: GraphQLOutputType,
825825
args?: GraphQLFieldConfigArgumentMap,
826826
resolve?: GraphQLFieldResolver<TSource, TContext, TArgs>,
827827
subscribe?: GraphQLFieldResolver<TSource, TContext, TArgs>,
828828
deprecationReason?: ?string,
829829
description?: ?string,
830830
astNode?: ?FieldDefinitionNode,
831-
};
831+
|};
832832

833833
export type GraphQLFieldConfigArgumentMap = ObjMap<GraphQLArgumentConfig>;
834834

835-
export type GraphQLArgumentConfig = {
835+
export type GraphQLArgumentConfig = {|
836836
type: GraphQLInputType,
837837
defaultValue?: mixed,
838838
description?: ?string,
839839
astNode?: ?InputValueDefinitionNode,
840-
};
840+
|};
841841

842842
export type GraphQLFieldConfigMap<TSource, TContext> = ObjMap<
843843
GraphQLFieldConfig<TSource, TContext>,
@@ -931,7 +931,7 @@ export class GraphQLInterfaceType {
931931
defineToStringTag(GraphQLInterfaceType);
932932
defineToJSON(GraphQLInterfaceType);
933933

934-
export type GraphQLInterfaceTypeConfig<TSource, TContext> = {
934+
export type GraphQLInterfaceTypeConfig<TSource, TContext> = {|
935935
name: string,
936936
fields: Thunk<GraphQLFieldConfigMap<TSource, TContext>>,
937937
/**
@@ -943,7 +943,7 @@ export type GraphQLInterfaceTypeConfig<TSource, TContext> = {
943943
description?: ?string,
944944
astNode?: ?InterfaceTypeDefinitionNode,
945945
extensionASTNodes?: ?$ReadOnlyArray<InterfaceTypeExtensionNode>,
946-
};
946+
|};
947947

948948
/**
949949
* Union Type Definition
@@ -1021,7 +1021,7 @@ function defineTypes(
10211021
return types;
10221022
}
10231023

1024-
export type GraphQLUnionTypeConfig<TSource, TContext> = {
1024+
export type GraphQLUnionTypeConfig<TSource, TContext> = {|
10251025
name: string,
10261026
types: Thunk<Array<GraphQLObjectType>>,
10271027
/**
@@ -1032,7 +1032,7 @@ export type GraphQLUnionTypeConfig<TSource, TContext> = {
10321032
resolveType?: ?GraphQLTypeResolver<TSource, TContext>,
10331033
description?: ?string,
10341034
astNode?: ?UnionTypeDefinitionNode,
1035-
};
1035+
|};
10361036

10371037
/**
10381038
* Enum Type Definition
@@ -1152,23 +1152,23 @@ function defineEnumValues(
11521152
});
11531153
}
11541154

1155-
export type GraphQLEnumTypeConfig /* <T> */ = {
1155+
export type GraphQLEnumTypeConfig /* <T> */ = {|
11561156
name: string,
11571157
values: GraphQLEnumValueConfigMap /* <T> */,
11581158
description?: ?string,
11591159
astNode?: ?EnumTypeDefinitionNode,
1160-
};
1160+
|};
11611161

11621162
export type GraphQLEnumValueConfigMap /* <T> */ = ObjMap<
11631163
GraphQLEnumValueConfig /* <T> */,
11641164
>;
11651165

1166-
export type GraphQLEnumValueConfig /* <T> */ = {
1166+
export type GraphQLEnumValueConfig /* <T> */ = {|
11671167
value?: any /* T */,
11681168
deprecationReason?: ?string,
11691169
description?: ?string,
11701170
astNode?: ?EnumValueDefinitionNode,
1171-
};
1171+
|};
11721172

11731173
export type GraphQLEnumValue /* <T> */ = {
11741174
name: string,
@@ -1252,19 +1252,19 @@ export class GraphQLInputObjectType {
12521252
defineToStringTag(GraphQLInputObjectType);
12531253
defineToJSON(GraphQLInputObjectType);
12541254

1255-
export type GraphQLInputObjectTypeConfig = {
1255+
export type GraphQLInputObjectTypeConfig = {|
12561256
name: string,
12571257
fields: Thunk<GraphQLInputFieldConfigMap>,
12581258
description?: ?string,
12591259
astNode?: ?InputObjectTypeDefinitionNode,
1260-
};
1260+
|};
12611261

1262-
export type GraphQLInputFieldConfig = {
1262+
export type GraphQLInputFieldConfig = {|
12631263
type: GraphQLInputType,
12641264
defaultValue?: mixed,
12651265
description?: ?string,
12661266
astNode?: ?InputValueDefinitionNode,
1267-
};
1267+
|};
12681268

12691269
export type GraphQLInputFieldConfigMap = ObjMap<GraphQLInputFieldConfig>;
12701270

src/type/introspection.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import type { GraphQLField } from './definition';
3333

3434
export const __Schema = new GraphQLObjectType({
3535
name: '__Schema',
36-
isIntrospection: true,
3736
description:
3837
'A GraphQL Schema defines the capabilities of a GraphQL server. It ' +
3938
'exposes all available types and directives on the server, as well as ' +
@@ -75,7 +74,6 @@ export const __Schema = new GraphQLObjectType({
7574

7675
export const __Directive = new GraphQLObjectType({
7776
name: '__Directive',
78-
isIntrospection: true,
7977
description:
8078
'A Directive provides a way to describe alternate runtime execution and ' +
8179
'type validation behavior in a GraphQL document.' +
@@ -105,7 +103,6 @@ export const __Directive = new GraphQLObjectType({
105103

106104
export const __DirectiveLocation = new GraphQLEnumType({
107105
name: '__DirectiveLocation',
108-
isIntrospection: true,
109106
description:
110107
'A Directive can be adjacent to many parts of the GraphQL language, a ' +
111108
'__DirectiveLocation describes one such possible adjacencies.',
@@ -187,7 +184,6 @@ export const __DirectiveLocation = new GraphQLEnumType({
187184

188185
export const __Type = new GraphQLObjectType({
189186
name: '__Type',
190-
isIntrospection: true,
191187
description:
192188
'The fundamental unit of any GraphQL Schema is the type. There are ' +
193189
'many kinds of types in GraphQL as represented by the `__TypeKind` enum.' +
@@ -293,7 +289,6 @@ export const __Type = new GraphQLObjectType({
293289

294290
export const __Field = new GraphQLObjectType({
295291
name: '__Field',
296-
isIntrospection: true,
297292
description:
298293
'Object and Interface types are described by a list of Fields, each of ' +
299294
'which has a name, potentially a list of arguments, and a return type.',
@@ -327,7 +322,6 @@ export const __Field = new GraphQLObjectType({
327322

328323
export const __InputValue = new GraphQLObjectType({
329324
name: '__InputValue',
330-
isIntrospection: true,
331325
description:
332326
'Arguments provided to Fields or Directives and the input fields of an ' +
333327
'InputObject are represented as Input Values which describe their type ' +
@@ -360,7 +354,6 @@ export const __InputValue = new GraphQLObjectType({
360354

361355
export const __EnumValue = new GraphQLObjectType({
362356
name: '__EnumValue',
363-
isIntrospection: true,
364357
description:
365358
'One possible value for a given Enum. Enum values are unique values, not ' +
366359
'a placeholder for a string or numeric value. However an Enum value is ' +
@@ -398,7 +391,6 @@ export const TypeKind = {
398391

399392
export const __TypeKind = new GraphQLEnumType({
400393
name: '__TypeKind',
401-
isIntrospection: true,
402394
description: 'An enum describing what kind of type a given `__Type` is.',
403395
values: {
404396
SCALAR: {

src/utilities/buildClientSchema.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,6 @@ export function buildClientSchema(
333333
? valueFromAST(parseValue(inputValueIntrospection.defaultValue), type)
334334
: undefined;
335335
return {
336-
name: inputValueIntrospection.name,
337336
description: inputValueIntrospection.description,
338337
type,
339338
defaultValue,

0 commit comments

Comments
 (0)