question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TS Types do not agree with GQL Binding types

See original GitHub issue

Gen result from same schema:

GQL bindings:

{
  where?: UserWhereInput
  orderBy?: UserOrderByInput
  skip?: Int
  after?: String
  before?: String
  first?: Int
  last?: Int
}

GQL Code Generator:

export interface UsersQueryArgs {
  where?: UserWhereInput | null
  orderBy?: UserOrderByInput | null
  skip?: number | null
  after?: string | null
  before?: string | null
  first?: number | null
  last?: number | null
}

This makes resolvers harder to type because of the type mismatch (the following would type error):

    users: (_, args: Schema.UsersQueryArgs, ctx, info) => {
      return ctx.core.query.users(args, info)
    },

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jasonkuhrtcommented, Sep 18, 2018

haven’t been around this for a while, will do next time I am. Note there has been a new major version of GQL bindings released, of TS, so need to revisit more deeply.

0reactions
dotansimhacommented, Sep 18, 2018

@jasonkuhrt can you please try what @ardatan suggested?

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeScript with Apollo Client - Apollo GraphQL Docs
GraphQL uses a type system to clearly define the available data for each type and field in a GraphQL schema. Given that a...
Read more >
GraphQL error handling to the max with Typescript, codegen ...
In the codegen configuration, we have defined mappers between the GraphQL schema types and the Typescript types. But this is not used at...
Read more >
Graphql React Typescript error binding element 'currency ...
Error Message: Binding element 'currency' implicitly has an 'any' type. My EXCHANGE_RATES: import { ApolloClient, InMemoryCache, gql, } from "@ ...
Read more >
Generated interfaces for input types should use undefined ...
Given a returned value of undefined in the interface, it is expected that the generated input will allow undefined, but it only allows...
Read more >
TSConfig Reference - Docs on every TSConfig option
It is not a mechanism that prevents a file from being included in the codebase ... In TypeScript 4.0, support was added to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found