Skip to content

Commit 4adac42

Browse files
TypeInfo: use explicit type for getFieldDef arg (#3125)
1 parent 23a404b commit 4adac42

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/utilities/TypeInfo.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export class TypeInfo {
2626
*/
2727
initialType?: GraphQLType,
2828
/** @deprecated will be removed in 17.0.0 */
29-
getFieldDefFn?: getFieldDef,
29+
getFieldDefFn?: GetFieldDefFn,
3030
);
3131
getType(): Maybe<GraphQLOutputType>;
3232
getParentType(): Maybe<GraphQLCompositeType>;
@@ -40,7 +40,7 @@ export class TypeInfo {
4040
enter(node: ASTNode): any;
4141
leave(node: ASTNode): any;
4242
}
43-
type getFieldDef = (
43+
type GetFieldDefFn = (
4444
schema: GraphQLSchema,
4545
parentType: GraphQLType,
4646
fieldNode: FieldNode,

src/utilities/TypeInfo.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export class TypeInfo {
5151
_directive: ?GraphQLDirective;
5252
_argument: ?GraphQLArgument;
5353
_enumValue: ?GraphQLEnumValue;
54-
_getFieldDef: typeof getFieldDef;
54+
_getFieldDef: GetFieldDefFn;
5555

5656
constructor(
5757
schema: GraphQLSchema,
@@ -62,7 +62,7 @@ export class TypeInfo {
6262
initialType?: ?GraphQLType,
6363

6464
/** @deprecated will be removed in 17.0.0 */
65-
getFieldDefFn?: typeof getFieldDef,
65+
getFieldDefFn?: GetFieldDefFn,
6666
) {
6767
this._schema = schema;
6868
this._typeStack = [];
@@ -292,6 +292,12 @@ export class TypeInfo {
292292
}
293293
}
294294

295+
type GetFieldDefFn = (
296+
schema: GraphQLSchema,
297+
parentType: GraphQLType,
298+
fieldNode: FieldNode,
299+
) => ?GraphQLField<mixed, mixed>;
300+
295301
/**
296302
* Not exactly the same as the executor's definition of getFieldDef, in this
297303
* statically evaluated environment we do not always have an Object type,

0 commit comments

Comments
 (0)