How to fix Void function cannot return a value in TypeScript | DevErrors