graphile-engine
graphile-engine copied to clipboard
Fix return type of simplifyParsedResolveInfoFragmentWithType
Description
Specify type as ResolveTree for returned fields in simplifyParsedResolveInfoFragmentWithType. Otherwise, the return type is simply {} which is not indexable in TS.
Checklist
- [x] My code matches the project's code style and
yarn lint:fixpasses. - [ ] I've added tests for the new feature, and
yarn testpasses. - [ ] I have detailed the new feature in the relevant documentation.
- [ ] I have added this feature to 'Pending' in the
RELEASE_NOTES.mdfile (if one exists). - [x] If this is a breaking change I've explained why.
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.
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.