Skip to content

Commit 1089faf

Browse files
committed
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: 4c98b8d Pull Request resolved: #25416
1 parent 3fd9bd8 commit 1089faf

16 files changed

+37
-47
lines changed

packages/react-devtools-shared/src/devtools/ContextMenu/useContextMenu.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default function useContextMenu({
2222
data: Object,
2323
id: string,
2424
onChange?: OnChangeFn,
25-
ref: {current: ElementRef<*> | null},
25+
ref: {current: ElementRef<any> | null},
2626
}) {
2727
const {showMenu} = useContext<RegistryContextType>(RegistryContext);
2828

packages/react-devtools-shared/src/devtools/views/Profiler/ChartNode.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ type Props = {
1616
height: number,
1717
isDimmed?: boolean,
1818
label: string,
19-
onClick: (event: SyntheticMouseEvent<*>) => mixed,
20-
onDoubleClick?: (event: SyntheticMouseEvent<*>) => mixed,
21-
onMouseEnter: (event: SyntheticMouseEvent<*>) => mixed,
22-
onMouseLeave: (event: SyntheticMouseEvent<*>) => mixed,
19+
onClick: (event: SyntheticMouseEvent<any>) => mixed,
20+
onDoubleClick?: (event: SyntheticMouseEvent<any>) => mixed,
21+
onMouseEnter: (event: SyntheticMouseEvent<any>) => mixed,
22+
onMouseLeave: (event: SyntheticMouseEvent<any>) => mixed,
2323
placeLabelAboveNode?: boolean,
2424
textStyle?: Object,
2525
width: number,

packages/react-devtools-shared/src/devtools/views/Profiler/CommitFlamegraphListItem.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function CommitFlamegraphListItem({data, index, style}: Props): React.Node {
4141
const {lineHeight} = useContext(SettingsContext);
4242

4343
const handleClick = useCallback(
44-
(event: SyntheticMouseEvent<*>, id: number, name: string) => {
44+
(event: SyntheticMouseEvent<EventTarget>, id: number, name: string) => {
4545
event.stopPropagation();
4646
selectFiber(id, name);
4747
},

packages/react-devtools-shared/src/devtools/views/Profiler/Tooltip.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default function Tooltip({
1717
const tooltipRef = useRef(null);
1818

1919
// update the position of the tooltip based on current mouse position
20-
const updateTooltipPosition = (event: SyntheticMouseEvent<*>) => {
20+
const updateTooltipPosition = (event: SyntheticMouseEvent<EventTarget>) => {
2121
const element = tooltipRef.current;
2222
if (element != null) {
2323
// first find the mouse position
@@ -30,7 +30,7 @@ export default function Tooltip({
3030
}
3131
};
3232

33-
const onMouseMove = (event: SyntheticMouseEvent<*>) => {
33+
const onMouseMove = (event: SyntheticMouseEvent<EventTarget>) => {
3434
updateTooltipPosition(event);
3535
};
3636

@@ -86,7 +86,7 @@ function getTooltipPosition(element, mousePosition) {
8686
// method used to find the current mouse position inside the container
8787
function getMousePosition(
8888
relativeContainer,
89-
mouseEvent: SyntheticMouseEvent<*>,
89+
mouseEvent: SyntheticMouseEvent<EventTarget>,
9090
) {
9191
if (relativeContainer !== null) {
9292
// Position within the nearest position:relative container.

packages/react-devtools-shared/src/hooks/parseHookNames/loadSourceAndMetadata.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ function decodeBase64String(encoded: string): Object {
134134

135135
function extractAndLoadSourceMapJSON(
136136
locationKeyToHookSourceAndMetadata: LocationKeyToHookSourceAndMetadata,
137-
): Promise<*> {
137+
): Promise<Array<$Call<<T>(p: Promise<T> | T) => T, Promise<void>>>> {
138138
// Deduplicate fetches, since there can be multiple location keys per source map.
139139
const dedupedFetchPromises = new Map();
140140

@@ -459,7 +459,7 @@ function isUnnamedBuiltInHook(hook: HooksNode) {
459459
function loadSourceFiles(
460460
locationKeyToHookSourceAndMetadata: LocationKeyToHookSourceAndMetadata,
461461
fetchFileWithCaching: FetchFileWithCaching | null,
462-
): Promise<*> {
462+
): Promise<Array<$Call<<T>(p: Promise<T> | T) => T, Promise<void>>>> {
463463
// Deduplicate fetches, since there can be multiple location keys per file.
464464
const dedupedFetchPromises = new Map();
465465

packages/react-devtools-timeline/src/types.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import type {ScrollState} from './view-base/utils/scrollState';
1313
// eslint-disable-next-line no-unused-vars
1414
type Return_<R, F: (...args: Array<any>) => R> = R;
1515
/** Get return type of a function. */
16-
export type Return<T> = Return_<*, T>;
16+
export type Return<T> = Return_<mixed, T>;
1717

1818
// Project types
1919

packages/react-dom-bindings/src/client/ReactDOMHostConfig.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* @flow
88
*/
99

10+
import type {EventPriority} from 'react-reconciler/src/ReactEventPriorities';
1011
import type {DOMEventName} from '../events/DOMEventNames';
1112
import type {Fiber, FiberRoot} from 'react-reconciler/src/ReactInternalTypes';
1213
import type {
@@ -209,7 +210,7 @@ export function getChildHostContext(
209210
return getChildNamespace(parentNamespace, type);
210211
}
211212

212-
export function getPublicInstance(instance: Instance): * {
213+
export function getPublicInstance(instance: Instance): Instance {
213214
return instance;
214215
}
215216

@@ -370,7 +371,7 @@ export function createTextInstance(
370371
return textNode;
371372
}
372373

373-
export function getCurrentEventPriority(): * {
374+
export function getCurrentEventPriority(): EventPriority {
374375
const currentEvent = window.event;
375376
if (currentEvent === undefined) {
376377
return DefaultEventPriority;

packages/react-dom-bindings/src/client/ReactDOMInput.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ function updateNamedCousins(rootNode, props) {
415415
export function setDefaultValue(
416416
node: InputWithWrapperState,
417417
type: ?string,
418-
value: *,
418+
value: ToStringValue,
419419
) {
420420
if (
421421
// Focused number inputs synchronize on blur. See ChangeEventPlugin.js

packages/react-dom-bindings/src/events/ReactDOMEventListener.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* @flow
88
*/
99

10+
import type {EventPriority} from 'react-reconciler/src/ReactEventPriorities';
1011
import type {AnyNativeEvent} from '../events/PluginModuleType';
1112
import type {Fiber, FiberRoot} from 'react-reconciler/src/ReactInternalTypes';
1213
import type {Container, SuspenseInstance} from '../client/ReactDOMHostConfig';
@@ -407,7 +408,7 @@ export function findInstanceBlockingEvent(
407408
return null;
408409
}
409410

410-
export function getEventPriority(domEventName: DOMEventName): * {
411+
export function getEventPriority(domEventName: DOMEventName): EventPriority {
411412
switch (domEventName) {
412413
// Used by SimpleEventPlugin:
413414
case 'cancel':

packages/react-reconciler/src/ReactChildFiber.new.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ function createChildReconciler(shouldTrackSideEffects): ChildReconciler {
475475
function updateFragment(
476476
returnFiber: Fiber,
477477
current: Fiber | null,
478-
fragment: Iterable<*>,
478+
fragment: Iterable<React$Node>,
479479
lanes: Lanes,
480480
key: null | string,
481481
): Fiber {
@@ -750,7 +750,7 @@ function createChildReconciler(shouldTrackSideEffects): ChildReconciler {
750750
function reconcileChildrenArray(
751751
returnFiber: Fiber,
752752
currentFirstChild: Fiber | null,
753-
newChildren: Array<*>,
753+
newChildren: Array<any>,
754754
lanes: Lanes,
755755
): Fiber | null {
756756
// This algorithm can't optimize by searching from both ends since we
@@ -917,7 +917,7 @@ function createChildReconciler(shouldTrackSideEffects): ChildReconciler {
917917
function reconcileChildrenIterator(
918918
returnFiber: Fiber,
919919
currentFirstChild: Fiber | null,
920-
newChildrenIterable: Iterable<*>,
920+
newChildrenIterable: Iterable<mixed>,
921921
lanes: Lanes,
922922
): Fiber | null {
923923
// This is the same implementation as reconcileChildrenArray(),

packages/react-reconciler/src/ReactChildFiber.old.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ function createChildReconciler(shouldTrackSideEffects): ChildReconciler {
475475
function updateFragment(
476476
returnFiber: Fiber,
477477
current: Fiber | null,
478-
fragment: Iterable<*>,
478+
fragment: Iterable<React$Node>,
479479
lanes: Lanes,
480480
key: null | string,
481481
): Fiber {
@@ -750,7 +750,7 @@ function createChildReconciler(shouldTrackSideEffects): ChildReconciler {
750750
function reconcileChildrenArray(
751751
returnFiber: Fiber,
752752
currentFirstChild: Fiber | null,
753-
newChildren: Array<*>,
753+
newChildren: Array<any>,
754754
lanes: Lanes,
755755
): Fiber | null {
756756
// This algorithm can't optimize by searching from both ends since we
@@ -917,7 +917,7 @@ function createChildReconciler(shouldTrackSideEffects): ChildReconciler {
917917
function reconcileChildrenIterator(
918918
returnFiber: Fiber,
919919
currentFirstChild: Fiber | null,
920-
newChildrenIterable: Iterable<*>,
920+
newChildrenIterable: Iterable<mixed>,
921921
lanes: Lanes,
922922
): Fiber | null {
923923
// This is the same implementation as reconcileChildrenArray(),

packages/react-reconciler/src/ReactFiberClassUpdateQueue.new.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,8 @@ export function cloneUpdateQueue<State>(
207207
}
208208
}
209209

210-
export function createUpdate(eventTime: number, lane: Lane): Update<*> {
211-
const update: Update<*> = {
210+
export function createUpdate(eventTime: number, lane: Lane): Update<mixed> {
211+
const update: Update<mixed> = {
212212
eventTime,
213213
lane,
214214

packages/react-reconciler/src/ReactFiberClassUpdateQueue.old.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,8 @@ export function cloneUpdateQueue<State>(
207207
}
208208
}
209209

210-
export function createUpdate(eventTime: number, lane: Lane): Update<*> {
211-
const update: Update<*> = {
210+
export function createUpdate(eventTime: number, lane: Lane): Update<mixed> {
211+
const update: Update<mixed> = {
212212
eventTime,
213213
lane,
214214

packages/react-reconciler/src/ReactFiberCommitWork.new.js

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,7 @@ function commitClassLayoutLifecycles(
883883
function commitClassCallbacks(finishedWork: Fiber) {
884884
// TODO: I think this is now always non-null by the time it reaches the
885885
// commit phase. Consider removing the type check.
886-
const updateQueue: UpdateQueue<*> | null = (finishedWork.updateQueue: any);
886+
const updateQueue: UpdateQueue<mixed> | null = (finishedWork.updateQueue: any);
887887
if (updateQueue !== null) {
888888
const instance = finishedWork.stateNode;
889889
if (__DEV__) {
@@ -1050,9 +1050,7 @@ function commitLayoutEffectOnFiber(
10501050
if (flags & Callback) {
10511051
// TODO: I think this is now always non-null by the time it reaches the
10521052
// commit phase. Consider removing the type check.
1053-
const updateQueue: UpdateQueue<
1054-
*,
1055-
> | null = (finishedWork.updateQueue: any);
1053+
const updateQueue: UpdateQueue<mixed> | null = (finishedWork.updateQueue: any);
10561054
if (updateQueue !== null) {
10571055
let instance = null;
10581056
if (finishedWork.child !== null) {
@@ -2521,9 +2519,7 @@ function commitMutationEffectsOnFiber(
25212519
}
25222520

25232521
if (flags & Callback && offscreenSubtreeIsHidden) {
2524-
const updateQueue: UpdateQueue<
2525-
*,
2526-
> | null = (finishedWork.updateQueue: any);
2522+
const updateQueue: UpdateQueue<mixed> | null = (finishedWork.updateQueue: any);
25272523
if (updateQueue !== null) {
25282524
deferHiddenCallbacks(updateQueue);
25292525
}
@@ -3015,9 +3011,7 @@ export function reappearLayoutEffects(
30153011

30163012
// Commit any callbacks that would have fired while the component
30173013
// was hidden.
3018-
const updateQueue: UpdateQueue<
3019-
*,
3020-
> | null = (finishedWork.updateQueue: any);
3014+
const updateQueue: UpdateQueue<mixed> | null = (finishedWork.updateQueue: any);
30213015
if (updateQueue !== null) {
30223016
commitHiddenCallbacks(updateQueue, instance);
30233017
}

packages/react-reconciler/src/ReactFiberCommitWork.old.js

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,7 @@ function commitClassLayoutLifecycles(
883883
function commitClassCallbacks(finishedWork: Fiber) {
884884
// TODO: I think this is now always non-null by the time it reaches the
885885
// commit phase. Consider removing the type check.
886-
const updateQueue: UpdateQueue<*> | null = (finishedWork.updateQueue: any);
886+
const updateQueue: UpdateQueue<mixed> | null = (finishedWork.updateQueue: any);
887887
if (updateQueue !== null) {
888888
const instance = finishedWork.stateNode;
889889
if (__DEV__) {
@@ -1050,9 +1050,7 @@ function commitLayoutEffectOnFiber(
10501050
if (flags & Callback) {
10511051
// TODO: I think this is now always non-null by the time it reaches the
10521052
// commit phase. Consider removing the type check.
1053-
const updateQueue: UpdateQueue<
1054-
*,
1055-
> | null = (finishedWork.updateQueue: any);
1053+
const updateQueue: UpdateQueue<mixed> | null = (finishedWork.updateQueue: any);
10561054
if (updateQueue !== null) {
10571055
let instance = null;
10581056
if (finishedWork.child !== null) {
@@ -2521,9 +2519,7 @@ function commitMutationEffectsOnFiber(
25212519
}
25222520

25232521
if (flags & Callback && offscreenSubtreeIsHidden) {
2524-
const updateQueue: UpdateQueue<
2525-
*,
2526-
> | null = (finishedWork.updateQueue: any);
2522+
const updateQueue: UpdateQueue<mixed> | null = (finishedWork.updateQueue: any);
25272523
if (updateQueue !== null) {
25282524
deferHiddenCallbacks(updateQueue);
25292525
}
@@ -3015,9 +3011,7 @@ export function reappearLayoutEffects(
30153011

30163012
// Commit any callbacks that would have fired while the component
30173013
// was hidden.
3018-
const updateQueue: UpdateQueue<
3019-
*,
3020-
> | null = (finishedWork.updateQueue: any);
3014+
const updateQueue: UpdateQueue<mixed> | null = (finishedWork.updateQueue: any);
30213015
if (updateQueue !== null) {
30223016
commitHiddenCallbacks(updateQueue, instance);
30233017
}

packages/react-reconciler/src/ReactInternalTypes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ type BaseFiberRootProperties = {
238238

239239
// Node returned by Scheduler.scheduleCallback. Represents the next rendering
240240
// task that the root will work on.
241-
callbackNode: *,
241+
callbackNode: any,
242242
callbackPriority: Lane,
243243
eventTimes: LaneMap<number>,
244244
expirationTimes: LaneMap<number>,

0 commit comments

Comments
 (0)