title: Typing function when decorator change return type
body: <p>how to correctly write types for the function whose return type is modified by decorator ? </p>
  
  <p>Simple example:</p>
  
  <pre class="lang-py prettyprint-override"><code>def example_decorator(fn):
      def wrapper(data):
          res = fn(data)
          return ', '.join(res)
  
      return wrapper
  
  
  @example_decorator
  def func(data: list):  # -&gt; ???? str ? list ?
      new_data = data
      new_data.append('XYZ')
      return new_data
  
  
  # When we type func -&gt; list
  
  def test() -&gt; str:
      result = func(['ABC', 'EFG'])
      print(type(result))  # &lt;class 'str'&gt;
      return result  # Incompatible return type [7]: Expected str but got list.
  
  
  test()
  </code></pre>