1

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) {
 // ...
}
1

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.