dotansimha / dotansimha/graphql-code-generator-community

Unable to use generic-sdk example with ApolloClient v3.7.6

Open
#234 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
137
Forks
195
Avg merge
6h 20m
Merged PRs (30d)
16

Description

### Is your feature request related to a problem? Please describe.

First of, thanks for the generator! :)

I'm having a Problem now upgrading ApolloClient to [v3.7.6](https://github.com/apollographql/apollo-client/releases/tag/v3.7.6)
which introduced this TypeScript feature of "Unconstrained Generics No Longer Assignable to {}"
https://devblogs.microsoft.com/typescript/announcing-typescript-4-8/#unconstrained-generics-no-longer-assignable-to

Even tho it's a minor Version bump by ApolloClient it breaks the generic-sdk CodeGenerator with the example for me.

The Example you're suggesting with ApolloClient: https://gist.github.com/akozhemiakin/731b0c1e99eb89b01f80f08f9146b6b6
Does not work anymore as the Generated SDK Requester
export type Requester = ...
is not compatible with the new ApolloClient contstraints on generic types ( ... extends OperationVariables)

Currently I'm using ApolloClient v3.7.5 which works fine.
I think moving forward the generated SDK or example should work with ApolloClient v3.7.6 ...

Thank you very much!

### Describe the solution you'd like

Maybe the generator could support making the generated

export type Requester ... compatible with ApolloClient's generic type constraints

or there could be an updated example working with ApolloClient v3.7.6+

### Describe alternatives you've considered

Trying to fix the code I'm using from the example I'm unable to make it work adding

- V extends OperationVariables
- V extends OperationVariables | undefined
-
constraints :(

### Is your feature request related to a problem? Please describe.

_No response_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.