MySqlInsertValue<> vs typeof Table type mismatch

I've got this line of code:

await db.insert(table).values(props);


Where props is showing a TS problem:

Argument of type 'ModelMap[T]["select"]' is not assignable to parameter of type 'MySqlInsertValue<ModelMap[T]["model"]>'.
  Type '{ id: string; createdAt: Date; updatedAt: Date; username: string; email: string; realName: string; password: string; passwordType: "bcrypt"; useAsDisplayName: "username" | "email" | "realName"; admin: boolean; developer: boolean; } | { ...; }' is not assignable to type 'MySqlInsertValue<ModelMap[T]["model"]>'.
    Type '{ id: string; createdAt: Date; updatedAt: Date; username: string; email: string; realName: string; password: string; passwordType: "bcrypt"; useAsDisplayName: "username" | "email" | "realName"; admin: boolean; developer: boolean; }' is not assignable to type 'MySqlInsertValue<ModelMap[T]["model"]>'.


The variables in there are typed like:

db: MySql2Database
table: ModelMap[T]['model'] 
props: ModelMap[T]['select']


The ModelMap is an index of all the different types generated by various drizzle schemas I have, so that they are available for quick reference by just passing T.

ModelMap[T]['model'] is equivalent to typeof SomeTable and ModelMap[T]['select'] is equivalent to InferModel<typeof SomeTable>

What might be causing this problem?
Was this page helpful?