I have a vision to craft an innovative array that is filled with functions.
const a = [
(): { a: string } => ({ a: 'alpha'}),
({ a }): { b: string } => ({ b: 'beta' }),
({ a, b }): {} => ({}),
]
The functions are specified with return types, but I desire a method to eliminate the need for specifying input types and instead generate a "chaining" mechanism where all inputs are merged into the return types of previous functions in the sequence.
If achieving this directly isn't feasible, could I at least implement an interface like the following:
interface State {
a: string,
b: string
}
And potentially formulate a generic type for the array that utilizes State
as a partial application to both input and output types for each function within the array?