const getAccount = async (telegram_id: number) => {
const account = await prisma.account.findUnique({
where: { telegram_id: telegram_id.toString() },
});
return account;
};
// Testing type inference
const testTypeInference = async () => {
const account = await getAccount(123456);
if (account) {
// TypeScript should infer that account is of type Account
// but instead it infers a complex Prisma type
console.log(account.telegram_username);
}
};
testTypeInference();
const getAccount = async (telegram_id: number) => {
const account = await prisma.account.findUnique({
where: { telegram_id: telegram_id.toString() },
});
return account;
};
// Testing type inference
const testTypeInference = async () => {
const account = await getAccount(123456);
if (account) {
// TypeScript should infer that account is of type Account
// but instead it infers a complex Prisma type
console.log(account.telegram_username);
}
};
testTypeInference();