mongoose
mongoose copied to clipboard
IntersectionType and Prop decorator
Is there an existing issue for this?
- [X] I have searched the existing issues
Current behavior
When I use IntersectionType:
export class First {
@Prop()
first: string;
}
export class Second {
@Prop()
second: string;
}
export class Last extends IntersectionType(First, Second) {
@Prop()
last: string;
}
The problem is that properties like first and second are ignored.
const result = await this.model.create({
first: 'First',
second: 'Second',
last: 'Last'
});
output:
{last: 'Last'}
Minimum reproduction code
https://github.com/nestjs/mongoose
Steps to reproduce
No response
Expected behavior
const result = await this.model.create({
first: 'First',
second: 'Second',
last: 'Last'
});
output:
{first: 'First', second: 'Second', last: 'Last'}
Package version
10.0.4
mongoose version
8.0.2
NestJS version
10.3.3
Node.js version
21.7
In which operating systems have you tested?
- [X] macOS
- [ ] Windows
- [ ] Linux
Other
No response