Closed tandpfun closed 2 years ago
Fastify's FastifyContextConfig
appears to default to an empty interface {}
type. TypeScript treats {}
as a generic Object type -- you can assign any object to this type (in JS that's pretty much everything...string
, number
, {a: 1}
, etc). When fastify-metrics extended the type, it made it from {}
into a proper interface, so normal interface rules apply.
Since fastify rate-limiter doesn't extend the type FastifyContextConfig
you should either submit a PR to rate-limiter types or you should extend it manually. fastify-metrics
has no relation to it, it only extends FastifyContextConfig
.
How to do this you can see in https://github.com/SkeLLLa/fastify-metrics/blob/master/src/index.ts#L23, for example.
Hey hi!
After updating to v7.4.0, I ran into some issues with my other config options. It appears that the update doesn't let any other plugins or custom config options be entered other than the ones for this plugin.
I haven't fully figured out the issue, but it looks like something with the overwriting of the context config? The @fastify/rate-limit plugin I'm using doesn't implement any types, and config should still work for any config, even ones without types defined.
Package version things: @fastify/rate-limit: 7.4.0 fastify: 4.7.0 fastify-metrics: 9.2.2
Thank you!