Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why is @Expose() decorator required to create new property fields? #1508

Open
Krrish-raj opened this issue Apr 18, 2023 · 0 comments
Open

Why is @Expose() decorator required to create new property fields? #1508

Krrish-raj opened this issue Apr 18, 2023 · 0 comments
Labels
type: question Questions about the usage of the library.

Comments

@Krrish-raj
Copy link

Krrish-raj commented Apr 18, 2023

Say I have the following class definition:

export class Filter {
    @IsEnum(FilterType)
    id: FilterType

    @IsString()
    /* This is not getting executed. **/
    @Transform(({ obj }) => LabelGenerator.getfilterTypeLabel(obj.id), { toClassOnly: true })
    label: string;

    @IsEnum(FilterSelectType)
    select: FilterSelectType;
}

I am using a plain object: {id: 'Sample', select: 'multi'} to create the class.

In the above case, @Transform decorator is not getting executed, but if I put @expose() decorator on top of that, it works as expected. Is this the expected behavior?

@Krrish-raj Krrish-raj added the type: question Questions about the usage of the library. label Apr 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question Questions about the usage of the library.
Development

No branches or pull requests

1 participant