My generic type gets turned into a union. But I wan’t the “T” to be generic individually for each tuple in the array:
type MyTuple<T extends object> = [T, (s: NoInfer<T>) => any]
const func = <T extends object>(arr: Array<MyTuple<T>>) => {
// ...
}
func([
[{ foo: 'bar' }, (s) => s.foo], // ok
[{ foo2: 'bar' }, (s) => s.foo2], // ok
[{ foo: 'bar' }, (s) => s.foo2], // should fail, but doesn't
[{ foo: 'bar' }, (s) => s.foo3], // should fail
])
Is there a way to do this?