Skip to content

Commit b8fbda2

Browse files
docs() add comments for overloaded signatures
1 parent 464c2bb commit b8fbda2

4 files changed

Lines changed: 129 additions & 6 deletions

File tree

packages/common/PACKAGE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
The common package comes with decorators such as `@Controller()`, `@Injectable` and so on.
1+
The common package comes with decorators such as `@Controller()`, `@Injectable()` and so on.

packages/common/decorators/core/controller.decorator.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ export interface ControllerOptions extends ScopeOptions {
1717
path?: string;
1818
}
1919

20-
export function Controller();
21-
export function Controller(prefix: string);
22-
export function Controller(options: ControllerOptions);
2320
/**
2421
* Decorator that marks a class as a Nest controller that can receive inbound
2522
* requests and produce responses.

packages/common/decorators/http/route-params.decorator.ts

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,64 @@ export const Headers: (
170170
property?: string,
171171
) => ParameterDecorator = createRouteParamDecorator(RouteParamtypes.HEADERS);
172172

173+
/**
174+
* Route handler parameter decorator. Extracts the `query`
175+
* property from the `req` object and populates the decorated
176+
* parameter with the value of `query`. May also apply pipes to the bound
177+
* query parameter.
178+
*
179+
* For example:
180+
* ```typescript
181+
* async find(@Query('user') user: string)
182+
* ```
183+
*
184+
* @param property name of single property to extract from the `query` object
185+
* @param pipes one or more pipes to apply to the bound query parameter
186+
*
187+
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
188+
*
189+
* @publicApi
190+
*/
173191
export function Query(): ParameterDecorator;
192+
/**
193+
* Route handler parameter decorator. Extracts the `query`
194+
* property from the `req` object and populates the decorated
195+
* parameter with the value of `query`. May also apply pipes to the bound
196+
* query parameter.
197+
*
198+
* For example:
199+
* ```typescript
200+
* async find(@Query('user') user: string)
201+
* ```
202+
*
203+
* @param property name of single property to extract from the `query` object
204+
* @param pipes one or more pipes to apply to the bound query parameter
205+
*
206+
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
207+
*
208+
* @publicApi
209+
*/
174210
export function Query(
175211
...pipes: (Type<PipeTransform> | PipeTransform)[]
176212
): ParameterDecorator;
213+
/**
214+
* Route handler parameter decorator. Extracts the `query`
215+
* property from the `req` object and populates the decorated
216+
* parameter with the value of `query`. May also apply pipes to the bound
217+
* query parameter.
218+
*
219+
* For example:
220+
* ```typescript
221+
* async find(@Query('user') user: string)
222+
* ```
223+
*
224+
* @param property name of single property to extract from the `query` object
225+
* @param pipes one or more pipes to apply to the bound query parameter
226+
*
227+
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
228+
*
229+
* @publicApi
230+
*/
177231
export function Query(
178232
property: string,
179233
...pipes: (Type<PipeTransform> | PipeTransform)[]
@@ -300,10 +354,82 @@ export function Body(
300354
);
301355
}
302356

357+
/**
358+
* Route handler parameter decorator. Extracts the `params`
359+
* property from the `req` object and populates the decorated
360+
* parameter with the value of `params`. May also apply pipes to the bound
361+
* parameter.
362+
*
363+
* For example, extracting all params:
364+
* ```typescript
365+
* findOne(@Param() params: string[])
366+
* ```
367+
*
368+
* For example, extracting a single param:
369+
* ```typescript
370+
* findOne(@Param('id') id: string)
371+
* ```
372+
* @param property name of single property to extract from the `req` object
373+
* @param pipes one or more pipes - either instances or classes - to apply to
374+
* the bound parameter.
375+
*
376+
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
377+
* @see [Working with pipes](https://docs.nestjs.com/custom-decorators#working-with-pipes)
378+
*
379+
* @publicApi
380+
*/
303381
export function Param(): ParameterDecorator;
382+
/**
383+
* Route handler parameter decorator. Extracts the `params`
384+
* property from the `req` object and populates the decorated
385+
* parameter with the value of `params`. May also apply pipes to the bound
386+
* parameter.
387+
*
388+
* For example, extracting all params:
389+
* ```typescript
390+
* findOne(@Param() params: string[])
391+
* ```
392+
*
393+
* For example, extracting a single param:
394+
* ```typescript
395+
* findOne(@Param('id') id: string)
396+
* ```
397+
* @param property name of single property to extract from the `req` object
398+
* @param pipes one or more pipes - either instances or classes - to apply to
399+
* the bound parameter.
400+
*
401+
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
402+
* @see [Working with pipes](https://docs.nestjs.com/custom-decorators#working-with-pipes)
403+
*
404+
* @publicApi
405+
*/
304406
export function Param(
305407
...pipes: (Type<PipeTransform> | PipeTransform)[]
306408
): ParameterDecorator;
409+
/**
410+
* Route handler parameter decorator. Extracts the `params`
411+
* property from the `req` object and populates the decorated
412+
* parameter with the value of `params`. May also apply pipes to the bound
413+
* parameter.
414+
*
415+
* For example, extracting all params:
416+
* ```typescript
417+
* findOne(@Param() params: string[])
418+
* ```
419+
*
420+
* For example, extracting a single param:
421+
* ```typescript
422+
* findOne(@Param('id') id: string)
423+
* ```
424+
* @param property name of single property to extract from the `req` object
425+
* @param pipes one or more pipes - either instances or classes - to apply to
426+
* the bound parameter.
427+
*
428+
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
429+
* @see [Working with pipes](https://docs.nestjs.com/custom-decorators#working-with-pipes)
430+
*
431+
* @publicApi
432+
*/
307433
export function Param(
308434
property: string,
309435
...pipes: (Type<PipeTransform> | PipeTransform)[]

packages/common/interfaces/nest-application-options.interface.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1+
import { CorsOptions } from './external/cors-options.interface';
12
import { HttpsOptions } from './external/https-options.interface';
23
import { NestApplicationContextOptions } from './nest-application-context-options.interface';
3-
import { CorsOptions } from './external/cors-options.interface';
44

55
/**
66
* @publicApi
77
*/
88
export interface NestApplicationOptions extends NestApplicationContextOptions {
99
/**
10-
* CORS options from [Express CORS package](https://github.com/expressjs/cors#configuration-options)
10+
* CORS options from [CORS package](https://github.com/expressjs/cors#configuration-options)
1111
*/
1212
cors?: boolean | CorsOptions;
1313
/**

0 commit comments

Comments
 (0)