bookish-potato-dto
Version:
A TypeScript DTO (Data Transfer Object) parsing and validation library. Define a schema once — get runtime validation and a fully inferred TypeScript type for free.
19 lines (18 loc) • 715 B
TypeScript
import { PropertyParser, Range } from '../types';
import { PropertyParserAbstract } from './property-parser.abstract';
export declare abstract class PropertyParserRangeDecorator<T> extends PropertyParserAbstract<T> {
private readonly _range;
private readonly _parser;
private readonly _errorMessage;
protected constructor(data: {
range: Partial<Range>;
parser: PropertyParser<T>;
errorMessage?: string;
});
parse(value: unknown): T;
private _checkIfMoreThan;
protected abstract checkIfMoreThan(value: T, min: number): boolean;
private _checkIfLessThan;
protected abstract checkIfLessThan(value: T, max: number): boolean;
private checkIfInRange;
}