How to fix A function whose declared type is neither 'void' nor 'any' must return a value in TypeScript | DevErrors