Skip to content

Commit

Permalink
Merge pull request #13879 from frndvrgs/feat-opts-listen-method
Browse files Browse the repository at this point in the history
feat(fastify): adding opts to the listen method interface and deprecating variadic JSDocs warnings
  • Loading branch information
kamilmysliwiec authored Oct 16, 2024
2 parents 508d2f3 + aaebb6f commit 0ea48d2
Showing 1 changed file with 26 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { INestApplication, HttpServer } from '@nestjs/common';
import {
FastifyBodyParser,
FastifyInstance,
FastifyListenOptions,
FastifyPluginAsync,
FastifyPluginCallback,
FastifyPluginOptions,
Expand Down Expand Up @@ -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<TServer>;
listen(
opts?: FastifyListenOptions,
): Promise<TServer>;
listen(
callback?: (err: Error | null, address: string) => void,
): Promise<TServer>;
/**
* @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<TServer>;
/**
* @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<TServer>;
/**
* @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<TServer>;
}

0 comments on commit 0ea48d2

Please sign in to comment.