Open
Description
Description
It seems that using plainToInstance
where you have a few getters (without setters) doesn't work.
I have this recollection where I converted responses in Angular and this used to work.
But I tried up to class-transformer 0.4.0 and it always behaves the same.
This is somewhat related (or clones) #1257
class ErrorResponse {
@Expose()
get errorCode(): number {
return this._errorCode;
}
constructor(protected _errorCode: number = 800){}
}
plainToInstance(ErrorResponse, {
"errorCode": 123
});
Blitz with full code here => https://stackblitz.com/edit/ts-class-transformer-issue
Expected behavior
I would expect to have
{
errorCode: 123
}
Actual behavior
{
errorCode: 800
}