Skip to content

Commit 0ea48d2

Browse files
Merge pull request #13879 from frndvrgs/feat-opts-listen-method
feat(fastify): adding opts to the listen method interface and deprecating variadic JSDocs warnings
2 parents 508d2f3 + aaebb6f commit 0ea48d2

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

packages/platform-fastify/interfaces/nest-fastify-application.interface.ts

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { INestApplication, HttpServer } from '@nestjs/common';
22
import {
33
FastifyBodyParser,
44
FastifyInstance,
5+
FastifyListenOptions,
56
FastifyPluginAsync,
67
FastifyPluginCallback,
78
FastifyPluginOptions,
@@ -93,19 +94,41 @@ export interface NestFastifyApplication<
9394
* Starts the application.
9495
* @returns A Promise that, when resolved, is a reference to the underlying HttpServer.
9596
*/
97+
listen(
98+
opts: FastifyListenOptions,
99+
callback?: (err: Error | null, address: string) => void,
100+
): Promise<TServer>;
101+
listen(
102+
opts?: FastifyListenOptions,
103+
): Promise<TServer>;
104+
listen(
105+
callback?: (err: Error | null, address: string) => void,
106+
): Promise<TServer>;
107+
/**
108+
* @deprecated Variadic listen method is deprecated. Please use `.listen(optionsObject, callback)` instead. The variadic signature will be removed in `fastify@5`
109+
* @see https://github.com/fastify/fastify/pull/3712
110+
*/
96111
listen(
97112
port: number | string,
98-
callback?: (err: Error, address: string) => void,
113+
callback?: (err: Error | null, address: string) => void,
99114
): Promise<TServer>;
115+
/**
116+
* @deprecated Variadic listen method is deprecated. Please use `.listen(optionsObject, callback)` instead. The variadic signature will be removed in `fastify@5`
117+
* @see https://github.com/fastify/fastify/pull/3712
118+
*/
100119
listen(
101120
port: number | string,
102121
address: string,
103-
callback?: (err: Error, address: string) => void,
122+
callback?: (err: Error | null, address: string) => void,
104123
): Promise<TServer>;
124+
/**
125+
* @deprecated Variadic listen method is deprecated. Please use `.listen(optionsObject, callback)` instead. The variadic signature will be removed in `fastify@5`
126+
* @see https://github.com/fastify/fastify/pull/3712
127+
*/
105128
listen(
106129
port: number | string,
107130
address: string,
108131
backlog: number,
109-
callback?: (err: Error, address: string) => void,
132+
callback?: (err: Error | null, address: string) => void,
110133
): Promise<TServer>;
111134
}

0 commit comments

Comments
 (0)