There are two valid ways to declare a function type in TypeScript.
The first method is:
const example : type = () => {}
In this syntax, we declare a constant variable named example of type type. It is a function type that does not take any parameters and returns a value.
The second method is:
const example = () : type => {}
This syntax declares a constant variable named example and assigns its type using a function type annotation. It indicates that example is a function that takes no parameters and returns a value of type type.
If you need to use parameters in your function, you can do so like this:
let example: (x: type, y: type) => type;
If your function returns void without any parameters, you should follow this approach:
let example : Function;