And even if you wanted the "object overhead" and really wanted to avoid switch/case, why not put the area calculation *SHOCK* ON THE OBJECT?
https://codepen.io/jason-knight/pen/LYMvoYv
Then you just need a wrapper function to pull the area, which is the sane/rational approach if you're really so gun-shy of switch. Though sadly it's 50% more code...
Again, you made an excellent example of why at this point you couldn't pay me to deal with TypeScript... and not in any way, shape, or form a good argument against switch/case.
Just like with "framework stupid" or "preprocessor dumbass", I'll never understand how writing two to ten times the code needed to do the job is easier, simpler, "better for collaboration" or any of the other nonsensical unfounded claims people make about this type of bloated , cryptic, hard to follow coding.
And that's coming from someone who used to hand assemble machine language and enter it on toggle switches.