Skip to content

Commit 2dbc5ca

Browse files
committed
Revert named extension types in Flow
1 parent aa6ddc6 commit 2dbc5ca

File tree

5 files changed

+34
-83
lines changed

5 files changed

+34
-83
lines changed

src/index.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -140,44 +140,32 @@ export type {
140140
GraphQLNamedType,
141141
Thunk,
142142
GraphQLSchemaConfig,
143-
GraphQLSchemaExtensions,
144143
GraphQLDirectiveConfig,
145-
GraphQLDirectiveExtensions,
146144
GraphQLArgument,
147145
GraphQLArgumentConfig,
148-
GraphQLArgumentExtensions,
149146
GraphQLEnumTypeConfig,
150-
GraphQLEnumTypeExtensions,
151147
GraphQLEnumValue,
152148
GraphQLEnumValueConfig,
153-
GraphQLEnumValueExtensions,
154149
GraphQLEnumValueConfigMap,
155150
GraphQLField,
156151
GraphQLFieldConfig,
157-
GraphQLFieldExtensions,
158152
GraphQLFieldConfigArgumentMap,
159153
GraphQLFieldConfigMap,
160154
GraphQLFieldMap,
161155
GraphQLFieldResolver,
162156
GraphQLInputField,
163157
GraphQLInputFieldConfig,
164-
GraphQLInputFieldExtensions,
165158
GraphQLInputFieldConfigMap,
166159
GraphQLInputFieldMap,
167160
GraphQLInputObjectTypeConfig,
168-
GraphQLInputObjectTypeExtensions,
169161
GraphQLInterfaceTypeConfig,
170-
GraphQLInterfaceTypeExtensions,
171162
GraphQLIsTypeOfFn,
172163
GraphQLObjectTypeConfig,
173-
GraphQLObjectTypeExtensions,
174164
GraphQLResolveInfo,
175165
ResponsePath,
176166
GraphQLScalarTypeConfig,
177-
GraphQLScalarTypeExtensions,
178167
GraphQLTypeResolver,
179168
GraphQLUnionTypeConfig,
180-
GraphQLUnionTypeExtensions,
181169
GraphQLScalarSerializer,
182170
GraphQLScalarValueParser,
183171
GraphQLScalarLiteralParser,

src/type/definition.js

Lines changed: 26 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -548,8 +548,6 @@ function undefineIfEmpty<T>(arr: ?$ReadOnlyArray<T>): ?$ReadOnlyArray<T> {
548548
return arr && arr.length > 0 ? arr : undefined;
549549
}
550550

551-
export type GraphQLScalarTypeExtensions = ReadOnlyObjMap<mixed>;
552-
553551
/**
554552
* Scalar Type Definition
555553
*
@@ -581,7 +579,7 @@ export class GraphQLScalarType {
581579
serialize: GraphQLScalarSerializer<mixed>;
582580
parseValue: GraphQLScalarValueParser<mixed>;
583581
parseLiteral: GraphQLScalarLiteralParser<mixed>;
584-
extensions: ?GraphQLScalarTypeExtensions;
582+
extensions: ?ReadOnlyObjMap<mixed>;
585583
astNode: ?ScalarTypeDefinitionNode;
586584
extensionASTNodes: ?$ReadOnlyArray<ScalarTypeExtensionNode>;
587585

@@ -626,7 +624,7 @@ export class GraphQLScalarType {
626624
serialize: GraphQLScalarSerializer<mixed>,
627625
parseValue: GraphQLScalarValueParser<mixed>,
628626
parseLiteral: GraphQLScalarLiteralParser<mixed>,
629-
extensions: ?GraphQLScalarTypeExtensions,
627+
extensions: ?ReadOnlyObjMap<mixed>,
630628
extensionASTNodes: $ReadOnlyArray<ScalarTypeExtensionNode>,
631629
|} {
632630
return {
@@ -682,13 +680,11 @@ export type GraphQLScalarTypeConfig<TInternal, TExternal> = {|
682680
parseValue?: GraphQLScalarValueParser<TInternal>,
683681
// Parses an externally provided literal value to use as an input.
684682
parseLiteral?: GraphQLScalarLiteralParser<TInternal>,
685-
extensions?: ?GraphQLScalarTypeExtensions,
683+
extensions?: ?ReadOnlyObjMapLike<mixed>,
686684
astNode?: ?ScalarTypeDefinitionNode,
687685
extensionASTNodes?: ?$ReadOnlyArray<ScalarTypeExtensionNode>,
688686
|};
689687
690-
export type GraphQLObjectTypeExtensions = ReadOnlyObjMap<mixed>;
691-
692688
/**
693689
* Object Type Definition
694690
*
@@ -730,7 +726,7 @@ export class GraphQLObjectType {
730726
name: string;
731727
description: ?string;
732728
isTypeOf: ?GraphQLIsTypeOfFn<any, any>;
733-
extensions: ?GraphQLObjectTypeExtensions;
729+
extensions: ?ReadOnlyObjMap<mixed>;
734730
astNode: ?ObjectTypeDefinitionNode;
735731
extensionASTNodes: ?$ReadOnlyArray<ObjectTypeExtensionNode>;
736732
@@ -773,7 +769,7 @@ export class GraphQLObjectType {
773769
...GraphQLObjectTypeConfig<any, any>,
774770
interfaces: Array<GraphQLInterfaceType>,
775771
fields: GraphQLFieldConfigMap<any, any>,
776-
extensions: ?GraphQLObjectTypeExtensions,
772+
extensions: ?ReadOnlyObjMap<mixed>,
777773
extensionASTNodes: $ReadOnlyArray<ObjectTypeExtensionNode>,
778774
|} {
779775
return {
@@ -918,7 +914,7 @@ export type GraphQLObjectTypeConfig<TSource, TContext> = {|
918914
interfaces?: Thunk<?Array<GraphQLInterfaceType>>,
919915
fields: Thunk<GraphQLFieldConfigMap<TSource, TContext>>,
920916
isTypeOf?: ?GraphQLIsTypeOfFn<TSource, TContext>,
921-
extensions?: ?GraphQLObjectTypeExtensions,
917+
extensions?: ?ReadOnlyObjMapLike<mixed>,
922918
astNode?: ?ObjectTypeDefinitionNode,
923919
extensionASTNodes?: ?$ReadOnlyArray<ObjectTypeExtensionNode>,
924920
|};
@@ -971,7 +967,7 @@ export type GraphQLFieldConfig<
971967
resolve?: GraphQLFieldResolver<TSource, TContext, TArgs>,
972968
subscribe?: GraphQLFieldResolver<TSource, TContext, TArgs>,
973969
deprecationReason?: ?string,
974-
extensions?: ?GraphQLFieldExtensions,
970+
extensions?: ?ReadOnlyObjMapLike<mixed>,
975971
astNode?: ?FieldDefinitionNode,
976972
|};
977973

@@ -981,16 +977,14 @@ export type GraphQLArgumentConfig = {|
981977
description?: ?string,
982978
type: GraphQLInputType,
983979
defaultValue?: mixed,
984-
extensions?: ?GraphQLArgumentExtensions,
980+
extensions?: ?ReadOnlyObjMapLike<mixed>,
985981
astNode?: ?InputValueDefinitionNode,
986982
|};
987983

988984
export type GraphQLFieldConfigMap<TSource, TContext> = ObjMap<
989985
GraphQLFieldConfig<TSource, TContext>,
990986
>;
991987

992-
export type GraphQLFieldExtensions = ReadOnlyObjMap<mixed>;
993-
994988
export type GraphQLField<
995989
TSource,
996990
TContext,
@@ -1004,18 +998,16 @@ export type GraphQLField<
1004998
subscribe?: GraphQLFieldResolver<TSource, TContext, TArgs>,
1005999
isDeprecated: boolean,
10061000
deprecationReason: ?string,
1007-
extensions: ?GraphQLFieldExtensions,
1001+
extensions: ?ReadOnlyObjMap<mixed>,
10081002
astNode: ?FieldDefinitionNode,
10091003
|};
10101004

1011-
export type GraphQLArgumentExtensions = ReadOnlyObjMap<mixed>;
1012-
10131005
export type GraphQLArgument = {|
10141006
name: string,
10151007
description: ?string,
10161008
type: GraphQLInputType,
10171009
defaultValue: mixed,
1018-
extensions: ?GraphQLArgumentExtensions,
1010+
extensions: ?ReadOnlyObjMap<mixed>,
10191011
astNode: ?InputValueDefinitionNode,
10201012
|};
10211013

@@ -1027,8 +1019,6 @@ export type GraphQLFieldMap<TSource, TContext> = ObjMap<
10271019
GraphQLField<TSource, TContext>,
10281020
>;
10291021

1030-
export type GraphQLInterfaceTypeExtensions = ReadOnlyObjMap<mixed>;
1031-
10321022
/**
10331023
* Interface Type Definition
10341024
*
@@ -1051,7 +1041,7 @@ export class GraphQLInterfaceType {
10511041
name: string;
10521042
description: ?string;
10531043
resolveType: ?GraphQLTypeResolver<any, any>;
1054-
extensions: ?GraphQLInterfaceTypeExtensions;
1044+
extensions: ?ReadOnlyObjMap<mixed>;
10551045
astNode: ?InterfaceTypeDefinitionNode;
10561046
extensionASTNodes: ?$ReadOnlyArray<InterfaceTypeExtensionNode>;
10571047

@@ -1094,7 +1084,7 @@ export class GraphQLInterfaceType {
10941084
...GraphQLInterfaceTypeConfig<any, any>,
10951085
interfaces: Array<GraphQLInterfaceType>,
10961086
fields: GraphQLFieldConfigMap<any, any>,
1097-
extensions: ?GraphQLInterfaceTypeExtensions,
1087+
extensions: ?ReadOnlyObjMap<mixed>,
10981088
extensionASTNodes: $ReadOnlyArray<InterfaceTypeExtensionNode>,
10991089
|} {
11001090
return {
@@ -1137,13 +1127,11 @@ export type GraphQLInterfaceTypeConfig<TSource, TContext> = {|
11371127
* Object type.
11381128
*/
11391129
resolveType?: ?GraphQLTypeResolver<TSource, TContext>,
1140-
extensions?: ?GraphQLInterfaceTypeExtensions,
1130+
extensions?: ?ReadOnlyObjMapLike<mixed>,
11411131
astNode?: ?InterfaceTypeDefinitionNode,
11421132
extensionASTNodes?: ?$ReadOnlyArray<InterfaceTypeExtensionNode>,
11431133
|};
11441134

