Greetings TS community.
I've got into declarative programming with Typescript and I'm trying to design my code and types more in this style, however I run into a road bump which is giving me a headaches.
I'm working on a complex function, but for the sake of everyones attention span, I've cut it down to the problematic part.
(Typescript playground link in the comment)
The question is how does my internal function know which keys are selected on top level so it can create a proper signature of the return value.
This might be a perspective issue, rather then a TS issue per say, but hopefully someone can put me on the correct path.
Cheers