diff --git a/src/execution/__tests__/abstract-test.ts b/src/execution/__tests__/abstract-test.ts index 6349d59b94..fde551b88d 100644 --- a/src/execution/__tests__/abstract-test.ts +++ b/src/execution/__tests__/abstract-test.ts @@ -357,11 +357,11 @@ describe('Execute: Handles execution of abstract types', () => { }); it('resolveType can throw', async () => { - const PetType = new GraphQLInterfaceType({ + const PetType = new GraphQLInterfaceType({ name: 'Pet', resolveType(_source, context) { const error = new Error('We are testing this error'); - if (context.async === true) { + if (context.async) { return Promise.reject(error); } throw error; diff --git a/src/type/definition.ts b/src/type/definition.ts index 96b064480f..25f4133a42 100644 --- a/src/type/definition.ts +++ b/src/type/definition.ts @@ -1017,18 +1017,18 @@ export interface GraphQLInterfaceTypeExtensions { * }); * ``` */ -export class GraphQLInterfaceType { +export class GraphQLInterfaceType { name: string; description: Maybe; - resolveType: Maybe>; + resolveType: Maybe>; extensions: Readonly; astNode: Maybe; extensionASTNodes: ReadonlyArray; - private _fields: ThunkObjMap>; + private _fields: ThunkObjMap>; private _interfaces: ThunkReadonlyArray; - constructor(config: Readonly>) { + constructor(config: Readonly>) { this.name = assertName(config.name); this.description = config.description; this.resolveType = config.resolveType; @@ -1036,7 +1036,9 @@ export class GraphQLInterfaceType { this.astNode = config.astNode; this.extensionASTNodes = config.extensionASTNodes ?? []; - this._fields = defineFieldMap.bind(undefined, config.fields); + // prettier-ignore + // FIXME: blocked by https://github.com/prettier/prettier/issues/14625 + this._fields = (defineFieldMap).bind(undefined, config.fields); this._interfaces = defineInterfaces.bind(undefined, config.interfaces); } @@ -1044,7 +1046,7 @@ export class GraphQLInterfaceType { return 'GraphQLInterfaceType'; } - getFields(): GraphQLFieldMap { + getFields(): GraphQLFieldMap { if (typeof this._fields === 'function') { this._fields = this._fields(); } @@ -1058,7 +1060,7 @@ export class GraphQLInterfaceType { return this._interfaces; } - toConfig(): GraphQLInterfaceTypeNormalizedConfig { + toConfig(): GraphQLInterfaceTypeNormalizedConfig { return { name: this.name, description: this.description, @@ -1096,10 +1098,10 @@ export interface GraphQLInterfaceTypeConfig { extensionASTNodes?: Maybe>; } -export interface GraphQLInterfaceTypeNormalizedConfig +export interface GraphQLInterfaceTypeNormalizedConfig extends GraphQLInterfaceTypeConfig { interfaces: ReadonlyArray; - fields: GraphQLFieldConfigMap; + fields: GraphQLFieldConfigMap; extensions: Readonly; extensionASTNodes: ReadonlyArray; }