jsdoc valid param types
JavascriptJsdocJavascript Problem Overview
Is there a list somewhere of valid types for param tags for jsdoc? For example,
@param {type} myParam Some parameter description
I know that things like number
and String
are valid, but what if I want to document that the number is an integer. Is int
valid?
I've done some googling, but I can't seem to find a full list.
Javascript Solutions
Solution 1 - Javascript
The JS Documentation tooling I've used just tokenizes the comments into strings anyway, making it possible to put anything you want in the {type} section.
You could stick with JavaScript types if you wanted like {number} or {string}, or if you want to specify you could do {integer}... but I would probably recommend something like:
@param {number} myParam must be an integer
cheers
Solution 2 - Javascript
To answer the actual question
> Is there a list somewhere of valid types for param tags for jsdoc?
The documentation of @param
states here that you can use built-in types and "namepaths" (a.k. paths to types you have created/documented earlier and your own types you declared with @type
.
If you look up built-in Javascript types
, you get the following, for example here, you get the list of primitive types:
- Boolean
- Null
- Undefined
- Number
- String
- Symbol (new in ECMAScript 2015)
- Object
And here are some examples of namepaths:
- exampleFunction
- exampleClass#someInstanceMember
- exampleClass.staticMember
- exampleClass~innerMember
E.g. @param {exampleClass} exampleParam Instance of your example class