title: Cannot invoke an expression whose type lacks a call signature, map
body: <p>This code works:</p>
  
  <pre><code>class A {}
  class B {}
  class C {}
  
  const classCFromAOrB = (element: A | B): C =&gt; new C()
  
  const a: A[] | B[] = [new A()]
  
  const c: C[] = a.map(element =&gt; classCFromAOrB(element))
  </code></pre>
  
  <p>This code doesn't:</p>
  
  <pre><code>import { classA } from '../some'
  import { classB } from './../some'
  
  interface interfaceC {}
  
  const render = (element: classA | classB): interfaceC =&gt; {
      return {}
  }
  
  interface ResultsScreenProps {
      resultsScreenPresented: boolean
      answers: classA[] | classB[]
      dismiss: SimpleFunc
  }
  
  const Screen: React.SFC&lt;ResultsScreenProps&gt; = (props) =&gt; {
      const array: classA[] | classB[] = props.answers
      const second: interfaceC[] = array.map(el =&gt; render(el)) // here is the error
      ...
  }
  </code></pre>
  
  <p>On the line defining <code>second</code> I'm getting an error:</p>
  
  <blockquote>
    <p>[ts] Cannot invoke an expression whose type lacks a call signature.
    Type '((callbackfn: (value: classA, index: number, array: classA[])
    =>...' has no compatible call signatures.</p>
  </blockquote>
  
  <p>What am I doing wrong?</p>
  
  <p>The error is reproducible if classA looks like this:</p>
  
  <pre><code>class classA {
      anyArg: number
  
      constructor(anyArg: number) {
          this.anyArg = anyArg
      }
  }
  </code></pre>