0
votes

I have a promise that I am trying to document using JSDoc. It has three resolve types, string[], Object[] and Object. There seems to be a number of ways suggested to document this but I can't seem to find anything concrete.

https://github.com/jsdoc/jsdoc/issues/1197#issuecomment-312948746 would seem to sugest something like this:

/**
 * The results of the DNS resolution request
 * @promise DNSResolve
 * @fufill {(string[]|Object[]|Object)}
 * @reject {Error}
 */

/**
 * Resolve a DNS record
 *
 * @returns {DNSResolve} The result
 */

Note: In this one I am using the answer to multiple types as suggested here How do you document JSDoc with mixed parameter type?

However, this doesn't seem to have been implemented and doesn't appear on https://jsdoc.app/. It also seems very bloated and long winded.

My idea was to follow TypeScripts return type idea of

Promise<string[] | Object[] | Object>

Is there any kind of standard on how to do this or should I just use the scheme suggested by issue #1197