@@ -365,7 +365,9 @@ export function assertAbstractType(type: unknown): GraphQLAbstractType {
365
365
* })
366
366
* ```
367
367
*/
368
- export class GraphQLList < T extends GraphQLType > {
368
+ export class GraphQLList < T extends GraphQLType >
369
+ implements GraphQLSchemaElement
370
+ {
369
371
readonly ofType : T ;
370
372
371
373
constructor ( ofType : T ) {
@@ -406,7 +408,9 @@ export class GraphQLList<T extends GraphQLType> {
406
408
* ```
407
409
* Note: the enforcement of non-nullability occurs within the executor.
408
410
*/
409
- export class GraphQLNonNull < T extends GraphQLNullableType > {
411
+ export class GraphQLNonNull < T extends GraphQLNullableType >
412
+ implements GraphQLSchemaElement
413
+ {
410
414
readonly ofType : T ;
411
415
412
416
constructor ( ofType : T ) {
@@ -530,6 +534,15 @@ export function getNamedType(
530
534
}
531
535
}
532
536
537
+ /**
538
+ * An interface for all Schema Elements.
539
+ */
540
+
541
+ export interface GraphQLSchemaElement {
542
+ toString : ( ) => string ;
543
+ toJSON : ( ) => string ;
544
+ }
545
+
533
546
/**
534
547
* Used while defining GraphQL types to allow for circular references in
535
548
* otherwise immutable type definitions.
@@ -635,7 +648,9 @@ export interface GraphQLScalarTypeExtensions {
635
648
* `coerceInputLiteral()` method.
636
649
*
637
650
*/
638
- export class GraphQLScalarType < TInternal = unknown , TExternal = TInternal > {
651
+ export class GraphQLScalarType < TInternal = unknown , TExternal = TInternal >
652
+ implements GraphQLSchemaElement
653
+ {
639
654
name : string ;
640
655
description : Maybe < string > ;
641
656
specifiedByURL : Maybe < string > ;
@@ -851,7 +866,9 @@ export interface GraphQLObjectTypeExtensions<_TSource = any, _TContext = any> {
851
866
* });
852
867
* ```
853
868
*/
854
- export class GraphQLObjectType < TSource = any , TContext = any > {
869
+ export class GraphQLObjectType < TSource = any , TContext = any >
870
+ implements GraphQLSchemaElement
871
+ {
855
872
name : string ;
856
873
description : Maybe < string > ;
857
874
isTypeOf : Maybe < GraphQLIsTypeOfFn < TSource , TContext > > ;
@@ -1054,7 +1071,9 @@ export type GraphQLFieldConfigMap<TSource, TContext> = ObjMap<
1054
1071
GraphQLFieldConfig < TSource , TContext >
1055
1072
> ;
1056
1073
1057
- export class GraphQLField < TSource = any , TContext = any , TArgs = any > {
1074
+ export class GraphQLField < TSource = any , TContext = any , TArgs = any >
1075
+ implements GraphQLSchemaElement
1076
+ {
1058
1077
parentType :
1059
1078
| GraphQLObjectType < TSource , TContext >
1060
1079
| GraphQLInterfaceType < TSource , TContext >
@@ -1127,7 +1146,7 @@ export class GraphQLField<TSource = any, TContext = any, TArgs = any> {
1127
1146
}
1128
1147
}
1129
1148
1130
- export class GraphQLArgument {
1149
+ export class GraphQLArgument implements GraphQLSchemaElement {
1131
1150
parent : GraphQLField | GraphQLDirective ;
1132
1151
name : string ;
1133
1152
description : Maybe < string > ;
@@ -1239,7 +1258,9 @@ export interface GraphQLInterfaceTypeExtensions {
1239
1258
* });
1240
1259
* ```
1241
1260
*/
1242
- export class GraphQLInterfaceType < TSource = any , TContext = any > {
1261
+ export class GraphQLInterfaceType < TSource = any , TContext = any >
1262
+ implements GraphQLSchemaElement
1263
+ {
1243
1264
name : string ;
1244
1265
description : Maybe < string > ;
1245
1266
resolveType : Maybe < GraphQLTypeResolver < TSource , TContext > > ;
@@ -1366,7 +1387,7 @@ export interface GraphQLUnionTypeExtensions {
1366
1387
* });
1367
1388
* ```
1368
1389
*/
1369
- export class GraphQLUnionType {
1390
+ export class GraphQLUnionType implements GraphQLSchemaElement {
1370
1391
name : string ;
1371
1392
description : Maybe < string > ;
1372
1393
resolveType : Maybe < GraphQLTypeResolver < any , any > > ;
@@ -1483,7 +1504,7 @@ export interface GraphQLEnumTypeExtensions {
1483
1504
* Note: If a value is not provided in a definition, the name of the enum value
1484
1505
* will be used as its internal value.
1485
1506
*/
1486
- export class GraphQLEnumType /* <T> */ {
1507
+ export class GraphQLEnumType /* <T> */ implements GraphQLSchemaElement {
1487
1508
name : string ;
1488
1509
description : Maybe < string > ;
1489
1510
extensions : Readonly < GraphQLEnumTypeExtensions > ;
@@ -1703,7 +1724,7 @@ export interface GraphQLEnumValueConfig {
1703
1724
astNode ?: Maybe < EnumValueDefinitionNode > ;
1704
1725
}
1705
1726
1706
- export class GraphQLEnumValue {
1727
+ export class GraphQLEnumValue implements GraphQLSchemaElement {
1707
1728
parentEnum : GraphQLEnumType ;
1708
1729
name : string ;
1709
1730
description : Maybe < string > ;
@@ -1783,7 +1804,7 @@ export interface GraphQLInputObjectTypeExtensions {
1783
1804
* });
1784
1805
* ```
1785
1806
*/
1786
- export class GraphQLInputObjectType {
1807
+ export class GraphQLInputObjectType implements GraphQLSchemaElement {
1787
1808
name : string ;
1788
1809
description : Maybe < string > ;
1789
1810
extensions : Readonly < GraphQLInputObjectTypeExtensions > ;
@@ -1890,7 +1911,7 @@ export interface GraphQLInputFieldConfig {
1890
1911
1891
1912
export type GraphQLInputFieldConfigMap = ObjMap < GraphQLInputFieldConfig > ;
1892
1913
1893
- export class GraphQLInputField {
1914
+ export class GraphQLInputField implements GraphQLSchemaElement {
1894
1915
parentType : GraphQLInputObjectType ;
1895
1916
name : string ;
1896
1917
description : Maybe < string > ;
0 commit comments