TypeScript types
Is anyone able to add TypeScript types directly to this library? Are PRs requested? I cannot find any on DefinitelyTyped via @types/graphqurl.
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
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.
Hasura noob here. Does that graphqurl.d.ts file need any changes? If not, I can make a PR for DefinitelyTyped.
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!
@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.
(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)
@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
hacktoberfestlabel 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 labelhacktoberfest-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:
~~@mehtavishwa30 Are you the right person to ask about this? (I see you were involved with some hacktoberfest PRs elsewhere)~~ Edit: resolved on Discord
@ptboyer @tsujp @qtLOLI By the way, the PR has been merged and the npm package is now available as @types/graphqurl.