0

I want to have a nice documentation and that is why I want to write:

@param {(device)} device

and when I click on parameter device I want to see something like:

configInSync:null
lastUpgradeStatus:"none"
lastUpgradeStatusReported:true
modelID:"F4FE7EBE"
packages:Object {}
registrationInSync:false
softwareVersion:3
UUID:"85196BFA6E90"

So I want to define my own type, is it possible? Of course I was trying with

@typedef

But how to create such "defice" type? I was tried:

@typedef {configInSync:null
lastUpgradeStatus:"none"
lastUpgradeStatusReported:true
modelID:"F4FE7EBE"
packages:Object {}
registrationInSync:false
softwareVersion:3
UUID:"85196BFA6E90"} device

Solution: It is needed to define every property in the type, like:

/**
 * @typedef {object} MessageProperties
 * @property {string} replyTo
 * @property {string} type
 * @property {string} messageId
 * @property {string} contentType
 * @property {string} correlationId
 * @property {number} expiration
 * @property {object} headers
 */
Tomasz Waszczyk
  • 2,680
  • 5
  • 35
  • 73

1 Answers1

0

You can use typedef

The @typedef tag is useful for documenting custom types, particularly if you wish to refer to them repeatedly. These types can then be used within other tags expecting a type, such as @type or @param.

/**
 * The complete Triforce, or one or more components of the Triforce.
 * @typedef {Object} WishGranter~Triforce
 * @property {boolean} hasCourage - Indicates whether the Courage component is present.
 * @property {boolean} hasPower - Indicates whether the Power component is present.
 * @property {boolean} hasWisdom - Indicates whether the Wisdom component is present.
 */
ponury-kostek
  • 7,824
  • 4
  • 23
  • 31