1145-
export type GraphQLUnionTypeExtensions = ReadOnlyObjMap<mixed>;
1146-
11471135
/**
11481136
* Union Type Definition
11491137
*
@@ -1171,7 +1159,7 @@ export class GraphQLUnionType {
11711159
name: string;
11721160
description: ?string;
11731161
resolveType: ?GraphQLTypeResolver<any, any>;
1174-
extensions: ?GraphQLUnionTypeExtensions;
1162+
extensions: ?ReadOnlyObjMap<mixed>;
11751163
astNode: ?UnionTypeDefinitionNode;
11761164
extensionASTNodes: ?$ReadOnlyArray<UnionTypeExtensionNode>;
11771165

@@ -1204,7 +1192,7 @@ export class GraphQLUnionType {
12041192
toConfig(): {|
12051193
...GraphQLUnionTypeConfig<any, any>,
12061194
types: Array<GraphQLObjectType>,
1207-
extensions: ?GraphQLUnionTypeExtensions,
1195+
extensions: ?ReadOnlyObjMap<mixed>,
12081196
extensionASTNodes: $ReadOnlyArray<UnionTypeExtensionNode>,
12091197
|} {
12101198
return {
@@ -1256,13 +1244,11 @@ export type GraphQLUnionTypeConfig<TSource, TContext> = {|
12561244
* Object type.
12571245
*/
12581246
resolveType?: ?GraphQLTypeResolver<TSource, TContext>,
1259-
extensions?: ?GraphQLUnionTypeExtensions,
1247+
extensions?: ?ReadOnlyObjMapLike<mixed>,
12601248
astNode?: ?UnionTypeDefinitionNode,
12611249
extensionASTNodes?: ?$ReadOnlyArray<UnionTypeExtensionNode>,
12621250
|};
12631251

