M
M
Michael2017-06-12 01:42:47
typescript
Michael, 2017-06-12 01:42:47

How to correctly pass a function to another function?

Hello. I'm trying to implement a method that takes a string and a callback as input. I do it like this:

interface handlers {
    handlerFunctions: handler[],
    on(event: string, (msg: Message, text: TextMessage, level: string) => void): void
}

But I see an error: Call signature, which lacks return-type annotation, implicitly has an 'any' return type
I don't understand how to fix it. How to correctly pass a callback function?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question