What I'm looking for is to have a function with infinite number of parameters and each parameter type is based on if its index is even or odd.
A contrived example:
flow(isMachineReady(), 'and', isWaterHot(), 'or', isMilkHot(), 'then', serveCoffee())
Odd arguments: () => boolean
Even arguments: 'and' | 'or' | 'then'
So if the function was used like this I want to get error for the second argument type:
flow(isMachineReady(), **isWaterHot()**, 'or', isMilkHot(), 'then', serveCoffee())
Here is what I tried before but didn't work
type FlowArgCouple = [operand: () => boolean, operator: 'and' | 'or' | 'then']
function flow(...args: [...FlowArgCouple][]){
...
}