I need to crate a type that can hold an array where each element is a function that gets the previous output as an input. For example, a valid array is:
const pipe: SpecialArray = [
() => string,
(prev:string) => number,
(prev:number) => boolean
];
An invalid array would be:
const pipe: SpecialArray = [
() => string,
(prev:number) => number, // <-- Here number should be string
(prev:number) => boolean
];
Is there a way to define such structure in TypeScript?