fix: exposed getter function returns null if it returns other, excluded, parameter
Description
The getter function used in the NestJS controller omits the result if inside function body we use other (excluded) property. Meaning in my example, controller will return JSON without 'name' property at all..
Minimal code-snippet showcasing the problem
@Exclude()
export class exampleDto {
@Expose()
get name(): string {
return this.intlName
}
readonly intlName?: string;
}
Expected behavior
'name' property should be visible with the value of 'intlName' property
Actual behavior
'name' property is missing in response json
any update ?
It is originated from the inability of es6 class
I would expect class-transformer handles this case internally
Workaround can be found here: https://stackoverflow.com/questions/42107492/json-stringify-es6-class-property-with-getter-setter
maybe we can include this logic into class-transformer 🤔
I checked. It's working now