Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript types #55

Open
tsujp opened this issue Nov 4, 2019 · 9 comments
Open

TypeScript types #55

tsujp opened this issue Nov 4, 2019 · 9 comments

Comments

@tsujp
Copy link

tsujp commented Nov 4, 2019

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

@qtLOLI
Copy link

qtLOLI commented Mar 10, 2020

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

@peterboyer
Copy link

peterboyer commented Jul 9, 2021

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.

@josephcagle
Copy link

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

@peterboyer
Copy link

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!

josephcagle added a commit to josephcagle/DefinitelyTyped that referenced this issue Nov 15, 2021
@josephcagle
Copy link

@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.

@josephcagle
Copy link

(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)

@peterboyer
Copy link

peterboyer commented Nov 15, 2021

@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! 😄

@josephcagle
Copy link

josephcagle commented Nov 15, 2021

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

weswigham pushed a commit to DefinitelyTyped/DefinitelyTyped that referenced this issue Nov 15, 2021
* Add type definitions for graphqurl by @hasura

Type definitions by Peter Boyer as per hasura/graphqurl#55

* Make sure graphqurl-tests.ts uses 4 spaces indent

* Make sure graphqurl files end with newlines
@josephcagle
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants