graphile-engine icon indicating copy to clipboard operation
graphile-engine copied to clipboard

feat(graphql-parse-resolve-info): add isResolveTree type guard

Open Nargonath opened this issue 1 year ago • 2 comments
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:fix passes.
  • [x] I've added tests for the new feature, and yarn test passes.
  • [x] 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.

Nargonath avatar Mar 25 '24 16:03 Nargonath

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?

Nargonath avatar Apr 01 '24 12:04 Nargonath

It already exists, IIRC it’s what controls the type that is returned. The changes I have suggested are types only.

benjie avatar Apr 01 '24 22:04 benjie