Skip to content

Commit

Permalink
TypeInfo: use explicit type for getFieldDef arg (#3125)
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov committed May 23, 2021
1 parent 23a404b commit 4adac42
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/utilities/TypeInfo.d.ts
Expand Up @@ -26,7 +26,7 @@ export class TypeInfo {
*/
initialType?: GraphQLType,
/** @deprecated will be removed in 17.0.0 */
getFieldDefFn?: getFieldDef,
getFieldDefFn?: GetFieldDefFn,
);
getType(): Maybe<GraphQLOutputType>;
getParentType(): Maybe<GraphQLCompositeType>;
Expand All @@ -40,7 +40,7 @@ export class TypeInfo {
enter(node: ASTNode): any;
leave(node: ASTNode): any;
}
type getFieldDef = (
type GetFieldDefFn = (
schema: GraphQLSchema,
parentType: GraphQLType,
fieldNode: FieldNode,
Expand Down
10 changes: 8 additions & 2 deletions src/utilities/TypeInfo.js
Expand Up @@ -51,7 +51,7 @@ export class TypeInfo {
_directive: ?GraphQLDirective;
_argument: ?GraphQLArgument;
_enumValue: ?GraphQLEnumValue;
_getFieldDef: typeof getFieldDef;
_getFieldDef: GetFieldDefFn;

constructor(
schema: GraphQLSchema,
Expand All @@ -62,7 +62,7 @@ export class TypeInfo {
initialType?: ?GraphQLType,

/** @deprecated will be removed in 17.0.0 */
getFieldDefFn?: typeof getFieldDef,
getFieldDefFn?: GetFieldDefFn,
) {
this._schema = schema;
this._typeStack = [];
Expand Down Expand Up @@ -292,6 +292,12 @@ export class TypeInfo {
}
}

type GetFieldDefFn = (
schema: GraphQLSchema,
parentType: GraphQLType,
fieldNode: FieldNode,
) => ?GraphQLField<mixed, mixed>;

/**
* Not exactly the same as the executor's definition of getFieldDef, in this
* statically evaluated environment we do not always have an Object type,
Expand Down

0 comments on commit 4adac42

Please sign in to comment.