【问题标题】:Proper JSDoc typedef declaration of function with optional arguments in javascriptjavascript中带有可选参数的函数的正确JSDoc typedef声明
【发布时间】:2018-05-28 23:06:45
【问题描述】:

给定以下类型定义

/***
 * @typedef {object} Queue
 * @property {function(string):string[]} listQueueNames Gets an optionally 
   filtered list of QueueNames. 
 */

将 listQueueName 的 Argument 标记为可选 Argument 的正确方法是什么?

【问题讨论】:

    标签: javascript webstorm typedef jsdoc


    【解决方案1】:

    使用Closure Compiler 语法应该在这里工作:

    /***
     * @typedef {object} Queue
     * @property {function(string=):string[]} listQueueNames Gets an optionally 
       filtered list of QueueNames. 
     */
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-04-17
      • 2017-04-26
      • 2020-09-20
      • 2011-09-17
      • 2012-09-29
      • 1970-01-01
      • 2016-03-27
      相关资源
      最近更新 更多