graphql-tools icon indicating copy to clipboard operation
graphql-tools copied to clipboard

Export `DirectableGraphQLObject` type

Open kennyjwilli opened this issue 11 months ago • 3 comments

Is your feature request related to a problem? Please describe.

I am working on a GraphQL library that works extensively with directives. I would like to write a wrapper function that calls getDirective. I'd like my wrapper function to take in a DirectableGraphQLObject.

Describe the solution you'd like

Export DirectableGraphQLObject, located here.

Describe alternatives you've considered

  1. Copy and pasting the DirectableGraphQLObject into my codebase. This is less ideal since it results in duplicate code.
  2. Adding a type assertion. This is prone to breakage since I cannot be sure the passed in type is correct.
  3. Using a utility type to extract the type (e.g., Parameters<typeof getDirective>[1]). This is likely the best workaround for now.

Additional context

None.

kennyjwilli avatar Jul 21 '23 17:07 kennyjwilli

Sounds good! Would you create a PR?

ardatan avatar Jul 21 '23 18:07 ardatan

Sure: https://github.com/ardatan/graphql-tools/pull/5444. Seemed straightforward. LMK if more is required.

kennyjwilli avatar Jul 21 '23 19:07 kennyjwilli

Thanks for the PR! Available in the latest version!

ardatan avatar Jul 22 '23 05:07 ardatan