|
1 | 1 | import { INestApplication } from '@nestjs/common'; |
2 | 2 | import { |
3 | | - FastifyPlugin, |
| 3 | + FastifyInstance, |
| 4 | + FastifyPluginAsync, |
| 5 | + FastifyPluginCallback, |
4 | 6 | FastifyPluginOptions, |
5 | 7 | FastifyRegisterOptions, |
6 | 8 | } from 'fastify'; |
7 | 9 | import { |
| 10 | + Chain as LightMyRequestChain, |
8 | 11 | InjectOptions, |
9 | 12 | Response as LightMyRequestResponse, |
10 | | - Chain as LightMyRequestChain, |
11 | 13 | } from 'light-my-request'; |
12 | 14 | import { FastifyStaticOptions, PointOfViewOptions } from './external'; |
13 | 15 |
|
14 | 16 | export interface NestFastifyApplication extends INestApplication { |
15 | 17 | /** |
16 | 18 | * A wrapper function around native `fastify.register()` method. |
17 | | - * Example `app.register(require('fastify-formbody'))` |
18 | | - * |
19 | | - * @returns {this} |
| 19 | + * Example `app.register(require('fastify-formbody')) |
| 20 | + * @returns {Promise<FastifyInstance>} |
20 | 21 | */ |
21 | | - register<Options extends FastifyPluginOptions>( |
22 | | - plugin: FastifyPlugin<Options>, |
| 22 | + register<Options extends FastifyPluginOptions = any>( |
| 23 | + plugin: |
| 24 | + | FastifyPluginCallback<Options> |
| 25 | + | FastifyPluginAsync<Options> |
| 26 | + | Promise<{ default: FastifyPluginCallback<Options> }> |
| 27 | + | Promise<{ default: FastifyPluginAsync<Options> }>, |
23 | 28 | opts?: FastifyRegisterOptions<Options>, |
24 | | - ): this; |
| 29 | + ): Promise<FastifyInstance>; |
25 | 30 |
|
26 | 31 | /** |
27 | 32 | * Sets a base directory for public assets. |
28 | 33 | * Example `app.useStaticAssets({ root: 'public' })` |
29 | | - * |
30 | 34 | * @returns {this} |
31 | 35 | */ |
32 | 36 | useStaticAssets(options: FastifyStaticOptions): this; |
|
0 commit comments