Can you help me understand how to specify the type when a function returns two values?
Consider this function:
const exampleFunction = (input: number) => {
const firstValue = input;
const innerFunction = (funcInput: number) => {
funcInput * input;
};
return [firstValue, innerFunction];
};
Here is how I am calling it:
const [value, innerFunction] = exampleFunction(1);
However, TypeScript seems uncertain whether innerFunction
is actually a function. Currently, it interprets it as:
number | ((funcInput: number) => void)
Is there a way to inform TypeScript that the second return value is indeed a function?