From dd71d6940deacd34384f996b4ca015585b051f5c Mon Sep 17 00:00:00 2001 From: Eddy Nguyen Date: Wed, 11 Sep 2024 23:25:37 +1000 Subject: [PATCH] Update loop usage --- .../src/base-resolvers-visitor.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/plugins/other/visitor-plugin-common/src/base-resolvers-visitor.ts b/packages/plugins/other/visitor-plugin-common/src/base-resolvers-visitor.ts index 6cdaffea7b1..19b934899cc 100644 --- a/packages/plugins/other/visitor-plugin-common/src/base-resolvers-visitor.ts +++ b/packages/plugins/other/visitor-plugin-common/src/base-resolvers-visitor.ts @@ -582,10 +582,9 @@ export interface RawResolversConfig extends RawConfig { internalResolversPrefix?: string; /** * @type object - * @default { __resolveReference: false } + * @default { __resolveReference: false, __isTypeOf: false } * @description If relevant internal resolvers are set to `true`, the resolver type will only be generated if the right conditions are met. - * Enabling this allows a more correct type generation for the resolvers. - * For example: + * Enabling this allows a more correct type generation for the resolvers: * - `__isTypeOf` is generated for implementing types and union members * - `__resolveReference` is generated for federation types that have at least one resolvable `@key` directive */ @@ -997,7 +996,9 @@ export class BaseResolversVisitor< const memberTypes = schemaType.getTypes(); - for (const type of memberTypes) (this._objectTypesWithIsTypeOf[type.name] = true); + for (const type of memberTypes) { + this._objectTypesWithIsTypeOf[type.name] = true; + } res[typeName] = this.getAbstractMembersType({ typeName, @@ -1038,7 +1039,9 @@ export class BaseResolversVisitor< const { interfaceImplementingType, excludeTypes } = this.config.resolversNonOptionalTypename; - for (const type of implementingTypes) (this._objectTypesWithIsTypeOf[type.name] = true); + for (const type of implementingTypes) { + this._objectTypesWithIsTypeOf[type.name] = true; + } res[typeName] = this.getAbstractMembersType({ typeName,