Skip to content

feat(graphql): add TArgs generic to more graphql types#32694

Merged
minestarks merged 2 commits intoDefinitelyTyped:masterfrom
mc0:define-graphql-args
Feb 12, 2019
Merged

feat(graphql): add TArgs generic to more graphql types#32694
minestarks merged 2 commits intoDefinitelyTyped:masterfrom
mc0:define-graphql-args

Conversation

@mc0
Copy link
Copy Markdown
Contributor

@mc0 mc0 commented Feb 1, 2019

  • Use a meaningful title for the pull request. Include the name of the package modified.
  • Test the change in your own code. (Compile and run.)
  • Add or edit tests to reflect the change. (Run with npm test.)
  • Follow the advice from the readme.
  • Avoid common mistakes.
  • Run npm run lint package-name (or tsc if no tslint.json is present).
  • Provide a URL to documentation or source code which provides context for the suggested changes: https://graphql.org/graphql-js/type/#graphqlobjecttype
  • [n/a] Increase the version number in the header if appropriate.
  • [n/a] If you are making substantial changes, consider adding a tslint.json containing { "extends": "dtslint/dt.json" }.

This builds off of some changes from #22789 and continues having TArgs be optional. This is not a breaking change. It's possible that unknown is a better option for TArgs; however, that would be TS3 specific and be a breaking change.

This change is to allow overriding TArgs in more places. For example, allowing any args or to restrict args further. This primarily impacts the GraphQLFieldConfigMap and GraphQLObjectType types.

Using GraphQLFieldConfigMap with generics:

const Query = new GraphQLObjectType({
  fields: (): GraphQLFieldConfigMap<void, Context, any> => ({
    someField: getFieldConfig(),
  })
});

Using GraphQLObjectType with generics:

const Query = new GraphQLObjectType<void, Context, any>({
  fields: () => ({
    someField: getFieldConfig(),
  })
});

@typescript-bot typescript-bot added the Popular package This PR affects a popular package (as counted by NPM download counts). label Feb 1, 2019
@typescript-bot
Copy link
Copy Markdown
Contributor

typescript-bot commented Feb 1, 2019

@mc0 Thank you for submitting this PR!

🔔 @TonyPythoneer @calebmer @intellix @firede @kepennar @freiksenet @IvanGoncharov @DxCx @rportugal @tgriesser @dyst5422 @adnsio @divyenduz @bradzacher @clayne11 @JCMais @langpavel - please review this PR in the next few days. Be sure to explicitly select Approve or Request Changes in the GitHub UI so I know what's going on.

If no reviewer appears after a week, a DefinitelyTyped maintainer will review the PR instead.

@typescript-bot
Copy link
Copy Markdown
Contributor

typescript-bot commented Feb 1, 2019

@mc0 The Travis CI build failed! Please review the logs for more information.

Once you've pushed the fixes, the build will automatically re-run. Thanks!

@mc0
Copy link
Copy Markdown
Contributor Author

mc0 commented Feb 1, 2019

See microsoft/dtslint#192 for why this build is failing and related #32696 for a succinct example of the tests failing for the dependent package.

@typescript-bot
Copy link
Copy Markdown
Contributor

@mc0 I haven't seen anything from you in a while and this PR currently has problems that prevent it from being merged. The PR will be closed tomorrow if there aren't new commits to fix the issues.

@mc0
Copy link
Copy Markdown
Contributor Author

mc0 commented Feb 7, 2019

🤷‍♂️

@typescript-bot typescript-bot added Owner Approved A listed owner of this package signed off on the pull request. Merge:Express and removed Awaiting reviewer feedback labels Feb 10, 2019
@typescript-bot
Copy link
Copy Markdown
Contributor

A definition owner has approved this PR ⭐️. A maintainer will merge this PR shortly. If it shouldn't be merged yet, please leave a comment saying so and we'll wait. Thank you for your contribution to DefinitelyTyped!

@minestarks minestarks merged commit ccca3e2 into DefinitelyTyped:master Feb 12, 2019
@typescript-bot
Copy link
Copy Markdown
Contributor

I just published @types/[email protected] to npm.

@mc0 mc0 deleted the define-graphql-args branch February 13, 2019 16:59
@mc0 mc0 mentioned this pull request Mar 10, 2019
9 tasks
IvanGoncharov added a commit to IvanGoncharov/graphql-js that referenced this pull request Mar 12, 2020
IvanGoncharov added a commit to IvanGoncharov/graphql-js that referenced this pull request Mar 12, 2020
IvanGoncharov added a commit to IvanGoncharov/graphql-js that referenced this pull request Mar 12, 2020
IvanGoncharov added a commit to graphql/graphql-js that referenced this pull request Mar 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Owner Approved A listed owner of this package signed off on the pull request. Popular package This PR affects a popular package (as counted by NPM download counts).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants