If you have a child prop that has a null union, Camelize stops trying to camelize that property. The following is a basic reproducable example:
import type { Camelize } from 'camelize-ts'
import camelize from 'camelize-ts'
type SnakeCasedChild = {
foo_bar: string
}
type SnakeCasedParent = {
child: SnakeCasedChild[] | null
}
type CamelCasedParent = Camelize<SnakeCasedParent>
const myObject: CamelCasedParent = camelize({
child: [{ foo_bar: 'hello' }],
})
myObject.child?.map((child) => child.fooBar)
You'll notice that TypeScript complains that child.fooBar is not a valid property, but child.foo_bar is.
If you have a child prop that has a null union,
Camelizestops trying to camelize that property. The following is a basic reproducable example:You'll notice that TypeScript complains that
child.fooBaris not a valid property, butchild.foo_baris.