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

Version 9 does not recursively camelCase keys in nested objects when using union with null #118

Closed
yonex opened this issue Oct 17, 2023 · 2 comments · Fixed by #119
Closed

Comments

@yonex
Copy link

yonex commented Oct 17, 2023

Hello,

I recently upgraded camelcase-keys from version 8.0.2 to 9.1.0 and encountered an issue where nested object keys are not being camelCased recursively when using a union type with null.

Example Code:

Here's a TypeScript example to illustrate the issue:

type MyType = {
  foo_bar: {
    foo_prop: string;
  } | null;
};

type MyTypeCamel = CamelCaseKeys<MyType, true>;

In version 8.0.2, the MyTypeCamel would be:

{
  fooBar: {
    fooProp: string;
  } | null;
}

However, in version 9.1.0, it becomes:

{
  fooBar: {
    foo_prop: string;
  } | null;
}

It is worth noting that this issue does not occur when the nested object type is not unioned with null.

Is this a known issue, or is there a new configuration setting that I am not aware of? I would appreciate your assistance on this matter.

Thank you!

@sindresorhus
Copy link
Owner

// @yutak23

@yonex
Copy link
Author

yonex commented Oct 18, 2023

@yutak23 @sindresorhus Thank you for the prompt resolution of the issue! I've updated to version 9.1.2 in my own project and can confirm that the issue has been resolved. I really appreciate the quick turnaround.

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