我想用JSDoc文档注释对回调函数的参数进行注释。我该怎么办?
/** Get something.
* @param options What to get
* @param callback A function to invoke when the value has been fetched.
*/
get(options: GetOptions, callback: (details: GetDetails) => void): void;
如果这是JavaScript,我会这样做:
/** The callback for the get method.
* @callback GetCallbackFunction
* @param {GetDetails} details The details and the value that was fetched.
*/
/** Get something.
* @param {GetOptions} options What to get
* @param {GetCallbackFunction} callback A function to invoke when the value has been fetched.
*/
function get(options, callback);