immobiliare / fastify-metrics

📊 Fastify plugin that integrates metrics collection and dispatch to statsd

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Types Migration

antoniomuso opened this issue · comments

The current types do the overloading of Fastify default types, this creates the problem that we found the plugin types also in data type not reached from the plugin.

fastify.get<ReqReplyMetrics, MetricsConfig>(
        '/',
        { config: { metrics: { metricId: '' } } },
        (request, reply) => {}
    );

For this reason, we can evaluate the migration to generics typing, in this way, it is the user's responsibility to type his data.

commented

I've looked into this lately, and I agree with you, the downside of this approach is that we have to use the generics in every point we need it 🤔 , that could be cumbersome in my opinion.

/cc @mdoria12