Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions flow-typed/react-intl_vx.x.x.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion flow-typed/react-native-safe-area-context_vx.x.x.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>(
WrappedComponent: React.ComponentType<T>,
WrappedComponent: React$ComponentType<T>,
): React.ForwardRefExoticComponent<React.PropsWithoutRef<T> & React.RefAttributes<T>>;

/**
Expand Down
4 changes: 2 additions & 2 deletions src/RootErrorBoundary.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ export default class ErrorBoundary extends React.Component<Props, State> {

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 ?? '<none available>'
}

Expand Down
13 changes: 5 additions & 8 deletions src/__flow-tests__/nav-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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;
}
}
Expand Down Expand Up @@ -69,7 +66,7 @@ function testNavigatorTypes() {
<Stack.Navigator>
{/* Happy case is happy */}
<Stack.Screen name="Profile" component={Profile} />
{/* $FlowExpectedError - mismatch of name with route prop */}
{/* $FlowExpectedError[incompatible-type] - mismatch of name with route prop */}
<Stack.Screen name="Profile1" component={Profile12} />
{/* Should error but doesn't! on mismatch of name with navigation prop */}
<Stack.Screen name="Profile2" component={Profile12} />
Expand Down
2 changes: 1 addition & 1 deletion src/boot/TranslationProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<GetText> = React.createContext(undefined);

/**
Expand Down
2 changes: 1 addition & 1 deletion src/boot/__tests__/ZulipAsyncStorage-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});

Expand Down
6 changes: 3 additions & 3 deletions src/boot/reducers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<GlobalState>, startMs, endMs) {
if (endMs - startMs >= slowReducersThreshold) {
timing.add({ text: `${action.type} @ ${key}`, startMs, endMs });
}
Expand All @@ -51,8 +51,8 @@ function applyReducer<Key: $Keys<GlobalState>, 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
Expand Down
6 changes: 3 additions & 3 deletions src/events/__tests__/eventToAction-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});

Expand Down
4 changes: 2 additions & 2 deletions src/presence/presenceReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
11 changes: 6 additions & 5 deletions src/session/sessionReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions src/utils/objectEntries.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
// static entries(object: mixed): Array<[string, mixed]>;
// .... which is almost useless.

type EntriesType = <K: string, V>({| +[K]: V |}) => $ReadOnlyArray<[K, V]>;

const objectEntries: EntriesType = obj => (Object.entries(obj): $FlowFixMe);
const objectEntries = <K: string, V>(obj: {| +[K]: V |}): $ReadOnlyArray<[K, V]> =>
(Object.entries(obj): $FlowFixMe);

export default objectEntries;
2 changes: 1 addition & 1 deletion src/webview/html/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import escape from 'lodash.escape';
* template`Hello $\!${&<world}` -> 'Hello $!&amp;&lt;world'
*/
export default (strings: string[], ...values: Array<string | number>) => {
// $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) => {
Expand Down