Is it possible to take a tuple of different objects, and get a type of all of these objects combined? For example if i have a tuple like this:
const t = tuple({current: 1}, {old: 2}, {new: 3}); //this should be interpreted as [{current: number;}, {old: number;}, {new: number;}]
and then i combine those objects into a single one:
let newob = {};
for(let ob of t) {
Object.assign(newob, ob);
}
can I somehow make typescript treat this new object as a
typeof t[0] & typeof t[1] & typeof t[2]
which in this case would be
{current: number; old: number; new: number;}
without manually typing that all?
I'd like it to work with any tuple and any objects inside tuple