diff --git a/packages/platform-fastify/interfaces/nest-fastify-application.interface.ts b/packages/platform-fastify/interfaces/nest-fastify-application.interface.ts index c52d804a640..4ce780d0a28 100644 --- a/packages/platform-fastify/interfaces/nest-fastify-application.interface.ts +++ b/packages/platform-fastify/interfaces/nest-fastify-application.interface.ts @@ -2,6 +2,7 @@ import { INestApplication, HttpServer } from '@nestjs/common'; import { FastifyBodyParser, FastifyInstance, + FastifyListenOptions, FastifyPluginAsync, FastifyPluginCallback, FastifyPluginOptions, @@ -93,19 +94,41 @@ export interface NestFastifyApplication< * Starts the application. * @returns A Promise that, when resolved, is a reference to the underlying HttpServer. */ + listen( + opts: FastifyListenOptions, + callback?: (err: Error | null, address: string) => void, + ): Promise; + listen( + opts?: FastifyListenOptions, + ): Promise; + listen( + callback?: (err: Error | null, address: string) => void, + ): Promise; + /** + * @deprecated Variadic listen method is deprecated. Please use `.listen(optionsObject, callback)` instead. The variadic signature will be removed in `fastify@5` + * @see https://github.com/fastify/fastify/pull/3712 + */ listen( port: number | string, - callback?: (err: Error, address: string) => void, + callback?: (err: Error | null, address: string) => void, ): Promise; + /** + * @deprecated Variadic listen method is deprecated. Please use `.listen(optionsObject, callback)` instead. The variadic signature will be removed in `fastify@5` + * @see https://github.com/fastify/fastify/pull/3712 + */ listen( port: number | string, address: string, - callback?: (err: Error, address: string) => void, + callback?: (err: Error | null, address: string) => void, ): Promise; + /** + * @deprecated Variadic listen method is deprecated. Please use `.listen(optionsObject, callback)` instead. The variadic signature will be removed in `fastify@5` + * @see https://github.com/fastify/fastify/pull/3712 + */ listen( port: number | string, address: string, backlog: number, - callback?: (err: Error, address: string) => void, + callback?: (err: Error | null, address: string) => void, ): Promise; }