docsforadobe / Types-for-Adobe

TypeScript types for Adobe: AfterEffects, Animate, Audition, Illustrator, InDesign, Photoshop, Premiere, ScriptUI.
531 stars 126 forks source link

Fix: ComponentParamCollection needs numItems and length property #113

Closed galaddirie closed 11 months ago

galaddirie commented 1 year ago

fixes #112

Observed this issue when trying to iterate over the properties of a component. I noticed I could access properties through indexing but when trying to access the length of the collection, we received a linting error but the code works at run time. Property 'numItems' does not exist on type 'ComponentParamCollection'.ts(2339)

const seq = app.project.activeSequence;
  const tracks = seq.getSelection();
  for (let track of tracks) {
      let components: ComponentCollection = track.components;
      for (let i = 0; i < components.numItems; i++) {
          const comp = components[i];
          comp.properties[0]
          for (let j = 0; j < comp.properties.numItems; j++) { // !THE ISSUE
              // numItems and length is not defined in ComponentPropertiesCollection, but this exists

I noticed that the numItems and length properties were used in the codebase but weren't defined like other Collection types

all this fix does is set the properties length and numItems

justintaylor-dev commented 11 months ago

looks good, thanks