TBD - Coming when I have the time… (TODO: General structure and TLDR of @param, etc.)
Documenting Object Parameters
I must say, I don’t typically like taking AI-generated information and just dumping it into the things I write. But this was so succinct that it seems reasonable to put it all here. It all started with this prompt:
If I have a JavaScript function whose parameter is an object deconstruction, what are my options for documenting it with JSDocs? For example, consider this function:
And here’s the response (from ChatGPT 5, in Sep 2025, with edited formatting):
ChatGPT 5
Great question — JSDoc has a few idioms for when a function parameter is an object that you destructure right in the signature. Here are your main options:
1. Document the parameter as a single object
You can treat the parameter as one object and list its properties with @param {Type} [options.prop].
/**
* Get the current weather.
*
* @param{Object}options - Options for the request.
* @param{string}options.city - The city name.
* @param{string}options.country - The country code.
* @param{Function}options.callback - Called with the weather data.