Unresolved property variable when returning from method

...

doChunk().then(function (results) {
   angular.forEach(results, function (info) {
      if (info.data.fields.worklog) {
         configProcess.results.push(info.data);

      

...

The above is just an example from my application AngularJS

, but this is the same problem for all data (and vanilla JS) that was returned from elsewhere - like the request HTTP

in this case.

results is the result of an HTTP request and contains an array of objects.

So, when I iterate over this array, I access various properties of these objects. Everything is fine and it works, but how can I declare what are the different properties of these methods?

Basically I want to get rid of the error checking code of WebStorm, like this: Unresolved variable fields at line 106

.

It makes sense to me why it reported, but how do I solve it?

+3


source to share


1 answer


I can suggest using JSDoc to document such objects received by ajax calls. See How to deal with many unresolved variables in Webstorm , for example



+2


source







All Articles