graphqurl icon indicating copy to clipboard operation
graphqurl copied to clipboard

TypeScript types

Open tsujp opened this issue 6 years ago • 9 comments

Is anyone able to add TypeScript types directly to this library? Are PRs requested? I cannot find any on DefinitelyTyped via @types/graphqurl.

tsujp avatar Nov 04 '19 08:11 tsujp

declare module 'graphqurl' {
    export interface Options {
        endpoint: string,
        query: string
        variables?: any
        headers?: any
    }

    export interface Response {
        data: any
        loading: boolean,
        networkStatus: number,
        stale: boolean
    }

    export function query(options: Options): Promise<Response>
}

I use this

qtLOLI avatar Mar 10 '20 18:03 qtLOLI

For anyone else that comes across this issue, I made this graphqurl.d.ts as referencing the README.

Can't be bothered making a full pull-request for DefinitelyTyped at the moment, but still wanted to share.

It's got complete typings for createClient the Client itself, all options and arguments, query and subscribe methods, subscription Disposer etc.

peterboyer avatar Jul 09 '21 10:07 peterboyer

Hasura noob here. Does that graphqurl.d.ts file need any changes? If not, I can make a PR for DefinitelyTyped.

josephcagle avatar Nov 02 '21 23:11 josephcagle

Does that graphqurl.d.ts file need any changes? If not, I can make a PR for DefinitelyTyped.

@DarthFloopy It seems to be complete to me; been using it in production ever since I made it initially and I have made no changes. If you end up making a PR with it please reference me and this issue. :) Thanks!

peterboyer avatar Nov 02 '21 23:11 peterboyer

@ptboyer I've made a PR on DT based on your file. (https://github.com/DefinitelyTyped/DefinitelyTyped/pull/57156) I used the graphqurl readme to create a basic test for the TS types. The PR has passed the CI tests and is waiting for review as I write this.

josephcagle avatar Nov 15 '21 02:11 josephcagle

(Note: I assume this counts as a contribution for Hacktoberfest, since this issue has the hacktoberfest label and my work was submitted by Hasura's deadline, Nov 14. However, working on this issue obviously doesn't involve submitting a pull request on this repo, so there is nothing to label hacktoberfest-accepted. Who should I talk to to get credit for Hacktoberfest? Thanks)

josephcagle avatar Nov 15 '21 02:11 josephcagle

@ptboyer I've made a PR on DT based on your file. (DefinitelyTyped/DefinitelyTyped#57156) I used the graphqurl readme to create a basic test for the TS types. The PR has passed the CI tests and is waiting for review as I write this.

@DarthFloopy Fantastic! Cheers mate!

(Note: I assume this counts as a contribution for Hacktoberfest, since this issue has the hacktoberfest label and my work was submitted by Hasura's deadline, Nov 14. However, working on this issue obviously doesn't involve submitting a pull request on this repo, so there is nothing to label hacktoberfest-accepted. Who should I talk to to get credit for Hacktoberfest? Thanks)

Oh cool! Never heard of Hacktoberfest before -- but heck I'd be super stoked if I were to be somewhat eligible for a t-shirt also! :smile:

peterboyer avatar Nov 15 '21 11:11 peterboyer

~~@mehtavishwa30 Are you the right person to ask about this? (I see you were involved with some hacktoberfest PRs elsewhere)~~ Edit: resolved on Discord

josephcagle avatar Nov 15 '21 15:11 josephcagle

@ptboyer @tsujp @qtLOLI By the way, the PR has been merged and the npm package is now available as @types/graphqurl.

josephcagle avatar Nov 15 '21 16:11 josephcagle