How to avoid specifying field name in Octokit GraphQL

How to avoid specifying field name in Octokit GraphQL


1

Example query:

mutation prrt($input: AddPullRequestReviewThreadInput!) {
    addPullRequestReviewThread(input: $input) {
        thread {
            id
        } } }

Using Octokit, I have to type like this:

const mutateFn = graphql<{
    addPullRequestReviewThread: AddPullRequestReviewThreadPayload;
}>;
const response = await mutateFn(mutation, { input, headers });

The addPullRequestReviewThread: part is quite long. Can this be automated/inferred somehow? I’d like to just specify the payload type AddPullRequestReviewThreadPayload. Or is this required in all GraphQL?


Load 7 more related questions


Show fewer related questions

0



Leave a Reply

Your email address will not be published. Required fields are marked *