Select<Type> Help

Random, but how can I get this to be type safe?

type Reports = {
    character: typeof characters.$inferSelect & {
        faction: typeof factions.$inferSelect,
        guild: typeof guilds.$inferSelect & {
            faction: typeof factions.$inferSelect
        }
    },
    log: typeof logs.$inferSelect
}
const characterFaction = alias(factions, 'characterFaction')
const guildFaction = alias(factions, 'guildFaction')

const preparedReports = db.select({
    character: {
        ...characters,
        faction: characterFaction,
        guild: {
            ...guilds,
            faction: guildFaction
        }
    },
    log: logs

}) 
//...

I get the object exactly how I want it but just not the type safety where it knows the Reports type is the actual selected type
Was this page helpful?