I have types like this defined in a separate file:
type AddFunc = (a: number, b:number) => number
and am using them to type "fat arrow" functions:
const add: AddFunc = (a, b) => a + b
This is fine, however I came across an issue when changing above to a function declaration i.e
function add(a, b) {
return a + b
}
I'm not sure, but is there a way to re-use AddFunc type for above?The only approach I figured out is to do it manually like below, but I wonder if I can reuse existing types instead
function add(a: number, b: number): number {
return a + b
}
