user5507535
user5507535

Reputation: 1800

JSDoc - Document Object of type

In JSDoc, how does one document an Object of certain defined type?

For example, if I have a function which receives a HTMLImageElement object, how should I document it in the parameters?

Would it be like just like this @param {HTMLImageElement} - An image or @param {Object<HTMLImageElement>} ?

Upvotes: 0

Views: 392

Answers (1)

samanime
samanime

Reputation: 26527

The first option you mentioned is correct:

@param {HTMLImageElement} An image

All class/object types can be used as a type in the type parameter. You don't need to do anything fancy with them.

And since all class instances are objects, you know it is also an object.

Upvotes: 1

Related Questions