Definitelytyped: [@types/graphql] kind is not required for queryType

Created on 11 Apr 2019  路  5Comments  路  Source: DefinitelyTyped/DefinitelyTyped

  • [X] I tried using the @types/graphql package and had problems.
  • [x] I tried using the latest stable version of tsc. https://www.npmjs.com/package/typescript
  • [ ] I have a question that is inappropriate for StackOverflow. (Please ask any appropriate questions there).
  • [x] [Mention](https://github.com/blog/821-mention-somebody-they-re-notified) the authors (see Definitions by: in index.d.ts) so they can respond.

    • Authors: @martijnwalraven

I download schema from apollo-tooling with command: apollo service:download. apollo-tooling use introspectionFromSchema to generate a graphql file. As a result, I use buildClientSchema to build the schema. However, @types/graphql throw error like this:

error TS2345: Argument of type '{ "__schema": { "queryType": { "name": string; }; "mutationType": { "name": string; }; "subscriptionType": null; "types": ({ "kind": string; "name": string; "description": string; "fields": ({ "name": string; "description": string; "args": { ...; }[]; "type": { ...; }; "isDeprecated": boolean; "deprecationReason": s...' is not assignable to parameter of type 'IntrospectionQuery'.
  Types of property '__schema' are incompatible.
    Type '{ "queryType": { "name": string; }; "mutationType": { "name": string; }; "subscriptionType": null; "types": ({ "kind": string; "name": string; "description": string; "fields": ({ "name": string; "description": string; "args": { ...; }[]; "type": { ...; }; "isDeprecated": boolean; "deprecationReason": string; } | { ....' is not assignable to type 'IntrospectionSchema'.
      Types of property 'queryType' are incompatible.
        Property 'kind' is missing in type '{ "name": string; }' but required in type 'IntrospectionNamedTypeRef<IntrospectionObjectType>'.

In graphql Introspection docs, Kind is not required for queryType. Is this a bug in @type/graphql?

Most helpful comment

I'm having the same issue. I used get-graphql-schema to download the schema, and it does not have "kind" for "queryType".

All 5 comments

I'm having the same issue. I used get-graphql-schema to download the schema, and it does not have "kind" for "queryType".

Running into the same issue here. Any news or workaround?

Same issue. Assumed it was some issue with incompatible GQL versions but tried all kinds of introspection query output with no success.

Follow up:

According to NPM NPM, these types are deprecated. The lib itself comes with types.

Yes, you should remove the @types/graphql and upgrade graphql.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

victor-guoyu picture victor-guoyu  路  3Comments

alisabzevari picture alisabzevari  路  3Comments

fasatrix picture fasatrix  路  3Comments

ArtemZag picture ArtemZag  路  3Comments

jbreckmckye picture jbreckmckye  路  3Comments