The problem of switch not being an expression has _always_ bugged me.
As a comparison, I’d say your solution has clearer syntax. The other solution has an interesting point free style and better performance (though I’ve yet to see a case where performance matters in switch cases).
Both can also be easily strongly typed, like in Typescript. In both cases the error given would be about mismatched types, which could be pretty puzzling though.