graphql-editor / graphql-zeus

GraphQL client and GraphQL code generator with GraphQL autocomplete library generation ⚡⚡⚡ for browser,nodejs and react native ( apollo compatible )
https://graphqleditor.com/docs/zeus
MIT License
1.95k stars 106 forks source link

Unexpected behaviour when using Chain #401

Closed AleksanderBondar closed 5 months ago

AleksanderBondar commented 5 months ago

Screenshot 2024-06-06 at 11 24 05

Possible solution on Thunder.

o: Z & { [P in keyof Z]: P extends keyof ValueTypes[R] ? Z[P] : P extends keyof SCLR ? Z[P] : never; }
AleksanderBondar commented 5 months ago

Resolved by using generic parameter for Chain

const chain = <T extends 'query' | 'mutation'>(option: T) =>
  Chain(`${process.env.SHOP_HOST || 'http://localhost:3001'}/admin-api`, {
    headers: {
      'Content-type': 'application/json',
      Authorization: `Bearer `,
      // ...(channel ? { 'vendure-token': channel } : {}),
    },
  })(option, { scalars });