I need help with type declaration that contains a backward referring and I'll explain:
Given an interface Car like that:
interface Car {
name: string,
engine: Engine,
brand: Brand,
...
}
I need to create a type of the following structure:
[ 'engine', (engine1, engine2) => {...} ]
Where engine1 and engine2 will be the same type as Car['engine'] and without limitation of generality - I need an array of:
[(keyof T) as S, (s1: S, s2: S) => { ... }]
In words: an array that contains exactly two elements: the first - is a property of T and the second is a function that accepts arg1 and arg2 where their type is the same type as the type of T[the first item in the array]
Can someone help me to declare such a type?