There are two errors I'm getting when trying to learn TypeScript.
Type 'string | null | undefined' is not assignable to type 'string | RegExp | QuerySelector<string | RegExp> | undefined'.
Type 'null' is not assignable to type 'string | RegExp | QuerySelector<string | RegExp> | undefined'.
This line in particular:
const warrior = await Warrior.findOne({ warriorname })
This comes from the code
async (warriorname) => {
const warrior = await Warrior.findOne({ warriorname })
return !warrior
}
How can I fix this?