Support to override the @map property behavior
Opened this issue · 1 comments
alexander9306 commented
Currently, I use Kysely with Next-Auth which uses pascal Case for some properties, in my schema file I use @Map for those properties, but the generated types are using the @Map name as the correct one.
Since I have a Custom camel Case plugin with kyselly that only parse some of the properties, I can use the default "camelCase = true" option.
bictorg commented
Also had this issue :(
My workaround was wrapping the generated DB in a SnakeToCamelCaseNested type. It ignores the private select, insert, and update of the defined ColumnTypes
// Use this camel case version
type KyselyDb = SnakeToCamelCaseNested<DB>;
type SnakeToCamelCaseNested<T> = T extends object
? {
[K in keyof T as K extends `__${string}__`
? K
: SnakeToCamelCase<K & string>]: SnakeToCamelCaseNested<T[K]>;
}
: T;