Open
Description
I was trying to...
export class Test {
@Expose({ groups: ['1'] })
prop1: string;
@Expose({ groups: ['2'] })
prop2: string;
}
const test = {
prop1: 'prop1',
prop2: 'prop2'.
}
const inst = plainToClass(Test, test, {
groups: ['1'],
excludeExtraneousValue: true,
})
console.log(inst)
// { prop1: 'prop1', prop2: undefined }
The problem:
I wonder if there's a way to exclude properties not included in the specified group when using plainToClass, not just make it undefined
. In this case, I want the inst
to be only { prop1: 'prop1' }
instead of { prop1: 'prop1', prop2: undefined }