Skip to content

Commit 9b7807a

Browse files
IvanGoncharovleebyron
authored andcommitted
Convert 'GraphQL*Config' to exact types (#1391)
1 parent 8a097e5 commit 9b7807a

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
@@ -592,7 +592,7 @@ export class GraphQLScalarType {
592592
defineToStringTag(GraphQLScalarType);
593593
defineToJSON(GraphQLScalarType);
594594

595-
export type GraphQLScalarTypeConfig<TInternal, TExternal> = {
595+
export type GraphQLScalarTypeConfig<TInternal, TExternal> = {|
596596
name: string,
597597
description?: ?string,
598598
astNode?: ?ScalarTypeDefinitionNode,
@@ -603,7 +603,7 @@ export type GraphQLScalarTypeConfig<TInternal, TExternal> = {
603603
valueNode: ValueNode,
604604
variables: ?ObjMap<mixed>,
605605
) => ?TInternal,
606-
};
606+
|};
607607

608608
/**
609609
* Object Type Definition
@@ -772,15 +772,15 @@ function isValidResolver(resolver: mixed): boolean {
772772
return resolver == null || typeof resolver === 'function';
773773
}
774774

775-
export type GraphQLObjectTypeConfig<TSource, TContext> = {
775+
export type GraphQLObjectTypeConfig<TSource, TContext> = {|
776776
name: string,
777777
interfaces?: Thunk<?Array<GraphQLInterfaceType>>,
778778
fields: Thunk<GraphQLFieldConfigMap<TSource, TContext>>,
779779
isTypeOf?: ?GraphQLIsTypeOfFn<TSource, TContext>,
780780
description?: ?string,
781781
astNode?: ?ObjectTypeDefinitionNode,
782782
extensionASTNodes?: ?$ReadOnlyArray<ObjectTypeExtensionNode>,
783-
};
783+
|};
784784

785785
export type GraphQLTypeResolver<TSource, TContext> = (
786786
value: TSource,
@@ -827,24 +827,24 @@ export type GraphQLFieldConfig<
827827
TSource,
828828
TContext,
829829
TArgs = { [argument: string]: any },
830-
> = {
830+
> = {|
831831
type: GraphQLOutputType,
832832
args?: GraphQLFieldConfigArgumentMap,
833833
resolve?: GraphQLFieldResolver<TSource, TContext, TArgs>,
834834
subscribe?: GraphQLFieldResolver<TSource, TContext, TArgs>,
835835
deprecationReason?: ?string,
836836
description?: ?string,
837837
astNode?: ?FieldDefinitionNode,
838-
};
838+
|};
839839

840840
export type GraphQLFieldConfigArgumentMap = ObjMap<GraphQLArgumentConfig>;
841841

842-
export type GraphQLArgumentConfig = {
842+
export type GraphQLArgumentConfig = {|
843843
type: GraphQLInputType,
844844
defaultValue?: mixed,
845845
description?: ?string,
846846
astNode?: ?InputValueDefinitionNode,
847-
};
847+
|};
848848

849849
export type GraphQLFieldConfigMap<TSource, TContext> = ObjMap<
850850
GraphQLFieldConfig<TSource, TContext>,
@@ -938,7 +938,7 @@ export class GraphQLInterfaceType {
938938
defineToStringTag(GraphQLInterfaceType);
939939
defineToJSON(GraphQLInterfaceType);
940940

941-
export type GraphQLInterfaceTypeConfig<TSource, TContext> = {
941+
export type GraphQLInterfaceTypeConfig<TSource, TContext> = {|
942942
name: string,
943943
fields: Thunk<GraphQLFieldConfigMap<TSource, TContext>>,
944944
/**
@@ -950,7 +950,7 @@ export type GraphQLInterfaceTypeConfig<TSource, TContext> = {
950950
description?: ?string,
951951
astNode?: ?InterfaceTypeDefinitionNode,
952952
extensionASTNodes?: ?$ReadOnlyArray<InterfaceTypeExtensionNode>,
953-
};
953+
|};
954954

955955
/**
956956
* Union Type Definition
@@ -1029,7 +1029,7 @@ function defineTypes(
10291029
return types;
10301030
}
10311031

1032-
export type GraphQLUnionTypeConfig<TSource, TContext> = {
1032+
export type GraphQLUnionTypeConfig<TSource, TContext> = {|
10331033
name: string,
10341034
types: Thunk<Array<GraphQLObjectType>>,
10351035
/**
@@ -1041,7 +1041,7 @@ export type GraphQLUnionTypeConfig<TSource, TContext> = {
10411041
description?: ?string,
10421042
astNode?: ?UnionTypeDefinitionNode,
10431043
extensionASTNodes?: ?$ReadOnlyArray<UnionTypeExtensionNode>,
1044-
};
1044+
|};
10451045

10461046
/**
10471047
* Enum Type Definition
@@ -1162,24 +1162,24 @@ function defineEnumValues(
11621162
});
11631163
}
11641164

1165-
export type GraphQLEnumTypeConfig /* <T> */ = {
1165+
export type GraphQLEnumTypeConfig /* <T> */ = {|
11661166
name: string,
11671167
values: GraphQLEnumValueConfigMap /* <T> */,
11681168
description?: ?string,
11691169
astNode?: ?EnumTypeDefinitionNode,
11701170
extensionASTNodes?: ?$ReadOnlyArray<EnumTypeExtensionNode>,
1171-
};
1171+
|};
11721172

11731173
export type GraphQLEnumValueConfigMap /* <T> */ = ObjMap<
11741174
GraphQLEnumValueConfig /* <T> */,
11751175
>;
11761176

1177-
export type GraphQLEnumValueConfig /* <T> */ = {
1177+
export type GraphQLEnumValueConfig /* <T> */ = {|
11781178
value?: any /* T */,
11791179
deprecationReason?: ?string,
11801180
description?: ?string,
11811181
astNode?: ?EnumValueDefinitionNode,
1182-
};
1182+
|};
11831183

11841184
export type GraphQLEnumValue /* <T> */ = {
11851185
name: string,
@@ -1264,20 +1264,20 @@ export class GraphQLInputObjectType {
12641264
defineToStringTag(GraphQLInputObjectType);
12651265
defineToJSON(GraphQLInputObjectType);
12661266

1267-
export type GraphQLInputObjectTypeConfig = {
1267+
export type GraphQLInputObjectTypeConfig = {|
12681268
name: string,
12691269
fields: Thunk<GraphQLInputFieldConfigMap>,
12701270
description?: ?string,
12711271
astNode?: ?InputObjectTypeDefinitionNode,
12721272
extensionASTNodes?: ?$ReadOnlyArray<InputObjectTypeExtensionNode>,
1273-
};
1273+
|};
12741274

1275-
export type GraphQLInputFieldConfig = {
1275+
export type GraphQLInputFieldConfig = {|
12761276
type: GraphQLInputType,
12771277
defaultValue?: mixed,
12781278
description?: ?string,
12791279
astNode?: ?InputValueDefinitionNode,
1280-
};
1280+
|};
12811281

12821282
export type GraphQLInputFieldConfigMap = ObjMap<GraphQLInputFieldConfig>;
12831283

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)