Data Type - Static Typing in JavaScript.
Typing can be added with this method:
in js file: with Typescript checkJs (to true) and Jsdoc Ref
See typescript supports it via Jsdoc
{
"compilerOptions": {
"noEmit": true,
"allowJs": true,
"checkJs": true,
"target": "es2017",
"module": "commonjs"
},
"include": [
"lib"
]
}
the Google Closure types syntax (works within Idea).
/** @param {number} x **/
function inc(x) {return x + 1;}
function Point(x,y) { this.x = x; this.y = y; }
/** @param {Array.<Point>} points
* Array of elements of some type could also be specified with [] (for example, Point[]).
*/
function printPoints(points) {
...
}
// @param {Node} domNode
// @param {HTMLElement} htmlElement
/** @return {!Shape|undefined} */
/** @type {function(string, *)} */
function