1
1
// @flow strict
2
2
3
3
import objectEntries from '../polyfills/objectEntries' ;
4
+ import { SYMBOL_TO_STRING_TAG } from '../polyfills/symbols' ;
4
5
5
6
import inspect from '../jsutils/inspect' ;
6
7
import keyMap from '../jsutils/keyMap' ;
@@ -15,7 +16,6 @@ import isObjectLike from '../jsutils/isObjectLike';
15
16
import identityFunc from '../jsutils/identityFunc' ;
16
17
import defineToJSON from '../jsutils/defineToJSON' ;
17
18
import suggestionList from '../jsutils/suggestionList' ;
18
- import defineToStringTag from '../jsutils/defineToStringTag' ;
19
19
import { type PromiseOrValue } from '../jsutils/PromiseOrValue' ;
20
20
import {
21
21
type ObjMap ,
@@ -367,8 +367,12 @@ export function GraphQLList(ofType) {
367
367
return '[' + String ( this . ofType ) + ']' ;
368
368
} ;
369
369
370
- // Conditionally apply `[Symbol.toStringTag]` if `Symbol`s are supported
371
- defineToStringTag ( GraphQLList ) ;
370
+ Object . defineProperty ( GraphQLList . prototype , SYMBOL_TO_STRING_TAG , {
371
+ get ( ) {
372
+ return 'GraphQLList' ;
373
+ } ,
374
+ } ) ;
375
+
372
376
defineToJSON ( GraphQLList ) ;
373
377
374
378
/**
@@ -411,8 +415,12 @@ export function GraphQLNonNull(ofType) {
411
415
return String ( this . ofType ) + '!' ;
412
416
} ;
413
417
414
- // Conditionally apply `[Symbol.toStringTag]` if `Symbol`s are supported
415
- defineToStringTag ( GraphQLNonNull ) ;
418
+ Object . defineProperty ( GraphQLNonNull . prototype , SYMBOL_TO_STRING_TAG , {
419
+ get ( ) {
420
+ return 'GraphQLNonNull' ;
421
+ } ,
422
+ } ) ;
423
+
416
424
defineToJSON ( GraphQLNonNull ) ;
417
425
418
426
/**
@@ -608,10 +616,13 @@ export class GraphQLScalarType {
608
616
toString(): string {
609
617
return this.name;
610
618
}
619
+
620
+ // $FlowFixMe Flow doesn't support computed properties yet
621
+ get [SYMBOL_TO_STRING_TAG]() {
622
+ return 'GraphQLScalarType';
623
+ }
611
624
}
612
625
613
- // Conditionally apply ` [ Symbol . toStringTag ] ` if ` Symbol `s are supported
614
- defineToStringTag(GraphQLScalarType);
615
626
defineToJSON(GraphQLScalarType);
616
627
617
628
export type GraphQLScalarSerializer<TExternal> = (
@@ -743,10 +754,13 @@ export class GraphQLObjectType {
743
754
toString ( ) : string {
744
755
return this . name ;
745
756
}
757
+
758
+ // $FlowFixMe Flow doesn't support computed properties yet
759
+ get [ SYMBOL_TO_STRING_TAG ] ( ) {
760
+ return 'GraphQLObjectType' ;
761
+ }
746
762
}
747
763
748
- // Conditionally apply `[Symbol.toStringTag]` if `Symbol`s are supported
749
- defineToStringTag ( GraphQLObjectType ) ;
750
764
defineToJSON ( GraphQLObjectType ) ;
751
765
752
766
function defineInterfaces (
@@ -1050,10 +1064,13 @@ export class GraphQLInterfaceType {
1050
1064
toString ( ) : string {
1051
1065
return this . name ;
1052
1066
}
1067
+
1068
+ // $FlowFixMe Flow doesn't support computed properties yet
1069
+ get [ SYMBOL_TO_STRING_TAG ] ( ) {
1070
+ return 'GraphQLInterfaceType' ;
1071
+ }
1053
1072
}
1054
1073
1055
- // Conditionally apply `[Symbol.toStringTag]` if `Symbol`s are supported
1056
- defineToStringTag ( GraphQLInterfaceType ) ;
1057
1074
defineToJSON ( GraphQLInterfaceType ) ;
1058
1075
1059
1076
export type GraphQLInterfaceTypeConfig < TSource , TContext > = { |
@@ -1149,10 +1166,13 @@ export class GraphQLUnionType {
1149
1166
toString ( ) : string {
1150
1167
return this . name ;
1151
1168
}
1169
+
1170
+ // $FlowFixMe Flow doesn't support computed properties yet
1171
+ get [ SYMBOL_TO_STRING_TAG ] ( ) {
1172
+ return 'GraphQLUnionType ';
1173
+ }
1152
1174
}
1153
1175
1154
- // Conditionally apply `[Symbol.toStringTag]` if `Symbol`s are supported
1155
- defineToStringTag ( GraphQLUnionType ) ;
1156
1176
defineToJSON ( GraphQLUnionType ) ;
1157
1177
1158
1178
function defineTypes (
@@ -1319,10 +1339,13 @@ export class GraphQLEnumType /* <T> */ {
1319
1339
toString ( ) : string {
1320
1340
return this . name ;
1321
1341
}
1342
+
1343
+ // $FlowFixMe Flow doesn't support computed properties yet
1344
+ get [ SYMBOL_TO_STRING_TAG ] ( ) {
1345
+ return 'GraphQLEnumType' ;
1346
+ }
1322
1347
}
1323
1348
1324
- // Conditionally apply `[Symbol.toStringTag]` if `Symbol`s are supported
1325
- defineToStringTag ( GraphQLEnumType ) ;
1326
1349
defineToJSON ( GraphQLEnumType ) ;
1327
1350
1328
1351
function didYouMeanEnumValue (
@@ -1468,10 +1491,13 @@ export class GraphQLInputObjectType {
1468
1491
toString ( ) : string {
1469
1492
return this . name ;
1470
1493
}
1494
+
1495
+ // $FlowFixMe Flow doesn't support computed properties yet
1496
+ get [ SYMBOL_TO_STRING_TAG ] ( ) {
1497
+ return 'GraphQLInputObjectType ';
1498
+ }
1471
1499
}
1472
1500
1473
- // Conditionally apply `[Symbol.toStringTag]` if `Symbol`s are supported
1474
- defineToStringTag ( GraphQLInputObjectType ) ;
1475
1501
defineToJSON ( GraphQLInputObjectType ) ;
1476
1502
1477
1503
function defineInputFieldMap (
0 commit comments