Skip to content

Commit

Permalink
Remove $TEMPORARY$object types
Browse files Browse the repository at this point in the history
Summary:
This was left over from an old codemod.

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D41154548

fbshipit-source-id: 0b5fb3e78491b66ebaf13555f80e0265a25dc7d8
  • Loading branch information
javache authored and facebook-github-bot committed Nov 10, 2022
1 parent 1453ef1 commit 8a59153
Show file tree
Hide file tree
Showing 14 changed files with 72 additions and 65 deletions.
34 changes: 30 additions & 4 deletions Libraries/Components/Touchable/Touchable.flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,30 @@ import * as React from 'react';
* }
*/

// Default amount "active" region protrudes beyond box
/**
* Touchable states.
*/

const States = {
NOT_RESPONDER: 'NOT_RESPONDER', // Not the responder
RESPONDER_INACTIVE_PRESS_IN: 'RESPONDER_INACTIVE_PRESS_IN', // Responder, inactive, in the `PressRect`
RESPONDER_INACTIVE_PRESS_OUT: 'RESPONDER_INACTIVE_PRESS_OUT', // Responder, inactive, out of `PressRect`
RESPONDER_ACTIVE_PRESS_IN: 'RESPONDER_ACTIVE_PRESS_IN', // Responder, active, in the `PressRect`
RESPONDER_ACTIVE_PRESS_OUT: 'RESPONDER_ACTIVE_PRESS_OUT', // Responder, active, out of `PressRect`
RESPONDER_ACTIVE_LONG_PRESS_IN: 'RESPONDER_ACTIVE_LONG_PRESS_IN', // Responder, active, in the `PressRect`, after long press threshold
RESPONDER_ACTIVE_LONG_PRESS_OUT: 'RESPONDER_ACTIVE_LONG_PRESS_OUT', // Responder, active, out of `PressRect`, after long press threshold
ERROR: 'ERROR',
};

type State =
| typeof States.NOT_RESPONDER
| typeof States.RESPONDER_INACTIVE_PRESS_IN
| typeof States.RESPONDER_INACTIVE_PRESS_OUT
| typeof States.RESPONDER_ACTIVE_PRESS_IN
| typeof States.RESPONDER_ACTIVE_PRESS_OUT
| typeof States.RESPONDER_ACTIVE_LONG_PRESS_IN
| typeof States.RESPONDER_ACTIVE_LONG_PRESS_OUT
| typeof States.ERROR;

/**
* By convention, methods prefixed with underscores are meant to be @private,
Expand Down Expand Up @@ -200,9 +223,12 @@ interface TouchableMixinType {
* @return {object} State object to be placed inside of
* `this.state.touchable`.
*/
touchableGetInitialState: () => $TEMPORARY$object<{|
touchable: $TEMPORARY$object<{|responderID: null, touchState: void|}>,
|}>;
touchableGetInitialState: () => {
touchable: {
touchState: ?State,
responderID: ?PressEvent['currentTarget'],
},
};