1264-
export type GraphQLEnumTypeExtensions = ReadOnlyObjMap<mixed>;
1265-
12661252
/**
12671253
* Enum Type Definition
12681254
*
@@ -1287,7 +1273,7 @@ export type GraphQLEnumTypeExtensions = ReadOnlyObjMap<mixed>;
12871273
export class GraphQLEnumType /* <T> */ {
12881274
name: string;
12891275
description: ?string;
1290-
extensions: ?GraphQLEnumTypeExtensions;
1276+
extensions: ?ReadOnlyObjMap<mixed>;
12911277
astNode: ?EnumTypeDefinitionNode;
12921278
extensionASTNodes: ?$ReadOnlyArray<EnumTypeExtensionNode>;
12931279

@@ -1373,7 +1359,7 @@ export class GraphQLEnumType /* <T> */ {
13731359

13741360
toConfig(): {|
13751361
...GraphQLEnumTypeConfig,
1376-
extensions: ?GraphQLEnumTypeExtensions,
1362+
extensions: ?ReadOnlyObjMap<mixed>,
13771363
extensionASTNodes: $ReadOnlyArray<EnumTypeExtensionNode>,
13781364
|} {
13791365
const values = keyValMap(
@@ -1459,7 +1445,7 @@ export type GraphQLEnumTypeConfig /* <T> */ = {|
14591445
name: string,
14601446
description?: ?string,
14611447
values: GraphQLEnumValueConfigMap /* <T> */,
1462-
extensions?: ?GraphQLEnumTypeExtensions,
1448+
extensions?: ?ReadOnlyObjMapLike<mixed>,
14631449
astNode?: ?EnumTypeDefinitionNode,
14641450
extensionASTNodes?: ?$ReadOnlyArray<EnumTypeExtensionNode>,
14651451
|};
@@ -1470,24 +1456,20 @@ export type GraphQLEnumValueConfig /* <T> */ = {|
14701456
description?: ?string,
14711457
value?: any /* T */,
14721458
deprecationReason?: ?string,
1473-
extensions?: ?GraphQLEnumValueExtensions,
1459+
extensions?: ?ReadOnlyObjMapLike<mixed>,
14741460
astNode?: ?EnumValueDefinitionNode,
14751461
|};
14761462

1477-
export type GraphQLEnumValueExtensions = ReadOnlyObjMap<mixed>;
1478-
14791463
export type GraphQLEnumValue /* <T> */ = {|
14801464
name: string,
14811465
description: ?string,
14821466
value: any /* T */,
14831467
isDeprecated: boolean,
14841468
deprecationReason: ?string,
1485-
extensions: ?GraphQLEnumValueExtensions,
1469+
extensions: ?ReadOnlyObjMap<mixed>,
14861470
astNode: ?EnumValueDefinitionNode,
14871471
|};
14881472

1489-
export type GraphQLInputObjectTypeExtensions = ReadOnlyObjMap<mixed>;
1490-
14911473
/**
14921474
* Input Object Type Definition
14931475
*
@@ -1511,7 +1493,7 @@ export type GraphQLInputObjectTypeExtensions = ReadOnlyObjMap<mixed>;
15111493
export class GraphQLInputObjectType {
15121494
name: string;
15131495
description: ?string;
1514-
extensions: ?GraphQLInputObjectTypeExtensions;
1496+
extensions: ?ReadOnlyObjMap<mixed>;
15151497
astNode: ?InputObjectTypeDefinitionNode;
15161498
extensionASTNodes: ?$ReadOnlyArray<InputObjectTypeExtensionNode>;
15171499

@@ -1538,7 +1520,7 @@ export class GraphQLInputObjectType {
15381520
toConfig(): {|
15391521
...GraphQLInputObjectTypeConfig,
15401522
fields: GraphQLInputFieldConfigMap,
1541-
extensions: ?GraphQLInputObjectTypeExtensions,
1523+
extensions: ?ReadOnlyObjMap<mixed>,
15421524
extensionASTNodes: $ReadOnlyArray<InputObjectTypeExtensionNode>,
15431525
|} {
15441526
const fields = mapValue(this.getFields(), (field) => ({
@@ -1605,7 +1587,7 @@ export type GraphQLInputObjectTypeConfig = {|
16051587
name: string,
16061588
description?: ?string,
16071589
fields: Thunk<GraphQLInputFieldConfigMap>,
1608-
extensions?: ?GraphQLInputObjectTypeExtensions,
1590+
extensions?: ?ReadOnlyObjMapLike<mixed>,
16091591
astNode?: ?InputObjectTypeDefinitionNode,
16101592
extensionASTNodes?: ?$ReadOnlyArray<InputObjectTypeExtensionNode>,
16111593
|};
@@ -1614,20 +1596,18 @@ export type GraphQLInputFieldConfig = {|
16141596
description?: ?string,
16151597
type: GraphQLInputType,
16161598
defaultValue?: mixed,
1617-
extensions?: ?GraphQLInputFieldExtensions,
1599+
extensions?: ?ReadOnlyObjMapLike<mixed>,
16181600
astNode?: ?InputValueDefinitionNode,
16191601
|};
16201602

16211603
export type GraphQLInputFieldConfigMap = ObjMap<GraphQLInputFieldConfig>;
16221604

1623-
export type GraphQLInputFieldExtensions = ReadOnlyObjMap<mixed>;
1624-
16251605
export type GraphQLInputField = {|
16261606
name: string,
16271607
description: ?string,
16281608
type: GraphQLInputType,
16291609
defaultValue: mixed,
1630-
extensions: ?GraphQLInputFieldExtensions,
1610+
extensions: ?ReadOnlyObjMap<mixed>,
16311611
astNode: ?InputValueDefinitionNode,
16321612
|};
16331613

src/type/directives.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ export function assertDirective(directive: mixed): GraphQLDirective {
4242
return directive;
4343
}
4444

45-
export type GraphQLDirectiveExtensions = ReadOnlyObjMap<mixed>;
46-
4745
/**
4846
* Directives are used by the GraphQL runtime as a way of modifying execution
4947
* behavior. Type system creators will usually not create these directly.
@@ -54,7 +52,7 @@ export class GraphQLDirective {
5452
locations: Array<DirectiveLocationEnum>;
5553
args: Array<GraphQLArgument>;
5654
isRepeatable: boolean;
57-
extensions: ?GraphQLDirectiveExtensions;
55+
extensions: ?ReadOnlyObjMap<mixed>;
5856
astNode: ?DirectiveDefinitionNode;
5957

6058
constructor(config: $ReadOnly<GraphQLDirectiveConfig>): void {
@@ -91,7 +89,7 @@ export class GraphQLDirective {
9189
...GraphQLDirectiveConfig,
9290
args: GraphQLFieldConfigArgumentMap,
9391
isRepeatable: boolean,
94-
extensions: ?GraphQLDirectiveExtensions,
92+
extensions: ?ReadOnlyObjMap<mixed>,
9593
|} {
9694
return {
9795
name: this.name,
@@ -127,7 +125,7 @@ export type GraphQLDirectiveConfig = {|
127125
locations: Array<DirectiveLocationEnum>,
128126
args?: ?GraphQLFieldConfigArgumentMap,
129127
isRepeatable?: ?boolean,
130-
extensions?: ?GraphQLDirectiveExtensions,
128+
extensions?: ?ReadOnlyObjMapLike<mixed>,
131129
astNode?: ?DirectiveDefinitionNode,
132130
|};
133131

0 commit comments

Comments
 (0)