How to fix Type 'object' is not assignable to type 'string' in TypeScript | DevErrors