Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

type issue #46

Open
nicolasburtey opened this issue May 10, 2021 · 2 comments
Open

type issue #46

nicolasburtey opened this issue May 10, 2021 · 2 comments

Comments

@nicolasburtey
Copy link

trying to run the Value validation example.

I'm being returned this issue by typescript :

error TS2322: Type 'typeof ConcreteValidateDirectiveVisitor' is not assignable to type 'typeof SchemaDirectiveVisitor'.
  Types of property 'visitSchemaDirectives' are incompatible.
    Type '(schema: GraphQLSchema, directiveVisitors: { [directiveName: string]: typeof SchemaDirectiveVisitor; }, context?: { [key: string]: any; } | undefined) => { [directiveName: string]: SchemaDirectiveVisitor[]; }' is not assignable to type '(schema: GraphQLSchema, directiveVisitors: Record<string, typeof SchemaDirectiveVisitor>, context?: Record<string, any> | undefined, pathToDirectivesInExtensions?: string[] | undefined) => Record<...>'.
      Types of parameters 'directiveVisitors' and 'directiveVisitors' are incompatible.
        Type 'Record<string, typeof SchemaDirectiveVisitor>' is not assignable to type '{ [directiveName: string]: typeof SchemaDirectiveVisitor; }'.
          Index signatures are incompatible.
            Type 'typeof import("node_modules/@graphql-tools/utils/SchemaDirectiveVisitor").SchemaDirectiveVisitor' is not assignable to type 'typeof import("node_modules/apollo-server-core/node_modules/graphql-tools/dist/schemaVisitor").SchemaDirectiveVisitor'.
              The types returned by 'getDirectiveDeclaration(...)' are incompatible between these types.
                Type 'GraphQLDirective | null | undefined' is not assignable to type 'GraphQLDirective'.
                  Type 'undefined' is not assignable to type 'GraphQLDirective'.

adding // @ts-ignore before schemaDirectives: { range }, is silencing the issue

@smbkr
Copy link

smbkr commented May 21, 2021

The type of SchemaDirectiveVisitor from graphql-tools changed from v5 onwards. This lib will work with v4 of graphql-tools.

@barbieri
Copy link
Member

this will be fixed once we update to apollo v3 and newer graphql-tools, likely with #56

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants