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

The option ignoreDecorators does not ignore @Transform #1471

Open
cjsewell opened this issue Mar 8, 2023 · 3 comments
Open

The option ignoreDecorators does not ignore @Transform #1471

cjsewell opened this issue Mar 8, 2023 · 3 comments
Labels
status: needs triage Issues which needs to be reproduced to be verified report. type: fix Issues describing a broken feature.

Comments

@cjsewell
Copy link

cjsewell commented Mar 8, 2023

Description

The option ignoreDecorators does not ignore @Transform

Minimal code-snippet showcasing the problem

class MyClass {
    @Transform(({ value }) => `${value} transformed`, {
        toClassOnly: true,
    })
    prop: '';

}

const plain = { prop: 'prop' };

const result = plainToClass(MyClass, plain);
console.log(result.prop); // expected output: "prop transformed"

const resultNoDecorators = plainToClass(MyClass, plain, { ignoreDecorators: true });
console.log(resultNoDecorators.prop); // expected output: "prop"

Expected behavior

I expect the resultNoDecorators object to have the prop property with the original value, without any transformations applied.

Actual behavior

The resultNoDecorators object still has the prop property transformed, even though the ignoreDecorators option is used.nested. Prop

@cjsewell cjsewell added status: needs triage Issues which needs to be reproduced to be verified report. type: fix Issues describing a broken feature. labels Mar 8, 2023
@Eslam-Gaber645
Copy link

+1

1 similar comment
@hanyeol
Copy link

hanyeol commented Jan 3, 2024

+1

@hanyeol
Copy link

hanyeol commented Jan 3, 2024

The same applies to plainToInstance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs triage Issues which needs to be reproduced to be verified report. type: fix Issues describing a broken feature.
Development

No branches or pull requests

3 participants