How to JsDoc a “mixed” type?

前端 未结 3 489
时光取名叫无心
时光取名叫无心 2021-02-11 14:51

Simple question, how do I document that \"Mixed-type\"? I know I could just list all possible types like {null|undefined|String|Number|Object} and end up finding my

3条回答
  •  我在风中等你
    2021-02-11 15:46

    Use {}

    There is an example from http://usejsdoc.org/tags-type.html:

    An object called 'myObj' with properties 'a' (a number), 'b' (a string) and 'c' (any type).

    {{a: number, b: string, c}} myObj
    // or:
    {Object} myObj
    {number} myObj.a
    {string} myObj.b
    {} myObj.c
    

提交回复
热议问题