SelectionLeafKeys type
Field names of T that can be selected directly by name: scalar fields and
arrays of scalars. Relationship fields need a nested path instead.
type SelectionLeafKeys<T> = T extends object
? {
[K in CleanEntityKeys<T>]-?: NonNullable<T[K]> extends
| ProjectionScalar
| readonly (ProjectionScalar | null | undefined)[]
? K
: never
}[CleanEntityKeys<T>] &
string
: never