Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeInfo: use explicit type for getFieldDef arg #3125

Merged
merged 1 commit into from May 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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