I started writing this as a Discord message but ended up needing to write a gist as it got longer so I apologize for the unprofessional language in the beginning
I've run into yet another problem that I've encountered before and it's time to rant about it because this one really bugs me. I think the fundamental problem is that TypeScript function types are extremely shitty. as far as I can tell, you can't express how the return type of a function depends on the type of the