@@ -314,8 +314,16 @@ export class GraphQLScalarType {
314
314
toString(): string {
315
315
return this . name ;
316
316
}
317
+
318
+ toJSON: () => string ;
319
+ inspect : ( ) => string ;
317
320
}
318
321
322
+ // Also provide toJSON and inspect aliases for toString.
323
+ GraphQLScalarType . prototype . toJSON =
324
+ GraphQLScalarType . prototype . inspect =
325
+ GraphQLScalarType . prototype . toString ;
326
+
319
327
export type GraphQLScalarTypeConfig < TInternal , TExternal > = {
320
328
name : string ;
321
329
description ?: ?string ;
@@ -402,8 +410,16 @@ export class GraphQLObjectType {
402
410
toString ( ) : string {
403
411
return this . name ;
404
412
}
413
+
414
+ toJSON : ( ) = > string ;
415
+ inspect : ( ) = > string ;
405
416
}
406
417
418
+ // Also provide toJSON and inspect aliases for toString.
419
+ GraphQLObjectType . prototype . toJSON =
420
+ GraphQLObjectType . prototype . inspect =
421
+ GraphQLObjectType . prototype . toString ;
422
+
407
423
function defineInterfaces (
408
424
type : GraphQLObjectType ,
409
425
interfacesThunk : Thunk < ?Array < GraphQLInterfaceType >>
@@ -643,8 +659,16 @@ export class GraphQLInterfaceType {
643
659
toString ( ) : string {
644
660
return this . name ;
645
661
}
662
+
663
+ toJSON : ( ) => string ;
664
+ inspect : ( ) => string ;
646
665
}
647
666
667
+ // Also provide toJSON and inspect aliases for toString.
668
+ GraphQLInterfaceType . prototype . toJSON =
669
+ GraphQLInterfaceType . prototype . inspect =
670
+ GraphQLInterfaceType . prototype . toString ;
671
+
648
672
export type GraphQLInterfaceTypeConfig < TSource , TContext > = {
649
673
name : string ,
650
674
fields : Thunk < GraphQLFieldConfigMap < TSource , TContext> > ,
@@ -715,8 +739,16 @@ export class GraphQLUnionType {
715
739
toString ( ) : string {
716
740
return this . name ;
717
741
}
742
+
743
+ toJSON : ( ) = > string ;
744
+ inspect : ( ) => string ;
718
745
}
719
746
747
+ // Also provide toJSON and inspect aliases for toString.
748
+ GraphQLUnionType . prototype . toJSON =
749
+ GraphQLUnionType . prototype . inspect =
750
+ GraphQLUnionType . prototype . toString ;
751
+
720
752
function defineTypes (
721
753
unionType : GraphQLUnionType ,
722
754
typesThunk : Thunk < Array < GraphQLObjectType >>
@@ -852,8 +884,16 @@ export class GraphQLEnumType/* <T> */ {
852
884
toString ( ) : string {
853
885
return this . name ;
854
886
}
887
+
888
+ toJSON : ( ) = > string ;
889
+ inspect : ( ) = > string ;
855
890
}
856
891
892
+ // Also provide toJSON and inspect aliases for toString.
893
+ GraphQLEnumType . prototype . toJSON =
894
+ GraphQLEnumType . prototype . inspect =
895
+ GraphQLEnumType . prototype . toString ;
896
+
857
897
function defineEnumValues (
858
898
type : GraphQLEnumType ,
859
899
valueMap : GraphQLEnumValueConfigMap /* <T> */
@@ -988,8 +1028,16 @@ export class GraphQLInputObjectType {
988
1028
toString ( ) : string {
989
1029
return this . name ;
990
1030
}
1031
+
1032
+ toJSON : ( ) => string ;
1033
+ inspect : ( ) => string ;
991
1034
}
992
1035
1036
+ // Also provide toJSON and inspect aliases for toString.
1037
+ GraphQLInputObjectType . prototype . toJSON =
1038
+ GraphQLInputObjectType . prototype . inspect =
1039
+ GraphQLInputObjectType . prototype . toString ;
1040
+
993
1041
export type GraphQLInputObjectTypeConfig = {
994
1042
name : string ;
995
1043
fields : Thunk < GraphQLInputFieldConfigMap > ;
@@ -1051,8 +1099,16 @@ export class GraphQLList<T: GraphQLType> {
1051
1099
toString ( ) : string {
1052
1100
return '[ ' + String(this.ofType) + ' ] ';
1053
1101
}
1102
+
1103
+ toJSON : ( ) => string ;
1104
+ inspect : ( ) => string ;
1054
1105
}
1055
1106
1107
+ // Also provide toJSON and inspect aliases for toString.
1108
+ GraphQLList . prototype . toJSON =
1109
+ GraphQLList . prototype . inspect =
1110
+ GraphQLList . prototype . toString ;
1111
+
1056
1112
1057
1113
/**
1058
1114
* Non-Null Modifier
@@ -1089,4 +1145,12 @@ export class GraphQLNonNull<T: GraphQLNullableType> {
1089
1145
toString ( ) : string {
1090
1146
return this . ofType . toString ( ) + '!' ;
1091
1147
}
1148
+
1149
+ toJSON : ( ) = > string ;
1150
+ inspect : ( ) = > string ;
1092
1151
}
1152
+
1153
+ // Also provide toJSON and inspect aliases for toString.
1154
+ GraphQLNonNull . prototype . toJSON =
1155
+ GraphQLNonNull . prototype . inspect =
1156
+ GraphQLNonNull . prototype . toString ;
0 commit comments