Skip to content

Commit

Permalink
types: Make almost all types in types.js exact.
Browse files Browse the repository at this point in the history
Done with the same command as in 7037393:

  perl -i -0pe \
    's/^((?:export )?type \S+ = \{)(\n.*?\n)?(\};)/$1|$2|$3/msg' \
    src/**/*.js

but this time keeping the changes in src/types.js .  The only
exceptions I ended up making there were in two categories where
Flow seems to not do well (or at best be very confusing):
 * "indexer properties", aka using an object as a map;
 * callable objects.
  • Loading branch information
gnprice committed Dec 14, 2018
1 parent 5adc2de commit 8370002
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 128 deletions.
4 changes: 2 additions & 2 deletions src/actionTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,12 @@ export type AccountRemoveAction = {
index: number,
};

export type LoginSuccessAction = {
export type LoginSuccessAction = {|
type: typeof LOGIN_SUCCESS,
realm: string,
email: string,
apiKey: string,
};
|};

export type LogoutAction = {
type: typeof LOGOUT,
Expand Down
32 changes: 16 additions & 16 deletions src/api/apiTypes.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
/* @flow strict-local */
import type { PresenceState } from '../types';

export type Auth = {
export type Auth = {|
realm: string,
apiKey: string,
email: string,
};
|};

export type DevUser = {
export type DevUser = {|
realm_uri: string,
email: string,
};
|};

/**
* Type of an emoji reaction to a message.
Expand Down Expand Up @@ -216,7 +216,7 @@ export type Topic = {|
* For details on the properties, see the Zulip API docs:
* https://zulipchat.com/api/get-all-users#response
*/
export type User = {
export type User = {|
avatar_url: ?string,
bot_type?: number,
bot_owner?: string,
Expand All @@ -227,17 +227,17 @@ export type User = {
profile_data?: empty, // TODO describe actual type
timezone: string,
user_id: number,
};
|};

export type ApiResponse = {
export type ApiResponse = {|
result: string,
msg: string,
};
|};

export type ApiResponseSuccess = {
export type ApiResponseSuccess = {|
result: 'success',
msg: '',
};
|};

/** List of error codes at https://github.com/zulip/zulip/blob/master/zerver/lib/exceptions.py */

Expand All @@ -257,27 +257,27 @@ export type ApiErrorCode =
| 'INVITATION_FAILED'
| 'INVALID_ZULIP_SERVER';

export type ApiResponseError = {
export type ApiResponseError = {|
code?: ApiErrorCode,
msg: string,
result: 'error',
};
|};

export type ApiResponseWithPresence = ApiResponse & {
server_timestamp: number,
presences: PresenceState,
};

export type AuthenticationMethods = {
export type AuthenticationMethods = {|
dev: boolean,
github: boolean,
google: boolean,
ldap: boolean,
password: boolean,
remoteuser: boolean,
};
|};

export type ApiServerSettings = {
export type ApiServerSettings = {|
authentication_methods: AuthenticationMethods,
email_auth_enabled: boolean,
msg: string,
Expand All @@ -288,6 +288,6 @@ export type ApiServerSettings = {
realm_uri: string,
require_email_format_usernames: boolean,
zulip_version: string,
};
|};

export type TypingOperation = 'start' | 'stop';
4 changes: 2 additions & 2 deletions src/message/messageActionSheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,11 @@ type ButtonCode = $Keys<typeof allButtonsRaw>;

const allButtons: { [ButtonCode]: ButtonDescription } = allButtonsRaw;

type ConstructSheetParams = {
type ConstructSheetParams = {|
backgroundData: BackgroundData,
message: Message,
narrow: Narrow,
};
|};

export const constructHeaderActionButtons = ({
backgroundData: { mute, subscriptions },
Expand Down
Loading

0 comments on commit 8370002

Please sign in to comment.