(This is a theoretical use case as a question for thought, thus I have no XY)
I'm trying to make a type for the following array:
const array = [
() => 1, // 1
(num: number) => (num + 1) + "", // "2",
(str: string) => ({ a: "1" + str }), // { a: string }
(obj: { a: string }) => +obj.a * 5, // 5
// ..., can stop here or be any length
]
Essentially, the array starts off with a function that takes in no parameters, and then the return type is passed to the next function, and so on.
I am unsure where to start as I can not find anything in the TypeScript documentation for this. Where can I start?