How to document a function returned by a function using JSDoc

前端 未结 3 1942
终归单人心
终归单人心 2020-12-15 03:18

I am using JSDoc for parameter documentation.

It is clear how to document the parameter types for many_prompts, but what is the right way to document th

3条回答
  •  悲&欢浪女
    2020-12-15 03:55

    This seems to be working for me.

     /**
     * @param {Number} count - number of times to prompt
     * @return {function(): void} - the returned function
     */
      manyPrompts(count) {
          /**
           * My inner function
           *
           * @param {object} prompt Some parameter
           */
          const inner = function(prompt) {
            for (let i=0; i < count; i++) {
              alert(prompt);
            };
          };
          return inner;
      }
    

提交回复
热议问题