title: TS2322: Type is not assignable to type with arrow function
body: <p>I am trying to defined a basic interface with an arrow function as properties. However, it gives me a TS error.</p>
  
  <pre><code>interface InterfaceTest {
    input?: (test: number | string) =&gt; number | undefined;
  }
  
  const myVariable: InterfaceTest = {
    input: (test: number) =&gt; {
      return test;
    },
  };
  
  const myVariable2: InterfaceTest = {
    input: (test: string) =&gt; {
      return parseInt(test, 2);
    },
  };
  </code></pre>
  
  <blockquote>
    <p>TS2322: Type '(test: number) => undefined' is not assignable to type '(test: string | number) => number | undefined'.   
    Types of parameters 'test' and 'test' are incompatible.
    Type 'string | number' is not assignable to type 'number'.
     Type 'string' is not assignable to type 'number'.</p>
  </blockquote>
  
  <p>In fact, I do not understand the error because I would like to have a string or a number as parameter to my function and it tells me that I can not only number. How could I do to have string or number as input of my arrow function ?</p>
  
  <p>In addition, when I do that the error disappear</p>
  
  <pre><code>interface InterfaceTest {
    input?(test: number | string): number | undefined;
  }
  
  const myVariable: InterfaceTest = {
    input: (test: number) =&gt; {
      return test;
    },
  };
  
  const myVariable2: InterfaceTest = {
    input: (test: string) =&gt; {
      return parseInt(test, 2);
    },
  };
  </code></pre>
  
  <p>Why ?</p>