Giter Site home page Giter Site logo

Comments (6)

KirillTregubov avatar KirillTregubov commented on June 7, 2024

Same here. My type error (censored imports):

error TS2769: No overload matches this call.
  Overload 1 of 3, '(plugin: FastifyPluginCallback<{ max: number; timeWindow: string; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>, opts?: FastifyRegisterOptions<...> | undefined): FastifyInstance<...> & PromiseLike<...>', gave the following error.
    Argument of type 'typeof import(".../node_modules/@fastify/rate-limit/types/index")' is not assignable to parameter of type 'FastifyPluginCallback<{ max: number; timeWindow: string; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>'.
      Type 'typeof import(".../node_modules/@fastify/rate-limit/types/index")' provides no match for the signature '(instance: FastifyInstance<RawServerDefault, IncomingMessage, ServerResponse<IncomingMessage>, FastifyBaseLogger, FastifyTypeProvider>, opts: { ...; }, done: (err?: Error | undefined) => void): void'.
  Overload 2 of 3, '(plugin: FastifyPluginAsync<{ max: number; timeWindow: string; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>, opts?: FastifyRegisterOptions<...> | undefined): FastifyInstance<...> & PromiseLike<...>', gave the following error.
    Argument of type 'typeof import(".../node_modules/@fastify/rate-limit/types/index")' is not assignable to paramet      Type 'typeof import(".../node_modules/@fastify/rate-limit/types/index")' provides no match for the signature '(instance: FastifyInstance<RawServerDefault, IncomingMessage, ServerResponse<IncomingMessage>, FastifyBaseLogger, FastifyTypeProvider>, opts: { ...; }): Promise<...>'.
  Overload 3 of 3, '(plugin: FastifyPluginCallback<{ max: number; timeWindow: string; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger> | FastifyPluginAsync<...> | Promise<...> | Promise<...>, opts?: FastifyRegisterOptions<...> | undefined): FastifyInstance<...> & PromiseLike<...>', gave the following error.
    Argument of type 'typeof import(".../node_modules/@fastify/rate-limit/types/index")' is not assignable to parameter of type 'FastifyPluginCallback<{ max: number; timeWindow: string; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger> | FastifyPluginAsync<...> | Promise<...> | Promise<...>'.

fastify.register(rateLimit, {
                 ~~~~~~~~~

from fastify-rate-limit.

climba03003 avatar climba03003 commented on June 7, 2024

I didn't see the types properly set the FastifyRouteConfig interface in this plugin.
It is correct that typescript throw error in this case.

Would you like to send PR to update the types?

from fastify-rate-limit.

climba03003 avatar climba03003 commented on June 7, 2024

@KirillTregubov For your issue, please try version 8.0.2

from fastify-rate-limit.

FabianFrank avatar FabianFrank commented on June 7, 2024

Would you like to send PR to update the types?

Sure, I'll take a look today

from fastify-rate-limit.

FabianFrank avatar FabianFrank commented on June 7, 2024

#306

from fastify-rate-limit.

KirillTregubov avatar KirillTregubov commented on June 7, 2024

Fixed, thanks so much!

from fastify-rate-limit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.