// ==== Hooks to Gesture Responder system ====
/**
Expand Down
9 changes: 6 additions & 3 deletions Libraries/Components/Touchable/Touchable.js
Original file line number Diff line number Diff line change
Expand Up @@ -396,9 +396,12 @@ const TouchableMixin = {
* @return {object} State object to be placed inside of
* `this.state.touchable`.
*/
touchableGetInitialState: function (): $TEMPORARY$object<{|
touchable: $TEMPORARY$object<{|responderID: null, touchState: void|}>,
|}> {
touchableGetInitialState: function (): {
touchable: {
touchState: ?State,
responderID: ?PressEvent['currentTarget'],
},
} {
return {
touchable: {touchState: undefined, responderID: null},
};
Expand Down
10 changes: 1 addition & 9 deletions Libraries/Core/ReactNativeVersionCheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,7 @@ exports.checkVersions = function checkVersions(): void {
};

function _formatVersion(
version:
| {major: number, minor: number, patch: number, prerelease: ?number}
| {major: number, minor: number, patch: number, prerelease: ?string}
| $TEMPORARY$object<{
major: number,
minor: number,
patch: number,
prerelease: null,
}>,
version: (typeof Platform)['constants']['reactNativeVersion'],
): string {
return (
`${version.major}.${version.minor}.${version.patch}` +
Expand Down
4 changes: 2 additions & 2 deletions Libraries/Interaction/PanResponder.js
Original file line number Diff line number Diff line change
Expand Up @@ -399,10 +399,10 @@ const PanResponder: PanResponderType = {
* accordingly. (numberActiveTouches) may not be totally accurate unless you
* are the responder.
*/
create(config: PanResponderConfig): $TEMPORARY$object<{|
create(config: PanResponderConfig): {
getInteractionHandle: () => ?number,
panHandlers: PanHandlers,
|}> {
} {
const interactionState = {
handle: (null: ?number),
};
Expand Down
6 changes: 3 additions & 3 deletions Libraries/Lists/__tests__/VirtualizedSectionList-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@ describe('VirtualizedSectionList', () => {
describe('scrollToLocation', () => {
const ITEM_HEIGHT = 100;

const createVirtualizedSectionList = (
props: void | $TEMPORARY$object<{stickySectionHeadersEnabled: boolean}>,
) => {
const createVirtualizedSectionList = (props?: {
stickySectionHeadersEnabled: boolean,
}) => {
const component = ReactTestRenderer.create(
<VirtualizedSectionList
sections={[
Expand Down
4 changes: 1 addition & 3 deletions Libraries/LogBox/UI/LogBoxInspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@ const headerTitleMap = {
component: 'Render Error',
};

function LogBoxInspectorBody(
props: $TEMPORARY$object<{log: LogBoxLog, onRetry: () => void}>,
) {
function LogBoxInspectorBody(props: {log: LogBoxLog, onRetry: () => void}) {
const [collapsed, setCollapsed] = React.useState(true);

React.useEffect(() => {
Expand Down
4 changes: 2 additions & 2 deletions Libraries/LogBox/UI/LogBoxInspectorStackFrame.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import LogBoxButton from './LogBoxButton';
import * as LogBoxStyle from './LogBoxStyle';
import * as React from 'react';

type Props = $ReadOnly<{|
type Props = $ReadOnly<{
frame: StackFrame,
onPress?: ?(event: PressEvent) => void,
|}>;
}>;

function LogBoxInspectorStackFrame(props: Props): React.Node {
const {frame, onPress} = props;
Expand Down
12 changes: 5 additions & 7 deletions Libraries/LogBox/UI/LogBoxNotification.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ import LogBoxMessage from './LogBoxMessage';
import * as LogBoxStyle from './LogBoxStyle';
import * as React from 'react';

type Props = $ReadOnly<{|
type Props = $ReadOnly<{
log: LogBoxLog,
totalLogCount: number,
level: 'warn' | 'error',
onPressOpen: () => void,
onPressDismiss: () => void,
|}>;
}>;

function LogBoxLogNotification(props: Props): React.Node {
const {totalLogCount, level, log} = props;
Expand Down Expand Up @@ -56,9 +56,7 @@ function LogBoxLogNotification(props: Props): React.Node {
);
}

function CountBadge(
props: $TEMPORARY$object<{count: number, level: 'error' | 'warn'}>,
) {
function CountBadge(props: {count: number, level: 'error' | 'warn'}) {
return (
<View style={countStyles.outside}>
{/* $FlowFixMe[incompatible-type] (>=0.114.0) This suppression was added
Expand All @@ -73,7 +71,7 @@ function CountBadge(
);
}

function Message(props: $TEMPORARY$object<{message: MessageType}>) {
function Message(props: {message: MessageType}) {
return (
<View style={messageStyles.container}>
<Text numberOfLines={1} style={messageStyles.text}>
Expand All @@ -89,7 +87,7 @@ function Message(props: $TEMPORARY$object<{message: MessageType}>) {
);
}

function DismissButton(props: $TEMPORARY$object<{onPress: () => void}>) {
function DismissButton(props: {onPress: () => void}) {
return (
<View style={dismissStyles.container}>
<LogBoxButton
Expand Down
10 changes: 5 additions & 5 deletions Libraries/ReactNative/getCachedComponentWithDebugName.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
* @format
*/

import type {AbstractComponent, Node} from 'react';
import type {AbstractComponent} from 'react';

type NoopComponent = AbstractComponent<{children: Node}>;
import * as React from 'react';

type NoopComponent = AbstractComponent<{children: React.Node}>;

const cache: Map<
string, // displayName
Expand All @@ -23,9 +25,7 @@ export default function getCachedComponentWithDisplayName(
let ComponentWithDisplayName = cache.get(displayName);

if (!ComponentWithDisplayName) {
ComponentWithDisplayName = ({
children,
}: $TEMPORARY$object<{children: Node}>) => children;
ComponentWithDisplayName = ({children}: {children: React.Node}) => children;
// $FlowFixMe[prop-missing]
ComponentWithDisplayName.displayName = displayName;
cache.set(displayName, ComponentWithDisplayName);
Expand Down
15 changes: 4 additions & 11 deletions Libraries/Utilities/__tests__/useRefEffect-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,10 @@ import {act, create} from 'react-test-renderer';
function TestView({
childKey = null,
effect,
}:
| $FlowFixMe
| $TEMPORARY$object<{
childKey: $TEMPORARY$string<'bar'>,
effect: () => () => void,
}>
| $TEMPORARY$object<{childKey: $TEMPORARY$string<'foo'>, effect: () => void}>
| $TEMPORARY$object<{
childKey: $TEMPORARY$string<'foo'>,
effect: () => () => void,
}>) {
}: {
childKey: ?string,
effect: () => (() => void) | void,
}) {
const ref = useRefEffect(effect);
return <View key={childKey} ref={ref} testID={childKey} />;
}
Expand Down
9 changes: 2 additions & 7 deletions Libraries/Utilities/stringifySafe.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ export function createStringifySafeWithLimits(limits: {|
maxArrayLimit = Number.POSITIVE_INFINITY,
maxObjectKeysLimit = Number.POSITIVE_INFINITY,
} = limits;
const stack: Array<
string | {+[string]: mixed} | {'...(truncated keys)...': number},
> = [];
const stack: Array<mixed> = [];
/* $FlowFixMe[missing-this-annot] The 'this' type annotation(s) required by
* Flow's LTI update could not be added via codemod */
function replacer(key: string, value: mixed): mixed {
Expand All @@ -47,10 +45,7 @@ export function createStringifySafeWithLimits(limits: {|
return value;
}

let retval:
| string
| {+[string]: mixed}
| $TEMPORARY$object<{'...(truncated keys)...': number}> = value;
let retval: mixed = value;
if (Array.isArray(value)) {
if (stack.length >= maxDepth) {
retval = `[ ... array with ${value.length} values ... ]`;
Expand Down
6 changes: 3 additions & 3 deletions Libraries/Utilities/useWindowDimensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ export default function useWindowDimensions():
useEffect(() => {
function handleChange({
window,
}:
| $FlowFixMe
| $TEMPORARY$object<{window: DisplayMetrics | DisplayMetricsAndroid}>) {
}: {
window: DisplayMetrics | DisplayMetricsAndroid,
}) {
if (
dimensions.width !== window.width ||
dimensions.height !== window.height ||
Expand Down
10 changes: 6 additions & 4 deletions packages/rn-tester/js/components/RNTesterExampleFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,12 @@ class RNTesterExampleFilter<T> extends React.Component<Props<T>, State> {
}

_renderFilteredSections(
filteredSections: Array<
$TEMPORARY$object<{data: Array<T>, key: string, title: string}>,
>,
): ?React.Element<any> {
filteredSections: $ReadOnlyArray<{
data: Array<T>,
key: string,
title: string,
}>,
): React.Node {
if (this.props.page === 'examples_page') {
return (
<ScrollView
Expand Down
4 changes: 2 additions & 2 deletions packages/rn-tester/js/components/RNTesterNavbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ const BookmarkTab = ({
handleNavBarPress,
isBookmarkActive,
theme,
}: $TEMPORARY$object<{
}: {
handleNavBarPress: (data: {screen: string}) => void,
isBookmarkActive: boolean,
theme: RNTesterTheme,
}>) => (
}) => (
<View style={styles.centerBox}>
<View
style={[
Expand Down

0 comments on commit 8a59153

Please sign in to comment.