title: Infer function prop input type typescript
body: <p>I have a component (called Container) which has a renderHeader prop. The type of this prop is</p>
  <pre><code>(input: {
      scrollY: Animated.Value
      onLayout: (e: LayoutChangeEvent) =&gt; void
      headerHeight: number
    }) =&gt; JSX.Element
  </code></pre>
  <p>I have two ways to pass the prop. Either pass an inline arrow function or declare it somewhere and pass its name as prop.
  In the second one Typescript does not automatically infer the function's argument types. As there are several other props, using inline arrow functions make the code messy and less readable.</p>
  <p>How can I use the approach below and make TS infer the function's argument types?</p>
  <pre><code>const renderHeader = ({ /* This argument's type should be inferred without explicitly defining it  */ }) =&gt; {}
  &lt;Container renderHeader={renderHeader} /&gt;
  </code></pre>