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