ravangen/graphql-rate-limit

graphql-rate-limit 1.3.0 upgrade issue

chenrui333 opened this issue · 2 comments

When I tried to upgrade graphql-rate-limit from 1.2.1 to 1.3.0, I run into some eslint issue as below, it looks very similar to this issue, and this is my graphql-tools dependency, "graphql-tools": "^4.0.6",

$ yarn build && cd ../.. && eslint 'packages/graphql-edge-api/**/*{.ts,.tsx,.graphql}'
$ tsc --build && yarn copyschemas
src/serverCommon.ts:139:39 - error TS2345: Argument of type '{ typeDefs: (string | DocumentNode)[]; schemaDirectives: { hasRole: any; rateLimit: typeof SchemaDirectiveVisitor; }; resolvers: IResolvers<any, any>; resolverValidationOptions: { ...; }; }' is not assignable to parameter of type 'IExecutableSchemaDefinition<any>'.
  Types of property 'schemaDirectives' are incompatible.
    Type '{ hasRole: any; rateLimit: typeof SchemaDirectiveVisitor; }' is not assignable to type '{ [name: string]: typeof SchemaDirectiveVisitor; }'.
      Property 'rateLimit' is incompatible with index signature.
        Type 'typeof import("/Users/rchen/mup/build-meetup/node_modules/@graphql-tools/utils/SchemaDirectiveVisitor").SchemaDirectiveVisitor' is not assignable to type 'typeof import("/Users/rchen/mup/build-meetup/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'.

139   const schema = makeExecutableSchema(baseOptions);
                                          ~~~~~~~~~~~

So the cause might be we are still using an old version of graphql-tools.

I see, minimum gql version is 15.0.0 now. Closing my issue.