@@ -27,7 +27,7 @@ import type { GraphQLSchema } from './schema';
27
27
* These are all of the possible kinds of types.
28
28
*/
29
29
export type GraphQLType =
30
- GraphQLScalarType |
30
+ GraphQLScalarType < * , * > |
31
31
GraphQLObjectType |
32
32
GraphQLInterfaceType |
33
33
GraphQLUnionType |
@@ -61,12 +61,12 @@ export function assertType(type: mixed): GraphQLType {
61
61
* These types may be used as input types for arguments and directives.
62
62
*/
63
63
export type GraphQLInputType =
64
- GraphQLScalarType |
64
+ GraphQLScalarType < * , * > |
65
65
GraphQLEnumType |
66
66
GraphQLInputObjectType |
67
67
GraphQLList < GraphQLInputType > |
68
68
GraphQLNonNull <
69
- GraphQLScalarType |
69
+ GraphQLScalarType < * , * > |
70
70
GraphQLEnumType |
71
71
GraphQLInputObjectType |
72
72
GraphQLList < GraphQLInputType >
@@ -93,14 +93,14 @@ export function assertInputType(type: ?GraphQLType): GraphQLInputType {
93
93
* These types may be used as output types as the result of fields.
94
94
*/
95
95
export type GraphQLOutputType =
96
- GraphQLScalarType |
96
+ GraphQLScalarType < * , * > |
97
97
GraphQLObjectType |
98
98
GraphQLInterfaceType |
99
99
GraphQLUnionType |
100
100
GraphQLEnumType |
101
101
GraphQLList < GraphQLOutputType > |
102
102
GraphQLNonNull <
103
- GraphQLScalarType |
103
+ GraphQLScalarType < * , * > |
104
104
GraphQLObjectType |
105
105
GraphQLInterfaceType |
106
106
GraphQLUnionType |
@@ -131,7 +131,7 @@ export function assertOutputType(type: ?GraphQLType): GraphQLOutputType {
131
131
* These types may describe types which may be leaf values.
132
132
*/
133
133
export type GraphQLLeafType =
134
- GraphQLScalarType |
134
+ GraphQLScalarType < * , * > |
135
135
GraphQLEnumType ;
136
136
137
137
export function isLeafType ( type : ?GraphQLType ) : boolean {
@@ -200,7 +200,7 @@ export function assertAbstractType(type: ?GraphQLType): GraphQLAbstractType {
200
200
* These types can all accept null as a value.
201
201
*/
202
202
export type GraphQLNullableType =
203
- GraphQLScalarType |
203
+ GraphQLScalarType < * , * > |
204
204
GraphQLObjectType |
205
205
GraphQLInterfaceType |
206
206
GraphQLUnionType |
@@ -218,7 +218,7 @@ export function getNullableType<T: GraphQLType>(
218
218
* These named types do not include modifiers like List or NonNull.
219
219
*/
220
220
export type GraphQLNamedType =
221
- GraphQLScalarType |
221
+ GraphQLScalarType < * , * > |
222
222
GraphQLObjectType |
223
223
GraphQLInterfaceType |
224
224
GraphQLUnionType |
@@ -265,13 +265,13 @@ function resolveThunk<T>(thunk: Thunk<T>): T {
265
265
* } ) ;
266
266
*
267
267
* /
268
- export class GraphQLScalarType {
268
+ export class GraphQLScalarType < TInternal , TExternal > {
269
269
name : string ;
270
270
description : ?string ;
271
271
272
- _scalarConfig : GraphQLScalarTypeConfig < * , * > ;
272
+ _scalarConfig : GraphQLScalarTypeConfig < TInternal , TExternal > ;
273
273
274
- constructor ( config : GraphQLScalarTypeConfig < * , * > ) {
274
+ constructor ( config : GraphQLScalarTypeConfig < TInternal , TExternal > ) {
275
275
invariant ( config . name , 'Type must be named.' ) ;
276
276
assertValidName ( config . name ) ;
277
277
this . name = config . name ;
@@ -294,19 +294,19 @@ export class GraphQLScalarType {
294
294
}
295
295
296
296
// Serializes an internal value to include in a response.
297
- serialize ( value : mixed ) : mixed {
297
+ serialize ( value : mixed ) : ? TExternal {
298
298
const serializer = this . _scalarConfig . serialize ;
299
299
return serializer ( value ) ;
300
300
}
301
301
302
302
// Parses an externally provided value to use as an input.
303
- parseValue(value: mixed): mixed {
303
+ parseValue ( value : mixed ) : ? TInternal {
304
304
const parser = this . _scalarConfig . parseValue ;
305
305
return parser ? parser ( value ) : null ;
306
306
}
307
307
308
308
// Parses an externally provided literal value to use as an input.
309
- parseLiteral(valueNode: ValueNode): mixed {
309
+ parseLiteral ( valueNode : ValueNode ) : ? TInternal {
310
310
const parser = this . _scalarConfig . parseLiteral ;
311
311
return parser ? parser ( valueNode ) : null ;
312
312
}
0 commit comments