diff --git a/flow-typed/react-intl_vx.x.x.js b/flow-typed/react-intl_vx.x.x.js index 3b88fbf57da..14ba9853519 100644 --- a/flow-typed/react-intl_vx.x.x.js +++ b/flow-typed/react-intl_vx.x.x.js @@ -158,19 +158,19 @@ declare module 'react-intl' { +MISSING_INTL_API: 'MISSING_INTL_API', // "MISSING_INTL_API" |}; declare interface FieldData { - // $FlowFixMe - illegal name (these fixmes added in TS to Flow translation) + // $FlowFixMe[unsupported-syntax] - illegal name (these fixmes added in TS to Flow translation) '0'?: string; - // $FlowFixMe - illegal name + // $FlowFixMe[unsupported-syntax] - illegal name '1'?: string; - // $FlowFixMe - illegal name + // $FlowFixMe[unsupported-syntax] - illegal name '-1'?: string; - // $FlowFixMe - illegal name + // $FlowFixMe[unsupported-syntax] - illegal name '2'?: string; - // $FlowFixMe - illegal name + // $FlowFixMe[unsupported-syntax] - illegal name '-2'?: string; - // $FlowFixMe - illegal name + // $FlowFixMe[unsupported-syntax] - illegal name '3'?: string; - // $FlowFixMe - illegal name + // $FlowFixMe[unsupported-syntax] - illegal name '-3'?: string; future: RelativeTimeData; past: RelativeTimeData; diff --git a/flow-typed/react-native-safe-area-context_vx.x.x.js b/flow-typed/react-native-safe-area-context_vx.x.x.js index 6d1cb3da681..885e5feb5c8 100644 --- a/flow-typed/react-native-safe-area-context_vx.x.x.js +++ b/flow-typed/react-native-safe-area-context_vx.x.x.js @@ -57,7 +57,7 @@ declare module 'react-native-safe-area-context/SafeAreaContext' { declare export function useSafeAreaInsets(): EdgeInsets; declare export function useSafeAreaFrame(): Rect; declare export function withSafeAreaInsets( - WrappedComponent: React.ComponentType, + WrappedComponent: React$ComponentType, ): React.ForwardRefExoticComponent & React.RefAttributes>; /** diff --git a/src/RootErrorBoundary.js b/src/RootErrorBoundary.js index d172afed9fb..4c1520cf957 100644 --- a/src/RootErrorBoundary.js +++ b/src/RootErrorBoundary.js @@ -68,8 +68,8 @@ export default class ErrorBoundary extends React.Component { Component Stack: ${ - /* $FlowFixMe - I've seen this empirically in debug and release - builds on iOS and Android */ + /* $FlowFixMe[prop-missing] - I've seen this empirically in debug and + release builds on iOS and Android */ error.componentStack ?? '' } diff --git a/src/__flow-tests__/nav-test.js b/src/__flow-tests__/nav-test.js index 4eed2008f4c..6d8faaf7413 100644 --- a/src/__flow-tests__/nav-test.js +++ b/src/__flow-tests__/nav-test.js @@ -5,10 +5,7 @@ */ import React, { type ComponentType } from 'react'; -import { - createStackNavigator, - type StackNavigationProp, -} from '@react-navigation/stack'; +import { createStackNavigator, type StackNavigationProp } from '@react-navigation/stack'; import { type RouteProp, type RouteParamsOf } from '../react-navigation'; @@ -25,14 +22,14 @@ function testRouteParamTypes() { const { params } = props.route; (params.userId: string); - // $FlowExpectedError + // $FlowExpectedError[incompatible-cast] (params.userId: empty); (('a': string): typeof params.userId); - // $FlowExpectedError + // $FlowExpectedError[incompatible-cast] (('a': mixed): typeof params.userId); - // $FlowExpectedError + // $FlowExpectedError[prop-missing] params.nonsense; } } @@ -69,7 +66,7 @@ function testNavigatorTypes() { {/* Happy case is happy */} - {/* $FlowExpectedError - mismatch of name with route prop */} + {/* $FlowExpectedError[incompatible-type] - mismatch of name with route prop */} {/* Should error but doesn't! on mismatch of name with navigation prop */} diff --git a/src/boot/TranslationProvider.js b/src/boot/TranslationProvider.js index e92642fa1d5..e8df12a46b3 100644 --- a/src/boot/TranslationProvider.js +++ b/src/boot/TranslationProvider.js @@ -10,7 +10,7 @@ import { useSelector } from '../react-redux'; import { getSettings } from '../selectors'; import messages from '../i18n/messages'; -// $FlowFixMe could put a well-typed mock value here, to help write tests +// $FlowFixMe[incompatible-type] could put a well-typed mock value here, to help write tests export const TranslationContext: Context = React.createContext(undefined); /** diff --git a/src/boot/__tests__/ZulipAsyncStorage-test.js b/src/boot/__tests__/ZulipAsyncStorage-test.js index 3b8684474a6..f67e699b509 100644 --- a/src/boot/__tests__/ZulipAsyncStorage-test.js +++ b/src/boot/__tests__/ZulipAsyncStorage-test.js @@ -74,7 +74,7 @@ describe('getItem', () => { ); // suppress `logging.error` output - // $FlowFixMe - teach Flow about mocks + // $FlowFixMe[prop-missing] - teach Flow about mocks logging.error.mockReturnValue(); }); diff --git a/src/boot/reducers.js b/src/boot/reducers.js index e81ce5c76ae..6c39306c81a 100644 --- a/src/boot/reducers.js +++ b/src/boot/reducers.js @@ -33,7 +33,7 @@ const migrations = (state: MigrationsState = NULL_OBJECT): MigrationsState => st const { enableReduxSlowReducerWarnings, slowReducersThreshold } = config; -function maybeLogSlowReducer(action, key, startMs, endMs) { +function maybeLogSlowReducer(action, key: $Keys, startMs, endMs) { if (endMs - startMs >= slowReducersThreshold) { timing.add({ text: `${action.type} @ ${key}`, startMs, endMs }); } @@ -51,8 +51,8 @@ function applyReducer, State>( startMs = Date.now(); } - /* $FlowFixMe - We make a small lie about the type, pretending that - globalState is not void. + /* $FlowFixMe[incompatible-type] - We make a small lie about the type, + pretending that globalState is not void. This is OK because it's only ever void at the initialization action, and no reducer should do anything there other than return its initial diff --git a/src/events/__tests__/eventToAction-test.js b/src/events/__tests__/eventToAction-test.js index f8d1ad8178a..6ec14191f74 100644 --- a/src/events/__tests__/eventToAction-test.js +++ b/src/events/__tests__/eventToAction-test.js @@ -7,14 +7,14 @@ describe('eventToAction', () => { const state = eg.plusReduxState; test('filter out unknown event type', () => { - // $FlowFixMe: teach Flow about Jest mocks + // $FlowFixMe[prop-missing]: teach Flow about Jest mocks logging.error.mockReturnValue(); expect(eventToAction(state, { type: 'some unknown type' })).toBe(null); - // $FlowFixMe: teach Flow about Jest mocks + // $FlowFixMe[prop-missing]: teach Flow about Jest mocks expect(logging.error.mock.calls).toHaveLength(1); - // $FlowFixMe: teach Flow about Jest mocks + // $FlowFixMe[prop-missing]: teach Flow about Jest mocks logging.error.mockReset(); }); diff --git a/src/presence/presenceReducer.js b/src/presence/presenceReducer.js index 3ebb73fef21..6d8cf953db1 100644 --- a/src/presence/presenceReducer.js +++ b/src/presence/presenceReducer.js @@ -43,13 +43,13 @@ export default (state: PresenceState = initialState, action: Action): PresenceSt ...state, // Flow bug (unresolved): // https://github.com/facebook/flow/issues/8276 - // $FlowIssue #8276 + // $FlowIssue[cannot-spread-indexer] #8276 [action.email]: { ...state[action.email], ...action.presence, // Flow bug (unresolved): // https://github.com/facebook/flow/issues/8276 - // $FlowIssue #8276 + // $FlowIssue[cannot-spread-indexer] #8276 aggregated: getAggregatedPresence({ ...state[action.email], ...action.presence, diff --git a/src/session/sessionReducer.js b/src/session/sessionReducer.js index 48b89f60571..5f17b4373f1 100644 --- a/src/session/sessionReducer.js +++ b/src/session/sessionReducer.js @@ -92,11 +92,12 @@ const initialState: SessionState = { const rehydrate = (state, action) => { const { payload } = action; - /* $FlowIgnore: The actual type allows any property to be null; narrow - that to just the one that `getHasAuth` will care about. (What we - really want here is what the value of `getHasAuth` will be after the - rehydrate is complete. So even if some other property is null in the - payload, we still do want to ask `getHasAuth` what it thinks.) */ + /* $FlowIgnore[incompatible-cast]: The actual type allows any property to + be null; narrow that to just the one that `getHasAuth` will care + about. (What we really want here is what the value of `getHasAuth` + will be after the rehydrate is complete. So even if some other + property is null in the payload, we still do want to ask `getHasAuth` + what it thinks.) */ const payloadForGetHasAuth = (payload: GlobalState | { accounts: null, ... } | void); const haveApiKey = !!( payloadForGetHasAuth diff --git a/src/utils/objectEntries.js b/src/utils/objectEntries.js index b8f815475e0..e1994066a64 100644 --- a/src/utils/objectEntries.js +++ b/src/utils/objectEntries.js @@ -6,8 +6,7 @@ // static entries(object: mixed): Array<[string, mixed]>; // .... which is almost useless. -type EntriesType = ({| +[K]: V |}) => $ReadOnlyArray<[K, V]>; - -const objectEntries: EntriesType = obj => (Object.entries(obj): $FlowFixMe); +const objectEntries = (obj: {| +[K]: V |}): $ReadOnlyArray<[K, V]> => + (Object.entries(obj): $FlowFixMe); export default objectEntries; diff --git a/src/webview/html/template.js b/src/webview/html/template.js index 3f5c64f78d7..8b05fd05dd5 100644 --- a/src/webview/html/template.js +++ b/src/webview/html/template.js @@ -15,7 +15,7 @@ import escape from 'lodash.escape'; * template`Hello $\!${& 'Hello $!&<world' */ export default (strings: string[], ...values: Array) => { - // $FlowIssue #2616 github.com/facebook/flow/issues/2616 + // $FlowIssue[prop-missing] #2616 github.com/facebook/flow/issues/2616 const raw: string[] = strings.raw; // eslint-disable-line prefer-destructuring const result = []; values.forEach((value, i) => {