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

fix: do not apply custom name for instanceToPlain on toClassOnly and exposeAll #1701

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

diffy0712
Copy link

Description

The following code do not run as expected with 'exposeAll' strategy.

class User {
  @Expose({ name: 'pass', toClassOnly: true })
  password: string;
}

const user = new User();
user.password = 'StrongPassword'

const plainedUser = instanceToPlain(user, {strategy: 'exposeAll'});
expect(plainedUser).toEqual({
  password: 'StrongPassword',
});
/**
 * Fails
 * 
 * - Expected  - 1
 * + Received  + 1
 *
 *   Object {
 * -   "password": "StrongPassword",
 * +   "pass": "StrongPassword",
 *   }
 */

Checklist

  • the pull request title describes what this PR does (not a vague title like Update index.md)
  • the pull request targets the default branch of the repository (develop)
  • the code follows the established code style of the repository
    • npm run prettier:check passes
    • npm run lint:check passes
  • tests are added for the changes I made (if any source code was modified)
  • documentation added or updated
  • I have run the project locally and verified that there are no errors

Fixes

fixes #1324

@diffy0712 diffy0712 requested a review from NoNameProvided May 14, 2024 21:04
@jfelicianiats
Copy link

@diffy0712 Hey thanks so much for the PR on this issue! Quick question though as I'm not familiar with this project on releases. When this gets merged, is there an estimate to when this will be released to a public npm version? It doesn't look like any releases have happened in a long time... or is there some other process now there?

@diffy0712
Copy link
Author

@jfelicianiats,
Unfortunately, I cannot give an estimate on when this will be merged and released. Hopefully soon.
I think you can follow this pr and get notified if anything happens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

fix: toClassOnly still expose the name in instanceToPlain
2 participants