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

feat: TypedDocumentNode support & strict variable typings #350

Conversation

n1ru4l
Copy link
Contributor

@n1ru4l n1ru4l commented May 10, 2022

@jasonkuhrt
Copy link
Member

Will try to look at this next week.

Copy link
Member

@jasonkuhrt jasonkuhrt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add some tests that show there are no type errors where we don't expect them and vice versa. You've done some or all of that work, but at least it needs to be moved.


export type BatchRequestsOptions<V = Variables> = {
documents: BatchRequestDocument<V>[]
requestHeaders?: Dom.RequestInit['headers']
signal?: Dom.RequestInit['signal']
}

export type RequestExtendedOptions<V = Variables> = { url: string } & RequestOptions<V>
export type RequestExtendedOptions<V = Variables, T = any> = { url: string } & RequestOptions<V, T>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's rename T to what it is.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jasonkuhrt,

I'm working with @n1ru4l at The Guild, making this PR move forward.

Regarding your point, the T naming is used everywhere for the result type, do you want me to change it everywhere or just there?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, everywhere I guess.

console.log(data.greetings)
})().catch((error) => console.error(error))

/** TypeScript API Tests */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this to the test suite sommewhere.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done in 362cc9b

@charlypoly
Copy link
Contributor

@jasonkuhrt, I ran yarn format locally, and it looks like it was not run for a long time (or not part of the CI)...

Do all the format changes in this PR looks ok, or should I revert them?

@jasonkuhrt
Copy link
Member

Do all the format changes in this PR looks ok, or should I revert them?

It is fine, thanks! Yeah we need a format check in CI.

examples/typed-document-node.ts Outdated Show resolved Hide resolved
@jasonkuhrt jasonkuhrt changed the title feat: introduce TypedDocumentNode support and strict variable typings feat: TypedDocumentNode support & strict variable typings Aug 2, 2022
@jasonkuhrt jasonkuhrt merged commit a7ac904 into graffle-js:master Aug 2, 2022
@n1ru4l n1ru4l deleted the feat-strict-typings-with-typed-document-node branch August 2, 2022 15:43
@charlypoly
Copy link
Contributor

Thanks, @jasonkuhrt! ⚡

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

Successfully merging this pull request may close these issues.

5 participants