I am creating a documentation based on JSDoc (jsdoc-to-markdown to be precise https://www.npmjs.com/package/jsdoc-to-markdown) and i approached an issue related to annotating IIFE (which is a part of HttpService module).
/**
* Keeps track of {@link httpService} subscribers, which want to externally hook into any request
* that returns certain status.
*
* @namespace httpServiceSubscriber
*/
const httpServiceSubscriber = (() => {
const _subscribers: Record<string, TSubCallback | null> = {
EXCEPTION: null,
};
type TSubCallback = (...args: unknown[]) => unknown;
type TSubKey = keyof typeof _subscribers;
return {
/**
* asd
* @memberof httpServiceSubscriber~SUBSCRIPTION_TYPE
* @constant
*/
SUBSCRIPTION_TYPE: Object.freeze(Object.fromEntries(Object.keys(_subscribers).map((key) => [key, key]))),
/**
* @memberof httpServiceSubscriber~callSubscribers
* @method
* @inner
*/
callSubscribers(type: TSubKey, value: unknown) {},
/**
* @memberof httpServiceSubscriber~subscribe
* @method
* @inner
*/
subscribe(type: TSubKey, callback: TSubCallback) {},
/**
* @memberof httpServiceSubscriber~unSubscribe
* @method
* @inner
*/
unSubscribe(type: TSubKey) {},
};
})();
Which results in MD as on screenshot. As you can see this IIFE's internal code is not treated as some separate thing - more over, returned object is not documented at all - but rather a part of whole module. I would like the returned object of IIFE to be nested in MD structure, to indicate it's something more internal.