Skip to content

Commit 65c3a59

Browse files
committed
Remove deprecate getFieldDefFn argument of TypeInfo constructor
1 parent b4ad128 commit 65c3a59

File tree

1 file changed

+7
-18
lines changed

1 file changed

+7
-18
lines changed

src/utilities/TypeInfo.ts

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ export class TypeInfo {
5353
private _directive: Maybe<GraphQLDirective>;
5454
private _argument: Maybe<GraphQLArgument>;
5555
private _enumValue: Maybe<GraphQLEnumValue>;
56-
private _getFieldDef: GetFieldDefFn;
5756

5857
constructor(
5958
schema: GraphQLSchema,
@@ -62,9 +61,6 @@ export class TypeInfo {
6261
* beginning somewhere other than documents.
6362
*/
6463
initialType?: Maybe<GraphQLType>,
65-
66-
/** @deprecated will be removed in 17.0.0 */
67-
getFieldDefFn?: GetFieldDefFn,
6864
) {
6965
this._schema = schema;
7066
this._typeStack = [];
@@ -75,7 +71,6 @@ export class TypeInfo {
7571
this._directive = null;
7672
this._argument = null;
7773
this._enumValue = null;
78-
this._getFieldDef = getFieldDefFn ?? getFieldDef;
7974
if (initialType) {
8075
if (isInputType(initialType)) {
8176
this._inputTypeStack.push(initialType);
@@ -160,7 +155,7 @@ export class TypeInfo {
160155
let fieldDef;
161156
let fieldType: unknown;
162157
if (parentType) {
163-
fieldDef = this._getFieldDef(schema, parentType, node);
158+
fieldDef = getFieldDef(schema, parentType, node);
164159
if (fieldDef) {
165160
fieldType = fieldDef.type;
166161
}
@@ -291,37 +286,31 @@ export class TypeInfo {
291286
}
292287
}
293288

294-
type GetFieldDefFn = (
295-
schema: GraphQLSchema,
296-
parentType: GraphQLType,
297-
fieldNode: FieldNode,
298-
) => Maybe<GraphQLField<unknown, unknown>>;
299-
300289
/**
301290
* Not exactly the same as the executor's definition of getFieldDef, in this
302291
* statically evaluated environment we do not always have an Object type,
303292
* and need to handle Interface and Union types.
304293
*/
305294
function getFieldDef(
306295
schema: GraphQLSchema,
307-
parentType: GraphQLType,
296+
parentType: GraphQLCompositeType,
308297
fieldNode: FieldNode,
309298
): Maybe<GraphQLField<unknown, unknown>> {
310-
const name = fieldNode.name.value;
299+
const fieldName = fieldNode.name.value;
311300
if (
312-
name === SchemaMetaFieldDef.name &&
301+
fieldName === SchemaMetaFieldDef.name &&
313302
schema.getQueryType() === parentType
314303
) {
315304
return SchemaMetaFieldDef;
316305
}
317-
if (name === TypeMetaFieldDef.name && schema.getQueryType() === parentType) {
306+
if (fieldName === TypeMetaFieldDef.name && schema.getQueryType() === parentType) {
318307
return TypeMetaFieldDef;
319308
}
320-
if (name === TypeNameMetaFieldDef.name && isCompositeType(parentType)) {
309+
if (fieldName === TypeNameMetaFieldDef.name && isCompositeType(parentType)) {
321310
return TypeNameMetaFieldDef;
322311
}
323312
if (isObjectType(parentType) || isInterfaceType(parentType)) {
324-
return parentType.getFields()[name];
313+
return parentType.getFields()[fieldName];
325314
}
326315
}
327316

0 commit comments

Comments
 (0)