Closed jmcscript closed 3 years ago
It shows the type for me in all cases:
In your example could you check the type of document
variable. It looks like it cannot be inferred properly. Note that there is no global document
variable of type Document
in JSFL like it is in browsers.
I'm so sorry to have bothered you. It's because I was using an imported
library and didn't have JSDoc comments to describe the document
variable
in my custom method. This update seems to resolve it. Although I'm using
traditional loops here, the app knows what document
is now.
/**
@returns {null|Layer|} / TTUtil.prototype.getScriptLayer = function (document) {
var numLayers = document.getTimeline().layers.length; for (var i = 0; i < numLayers; i++) {
var numFrames = document.getTimeline().layers[i].frames.length;
for (var j = 0; j < numFrames; j++) {
if (document.getTimeline().layers[i].frames[j].actionScript.length
0) { return document.getTimeline().layers[i]; } } }
return null; };
On Tue, Feb 9, 2021 at 11:10 PM Evgeniy Polyakov notifications@github.com wrote:
It shows the type for me in all cases: [image: image] https://user-images.githubusercontent.com/7184003/107467249-41519a00-6b98-11eb-9dd1-3345d2ee9566.png
In your example could you check the type of document variable. It looks like it cannot be inferred properly. Note that there is no global document variable of type Document in JSFL like it is in browsers.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/evgeniy-polyakov/jsfl-support/issues/4#issuecomment-776446313, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJFHQCIDWFFQSFFYMUKVVD3S6IINDANCNFSM4XLBUESA .
-- Thanks,
James McDonald Email: jameschristophermcdonald@gmail.com Mobile Phone: (580) 351-8170
Ok, I'm closing this
Hello Evgeniy, I hope you are well.
I tend to use a lot of
Array.forEach()
loops when I know it's a small list and need to inspect every index. So, there is no need tobreak
for example. (In that case, I'd usefor i
orfor in
.)Here's my problem: when I'm using
forEach()
on known types, the IntelliJ showsT
as the type. This issue does not occur withArray.filter()
.Is there a way to fix this? It's not a huge problem, but I love the type of validation IntelliJ does with your plugin.
Note: This doesn't occur on all instances of forEach. Running it for
fl.documents
works fine. Running it forfl.documents,getTimeline().layers
does not.