In JetBrains WebStorm 6, NodeJS/Javascript how can you define, in the comments a JSON example?
Problem
I have a function with a json parameter that comes with the same structure each time.
/**
* @param box {object}
*/
function testBox( box )
I am looking for a way to instruct the autocomplete of a structure I insert in that input parameter aside for the fact that it is an {object}. I am looking to avoid typos in coding the function.
I have noticed if I add a structured json to a var, later in the function the IDE hints of the structure, but in the case of a function parameter, I don't do such a thing.
How might one do this?
Solution
please, see the following thread: https://groups.google.com/forum/?fromgroups#!topic/jsdoc-users/vR5REZ1I8Jc - the recommended way of documenting this is using @typedef WebStorm does support JSDoc @typedef annotation. In case oif any problems with resolving/typehinting, please, feel free to file a bug to http://youtrack.jetbrains.com/issues/WEB
Discussion
There is currently no discussion for this recipe.
This recipe can be found in it's original form on Stack Over Flow.