Reduce code in type switches.