Skip to content

Commit

Permalink
Update loop usage
Browse files Browse the repository at this point in the history
  • Loading branch information
eddeee888 committed Sep 11, 2024
1 parent 3966ca5 commit dd71d69
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit dd71d69

Please sign in to comment.