Now we'll move on to typing functions.
We have an
addListener function here:
The type of
onFocusChange that is passed in is currently
What we want it to be is a function that will take in a single boolean argument.
Your challenge is to visit the TypeScript Docs and work out how to appropriately type the
Now, we come onto typing functions. We've got an addListener function here that we've created. What we're saying is we want to say onFocusChange. OnFocusChange is currently unknown. What we want it to be is a function which takes in a single argument, which is going to be a Boolean.
Now, what we really need to do is to be able to somehow work out how to type this to express our function for us. That's your challenge. It's to go into the TypeScript docs, work out how you type functions, and what this unknown should actually be typed as.