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-vue-urql typing issue with generated code #9421

Closed
kefniark opened this issue May 17, 2023 · 15 comments
Closed

typescript-vue-urql typing issue with generated code #9421

kefniark opened this issue May 17, 2023 · 15 comments

Comments

@kefniark
Copy link

kefniark commented May 17, 2023

Which packages are impacted by your issue?

@graphql-codegen/typescript-vue-urql

Describe the bug

The issue I'm running into is that the code generated by typescript-vue-urql is not compatible with recent version of @urql/vue. Apparently one of the property variables is optional in the generated code, but not for @urql/vue, causing some typescript errors.

I'm ignoring this issue for months by just not bumping urql version, but now I need to update and I running into this codegen issue once again.

Your Example Website or App

https://github.com/kefniark/issue-codegen-urql-vue

Steps to Reproduce the Bug or Issue

Please check the Readme.md

  • yarn : install deps
  • yarn generate : use codegen to generate client code
  • yarn test : validate the client code

Expected behavior

The generated code should match @urql/vue typings.

Screenshots or Videos

image

Platform

  • OS: Windows, Linux
  • NodeJS: 18

in the reproduction repository everything is freshly installed and up-to-date (codegen, typescript, urql)

@kefniark kefniark changed the title typescript-vue-urql issue typescript-vue-urql typing issue with generated code May 17, 2023
@DevelonPro
Copy link

Can confirm with typescript-urql as well, this is an issue for me.

Seems like the urql developers were aware that this would break in codegen according to this: urql-graphql/urql#2606 (comment)

@TimoStolz
Copy link

+1

@TimoStolz
Copy link

@DevelonPro, @kefniark: Do you know a workaround until it is fixed?

@kefniark
Copy link
Author

Sadly, except using older version of urql, not really

@TimoStolz
Copy link

For further reference, this bug was also reported as issue #328 in dotansimha/graphql-code-generator-community with a PR that resolves the issue. This could serve as a workaround.

@TimoStolz
Copy link

The relevant change in urql is reported here: urql-graphql/urql#2607

@xmimiex
Copy link

xmimiex commented Jun 16, 2023

Hello, any news ?

@kefniark
Copy link
Author

kefniark commented Jun 30, 2023

Sadly not much,
It's still in graphql-code-generator PR ... 😮‍💨
It looks like it's really just missing someone to merge and publish.
So frustrating to see a basic type issue taking so long for no apparent reason.

@michael-pattern
Copy link

michael-pattern commented Sep 14, 2023

It looks like this is now available as an alpha release https://www.npmjs.com/package/@graphql-codegen/typescript-vue-urql/v/3.0.0-alpha-20230911210300-bd6b199b9

Only problem is that typing is not fixed for Subscriptions

export function useFoobarSubscription<R = FoobarSubscription>(options: Omit<Urql.UseSubscriptionArgs<never, FoobarSubscriptionVariables>, 'query'> = {}, handler?: Urql.SubscriptionHandlerArg<FoobarSubscription, R>) {
  return Urql.useSubscription<FoobarSubscription, R, FoobarSubscriptionVariables>({ query: FoobarDocument, ...options }, handler);
};
Property 'variables' is missing in type '{}' but required in type 'Omit<UseSubscriptionArgs<never, Exact<{ foobar: Foobar; }>>, "query">'

@semanser
Copy link

I had the same issue (with subscriptions in particular) but it got resolved after I updated to the latest versions. So make sure that you're on the latest version.

@graphql-codegen/typescript from 2.7.3 to 4.0.2
@graphql-codegen/typescript-urql from 3.6.4 to 4.0.0
@graphql-codegen/introspection from 2.2.1 to 4.0.1
@graphql-codegen/typescript-operations from 2.5.3 to 4.1.0
@graphql-codegen/cli from 2.11.6 to 5.0.1
@graphql-codegen/urql-introspection from 2.2.1 to 3.0.0

@mwahlhuetter
Copy link

@semanser Can not confirm.
Still a problem for subscriptions that have variables with the latest version.

@michael-pattern
Copy link

Also can not confirm, this problem is still persistent. This is relevant to subscriptions. I tested today using

@graphql-codegen/cli 5.0.2
@graphql-codegen/typescript 4.0.6
@graphql-codegen/typescript-operations 4.2.0
@graphql-codegen/typescript-vue-urql 3.0.0

@michael-pattern
Copy link

As of @graphql-codegen/typescript-vue-urql@3.1.0 this appears to be fixed!

@Ivan8R
Copy link

Ivan8R commented Jun 5, 2024

This issue not fixed in 3.1.0

@saihaj
Copy link
Collaborator

saihaj commented Sep 5, 2024

@saihaj saihaj closed this as completed Sep 5, 2024
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

No branches or pull requests

9 participants