Comments (6)
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.
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.
@KirillTregubov For your issue, please try version 8.0.2
from fastify-rate-limit.
Would you like to send PR to update the types?
Sure, I'll take a look today
from fastify-rate-limit.
from fastify-rate-limit.
Fixed, thanks so much!
from fastify-rate-limit.
Related Issues (20)
- Don't set the reply code automatically HOT 2
- How to Limit Download Speed in fastify-rate-limit? HOT 4
- Rate limiter not working at all? Followed documentation. HOT 3
- Inexistent page is pending forever ```server.setNotFoundHandler``` HOT 1
- Weird ES8 module imports HOT 18
- Incorrect Retry-After header value HOT 3
- continueExceeding option does not work as expected HOT 2
- Wrong type for rateLimit: false HOT 2
- Retry-After should use units of seconds HOT 2
- Align the behaviors of the LocalStore and RedisStore
- Updating for v5 HOT 8
- Make ban work with Redis
- Issue v5 release
- Cannot read properties of null (reading 'key') — /app/node_modules/tiny-lru/dist/tiny-lru.cjs in LRU.evict at line 65:27 HOT 3
- Bug in LRU cache can cause persistent server failure HOT 9
- Add parser option HOT 2
- eslint no-misused-promise in notFoundHandler HOT 17
- Rate limit don't working even using async/await HOT 2
- Support node-redis, possibly along with ioredis? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fastify-rate-limit.