Phpstorm keeps telling me I have an undefined variable input.connectto
Html:
<div class="b-showColorinList" data-connectto="123456" data-othervalue="Lorem Ipsum">...
JS:
$(document).on('click', '.b-showColorinList', function() {
cm.showColorInList( $(this) );
});
And:
/**
* Uses ajax to get other color in list view
* @param {object} inputObj
*/
cm.showColorInList = function(inputObj) {
"use strict";
var input = inputObj.data(),
parent = $("#"+input.connectto),
othervalue = input.othervalue;
I know I can ignore a line in jshint, but is there any way to make it correct with jsdoc, example define input
as an object
Accordingly to JSDoc docs the proper way should using
@typedef
to define actual object structure (especially useful if it will be re-used later in another place) and@type
to declare type of particular variable:This one (with just
@typedef
and variable name as type name) seems to work in PhpStorm as well: