forked from fastify/fastify
-
Notifications
You must be signed in to change notification settings - Fork 0
/
register.d.ts
29 lines (26 loc) · 1.02 KB
/
register.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { FastifyPluginOptions, FastifyPluginCallback, FastifyPluginAsync } from './plugin'
import { LogLevel } from './logger'
/**
* FastifyRegister
*
* Function for adding a plugin to fastify. The options are inferred from the passed in FastifyPlugin parameter.
*/
export interface FastifyRegister<T = void> {
<Options extends FastifyPluginOptions>(
plugin: FastifyPluginCallback<Options>,
opts?: FastifyRegisterOptions<Options>
): T;
<Options extends FastifyPluginOptions>(
plugin: FastifyPluginAsync<Options>,
opts?: FastifyRegisterOptions<Options>
): T;
<Options extends FastifyPluginOptions>(
plugin: FastifyPluginCallback<Options> | FastifyPluginAsync<Options> | Promise<{ default: FastifyPluginCallback<Options> }> | Promise<{ default: FastifyPluginAsync<Options> }>,
opts?: FastifyRegisterOptions<Options>
): T;
}
export type FastifyRegisterOptions<Options> = (RegisterOptions & Options) | (() => RegisterOptions & Options)
interface RegisterOptions {
prefix?: string;
logLevel?: LogLevel;
}