Explicit inferred types

async loginWithGoogle(user: NonNullable<Request['user']>) {
const existingUser = await this.db.query.users.findFirst({
where: eq(users.email, user.email),
});

if (existingUser) {
return existingUser;
}

const result = await this.db
.insert(users)
.values({
email: user.email,
firstName: user.firstName,
lastName: user.lastName,
})
.returning();

return result[0];
}
async loginWithGoogle(user: NonNullable<Request['user']>) {
const existingUser = await this.db.query.users.findFirst({
where: eq(users.email, user.email),
});

if (existingUser) {
return existingUser;
}

const result = await this.db
.insert(users)
.values({
email: user.email,
firstName: user.firstName,
lastName: user.lastName,
})
.returning();

return result[0];
}
Is there any way Drizzle can infer InferModel<typeof users> instead just type with members?
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server