mapped-types
mapped-types copied to clipboard
IntersectionType breaks returning value of methods
Is there an existing issue for this?
- [X] I have searched the existing issues
Current behavior
I'm trying to interect two classes to obtain a dto like that:
export class QueryPageDto extends IntersectionType(PartialType(OmitType(CreatePageDto,['metafields','translations'])),PaginationDTO) {}
export default class PaginationDTO {
@ApiProperty({
minimum: 1,
default: 1,
})
@IsNumber()
@IsOptional()
@IsInt()
@Min(1)
@Type(() => Number)
readonly page?:number = 1;
@ApiProperty({
minimum: 1,
maximum: 250,
default: 50,
})
@IsNumber()
@IsOptional()
@IsInt()
@Min(1)
@Max(250)
@Type(() => Number)
readonly limit?:number = 50;
get skip(): number {
return (this.page - 1) * this.limit;
}
get take(): number {
return this.limit;
}
}
but when i type queryPageDto.skip (or take) also if is suggested they always returns undefined i tried that whitout IntersectionType and obviously works.
Minimum reproduction code
https://github.com
Steps to reproduce
No response
Expected behavior
I'm expecting returning values
Package version
2.0.5
Node.js version
20.11.0
In which operating systems have you tested?
- [ ] macOS
- [X] Windows
- [ ] Linux
Other
"@nestjs/mapped-types": "*", "@nestjs/swagger": "^7.2.0",