How to fix Argument of type 'undefined' is not assignable to parameter of type 'string' in TypeScript | DevErrors