From fec6e82d52e43bce554aea12cf52f30d3ae8504e Mon Sep 17 00:00:00 2001 From: Fernando Vargas Date: Mon, 12 Aug 2024 08:12:24 -0300 Subject: [PATCH 1/2] feat(fastify): updates interface adding opts to the listen method --- .../nest-fastify-application.interface.ts | 29 +++++++++++++++++-- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/packages/platform-fastify/interfaces/nest-fastify-application.interface.ts b/packages/platform-fastify/interfaces/nest-fastify-application.interface.ts index c52d804a640..2d6baca5661 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; } From aaebb6f278efcbee22fa1f6c074f84ae5c2c43b8 Mon Sep 17 00:00:00 2001 From: Fernando Vargas Date: Mon, 12 Aug 2024 08:43:07 -0300 Subject: [PATCH 2/2] feat(fastify): setting opts object optional variation --- .../interfaces/nest-fastify-application.interface.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/platform-fastify/interfaces/nest-fastify-application.interface.ts b/packages/platform-fastify/interfaces/nest-fastify-application.interface.ts index 2d6baca5661..4ce780d0a28 100644 --- a/packages/platform-fastify/interfaces/nest-fastify-application.interface.ts +++ b/packages/platform-fastify/interfaces/nest-fastify-application.interface.ts @@ -99,7 +99,7 @@ export interface NestFastifyApplication< callback?: (err: Error | null, address: string) => void, ): Promise; listen( - opts: FastifyListenOptions, + opts?: FastifyListenOptions, ): Promise; listen( callback?: (err: Error | null, address: string) => void,