When using typescript, I tend to write my functions in this pattern:
const myFunc: MyFuncType = (input, otherInput, moreInput) => {
return input + otherInput + moreInput;
};
However, I can't seem to figure out how to pass an interface to a named function.
I'd like to do something like this:
function myFunc<MyFuncType>(input, otherInput, moreInput) {
return input + otherInput + moreInput;
}
In that second example, Typescript assigns any to all my function parameters, instead of inferring the type of each parameter. Is the const pattern the only way to assign a function signature?
Thanks.