Skip to content

Conversation

@dhritzkiv
Copy link

Description

Specify type as ResolveTree for returned fields in simplifyParsedResolveInfoFragmentWithType. Otherwise, the return type is simply {} which is not indexable in TS.

Checklist

  • My code matches the project's code style and yarn lint:fix passes.
  • I've added tests for the new feature, and yarn test passes.
  • I have detailed the new feature in the relevant documentation.
  • I have added this feature to 'Pending' in the RELEASE_NOTES.md file (if one exists).
  • If this is a breaking change I've explained why.

Specify type as `ResolveTree` for returned `fields` in `simplifyParsedResolveInfoFragmentWithType`. Otherwise, the return type is simply `{}` which is not indexable in TS.
@dhritzkiv dhritzkiv marked this pull request as ready for review May 13, 2025 21:27
benjie
benjie previously approved these changes Jun 11, 2025
Copy link
Member

@benjie benjie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

) {
const { fieldsByTypeName } = parsedResolveInfoFragment;
const fields = {};
const fields: ResolveTree = {};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

src/index.ts:355:9 - error TS2739: Type '{}' is missing the following properties from type 'ResolveTree': name, alias, args, fieldsByTypeName

355   const fields: ResolveTree = {};

@benjie benjie dismissed their stale review June 11, 2025 09:58

Types don't match.

@dhritzkiv
Copy link
Author

Sorry about that – I didn't see that tests fail when I initially submitted this PR.

I've now changed the syntax to allow for treating fields as ResolveTree, when initializing it.

@benjie
Copy link
Member

benjie commented Jul 7, 2025

fields isn't actually a ResolveTree; it's a Record<string, ResolveTree>. Whilst reworking this I spotted a bug in the merging, so I've raised an alternative fix in #873.

@benjie benjie closed this in #873 Jul 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants