mirror of
https://github.com/facebook/react.git
synced 2026-11-18 20:15:56 +00:00
Fix flow types (#18204)
* Added missing @flow pragma to React.js * Fixed useContext() return type definition * Fixed previously masked Flow errors in DevTools and react-interactions packages * Added displayName to internal Context Flow type * Removed Flow generic annotations for createResponder This seems to cause a parsing error. (Not sure why.) The API is deprecated anyway so I'm being lazy for now and just adding a .
This commit is contained in:
1 parent
8e6a08ea4f
commit
d2158d6ccb
29 files changed
+151
-96
No files matched your search
+6
-3
@@ -24,6 +24,9 @@ import {
|
||||
} from 'react-devtools-shared/src/devtools/views/context';
|
||||
import {TreeStateContext} from '../TreeContext';
|
||||
|
||||
import type {StateContext} from '../TreeContext';
|
||||
import type {FrontendBridge} from 'react-devtools-shared/src/bridge';
|
||||
import type Store from 'react-devtools-shared/src/devtools/store';
|
||||
import type {StyleAndLayout as StyleAndLayoutBackend} from 'react-devtools-shared/src/backend/NativeStyleEditor/types';
|
||||
import type {StyleAndLayout as StyleAndLayoutFrontend} from './types';
|
||||
import type {Element} from 'react-devtools-shared/src/devtools/views/Components/types';
|
||||
@@ -77,8 +80,8 @@ type Props = {|
|
||||
|};
|
||||
|
||||
function NativeStyleContextController({children}: Props) {
|
||||
const bridge = useContext(BridgeContext);
|
||||
const store = useContext(StoreContext);
|
||||
const bridge = useContext<FrontendBridge>(BridgeContext);
|
||||
const store = useContext<Store>(StoreContext);
|
||||
|
||||
const getStyleAndLayout = useCallback<GetStyleAndLayout>(
|
||||
(id: number) => {
|
||||
@@ -95,7 +98,7 @@ function NativeStyleContextController({children}: Props) {
|
||||
// It's very important that this context consumes selectedElementID and not NativeStyleID.
|
||||
// Otherwise the effect that sends the "inspect" message across the bridge-
|
||||
// would itself be blocked by the same render that suspends (waiting for the data).
|
||||
const {selectedElementID} = useContext(TreeStateContext);
|
||||
const {selectedElementID} = useContext<StateContext>(TreeStateContext);
|
||||
|
||||
const [
|
||||
currentStyleAndLayout,
|
||||
|
||||
Reference in new issue
Block a user