-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[flow] Make every module implicitly depend on
react
in file_sig
Summary: ## Background I want to make all the React typing self-contained within the `react` module, instead of having the current setup where the stuff in the `react` module references things like `React$Node` from the global, so that we can override the typing of `React$Node`. The self-contained goal is important so that we keep the ability to override react typing (by providing a `react.js.flow` in the userland in `flowtyped`), without relying on the current unprincipled global libdef overriding mechanism. Killing the current unprincipled global libdef overriding mechanism is important to implement declaration merging, which will be necessary for enhanced multiplatform support. ## Why this diff In various places, we currently do refer to the global React types, especially `React$Node`. As a replacement, we should do something equivalent to `import * as React from 'react'. type T = React.Node` instead. In order to make this synthetic import work, it needs to be declared explicitly in file_sig. Why do we need to unconditionally declare dependency on it? Well, reference to `React$Node` can happen at any file, due to subtyping rules that might grab a `React$Node` on the fly (e.g. function to component type subtyping). Fortunately, it only increases heap usage, but doesn't affect perf at all. For incremental recheck, it won't change the fanout compared to the status quo: no matter whether the user has a `react.js.flow` in the userland, changes to react typing will trigger a recheck on all files anyways, before and after. Changelog: [internal] Reviewed By: panagosg7 Differential Revision: D67991112 fbshipit-source-id: 0b176ea03e68a939fb570de2addb3d9e9104373c
- Loading branch information
1 parent
6b8a101
commit a8a2c19
Showing
2 changed files
with
44 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters