help with column builder types

As I play around with learning drizzle, I wondered if I could generate a drizzle schema from a master schema. I'm very close to being able to do that. As you can see in this repo I created: https://github.com/rizen/drizzle-icing/blob/main/user.ts

The code works perfectly, but problem is that when I try to use InferModel to get the column types from my schema, I'm getting

type User {
   [x:string]: unknown;
}

Where the I would get the following on a hand-built table:

type User = {
    id: string;
    createdAt: Date;
    username: string;
    password: string;
    useAsDisplayName: "username" | "email" | "realName";
    admin: boolean;
}

My guess is that the problem lies in the use of the AnyMySqlColumnBuilder type in this function:

export const makeTable = (schema: icingSchema) => {
    const columns: Record<string, AnyMySqlColumnBuilder> = {};
    for (const prop of schema.props) {
        columns[prop.name] = prop.db(prop);
    }
    return mysqlTable(schema.tableName, columns) 
}

Any help on what I should do to get the appropriate types out for InferModel?
GitHub
A test trying to generate drizzle schemas from a master schema. - drizzle-icing/user.ts at main · rizen/drizzle-icing
Was this page helpful?