A framework for building native applications using React
Add type exports to index.js.flow (#50225)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/50225 Updates `index.js.flow` to export (what should be) all public types for `react-native`, closely matching the resolved exported types of `types/index.d.ts` (current manual TS defs). - Note that this first pass doesn't have to be exhaustive (not yet load bearing) — however, I've done a best-effort scan, which passes our current `__typetests__` fixtures. **Approach: Explicit type imports in `index.js.flow`** We have a number of options for how we organise and re-export values and types from the new index file — for now, we're opting for explicitly exporting each symbol here. - While this clutters the index file somewhat, it also provides a single scannable source of truth — without introducing / altering each contributing module's type exports (we might want to do this eventually, but we're far from having strong organisation denoting the public API boundary). It's self-documenting that the index file contains all root exports by name. - At the same time, we currently have some exceptions that use `export [type] *` to line up with TypeScript `namespace`s. We aim to review and update these within this release cycle, to enforce the above system. Changelog: [Internal] - The `react-native` package now exports all public types in Flow (fbsource) Reviewed By: rubennorte Differential Revision: D71741575 fbshipit-source-id: 770e2b490e494ee195f4240358fec39f69145a94
A
Alex Hunt committed
4f709afa6d03a20f6e99aba5288068b5843b77db
Parent: c12fdc0
Committed by Facebook GitHub Bot <[email protected]>
on 3/27/2025, 3:46:41 AM