Webstorm UI Implementation Warning Using JSDoc

I am very new to JSDoc and I am trying to run Webstorm, so I am also very new to webstorm.

I, on the one hand, have an interface declared this way:

/** @interface */ function IInterface(){} IInterface.prototype.myMethod = function(){}; 

On the other hand, I am developing a module in which I implement this interface:

 window.exports.MyImplementation = (function(){ "use strict"; /** * * @constructor * @implements {IInterface} */ function MyImplementation(){} MyImplementation.prototype.myMethod = function(){ // my implementation here }; return MyImplementation; })(); 

The problem is that the implementation does not seem to be recognized: Not implemented warning screen shot

But if I remove the window.exports.MyImplementation binding or return, there are no more warnings ...

enter image description here

.. but I want to go back and save my type from my module!

Is there something that I am missing or something is wrong? ...

Edit:

Just to confuse my problem a bit, I was considering using the "full annotation" interface declaration (if possible, I'm experimenting here ...):

enter image description here

... but in this case, you may notice that the β€œI” character has disappeared on the left side, and if the method is not implemented, I have no warnings. BUT type IInterface is recognized.

Edit : I think I just figured something out while experimenting with other jsDoc products. A warning is issued because implementation checks are performed on window.exports.MyImplementation. But there is no direct purpose that implements this object in the code. And so the warning is disabled when I delete the return statement or the assignment of export.MyImplementation.

.. Thus, I’m not sure that this can be considered as an error, it could be a template that I used for my module, which does not match the template expected by WebStorm and, possibly, JSdoc itself ..... If someone who have experience in JSDoc and Webstorm can confirm .....

Another edit : (a significant step here in understanding JSDoc, I think)

Annotations were moved to the target field and ... tadaaa (note the β€œI”, which still indicates that the interface is actually being implemented).

enter image description here

My explanation: This may be logic ... but to be honest, I really don't know how relevant this is: since the documented field will be exported to "export.MyImplementation" at the very end, and it is obvious that the annotation is more useful here than in a private building. WebStorm detected an export in "export.MyImplementation", so it expects documentation on it ...

Does it make sense?...

And one more editing (again) Investigation, investigation.

I found a completely different solution that allows you to document, complete, verify and not warn, which seems to me the best solution for exporting modules: enter image description here

+5
source share
1 answer

this is a bug in supporting WebSphere JSDoc, please vote for WEB-14202

+1
source

Source: https://habr.com/ru/post/1206805/


All Articles