|
9 | 9 | } from 'graphql';
|
10 | 10 |
|
11 | 11 | import type {
|
12 |
| - GraphQLNamedType, |
| 12 | + GraphQLOutputType, |
13 | 13 | GraphQLFieldConfigMap,
|
14 | 14 | GraphQLFieldResolver,
|
15 | 15 | Thunk,
|
@@ -73,7 +73,7 @@ export interface ConnectionArguments {
|
73 | 73 |
|
74 | 74 | interface ConnectionConfig {
|
75 | 75 | name?: string;
|
76 |
| - nodeType: GraphQLNamedType | GraphQLNonNull<GraphQLNamedType>; |
| 76 | + nodeType: GraphQLOutputType | GraphQLNonNull<GraphQLOutputType>; |
77 | 77 | resolveNode?: GraphQLFieldResolver<any, any>;
|
78 | 78 | resolveCursor?: GraphQLFieldResolver<any, any>;
|
79 | 79 | edgeFields?: Thunk<GraphQLFieldConfigMap<any, any>>;
|
@@ -104,20 +104,21 @@ export function connectionDefinitions(
|
104 | 104 | const edgeType = new GraphQLObjectType({
|
105 | 105 | name: name + 'Edge',
|
106 | 106 | description: 'An edge in a connection.',
|
107 |
| - // @ts-expect-error TODO FIXME |
108 |
| - fields: () => ({ |
109 |
| - node: { |
110 |
| - type: nodeType, |
111 |
| - resolve: config.resolveNode, |
112 |
| - description: 'The item at the end of the edge', |
113 |
| - }, |
114 |
| - cursor: { |
115 |
| - type: new GraphQLNonNull(GraphQLString), |
116 |
| - resolve: config.resolveCursor, |
117 |
| - description: 'A cursor for use in pagination', |
118 |
| - }, |
119 |
| - ...resolveMaybeThunk(config.edgeFields ?? {}), |
120 |
| - }), |
| 107 | + fields(): GraphQLFieldConfigMap<unknown, unknown> { |
| 108 | + return { |
| 109 | + node: { |
| 110 | + type: nodeType, |
| 111 | + resolve: config.resolveNode, |
| 112 | + description: 'The item at the end of the edge', |
| 113 | + }, |
| 114 | + cursor: { |
| 115 | + type: new GraphQLNonNull(GraphQLString), |
| 116 | + resolve: config.resolveCursor, |
| 117 | + description: 'A cursor for use in pagination', |
| 118 | + }, |
| 119 | + ...resolveMaybeThunk(config.edgeFields ?? {}), |
| 120 | + }; |
| 121 | + }, |
121 | 122 | });
|
122 | 123 |
|
123 | 124 | const connectionType = new GraphQLObjectType({
|
|
0 commit comments