How to fix Function expression requires a return type in TypeScript | DevErrors