mirror of
https://github.com/facebook/react.git
synced 2026-02-22 03:42:05 +00:00
Flow: run codemod to remove existential type
The existential type `*` was deprecated and a codemod provided to replace it. Ran that and did some manual fixups:
```sh
node_modules/.bin/flow codemod replace-existentials --write .
```
ghstack-source-id: 4c98b8db6a
Pull Request resolved: https://github.com/facebook/react/pull/25416
This commit is contained in:
@@ -22,7 +22,7 @@ export default function useContextMenu({
|
||||
data: Object,
|
||||
id: string,
|
||||
onChange?: OnChangeFn,
|
||||
ref: {current: ElementRef<*> | null},
|
||||
ref: {current: ElementRef<any> | null},
|
||||
}) {
|
||||
const {showMenu} = useContext<RegistryContextType>(RegistryContext);
|
||||
|
||||
|
||||
@@ -16,10 +16,10 @@ type Props = {
|
||||
height: number,
|
||||
isDimmed?: boolean,
|
||||
label: string,
|
||||
onClick: (event: SyntheticMouseEvent<*>) => mixed,
|
||||
onDoubleClick?: (event: SyntheticMouseEvent<*>) => mixed,
|
||||
onMouseEnter: (event: SyntheticMouseEvent<*>) => mixed,
|
||||
onMouseLeave: (event: SyntheticMouseEvent<*>) => mixed,
|
||||
onClick: (event: SyntheticMouseEvent<any>) => mixed,
|
||||
onDoubleClick?: (event: SyntheticMouseEvent<any>) => mixed,
|
||||
onMouseEnter: (event: SyntheticMouseEvent<any>) => mixed,
|
||||
onMouseLeave: (event: SyntheticMouseEvent<any>) => mixed,
|
||||
placeLabelAboveNode?: boolean,
|
||||
textStyle?: Object,
|
||||
width: number,
|
||||
|
||||
@@ -41,7 +41,7 @@ function CommitFlamegraphListItem({data, index, style}: Props): React.Node {
|
||||
const {lineHeight} = useContext(SettingsContext);
|
||||
|
||||
const handleClick = useCallback(
|
||||
(event: SyntheticMouseEvent<*>, id: number, name: string) => {
|
||||
(event: SyntheticMouseEvent<EventTarget>, id: number, name: string) => {
|
||||
event.stopPropagation();
|
||||
selectFiber(id, name);
|
||||
},
|
||||
|
||||
@@ -17,7 +17,7 @@ export default function Tooltip({
|
||||
const tooltipRef = useRef(null);
|
||||
|
||||
// update the position of the tooltip based on current mouse position
|
||||
const updateTooltipPosition = (event: SyntheticMouseEvent<*>) => {
|
||||
const updateTooltipPosition = (event: SyntheticMouseEvent<EventTarget>) => {
|
||||
const element = tooltipRef.current;
|
||||
if (element != null) {
|
||||
// first find the mouse position
|
||||
@@ -30,7 +30,7 @@ export default function Tooltip({
|
||||
}
|
||||
};
|
||||
|
||||
const onMouseMove = (event: SyntheticMouseEvent<*>) => {
|
||||
const onMouseMove = (event: SyntheticMouseEvent<EventTarget>) => {
|
||||
updateTooltipPosition(event);
|
||||
};
|
||||
|
||||
@@ -86,7 +86,7 @@ function getTooltipPosition(element, mousePosition) {
|
||||
// method used to find the current mouse position inside the container
|
||||
function getMousePosition(
|
||||
relativeContainer,
|
||||
mouseEvent: SyntheticMouseEvent<*>,
|
||||
mouseEvent: SyntheticMouseEvent<EventTarget>,
|
||||
) {
|
||||
if (relativeContainer !== null) {
|
||||
// Position within the nearest position:relative container.
|
||||
|
||||
@@ -134,7 +134,7 @@ function decodeBase64String(encoded: string): Object {
|
||||
|
||||
function extractAndLoadSourceMapJSON(
|
||||
locationKeyToHookSourceAndMetadata: LocationKeyToHookSourceAndMetadata,
|
||||
): Promise<*> {
|
||||
): Promise<Array<$Call<<T>(p: Promise<T> | T) => T, Promise<void>>>> {
|
||||
// Deduplicate fetches, since there can be multiple location keys per source map.
|
||||
const dedupedFetchPromises = new Map();
|
||||
|
||||
@@ -459,7 +459,7 @@ function isUnnamedBuiltInHook(hook: HooksNode) {
|
||||
function loadSourceFiles(
|
||||
locationKeyToHookSourceAndMetadata: LocationKeyToHookSourceAndMetadata,
|
||||
fetchFileWithCaching: FetchFileWithCaching | null,
|
||||
): Promise<*> {
|
||||
): Promise<Array<$Call<<T>(p: Promise<T> | T) => T, Promise<void>>>> {
|
||||
// Deduplicate fetches, since there can be multiple location keys per file.
|
||||
const dedupedFetchPromises = new Map();
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import type {ScrollState} from './view-base/utils/scrollState';
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
type Return_<R, F: (...args: Array<any>) => R> = R;
|
||||
/** Get return type of a function. */
|
||||
export type Return<T> = Return_<*, T>;
|
||||
export type Return<T> = Return_<mixed, T>;
|
||||
|
||||
// Project types
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
* @flow
|
||||
*/
|
||||
|
||||
import type {EventPriority} from 'react-reconciler/src/ReactEventPriorities';
|
||||
import type {DOMEventName} from '../events/DOMEventNames';
|
||||
import type {Fiber, FiberRoot} from 'react-reconciler/src/ReactInternalTypes';
|
||||
import type {
|
||||
@@ -209,7 +210,7 @@ export function getChildHostContext(
|
||||
return getChildNamespace(parentNamespace, type);
|
||||
}
|
||||
|
||||
export function getPublicInstance(instance: Instance): * {
|
||||
export function getPublicInstance(instance: Instance): Instance {
|
||||
return instance;
|
||||
}
|
||||
|
||||
@@ -370,7 +371,7 @@ export function createTextInstance(
|
||||
return textNode;
|
||||
}
|
||||
|
||||
export function getCurrentEventPriority(): * {
|
||||
export function getCurrentEventPriority(): EventPriority {
|
||||
const currentEvent = window.event;
|
||||
if (currentEvent === undefined) {
|
||||
return DefaultEventPriority;
|
||||
|
||||
@@ -415,7 +415,7 @@ function updateNamedCousins(rootNode, props) {
|
||||
export function setDefaultValue(
|
||||
node: InputWithWrapperState,
|
||||
type: ?string,
|
||||
value: *,
|
||||
value: ToStringValue,
|
||||
) {
|
||||
if (
|
||||
// Focused number inputs synchronize on blur. See ChangeEventPlugin.js
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
* @flow
|
||||
*/
|
||||
|
||||
import type {EventPriority} from 'react-reconciler/src/ReactEventPriorities';
|
||||
import type {AnyNativeEvent} from '../events/PluginModuleType';
|
||||
import type {Fiber, FiberRoot} from 'react-reconciler/src/ReactInternalTypes';
|
||||
import type {Container, SuspenseInstance} from '../client/ReactDOMHostConfig';
|
||||
@@ -407,7 +408,7 @@ export function findInstanceBlockingEvent(
|
||||
return null;
|
||||
}
|
||||
|
||||
export function getEventPriority(domEventName: DOMEventName): * {
|
||||
export function getEventPriority(domEventName: DOMEventName): EventPriority {
|
||||
switch (domEventName) {
|
||||
// Used by SimpleEventPlugin:
|
||||
case 'cancel':
|
||||
|
||||
@@ -475,7 +475,7 @@ function createChildReconciler(shouldTrackSideEffects): ChildReconciler {
|
||||
function updateFragment(
|
||||
returnFiber: Fiber,
|
||||
current: Fiber | null,
|
||||
fragment: Iterable<*>,
|
||||
fragment: Iterable<React$Node>,
|
||||
lanes: Lanes,
|
||||
key: null | string,
|
||||
): Fiber {
|
||||
@@ -750,7 +750,7 @@ function createChildReconciler(shouldTrackSideEffects): ChildReconciler {
|
||||
function reconcileChildrenArray(
|
||||
returnFiber: Fiber,
|
||||
currentFirstChild: Fiber | null,
|
||||
newChildren: Array<*>,
|
||||
newChildren: Array<any>,
|
||||
lanes: Lanes,
|
||||
): Fiber | null {
|
||||
// This algorithm can't optimize by searching from both ends since we
|
||||
@@ -917,7 +917,7 @@ function createChildReconciler(shouldTrackSideEffects): ChildReconciler {
|
||||
function reconcileChildrenIterator(
|
||||
returnFiber: Fiber,
|
||||
currentFirstChild: Fiber | null,
|
||||
newChildrenIterable: Iterable<*>,
|
||||
newChildrenIterable: Iterable<mixed>,
|
||||
lanes: Lanes,
|
||||
): Fiber | null {
|
||||
// This is the same implementation as reconcileChildrenArray(),
|
||||
|
||||
@@ -475,7 +475,7 @@ function createChildReconciler(shouldTrackSideEffects): ChildReconciler {
|
||||
function updateFragment(
|
||||
returnFiber: Fiber,
|
||||
current: Fiber | null,
|
||||
fragment: Iterable<*>,
|
||||
fragment: Iterable<React$Node>,
|
||||
lanes: Lanes,
|
||||
key: null | string,
|
||||
): Fiber {
|
||||
@@ -750,7 +750,7 @@ function createChildReconciler(shouldTrackSideEffects): ChildReconciler {
|
||||
function reconcileChildrenArray(
|
||||
returnFiber: Fiber,
|
||||
currentFirstChild: Fiber | null,
|
||||
newChildren: Array<*>,
|
||||
newChildren: Array<any>,
|
||||
lanes: Lanes,
|
||||
): Fiber | null {
|
||||
// This algorithm can't optimize by searching from both ends since we
|
||||
@@ -917,7 +917,7 @@ function createChildReconciler(shouldTrackSideEffects): ChildReconciler {
|
||||
function reconcileChildrenIterator(
|
||||
returnFiber: Fiber,
|
||||
currentFirstChild: Fiber | null,
|
||||
newChildrenIterable: Iterable<*>,
|
||||
newChildrenIterable: Iterable<mixed>,
|
||||
lanes: Lanes,
|
||||
): Fiber | null {
|
||||
// This is the same implementation as reconcileChildrenArray(),
|
||||
|
||||
@@ -207,8 +207,8 @@ export function cloneUpdateQueue<State>(
|
||||
}
|
||||
}
|
||||
|
||||
export function createUpdate(eventTime: number, lane: Lane): Update<*> {
|
||||
const update: Update<*> = {
|
||||
export function createUpdate(eventTime: number, lane: Lane): Update<mixed> {
|
||||
const update: Update<mixed> = {
|
||||
eventTime,
|
||||
lane,
|
||||
|
||||
|
||||
@@ -207,8 +207,8 @@ export function cloneUpdateQueue<State>(
|
||||
}
|
||||
}
|
||||
|
||||
export function createUpdate(eventTime: number, lane: Lane): Update<*> {
|
||||
const update: Update<*> = {
|
||||
export function createUpdate(eventTime: number, lane: Lane): Update<mixed> {
|
||||
const update: Update<mixed> = {
|
||||
eventTime,
|
||||
lane,
|
||||
|
||||
|
||||
@@ -883,7 +883,7 @@ function commitClassLayoutLifecycles(
|
||||
function commitClassCallbacks(finishedWork: Fiber) {
|
||||
// TODO: I think this is now always non-null by the time it reaches the
|
||||
// commit phase. Consider removing the type check.
|
||||
const updateQueue: UpdateQueue<*> | null = (finishedWork.updateQueue: any);
|
||||
const updateQueue: UpdateQueue<mixed> | null = (finishedWork.updateQueue: any);
|
||||
if (updateQueue !== null) {
|
||||
const instance = finishedWork.stateNode;
|
||||
if (__DEV__) {
|
||||
@@ -1050,9 +1050,7 @@ function commitLayoutEffectOnFiber(
|
||||
if (flags & Callback) {
|
||||
// TODO: I think this is now always non-null by the time it reaches the
|
||||
// commit phase. Consider removing the type check.
|
||||
const updateQueue: UpdateQueue<
|
||||
*,
|
||||
> | null = (finishedWork.updateQueue: any);
|
||||
const updateQueue: UpdateQueue<mixed> | null = (finishedWork.updateQueue: any);
|
||||
if (updateQueue !== null) {
|
||||
let instance = null;
|
||||
if (finishedWork.child !== null) {
|
||||
@@ -2521,9 +2519,7 @@ function commitMutationEffectsOnFiber(
|
||||
}
|
||||
|
||||
if (flags & Callback && offscreenSubtreeIsHidden) {
|
||||
const updateQueue: UpdateQueue<
|
||||
*,
|
||||
> | null = (finishedWork.updateQueue: any);
|
||||
const updateQueue: UpdateQueue<mixed> | null = (finishedWork.updateQueue: any);
|
||||
if (updateQueue !== null) {
|
||||
deferHiddenCallbacks(updateQueue);
|
||||
}
|
||||
@@ -3015,9 +3011,7 @@ export function reappearLayoutEffects(
|
||||
|
||||
// Commit any callbacks that would have fired while the component
|
||||
// was hidden.
|
||||
const updateQueue: UpdateQueue<
|
||||
*,
|
||||
> | null = (finishedWork.updateQueue: any);
|
||||
const updateQueue: UpdateQueue<mixed> | null = (finishedWork.updateQueue: any);
|
||||
if (updateQueue !== null) {
|
||||
commitHiddenCallbacks(updateQueue, instance);
|
||||
}
|
||||
|
||||
@@ -883,7 +883,7 @@ function commitClassLayoutLifecycles(
|
||||
function commitClassCallbacks(finishedWork: Fiber) {
|
||||
// TODO: I think this is now always non-null by the time it reaches the
|
||||
// commit phase. Consider removing the type check.
|
||||
const updateQueue: UpdateQueue<*> | null = (finishedWork.updateQueue: any);
|
||||
const updateQueue: UpdateQueue<mixed> | null = (finishedWork.updateQueue: any);
|
||||
if (updateQueue !== null) {
|
||||
const instance = finishedWork.stateNode;
|
||||
if (__DEV__) {
|
||||
@@ -1050,9 +1050,7 @@ function commitLayoutEffectOnFiber(
|
||||
if (flags & Callback) {
|
||||
// TODO: I think this is now always non-null by the time it reaches the
|
||||
// commit phase. Consider removing the type check.
|
||||
const updateQueue: UpdateQueue<
|
||||
*,
|
||||
> | null = (finishedWork.updateQueue: any);
|
||||
const updateQueue: UpdateQueue<mixed> | null = (finishedWork.updateQueue: any);
|
||||
if (updateQueue !== null) {
|
||||
let instance = null;
|
||||
if (finishedWork.child !== null) {
|
||||
@@ -2521,9 +2519,7 @@ function commitMutationEffectsOnFiber(
|
||||
}
|
||||
|
||||
if (flags & Callback && offscreenSubtreeIsHidden) {
|
||||
const updateQueue: UpdateQueue<
|
||||
*,
|
||||
> | null = (finishedWork.updateQueue: any);
|
||||
const updateQueue: UpdateQueue<mixed> | null = (finishedWork.updateQueue: any);
|
||||
if (updateQueue !== null) {
|
||||
deferHiddenCallbacks(updateQueue);
|
||||
}
|
||||
@@ -3015,9 +3011,7 @@ export function reappearLayoutEffects(
|
||||
|
||||
// Commit any callbacks that would have fired while the component
|
||||
// was hidden.
|
||||
const updateQueue: UpdateQueue<
|
||||
*,
|
||||
> | null = (finishedWork.updateQueue: any);
|
||||
const updateQueue: UpdateQueue<mixed> | null = (finishedWork.updateQueue: any);
|
||||
if (updateQueue !== null) {
|
||||
commitHiddenCallbacks(updateQueue, instance);
|
||||
}
|
||||
|
||||
@@ -238,7 +238,7 @@ type BaseFiberRootProperties = {
|
||||
|
||||
// Node returned by Scheduler.scheduleCallback. Represents the next rendering
|
||||
// task that the root will work on.
|
||||
callbackNode: *,
|
||||
callbackNode: any,
|
||||
callbackPriority: Lane,
|
||||
eventTimes: LaneMap<number>,
|
||||
expirationTimes: LaneMap<number>,
|
||||
|
||||
Reference in New Issue
Block a user