@nestjs/common
Version:
Nest - modern, fast, powerful node.js web framework (@common)
25 lines (24 loc) • 1.13 kB
TypeScript
import { ArgumentMetadata, PipeTransform } from '../interfaces/features/pipe-transform.interface.js';
/**
* Defines the built-in DefaultValue Pipe
*
* A default value that is an array or a plain object is copied on every call
* (along with the arrays and plain objects nested in it), so that a handler
* that mutates its argument does not change it for subsequent requests. Any
* other object (e.g., a class instance, a `Date` or a `Map`) is returned as is.
*
* @see [Built-in Pipes](https://docs.nestjs.com/pipes#built-in-pipes)
*
* @publicApi
*/
export declare class DefaultValuePipe<T = any, R = any> implements PipeTransform<T, T | R> {
protected readonly defaultValue: R;
constructor(defaultValue: R);
transform(value?: T, _metadata?: ArgumentMetadata): T | R;
/**
* Copies `value` if it is an array or a plain object, along with the arrays
* and plain objects nested in it. `copies` maps the objects copied so far
* to their copies, so that shared and circular references are preserved.
*/
protected copyDefaultValue<V>(value: V, copies?: Map<unknown, unknown>): V;
}