title: How do you define an array of generics in TypeScript?
body: <p>Let's say I have a generic interface like the following:</p>
  
  <pre><code>interface Transform&lt;ArgType&gt; {
      transformer: (input: string, arg: ArgType) =&gt; string;
      arg: ArgType;
  }
  </code></pre>
  
  <p>And then I want to apply an array of these <code>Transform</code> to a <code>string</code>. How do I define this array of <code>Transform</code> such that it validates that <code>&lt;ArgType&gt;</code> is equivalent in both <code>Transform.transformer</code> and <code>Transform.arg</code>? I'd like to write something like this:</p>
  
  <pre><code>function append(input: string, arg: string): string {
      return input.concat(arg);
  }
  
  function repeat(input: string, arg: number): string {
      return input.repeat(arg);
  }
  
  const transforms = [
      {
          transformer: append,
          arg: " END"
      },
      {
          transformer: repeat,
          arg: 4
      },
  ];
  
  function applyTransforms(input: string, transforms: \*what type goes here?*\): string {
      for (const transform of transforms) {
          input = transform.transformer(input, transform.arg);
      }
  
      return input;
  }
  </code></pre>
  
  <p>In this example, what type do I define <code>const transforms</code> as in order for the type system to validate that each item in the array satisfies the generic <code>Transform&lt;ArgType&gt;</code> interface?</p>