Listing 11.1 and 11.2 returning type Unit rather than String

The IDE is telling me that menuItems needs to be List and it won’t compile otherwise. This causes other issues when I try to use the results which should be a string. I was able to compile once i updated the code to match listing 11.2, but I still had an error as the inferred type seems to be a unit rather than a string. Is this something that has changed since the book was published?