hello guys I am having a problem with the types in typescript. I am using micro orm to fetch data from the database I am using this code
const user = (await orm).em.findOne(User, { username: options.username });
it's returning me
user: Promise<string | null>
my problem starts here I have to use this object as a string in the form
user.password
in following query
const valid = await argon2.verify(user.password ,options.password);
but its giving me error as
Property 'password' does not exist on type 'Promise<User | null>'
I have no idea how to resolve this
It looks like you are already in an async function. The issue is that you are not waiting for the user promise to complete.
Try this: