Graphql-code-generator: Extraneous import GraphQLScalarTypeConfig

Created on 10 Dec 2018  路  3Comments  路  Source: dotansimha/graphql-code-generator

Describe the bug

Generated template imports GraphQLScalarTypeConfig causing:

TS6133: 'GraphQLScalarTypeConfig' is declared but its value is never read.

To Reproduce

Schema

type Query {
  me: User
}

type User {
  id: ID!
  firstName: String!
  fullName: String!
  lastName: String!
}

Documents

query Me {
  me {
    id
    fullName
  }
}

plugins

    plugins:
      - add
      - typescript-common
      - typescript-client
      - typescript-server
      - typescript-resolvers
      - typescript-react-apollo

tsconfig.json

{
  "compilerOptions": {
    "noUnusedLocals": true
    ...
bug plugins waiting-for-release

Most helpful comment

I guess it would be nice to have a shared logic for that. You request an import and after everything compiles we prepend it with import statements. Otherwise we would have to copy&paste the same logic over and over again.

@ardatan @dotansimha

All 3 comments

@ardatan I think it's related to the recent changes in the resolvers package. What do you think?

It is related to change for adding scalar resolvers. So, we need to import this type if only there is any scalar in the schema. I鈥檒l take care of it.

I guess it would be nice to have a shared logic for that. You request an import and after everything compiles we prepend it with import statements. Otherwise we would have to copy&paste the same logic over and over again.

@ardatan @dotansimha

Was this page helpful?
0 / 5 - 0 ratings