title: Different return type for function factory typescript
body: <p>I am waiting for have got function from switch with required number of parameters. But it isn't working. I am waiting for fun1 0 arguments because PrintSomething() don't have arguments But have got error //Expected 1 arguments, but got 0.
  Some idea?</p>
  <pre><code>type opt = 'number1' | 'string2' | 'something3'
  
  export class Factory {
    static getFun = (option: opt) =&gt; {
      switch (option) {
        case 'number1':
          return NumberFun;
        case 'string2':
          return StringFun;
        case 'something3':
          return PrintSomething;
      }
    };
  }
  
  //getResult(option: string): ((val: number) =&gt; void) | ((str: string) =&gt; void)
  //but what about PrintSomething() and type ()=&gt;void????
  let fun1 = Factory.getFun('something3');
  
  fun1()
  
  function NumberFun(val: number) {
    console.log(val);
  }
  
  function StringFun(str: string) {
    console.log(str);
  }
  
  function PrintSomething() {
    console.log('something');
  }
  </code></pre>