Conditioning type on an enum
I have two functions for accessing database and getting a post with all associated comments, etc. One returns the normal version of the post, and another returns the version containing sensitive information only the creator of the post should see (such as engagement metrics). The code for the two functions is almost identical, so I would ideally like to condence them into one function to reduce boilerplate. To do so, I need a way to condition the return type; from what I understand currently the only way to do that is to use types conditioned on another type like so: