Skip to content

Commit 8f8a368

Browse files
committed
Convert 'GraphQL*Config' to exact types
1 parent f9e6d81 commit 8f8a368

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
@@ -589,7 +589,7 @@ export class GraphQLScalarType {
589589
defineToStringTag(GraphQLScalarType);
590590
defineToJSON(GraphQLScalarType);
591591

592-
export type GraphQLScalarTypeConfig<TInternal, TExternal> = {
592+
export type GraphQLScalarTypeConfig<TInternal, TExternal> = {|
593593
name: string,
594594
description?: ?string,
595595
astNode?: ?ScalarTypeDefinitionNode,
@@ -599,7 +599,7 @@ export type GraphQLScalarTypeConfig<TInternal, TExternal> = {
599599
valueNode: ValueNode,
600600
variables: ?ObjMap<mixed>,
601601
) => ?TInternal,
602-
};
602+
|};
603603

604604
/**
605605
* Object Type Definition
@@ -768,15 +768,15 @@ function isValidResolver(resolver: mixed): boolean {
768768
return resolver == null || typeof resolver === 'function';
769769
}
770770

771-
export type GraphQLObjectTypeConfig<TSource, TContext> = {
771+
export type GraphQLObjectTypeConfig<TSource, TContext> = {|
772772
name: string,
773773
interfaces?: Thunk<?Array<GraphQLInterfaceType>>,
774774
fields: Thunk<GraphQLFieldConfigMap<TSource, TContext>>,
775775
isTypeOf?: ?GraphQLIsTypeOfFn<TSource, TContext>,
776776
description?: ?string,
777777
astNode?: ?ObjectTypeDefinitionNode,
778778
extensionASTNodes?: ?$ReadOnlyArray<ObjectTypeExtensionNode>,
779-
};
779+
|};
780780

781781
export type GraphQLTypeResolver<TSource, TContext> = (
782782
value: TSource,
@@ -823,24 +823,24 @@ export type GraphQLFieldConfig<
823823
TSource,
824824
TContext,
825825
TArgs = { [argument: string]: any },
826-
> = {
826+
> = {|
827827
type: GraphQLOutputType,
828828
args?: GraphQLFieldConfigArgumentMap,
829829
resolve?: GraphQLFieldResolver<TSource, TContext, TArgs>,
830830
subscribe?: GraphQLFieldResolver<TSource, TContext, TArgs>,
831831
deprecationReason?: ?string,
832832
description?: ?string,
833833
astNode?: ?FieldDefinitionNode,
834-
};
834+
|};
835835

836836
export type GraphQLFieldConfigArgumentMap = ObjMap<GraphQLArgumentConfig>;
837837

838-
export type GraphQLArgumentConfig = {
838+
export type GraphQLArgumentConfig = {|
839839
type: GraphQLInputType,
840840
defaultValue?: mixed,
841841
description?: ?string,
842842
astNode?: ?InputValueDefinitionNode,
843-
};
843+
|};
844844

845845
export type GraphQLFieldConfigMap<TSource, TContext> = ObjMap<
846846
GraphQLFieldConfig<TSource, TContext>,
@@ -934,7 +934,7 @@ export class GraphQLInterfaceType {
934934
defineToStringTag(GraphQLInterfaceType);
935935
defineToJSON(GraphQLInterfaceType);
936936

937-
export type GraphQLInterfaceTypeConfig<TSource, TContext> = {
937+
export type GraphQLInterfaceTypeConfig<TSource, TContext> = {|
938938
name: string,
939939
fields: Thunk<GraphQLFieldConfigMap<TSource, TContext>>,
940940
/**
@@ -946,7 +946,7 @@ export type GraphQLInterfaceTypeConfig<TSource, TContext> = {
946946
description?: ?string,
947947
astNode?: ?InterfaceTypeDefinitionNode,
948948
extensionASTNodes?: ?$ReadOnlyArray<InterfaceTypeExtensionNode>,
949-
};
949+
|};
950950

951951
/**
952952
* Union Type Definition
@@ -1025,7 +1025,7 @@ function defineTypes(
10251025
return types;
10261026
}
10271027

1028-
export type GraphQLUnionTypeConfig<TSource, TContext> = {
1028+
export type GraphQLUnionTypeConfig<TSource, TContext> = {|
10291029
name: string,
10301030
types: Thunk<Array<GraphQLObjectType>>,
10311031
/**
@@ -1037,7 +1037,7 @@ export type GraphQLUnionTypeConfig<TSource, TContext> = {
10371037
description?: ?string,
10381038
astNode?: ?UnionTypeDefinitionNode,
10391039
extensionASTNodes?: ?$ReadOnlyArray<UnionTypeExtensionNode>,
1040-
};
1040+
|};
10411041

10421042
/**
10431043
* Enum Type Definition
@@ -1158,24 +1158,24 @@ function defineEnumValues(
11581158
});
11591159
}
11601160

1161-
export type GraphQLEnumTypeConfig /* <T> */ = {
1161+
export type GraphQLEnumTypeConfig /* <T> */ = {|
11621162
name: string,
11631163
values: GraphQLEnumValueConfigMap /* <T> */,
11641164
description?: ?string,
11651165
astNode?: ?EnumTypeDefinitionNode,
11661166
extensionASTNodes?: ?$ReadOnlyArray<EnumTypeExtensionNode>,
1167-
};
1167+
|};
11681168

11691169
export type GraphQLEnumValueConfigMap /* <T> */ = ObjMap<
11701170
GraphQLEnumValueConfig /* <T> */,
11711171
>;
11721172

1173-
export type GraphQLEnumValueConfig /* <T> */ = {
1173+
export type GraphQLEnumValueConfig /* <T> */ = {|
11741174
value?: any /* T */,
11751175
deprecationReason?: ?string,
11761176
description?: ?string,
11771177
astNode?: ?EnumValueDefinitionNode,
1178-
};
1178+
|};
11791179

11801180
export type GraphQLEnumValue /* <T> */ = {
11811181
name: string,
@@ -1260,20 +1260,20 @@ export class GraphQLInputObjectType {
12601260
defineToStringTag(GraphQLInputObjectType);
12611261
defineToJSON(GraphQLInputObjectType);
12621262

1263-
export type GraphQLInputObjectTypeConfig = {
1263+
export type GraphQLInputObjectTypeConfig = {|
12641264
name: string,
12651265
fields: Thunk<GraphQLInputFieldConfigMap>,
12661266
description?: ?string,
12671267
astNode?: ?InputObjectTypeDefinitionNode,
12681268
extensionASTNodes?: ?$ReadOnlyArray<InputObjectTypeExtensionNode>,
1269-
};
1269+
|};
12701270

1271-
export type GraphQLInputFieldConfig = {
1271+
export type GraphQLInputFieldConfig = {|
12721272
type: GraphQLInputType,
12731273
defaultValue?: mixed,
12741274
description?: ?string,
12751275
astNode?: ?InputValueDefinitionNode,
1276-
};
1276+
|};
12771277

12781278
export type GraphQLInputFieldConfigMap = ObjMap<GraphQLInputFieldConfig>;
12791279

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)