In JavaScript, we can create a function using two ways:
1.
function X(){
}
const x = function(){
}
Using typescript, we can for example do the following:
interface LogFunction {
(sources: any[]): void
}
const log: LogFunction = (...sources) => {
// ...
}
We can type the function using an interface, then we can assign it to the variable log.
Can we do the same for function definitions? I mean functions which are created separately, not assigned to variables, ex:
function log: LogFunction(...sources) {
// ...
}