@member : 可以为某个成员变量定义类型.可以选择性为成员变量指定名称。
此标签推荐使用PhpStorm/WebStorm进行阅读,可以能直观体现标签的作用
@var
@member [<type>] [<name>]
| 类型 | 说明 |
|---|---|
| string | 字符串 |
| Array or Type[] | 数组 |
| number | 数字 |
| Object | 对象 |
| Class | 自定义的类名 |
| Function | 方法类型 |
| null | - |
| * | 任意类型 |
| 类型名 | 语法示例 | 描述 |
|---|---|---|
| Symbol name | {boolean} {myNamespace.MyClass} |
指定符号的名称。 如果标识符已经被文档化,JSDoc将创建一个链接到该标识符的文档 |
| Multiple types | {number|boolean} 表示数字或布尔 |
这意味着值可能是几种类型中的一种,并用|分隔类型的完整列表。 |
| Arrays | {Array.string} or string[] 表示字符串数组 |
- |
| Objects | {name: string, age : number} or Object | - |
| Nullable type | 一个数字或null {?number} | 指明类型为指定的类型,或者为null。 |
| Non-nullable type | 一个数字,但是绝对不会是null {!number} | 指明类型为指定的类型,但是绝对不会是null。 |
| Variable number of that type | 此函数接受可变数量的数值参数。 @param {...number} num |
表示该函数接受可变数量的参数,并指定一个类型的参数 |
| Optional parameter | 一个可选参数 @param {number} [foo] @param {number} [foo=1] 可选参数,默认值=1 |
指示参数是可选的。当使用JSDoc的语法表示可选参数时,你还可以指明参数的默认值。 |
