is possible to infer model along with all its relations?
Like if I have
projects and projectsRelations which includes tasks
can I create a type Project that includes tasks?
export const projects = mysqlTable(
"projects",
{
id: serial("id").primaryKey(),
name: varchar("name", { length: 256 }),
}
)
export const projectsRelations = relations(projects, ({ many }) => ({
tasks: many(tasks),
}))
export type Project = InferModel<<projects-with-its-relations>?>
// currently I just do
export type Project = InferModel<typeof projects> & {tasks?: Task[]}
export const projects = mysqlTable(
"projects",
{
id: serial("id").primaryKey(),
name: varchar("name", { length: 256 }),
}
)
export const projectsRelations = relations(projects, ({ many }) => ({
tasks: many(tasks),
}))
export type Project = InferModel<<projects-with-its-relations>?>
// currently I just do
export type Project = InferModel<typeof projects> & {tasks?: Task[]}