i have app with NestJs with server and client separately, in server side I use ValidationPipe and use decorators on DTO classes, for example
export class SearchDto {
@IsOptional()
readonly offset?: string;
@IsString()
readonly value: string;
@IsNumber()
readonly limit: number;
}
And all works OK, but on the client-side I can't use classes with decorators (its strict rule) and I simply need to use it like type, - const search: SearchDto = await...
How class-validator (class-transformer) works when there is no ValidationPipe over it? Is it wrapped it as in server side or it fully ignored? is it calls __decorate and put it inside js bundle?
Otherwise I need to write interfaces like this
export class SearchDto implements ISearchDto {
@IsOptional()
readonly offset?: string;
@IsString()
readonly value: string;
@IsNumber()
readonly limit: number;
}
export interface ISearchDto {
offset?: string;
value: string;
limit: number;
}
let decorated: SearchDto;
let nonDecorated: ISearchDto;
Thank's for help