0

I have the following code:

type AlarmEvent = events.Event<(name: Alarm) => void>;

As you can see, the event class takes a generic parameter in the form of a function signature, which I'd like to document.

Any ideas?

1
  • Are you using TypeDoc or JSDoc? Commented Jan 26, 2018 at 4:43

1 Answer 1

1

If all you need is a place to hang normal JSDocs off of, you can just create another type:

type AlarmHandler = (name: Alarm) => void
type AlarmEvent = events.Event<AlarmHandler>

If you need this to work with JSDoc you can use the @callback tag in a standalone JSDoc comment to do the work:

/**
 * Handles alarm events
 * @callback
 * @param {Alarm} name The alarm that fired
*/
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.