Let's say we have a wrapper object:
interface Wrapper<T> {
value: T
}
I want to design a function that receives Wrapper objects as arguments (with possibly different T) and returns one of them:
function <T extends ReadonlyArray<Wrapper<any>>>(...args: T) { ... }
The return type of such function should be Wrapper<(union of input Ts)>. How do I describe such return type in Typescript, without losing the input types (that is, not Wrapper<any>)?