flowtype how to annotate union with optional fields
<p>How to achieve the following in flow</p>

<pre><code>export type Response = {
  err: string,
  data: ?Array&lt;Object&gt;,
} | {
  data: Array&lt;Object&gt;,
};
</code></pre>

<p>I want to express a type, which returns an error and optional data or no error field in case there none. But, which I use it as </p>

<pre><code>return { err: 'todo' };
                ^^^^^^^^^^^^^^^ object literal. This type is incompatible with
.... Response
union: object type(s)
</code></pre>