typedCase could be a more direct solution