@@ -555,13 +555,13 @@ export class GraphQLScalarType {
555
555
extensionASTNodes : ?$ReadOnlyArray < ScalarTypeExtensionNode > ;
556
556
557
557
constructor ( config : GraphQLScalarTypeConfig < * , * > ) : void {
558
+ const parseValue = config . parseValue || identityFunc ;
558
559
this . name = config . name ;
559
560
this . description = config . description ;
560
561
this . serialize = config . serialize || identityFunc ;
561
- this . parseValue = config . parseValue || identityFunc ;
562
+ this . parseValue = parseValue ;
562
563
this . parseLiteral =
563
- config . parseLiteral ||
564
- ( node => this . parseValue ( valueFromASTUntyped ( node ) ) ) ;
564
+ config . parseLiteral || ( node => parseValue ( valueFromASTUntyped ( node ) ) )
565
565
566
566
this . astNode = config . astNode ;
567
567
this . extensionASTNodes = undefineIfEmpty ( config . extensionASTNodes ) ;
@@ -1155,7 +1155,7 @@ export class GraphQLEnumType /* <T> */ {
1155
1155
this . description = config . description ;
1156
1156
this . astNode = config . astNode ;
1157
1157
this . extensionASTNodes = undefineIfEmpty ( config . extensionASTNodes ) ;
1158
- this . _values = defineEnumValues ( this , config . values ) ;
1158
+ this . _values = defineEnumValues ( this . name , config . values ) ;
1159
1159
this . _valueLookup = new Map (
1160
1160
this . _values . map ( enumValue => [ enumValue . value , enumValue ] ) ,
1161
1161
) ;
@@ -1232,22 +1232,22 @@ defineToStringTag(GraphQLEnumType);
1232
1232
defineToJSON ( GraphQLEnumType ) ;
1233
1233
1234
1234
function defineEnumValues (
1235
- type : GraphQLEnumType ,
1235
+ typeName : string ,
1236
1236
valueMap : GraphQLEnumValueConfigMap /* <T> */ ,
1237
1237
) : Array < GraphQLEnumValue /* <T> */ > {
1238
1238
invariant (
1239
1239
isPlainObj ( valueMap ) ,
1240
- `${ type . name } values must be an object with value names as keys.` ,
1240
+ `${ typeName } values must be an object with value names as keys.` ,
1241
1241
) ;
1242
1242
return objectEntries ( valueMap ) . map ( ( [ valueName , value ] ) => {
1243
1243
invariant (
1244
1244
isPlainObj ( value ) ,
1245
- `${ type . name } .${ valueName } must refer to an object with a "value" key ` +
1245
+ `${ typeName } .${ valueName } must refer to an object with a "value" key ` +
1246
1246
`representing an internal value but got: ${ inspect ( value ) } .` ,
1247
1247
) ;
1248
1248
invariant (
1249
1249
! ( 'isDeprecated' in value ) ,
1250
- `${ type . name } .${ valueName } should provide "deprecationReason" instead of "isDeprecated".` ,
1250
+ `${ typeName } .${ valueName } should provide "deprecationReason" instead of "isDeprecated".` ,
1251
1251
) ;
1252
1252
return {
1253
1253
name : valueName ,
0 commit comments