title: Cannot invoke an expression whose type lacks a call signature ... has no compatible call signatures
body: <p>i get an error</p>
  
  <pre><code>Cannot invoke an expression whose type lacks a call signature ... has no compatible call signatures.
  </code></pre>
  
  <p>on one of my methods and i cant figure out how to fix it.
  i have seen this link <a href="https://stackoverflow.com/questions/42427393/cannot-invoke-an-expression-whose-type-lacks-a-call-signature">cannot-invoke-an-expression-whose-type-lacks-a-call-signature</a></p>
  
  <p>and 2 more but still didn`t mange to figure it out </p>
  
  <p>type declaration :</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>type ProcessMethods = "execute" | "execSpawn"
  
  interface IDeferedCmd {
      type: ProcessMethods,
      cmd: string,
      name: string,
      resolve: IResolveFn,
      reject: IRejectFn,
      args?: Array&lt;string&gt;,
      options?: object
  
  
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>in my class i have 2 static methods that looks like this</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>static execute({cmd, name}: { cmd: string, name: string }): Promise&lt;{
          stdout: string;
          stderr: string;
      }&gt;
  
  static execSpawn({cmd, name, args , options }: { cmd: string, name: string, args: Array&lt;string&gt;, options: object }): Promise&lt;NodeJS.ReadableStream&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>and a third method in witch the error is thrown from try to call them dynamicly </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>if (typeof firstDeferedCmd == "object" &amp;&amp; ( firstDeferedCmd.type === "execute" || firstDeferedCmd.type === "execSpawn" )) {
                  ProcessPoolExecutor[firstDeferedCmd.type](firstDeferedCmd); // this line throw the error
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>and the error it self </p>
  
  <blockquote>
    <p>Cannot invoke an expression whose type lacks a call signature. Type '(({ cmd, name }: { cmd: string; name: string; }) => Promise&lt;{}>) | (({ cmd, name, args, options }...' has no compatible call signatures.
    ProcessPoolExecutorfirstDeferedCmd.type;
                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</p>
  </blockquote>