Codemod $Enum<...> to $Keys<...> in xplat/fbcode

Summary:
In D15367312, I deprecate `$Enum<...>` in favour of `$Keys<...>` (the functionality is identical). Codemod existing usages in xplat and fbcode.

bypass-lint

Reviewed By: samwgoldman

Differential Revision: D15378084

fbshipit-source-id: 251c6b9ac07cb50139a8f03e3a45a5fac0d91812
This commit is contained in:
George Zahariev
2019-05-16 14:17:11 -07:00
committed by Facebook Github Bot
parent 016afe26bc
commit f050f99e56
8 changed files with 12 additions and 12 deletions
+2 -2
View File
@@ -25,14 +25,14 @@ type Options = {
onDismiss?: ?Function,
};
type AlertType = $Enum<{
type AlertType = $Keys<{
default: string,
'plain-text': string,
'secure-text': string,
'login-password': string,
}>;
export type AlertButtonStyle = $Enum<{
export type AlertButtonStyle = $Keys<{
default: string,
cancel: string,
destructive: string,
@@ -19,7 +19,7 @@ const RCTAccessibilityInfo = NativeModules.AccessibilityInfo;
const REDUCE_MOTION_EVENT = 'reduceMotionDidChange';
const TOUCH_EXPLORATION_EVENT = 'touchExplorationDidChange';
type ChangeEventName = $Enum<{
type ChangeEventName = $Keys<{
change: string,
reduceMotionChanged: string,
screenReaderChanged: string,
@@ -26,7 +26,7 @@ const CHANGE_EVENT_NAME = {
screenReaderChanged: 'screenReaderChanged',
};
type ChangeEventName = $Enum<{
type ChangeEventName = $Keys<{
announcementFinished: string,
boldTextChanged: string,
change: string,
+2 -2
View File
@@ -21,7 +21,7 @@ const StatusBarManager = require('../../BatchedBridge/NativeModules')
/**
* Status bar style
*/
export type StatusBarStyle = $Enum<{
export type StatusBarStyle = $Keys<{
/**
* Default status bar style (dark for iOS, light for Android)
*/
@@ -39,7 +39,7 @@ export type StatusBarStyle = $Enum<{
/**
* Status bar animation
*/
export type StatusBarAnimation = $Enum<{
export type StatusBarAnimation = $Keys<{
/**
* No animation
*/
@@ -44,7 +44,7 @@ type PageSelectedEvent = SyntheticEvent<
|}>,
>;
export type ViewPagerScrollState = $Enum<{
export type ViewPagerScrollState = $Keys<{
idle: string,
dragging: string,
settling: string,
+1 -1
View File
@@ -40,7 +40,7 @@ type ImageCropData = {
* (Optional) the resizing mode to use when scaling the image. If the
* `displaySize` param is not specified, this has no effect.
*/
resizeMode?: ?$Enum<{
resizeMode?: ?$Keys<{
contain: string,
cover: string,
stretch: string,
+3 -3
View File
@@ -19,19 +19,19 @@ const NetInfoEventEmitter = new NativeEventEmitter(RCTNetInfo);
const DEVICE_CONNECTIVITY_EVENT = 'networkStatusDidChange';
type ChangeEventName = $Enum<{
type ChangeEventName = $Keys<{
connectionChange: string,
change: string,
}>;
type ReachabilityStateIOS = $Enum<{
type ReachabilityStateIOS = $Keys<{
cell: string,
none: string,
unknown: string,
wifi: string,
}>;
type ConnectivityStateAndroid = $Enum<{
type ConnectivityStateAndroid = $Keys<{
NONE: string,
MOBILE: string,
WIFI: string,
@@ -37,7 +37,7 @@ export type FetchResult = {
/**
* An event emitted by PushNotificationIOS.
*/
export type PushNotificationEventName = $Enum<{
export type PushNotificationEventName = $Keys<{
/**
* Fired when a remote notification is received. The handler will be invoked
* with an instance of `PushNotificationIOS`.