UNPKG

1.25 kBTypeScriptView Raw
1import { ArgumentMetadata, PipeTransform } from '../interfaces/features/pipe-transform.interface';
2import { ErrorHttpStatusCode } from '../utils/http-error-by-code.util';
3/**
4 * @publicApi
5 */
6export interface ParseIntPipeOptions {
7 errorHttpStatusCode?: ErrorHttpStatusCode;
8 exceptionFactory?: (error: string) => any;
9 optional?: boolean;
10}
11/**
12 * Defines the built-in ParseInt Pipe
13 *
14 * @see [Built-in Pipes](https://docs.nestjs.com/pipes#built-in-pipes)
15 *
16 * @publicApi
17 */
18export declare class ParseIntPipe implements PipeTransform<string> {
19 protected readonly options?: ParseIntPipeOptions;
20 protected exceptionFactory: (error: string) => any;
21 constructor(options?: ParseIntPipeOptions);
22 /**
23 * Method that accesses and performs optional transformation on argument for
24 * in-flight requests.
25 *
26 * @param value currently processed route argument
27 * @param metadata contains metadata about the currently processed route argument
28 */
29 transform(value: string, metadata: ArgumentMetadata): Promise<number>;
30 /**
31 * @param value currently processed route argument
32 * @returns `true` if `value` is a valid integer number
33 */
34 protected isNumeric(value: string): boolean;
35}