graphile-engine
graphile-engine copied to clipboard
feat(graphql-parse-resolve-info): add isResolveTree type guard
trafficstars
Fix #849
Description
This PR adds a TypeScript type guard to determine whether a value is a ResolveTree or not.
Performance impact
None (or minimal), it's just a two property read and boolean conditions.
Security impact
none
Checklist
- [x] My code matches the project's code style and
yarn lint:fixpasses. - [x] I've added tests for the new feature, and
yarn testpasses. - [x] 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). - [ ] If this is a breaking change I've explained why.
Thanks for the suggestion @benjie. I wasn't aware of the keepRoot option. Does it already exist or is it something you suggest to create as part of this PR?
It already exists, IIRC it’s what controls the type that is returned. The changes I have suggested are types only.