From 956a4afcbf0532568f4f1924e2e4c8677f0acb45 Mon Sep 17 00:00:00 2001 From: Michele Doria <85507169+mdoria12@users.noreply.github.com> Date: Wed, 16 Mar 2022 12:16:59 +0100 Subject: [PATCH] fix(types): fix cannot cast MetricsPluginOptions properties to specific type --- index.d.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/index.d.ts b/index.d.ts index 18f1562..899e6ae 100644 --- a/index.d.ts +++ b/index.d.ts @@ -20,6 +20,7 @@ type GetDynamicRouteLabel = ( request: FastifyRequest, reply: FastifyReply ) => string; + type GetStaticRouteLabel = ( options: RouteOptions & { routePath: string; @@ -54,8 +55,6 @@ type StaticMode = { getLabel?: GetStaticRouteLabel; } & CommonRouteOptions; -type RoutesOptions = StaticMode | DynamicMode; - type SamplerOptions = { sampleInterval?: number; eventLoopOptions?: { @@ -79,10 +78,12 @@ type MetricsInstanceDecorator = { export interface MetricsPluginOptions { client?: ClientOptions | CustomClient; - routes?: boolean | RoutesOptions; + routes?: boolean | StaticMode | DynamicMode; health?: boolean | SamplerOptions; } +export { ClientOptions, CustomClient, StaticMode, DynamicMode, SamplerOptions }; + export const MetricsPluginCallback: FastifyPluginCallback; export const MetricsPluginAsync: FastifyPluginAsync;