Skip to content

Commit 40a4feb

Browse files
panagosg7facebook-github-bot
authored andcommitted
replace '$TEMPORARY$string<>' with 'string' (facebook#46876)
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
1 parent bed5323 commit 40a4feb

File tree

8 files changed

+19
-65
lines changed

8 files changed

+19
-65
lines changed

packages/assets/path-support.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const drawableFileTypes = new Set([
5555
function getAndroidResourceFolderName(
5656
asset: PackagerAsset,
5757
scale: number,
58-
): string | $TEMPORARY$string<'raw'> {
58+
): string {
5959
if (!drawableFileTypes.has(asset.type)) {
6060
return 'raw';
6161
}

packages/react-native/Libraries/Components/Keyboard/__tests__/Keyboard-test.js

+2-8
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,7 @@ describe('Keyboard', () => {
2929
describe('scheduling layout animation', () => {
3030
const scheduleLayoutAnimation = (
3131
duration: null | number,
32-
easing:
33-
| null
34-
| $TEMPORARY$string<'linear'>
35-
| $TEMPORARY$string<'some-unknown-animation-type'>
36-
| $TEMPORARY$string<'spring'>,
32+
easing: null | string,
3733
): void =>
3834
// $FlowFixMe[incompatible-call]
3935
Keyboard.scheduleLayoutAnimation({duration, easing});
@@ -60,9 +56,7 @@ describe('Keyboard', () => {
6056
});
6157

6258
describe('animation update type', () => {
63-
const assertAnimationUpdateType = (
64-
type: $TEMPORARY$string<'keyboard'> | $TEMPORARY$string<'linear'>,
65-
) =>
59+
const assertAnimationUpdateType = (type: string) =>
6660
expect(LayoutAnimation.configureNext).toHaveBeenCalledWith(
6761
expect.objectContaining({
6862
duration: expect.anything(),

packages/react-native/Libraries/Core/setUpBatchedBridge.js

+1-10
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,7 @@ if (global.RN$Bridgeless === true && global.RN$registerCallableModule) {
1616
} else {
1717
const BatchedBridge = require('../BatchedBridge/BatchedBridge');
1818
registerModule = (
19-
moduleName:
20-
| $TEMPORARY$string<'GlobalPerformanceLogger'>
21-
| $TEMPORARY$string<'HMRClient'>
22-
| $TEMPORARY$string<'HeapCapture'>
23-
| $TEMPORARY$string<'JSTimers'>
24-
| $TEMPORARY$string<'RCTDeviceEventEmitter'>
25-
| $TEMPORARY$string<'RCTLog'>
26-
| $TEMPORARY$string<'RCTNativeAppEventEmitter'>
27-
| $TEMPORARY$string<'SamplingProfiler'>
28-
| $TEMPORARY$string<'Systrace'>,
19+
moduleName: string,
2920
/* $FlowFixMe[missing-local-annot] The type annotation(s) required by
3021
* Flow's LTI update could not be added via codemod */
3122
factory,

packages/react-native/Libraries/JSInspector/NetworkAgent.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ type EnableArgs = {
260260
};
261261

262262
class NetworkAgent extends InspectorAgent {
263-
static DOMAIN: $TEMPORARY$string<'Network'> = 'Network';
263+
static DOMAIN: string = 'Network';
264264

265265
_sendEvent: EventSender;
266266
_interceptor: ?Interceptor;

packages/react-native/Libraries/LogBox/UI/LogBoxMessage.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function TappableLinks(props: {
5959

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

62-
let fragments: Array<React.Node> = [];
62+
const fragments: Array<React.Node> = [];
6363
let indexCounter = 0;
6464
let startIndex = 0;
6565

@@ -115,7 +115,7 @@ function LogBoxMessage(props: Props): React.Node {
115115
const elements = [];
116116
let length = 0;
117117
const createUnderLength = (
118-
key: string | $TEMPORARY$string<'-1'>,
118+
key: string,
119119
message: string,
120120
style: void | TextStyleProp,
121121
) => {

packages/react-native/Libraries/StyleSheet/processTransform.js

+3-34
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function processTransform(
2626
): Array<Object> | Array<number> {
2727
if (typeof transform === 'string') {
2828
const regex = new RegExp(/(\w+)\(([^)]+)\)/g);
29-
let transformArray: Array<Object> = [];
29+
const transformArray: Array<Object> = [];
3030
let matches;
3131

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

5252
const _getKeyAndValueFromCSSTransform: (
53-
key:
54-
| string
55-
| $TEMPORARY$string<'matrix'>
56-
| $TEMPORARY$string<'perspective'>
57-
| $TEMPORARY$string<'rotate'>
58-
| $TEMPORARY$string<'rotateX'>
59-
| $TEMPORARY$string<'rotateY'>
60-
| $TEMPORARY$string<'rotateZ'>
61-
| $TEMPORARY$string<'scale'>
62-
| $TEMPORARY$string<'scaleX'>
63-
| $TEMPORARY$string<'scaleY'>
64-
| $TEMPORARY$string<'skewX'>
65-
| $TEMPORARY$string<'skewY'>
66-
| $TEMPORARY$string<'translate'>
67-
| $TEMPORARY$string<'translate3d'>
68-
| $TEMPORARY$string<'translateX'>
69-
| $TEMPORARY$string<'translateY'>,
53+
key: string,
7054
args: string,
7155
) => {key: string, value?: Array<string | number> | number | string} = (
7256
key,
@@ -169,22 +153,7 @@ function _validateTransforms(transform: Array<Object>): void {
169153
}
170154

171155
function _validateTransform(
172-
key:
173-
| string
174-
| $TEMPORARY$string<'matrix'>
175-
| $TEMPORARY$string<'perspective'>
176-
| $TEMPORARY$string<'rotate'>
177-
| $TEMPORARY$string<'rotateX'>
178-
| $TEMPORARY$string<'rotateY'>
179-
| $TEMPORARY$string<'rotateZ'>
180-
| $TEMPORARY$string<'scale'>
181-
| $TEMPORARY$string<'scaleX'>
182-
| $TEMPORARY$string<'scaleY'>
183-
| $TEMPORARY$string<'skewX'>
184-
| $TEMPORARY$string<'skewY'>
185-
| $TEMPORARY$string<'translate'>
186-
| $TEMPORARY$string<'translateX'>
187-
| $TEMPORARY$string<'translateY'>,
156+
key: string,
188157
value: any | number | string,
189158
transformation: any,
190159
) {

packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -5539,7 +5539,7 @@ type EnableArgs = {
55395539
...
55405540
};
55415541
declare class NetworkAgent extends InspectorAgent {
5542-
static DOMAIN: $TEMPORARY$string<\\"Network\\">;
5542+
static DOMAIN: string;
55435543
_sendEvent: EventSender;
55445544
_interceptor: ?Interceptor;
55455545
enable(EnableArgs): void;

packages/rn-tester/js/examples/Accessibility/AccessibilityExample.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ class CheckboxExample extends React.Component<
500500
};
501501

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

512512
this.setState({
513-
checkboxState: checkboxState,
513+
checkboxState,
514514
});
515515
};
516516

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

550550
this.setState({
551-
switchState: switchState,
551+
switchState,
552552
});
553553
};
554554

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

669669
this.setState({
670-
expandState: expandState,
670+
expandState,
671671
});
672672
};
673673

@@ -719,7 +719,7 @@ class NestedCheckBox extends React.Component<
719719
}
720720
setTimeout(() => {
721721
this.setState({
722-
checkbox1: checkbox1,
722+
checkbox1,
723723
checkbox2: checkbox1,
724724
checkbox3: checkbox1,
725725
});
@@ -730,7 +730,7 @@ class NestedCheckBox extends React.Component<
730730
const checkbox2 = !this.state.checkbox2;
731731

732732
this.setState({
733-
checkbox2: checkbox2,
733+
checkbox2,
734734
checkbox1:
735735
checkbox2 && this.state.checkbox3
736736
? true
@@ -744,7 +744,7 @@ class NestedCheckBox extends React.Component<
744744
const checkbox3 = !this.state.checkbox3;
745745

746746
this.setState({
747-
checkbox3: checkbox3,
747+
checkbox3,
748748
checkbox1:
749749
this.state.checkbox2 && checkbox3
750750
? true

0 commit comments

Comments
 (0)