<p dir="auto">This RFC is regarding distributing typedef files with React. While this would be generally useful (and possibly useful to extract the <a href="https://github.com/facebook/flow/blob/master/lib/react.js">React.js definitions</a> out of flow itself (especially for renderer-implementers), it would be especially nice for renderer implementers.</p>
<p dir="auto">(I have manually extracted the minimal required for a react renderer in <a href="https://github.com/iamdustan/tiny-react-renderer/tree/fiber/src/fiber-types">https://github.com/iamdustan/tiny-react-renderer/tree/fiber/src/fiber-types</a>)</p>
<p dir="auto">Possible solutions:</p>
<ul dir="auto">
<li>ensure <code class="notranslate">flow gen-flow-files ....</code> works and generates all of the <code class="notranslate">*.js.flow</code> files in packages</li>
<li>add a custom step to the build tooling to include the public renderer type def for each public package + a minimal typedef for <code class="notranslate">ReactFiberReconciler.js</code> in each package that receives that file.</li>
</ul>
<p dir="auto">As per comments from <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/samwgoldman/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/samwgoldman">@samwgoldman</a> in the following issue, the flow built-in react type definitions are lagging behind and the recommendation is that the definitions be included and maintained in the react repo itself:</p>
<p dir="auto"><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="116360734" data-permission-text="Title is private" data-url="https://github.com/facebook/flow/issues/1081" data-hovercard-type="issue" data-hovercard-url="/facebook/flow/issues/1081/hovercard" href="https://github.com/facebook/flow/issues/1081">facebook/flow#1081</a></p>
<p dir="auto">The flow maintainers are doing an excellent job of implementing new JS syntax/features. It would be great if they did not also need to maintain this file:</p>
<p dir="auto"><a href="https://github.com/facebook/flow/blob/master/lib/react.js">https://github.com/facebook/flow/blob/master/lib/react.js</a></p>
<p dir="auto">One could, of course, also relegate this definition to yet another repo.</p>