fix: Corrected ObjectToCamel, ObjectToPascal, ObjectToSnake types
There is an issue with the ObjectToCamel, ObjectToPascal, ObjectToSnake where they don't handle an array of string number unions correctly.
For example, the following:
ObjectToCamel<{
prop_name: ("a" | "b" | "c")[];
}>
incorrectly returns:
{
propName: "a"[] | "b"[] | "c"[];
}
when it should return:
{
propName: ("a" | "b" | "c")[];
}
This PR fixes ObjectToCamel, ObjectToPascal, ObjectToSnake to return the correct string/number union array type.
Frankly, seeing fixes like this hang for months is discouraging when the library is as popular as it is.
Frankly, seeing fixes like this hang for months is discouraging when the library is as popular as it is.
@BigBallard If you want to re-write the PR so it doesn't reformat all the lines then I will look at it.
@ryanhaugh If you can preserve existing formatting then I can look at these changes.
@RossWilliams apologies for all the formatting changes - I've fixed them.
This PR also fixes this issue:
ObjectToCamel<{
property_name: undefined;
}>;
incorrectly returns:
{
propertyName: unknown[];
}
when it should return:
{
propertyName: undefined;
}
@RossWilliams let me know if you need anything else from me so we can get this across the line - thanks!
@ryanhaugh Build fails, you need to adjust the tests.
@RossWilliams I've simplified ObjectToCamel, ObjectToPascal, ObjectToSnake. I've also ensured all existing tests pass and have added more tests to ensure the bugs I've found are fixed with my PR.
@RossWilliams any chance you could take another look at this PR? Thanks! Ryan
@RossWilliams anything I can do to help move this along?
Starting to think this won't be reviewed - please prove me wrong.
Just tagging @RossWilliams so he knows that we are all annoyed :D.
PS: honstely, thanks for the library!! Please click the 2 buttons to merge and release!