Skip to content

Commit

Permalink
replace '$TEMPORARY$string<>' with 'string' (facebook#46876)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebook#46876

* Used codemods of [this commit](https://www.internalfb.com/intern/commit/cloud/FBS/3a8982d63197fff7bac8b6d448545ec9660f331e)
* `js1 flow-runner codemod flow/replaceTempStringWithString`
* `js1 flow-runner codemod flow/simplifyUnionsOfString`

Changelog: [internal]

Reviewed By: SamChou19815

Differential Revision: D63991775

fbshipit-source-id: 5b9d1fdf045405230ca2b0969357ae92479692b5
  • Loading branch information
panagosg7 authored and facebook-github-bot committed Oct 8, 2024
1 parent bed5323 commit 40a4feb
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 65 deletions.
2 changes: 1 addition & 1 deletion packages/assets/path-support.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const drawableFileTypes = new Set([
function getAndroidResourceFolderName(
asset: PackagerAsset,
scale: number,
): string | $TEMPORARY$string<'raw'> {
): string {
if (!drawableFileTypes.has(asset.type)) {
return 'raw';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ describe('Keyboard', () => {
describe('scheduling layout animation', () => {
const scheduleLayoutAnimation = (
duration: null | number,
easing:
| null
| $TEMPORARY$string<'linear'>
| $TEMPORARY$string<'some-unknown-animation-type'>
| $TEMPORARY$string<'spring'>,
easing: null | string,
): void =>
// $FlowFixMe[incompatible-call]
Keyboard.scheduleLayoutAnimation({duration, easing});
Expand All @@ -60,9 +56,7 @@ describe('Keyboard', () => {
});

describe('animation update type', () => {
const assertAnimationUpdateType = (
type: $TEMPORARY$string<'keyboard'> | $TEMPORARY$string<'linear'>,
) =>
const assertAnimationUpdateType = (type: string) =>
expect(LayoutAnimation.configureNext).toHaveBeenCalledWith(
expect.objectContaining({
duration: expect.anything(),
Expand Down
11 changes: 1 addition & 10 deletions packages/react-native/Libraries/Core/setUpBatchedBridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,7 @@ if (global.RN$Bridgeless === true && global.RN$registerCallableModule) {
} else {
const BatchedBridge = require('../BatchedBridge/BatchedBridge');
registerModule = (
moduleName:
| $TEMPORARY$string<'GlobalPerformanceLogger'>
| $TEMPORARY$string<'HMRClient'>
| $TEMPORARY$string<'HeapCapture'>
| $TEMPORARY$string<'JSTimers'>
| $TEMPORARY$string<'RCTDeviceEventEmitter'>
| $TEMPORARY$string<'RCTLog'>
| $TEMPORARY$string<'RCTNativeAppEventEmitter'>
| $TEMPORARY$string<'SamplingProfiler'>
| $TEMPORARY$string<'Systrace'>,
moduleName: string,
/* $FlowFixMe[missing-local-annot] The type annotation(s) required by
* Flow's LTI update could not be added via codemod */
factory,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ type EnableArgs = {
};

class NetworkAgent extends InspectorAgent {
static DOMAIN: $TEMPORARY$string<'Network'> = 'Network';
static DOMAIN: string = 'Network';

_sendEvent: EventSender;
_interceptor: ?Interceptor;
Expand Down
4 changes: 2 additions & 2 deletions packages/react-native/Libraries/LogBox/UI/LogBoxMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function TappableLinks(props: {

// URLs were detected. Construct array of Text nodes.

let fragments: Array<React.Node> = [];
const fragments: Array<React.Node> = [];
let indexCounter = 0;
let startIndex = 0;

Expand Down Expand Up @@ -115,7 +115,7 @@ function LogBoxMessage(props: Props): React.Node {
const elements = [];
let length = 0;
const createUnderLength = (
key: string | $TEMPORARY$string<'-1'>,
key: string,
message: string,
style: void | TextStyleProp,
) => {
Expand Down
37 changes: 3 additions & 34 deletions packages/react-native/Libraries/StyleSheet/processTransform.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function processTransform(
): Array<Object> | Array<number> {
if (typeof transform === 'string') {
const regex = new RegExp(/(\w+)\(([^)]+)\)/g);
let transformArray: Array<Object> = [];
const transformArray: Array<Object> = [];
let matches;

while ((matches = regex.exec(transform))) {
Expand All @@ -50,23 +50,7 @@ function processTransform(
}

const _getKeyAndValueFromCSSTransform: (
key:
| string
| $TEMPORARY$string<'matrix'>
| $TEMPORARY$string<'perspective'>
| $TEMPORARY$string<'rotate'>
| $TEMPORARY$string<'rotateX'>
| $TEMPORARY$string<'rotateY'>
| $TEMPORARY$string<'rotateZ'>
| $TEMPORARY$string<'scale'>
| $TEMPORARY$string<'scaleX'>
| $TEMPORARY$string<'scaleY'>
| $TEMPORARY$string<'skewX'>
| $TEMPORARY$string<'skewY'>
| $TEMPORARY$string<'translate'>
| $TEMPORARY$string<'translate3d'>
| $TEMPORARY$string<'translateX'>
| $TEMPORARY$string<'translateY'>,
key: string,
args: string,
) => {key: string, value?: Array<string | number> | number | string} = (
key,
Expand Down Expand Up @@ -169,22 +153,7 @@ function _validateTransforms(transform: Array<Object>): void {
}

function _validateTransform(
key:
| string
| $TEMPORARY$string<'matrix'>
| $TEMPORARY$string<'perspective'>
| $TEMPORARY$string<'rotate'>
| $TEMPORARY$string<'rotateX'>
| $TEMPORARY$string<'rotateY'>
| $TEMPORARY$string<'rotateZ'>
| $TEMPORARY$string<'scale'>
| $TEMPORARY$string<'scaleX'>
| $TEMPORARY$string<'scaleY'>
| $TEMPORARY$string<'skewX'>
| $TEMPORARY$string<'skewY'>
| $TEMPORARY$string<'translate'>
| $TEMPORARY$string<'translateX'>
| $TEMPORARY$string<'translateY'>,
key: string,
value: any | number | string,
transformation: any,
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5539,7 +5539,7 @@ type EnableArgs = {
...
};
declare class NetworkAgent extends InspectorAgent {
static DOMAIN: $TEMPORARY$string<\\"Network\\">;
static DOMAIN: string;
_sendEvent: EventSender;
_interceptor: ?Interceptor;
enable(EnableArgs): void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ class CheckboxExample extends React.Component<
};

_onCheckboxPress = () => {
let checkboxState: boolean | $TEMPORARY$string<'mixed'> = false;
let checkboxState: boolean | string = false;
if (this.state.checkboxState === false) {
checkboxState = 'mixed';
} else if (this.state.checkboxState === 'mixed') {
Expand All @@ -510,7 +510,7 @@ class CheckboxExample extends React.Component<
}

this.setState({
checkboxState: checkboxState,
checkboxState,
});
};

Expand Down Expand Up @@ -548,7 +548,7 @@ class SwitchExample extends React.Component<
const switchState = !this.state.switchState;

this.setState({
switchState: switchState,
switchState,
});
};

Expand Down Expand Up @@ -601,7 +601,7 @@ class SelectionExample extends React.Component<
if (!isEnabled) {
accessibilityHint = 'use the button on the right to enable selection';
}
let buttonTitle = isEnabled ? 'Disable selection' : 'Enable selection';
const buttonTitle = isEnabled ? 'Disable selection' : 'Enable selection';
const touchableHint = ` (touching the TouchableOpacity will ${
isSelected ? 'disable' : 'enable'
} accessibilityState.selected)`;
Expand Down Expand Up @@ -667,7 +667,7 @@ class ExpandableElementExample extends React.Component<
const expandState = !this.state.expandState;

this.setState({
expandState: expandState,
expandState,
});
};

Expand Down Expand Up @@ -719,7 +719,7 @@ class NestedCheckBox extends React.Component<
}
setTimeout(() => {
this.setState({
checkbox1: checkbox1,
checkbox1,
checkbox2: checkbox1,
checkbox3: checkbox1,
});
Expand All @@ -730,7 +730,7 @@ class NestedCheckBox extends React.Component<
const checkbox2 = !this.state.checkbox2;

this.setState({
checkbox2: checkbox2,
checkbox2,
checkbox1:
checkbox2 && this.state.checkbox3
? true
Expand All @@ -744,7 +744,7 @@ class NestedCheckBox extends React.Component<
const checkbox3 = !this.state.checkbox3;

this.setState({
checkbox3: checkbox3,
checkbox3,
checkbox1:
this.state.checkbox2 && checkbox3
? true
Expand Down

0 comments on commit 40a4feb

Please sign in to comment.