As I delve into learning TypeScript, I have encountered two errors that are causing me some trouble.
We have a problem with the following lines of code:
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'.
Specifically, the issue seems to be with this line:
const warrior = await Warrior.findOne({ warriorname })
This error arises from the following function:
async (warriorname) => {
const warrior = await Warrior.findOne({ warriorname })
return !warrior
}
Any suggestions on how to resolve this?