Skip to content

Commit

Permalink
fix(types): fix wrong export name
Browse files Browse the repository at this point in the history
Plugin init functions had a wrong name.

BREAKING CHANGE: the plugin init functions have different names.
  • Loading branch information
dnlup authored and simonecorsi committed Nov 30, 2021
1 parent fc9c838 commit 119fdc3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
6 changes: 3 additions & 3 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ export interface MetricsPluginOptions extends Options {
};
}

export const trapsPluginCallback: FastifyPluginCallback<MetricsPluginOptions>;
export const trapsPluginAsync: FastifyPluginAsync<MetricsPluginOptions>;
export const MetricsPluginCallback: FastifyPluginCallback<MetricsPluginOptions>;
export const MetricsPluginAsync: FastifyPluginAsync<MetricsPluginOptions>;

export default trapsPluginCallback;
export default MetricsPluginCallback;

declare module 'fastify' {
interface FastifyInstance {
Expand Down
12 changes: 10 additions & 2 deletions index.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import { expectType } from 'tsd';

import Fastify from 'fastify';
import Fastify, { FastifyPluginCallback, FastifyPluginAsync } from 'fastify';
import Client from '@immobiliarelabs/dats';
import { Sampler } from '@dnlup/doc';
import plugin from './index';
import plugin, {
MetricsPluginCallback,
MetricsPluginAsync,
MetricsPluginOptions,
} from './index';

expectType<FastifyPluginCallback<MetricsPluginOptions>>(plugin);
expectType<FastifyPluginCallback<MetricsPluginOptions>>(MetricsPluginCallback);
expectType<FastifyPluginAsync<MetricsPluginOptions>>(MetricsPluginAsync);

const fastify = Fastify();

Expand Down

0 comments on commit 119fdc3

Please sign in to comment.