I'm trying to write a function that will take an array of initialisation functions, along with their options. I am able derive the type of the options from the function, so I thought I should therefore be able to check that the options I provide are of the same type.
The example is a minimised version of this. I think I need an independent generic for each array item, but I obviously don't know the size of the array.
type O<T> = { a: T }
type E<T> = [O<T>, T]
const f = <T={}>(array: E<T>[]) => {}
f([
[{ a: 4 }, 4], //Works
[{ a: "5" }, "5"] //Doesn't work as T is set to number
])