Skip to content

Commit

Permalink
types: Pass exact object as second argument of $Diff wherever we us…
Browse files Browse the repository at this point in the history
…e it.

An instance of zulip#3452.
  • Loading branch information
chrisbobbe committed Mar 10, 2021
1 parent 5ef5162 commit 923446d
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/actionTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ type GenericEventAction = {|
|};

type EventNewMessageAction = {|
...$Diff<MessageEvent, { flags: mixed }>,
...$Diff<MessageEvent, {| flags: mixed |}>,
type: typeof EVENT_NEW_MESSAGE,
caughtUp: CaughtUpState,
ownUserId: UserId,
Expand Down
2 changes: 1 addition & 1 deletion src/common/InputWithClearButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const componentStyles = createStyleSheet({
},
});

type Props = $ReadOnly<$Diff<InputProps, { textInputRef: mixed, value: mixed, _: mixed }>>;
type Props = $ReadOnly<$Diff<InputProps, {| textInputRef: mixed, value: mixed, _: mixed |}>>;

type State = {|
canBeCleared: boolean,
Expand Down
2 changes: 1 addition & 1 deletion src/common/PasswordInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const styles = createStyleSheet({
type Props = $ReadOnly<$Diff<InputProps,
// "mixed" here is a way of spelling "no matter *what* type
// `InputProps` allows for these, don't allow them here."
{ secureTextEntry: mixed, autoCorrect: mixed, autoCapitalize: mixed, _: mixed }>>;
{| secureTextEntry: mixed, autoCorrect: mixed, autoCapitalize: mixed, _: mixed |}>>;

type State = {|
isHidden: boolean,
Expand Down
2 changes: 1 addition & 1 deletion src/message/__tests__/fetchActions-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ describe('fetchActions', () => {
};
const message1 = eg.streamMessage({ id: 1, sender });

type CommonFields = $Diff<Message, { reactions: mixed, avatar_url: mixed }>;
type CommonFields = $Diff<Message, {| reactions: mixed, avatar_url: mixed |}>;

// message1 exactly as we receive it from the server, before our
// own transformations.
Expand Down
2 changes: 1 addition & 1 deletion src/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export type Account = {|
* Use `identityOfAuth` or `identityOfAccount` to make one of these where
* you have an `Auth` or `Account`.
*/
export type Identity = $Diff<Auth, { apiKey: string }>;
export type Identity = $Diff<Auth, {| apiKey: string |}>;

export type EmojiType = 'image' | 'unicode';

Expand Down
2 changes: 1 addition & 1 deletion src/users/UserItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export class UserItemRaw<
}

type OuterProps = $ReadOnly<{|
...$Exact<$Diff<ElementConfig<typeof UserItemRaw>, { user: mixed }>>,
...$Exact<$Diff<ElementConfig<typeof UserItemRaw>, {| user: mixed |}>>,
userId: UserId,
|}>;

Expand Down
2 changes: 1 addition & 1 deletion src/webview/js/js.js
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ export const handleInitialLoad = (
scrollMessageId: number | null,
// The `realm` part of an `Auth` object is a URL object. It's passed
// in its stringified form.
rawAuth: {| ...$Diff<Auth, { realm: mixed }>, realm: string |},
rawAuth: {| ...$Diff<Auth, {| realm: mixed |}>, realm: string |},
) => {
const auth: Auth = { ...rawAuth, realm: new URL(rawAuth.realm) };

Expand Down

0 comments on commit 923446d

Please sign in to comment.