I am trying to understand how to use "Function types".
Let's say we have the following:
function calSum(val1: number, val2: number): number{
return val1 * val2;
}
console.log(calSum(10,20)); //prints 200
Now let's say we have:
let calc: (value1: number, value2: number) => number;
if I do the following:
calc(10,20);
I would expect to see 200, however I get following error:
Uncaught TypeError: calFuncType is not a function
I would like to understand why this is, and how to use this type?
calc(foo: type), not assigning a value (foo = value).let calc = (value1: number, value2: number) => value1 * value2?