Skip to content

Commit

Permalink
fix(types): fix cannot cast MetricsPluginOptions properties to specif…
Browse files Browse the repository at this point in the history
…ic type
  • Loading branch information
mdoria12 committed Mar 16, 2022
1 parent c43ef86 commit 956a4af
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type GetDynamicRouteLabel = (
request: FastifyRequest,
reply: FastifyReply
) => string;

type GetStaticRouteLabel = (
options: RouteOptions & {
routePath: string;
Expand Down Expand Up @@ -54,8 +55,6 @@ type StaticMode = {
getLabel?: GetStaticRouteLabel;
} & CommonRouteOptions;

type RoutesOptions = StaticMode | DynamicMode;

type SamplerOptions = {
sampleInterval?: number;
eventLoopOptions?: {
Expand All @@ -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<MetricsPluginOptions>;
export const MetricsPluginAsync: FastifyPluginAsync<MetricsPluginOptions>;

Expand Down

0 comments on commit 956a4af

Please sign in to comment.