Conditional Select in M2M findMany Type Inference

hey there, I'm adding a method that allows the user to either get a list of objects, and sometimes get related objects al well (members). it works fine function-wise - but for some reason, the addition of the ternary doesn't give me any type hints. I'd assume it'll add them conditionally...

Is this a bug? am I missing anything?

here is my code's paraphrase:
return db.query.projects.findMany({
    columns: {
        id: true
    },
    with: {
        membersMapping: {
            columns: {
                memberId: true,
            },
            //** this makes the type inference crazy!
            with: withMembers ? { member: { columns: { name: true, age: true } } } : {}
        }
    }
})
Was this page helpful?