How to generate JSDoc for `pipe`d ES6 function

VSCode will try to display the comment of the anonymous function inside asyncPipe. If you add a JSDoc comment inside it you can see the behaviour:

const asyncPipe = (...fns) =>
  /**
   * My asyncPipe description
   * @param {Object} x Any object
   */
  x => fns.reduce(async (y, f) => f(await y), x);

const request = asyncPipe(liftedGetToken, liftedFetch, json);

example

Unfortunately there is no way in JSDoc to override the documentation of the anonymous function like you were trying to do. You could however force your intent to VSCode like this, do note that this introduces an extra function call:

const doRequest = asyncPipe(liftedGetToken, liftedFetch, json);

/**
 * @method
 * @param {Object} fetchSettings the settings for the fetch request
 * @param {Object} fetchSettings.body the body of the request
 * @param {string} fetchSettings.route the URL of the request
 * @param {string} fetchSettings.method the method of the request
 * @param {string} fetchSettings.token should only be used for testing and unauthenticated requests
 */
const request = fetchSettings => doRequest(fetchSettings);

solution example