Skip to content

Commit

Permalink
Minor: mark reducer arguments as Readonly
Browse files Browse the repository at this point in the history
  • Loading branch information
EvanHahn-Signal authored and josh-signal committed Dec 17, 2020
1 parent 0c99604 commit eff2318
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 23 deletions.
6 changes: 3 additions & 3 deletions ts/state/ducks/calling.ts
Expand Up @@ -914,7 +914,7 @@ function getExistingPeekInfo(
}

function removeConversationFromState(
state: CallingStateType,
state: Readonly<CallingStateType>,
conversationId: string
): CallingStateType {
return {
Expand All @@ -926,8 +926,8 @@ function removeConversationFromState(
}

export function reducer(
state: CallingStateType = getEmptyState(),
action: CallingActionType
state: Readonly<CallingStateType> = getEmptyState(),
action: Readonly<CallingActionType>
): CallingStateType {
const { callsByConversation } = state;

Expand Down
4 changes: 2 additions & 2 deletions ts/state/ducks/conversations.ts
Expand Up @@ -811,8 +811,8 @@ function hasMessageHeightChanged(
}

export function reducer(
state: ConversationsStateType = getEmptyState(),
action: ConversationActionType
state: Readonly<ConversationsStateType> = getEmptyState(),
action: Readonly<ConversationActionType>
): ConversationsStateType {
if (action.type === 'CONVERSATION_ADDED') {
const { payload } = action;
Expand Down
4 changes: 2 additions & 2 deletions ts/state/ducks/emojis.ts
Expand Up @@ -62,8 +62,8 @@ function getEmptyState(): EmojisStateType {
}

export function reducer(
state: EmojisStateType = getEmptyState(),
action: EmojisActionType
state: Readonly<EmojisStateType> = getEmptyState(),
action: Readonly<EmojisActionType>
): EmojisStateType {
if (action.type === 'emojis/USE_EMOJI') {
const { payload } = action;
Expand Down
4 changes: 2 additions & 2 deletions ts/state/ducks/expiration.ts
Expand Up @@ -40,8 +40,8 @@ function getEmptyState(): ExpirationStateType {
}

export function reducer(
state: ExpirationStateType = getEmptyState(),
action: ExpirationActionType
state: Readonly<ExpirationStateType> = getEmptyState(),
action: Readonly<ExpirationActionType>
): ExpirationStateType {
if (action.type === HYDRATE_EXPIRATION_STATUS) {
return {
Expand Down
4 changes: 2 additions & 2 deletions ts/state/ducks/items.ts
Expand Up @@ -109,8 +109,8 @@ function getEmptyState(): ItemsStateType {
}

export function reducer(
state: ItemsStateType = getEmptyState(),
action: ItemsActionType
state: Readonly<ItemsStateType> = getEmptyState(),
action: Readonly<ItemsActionType>
): ItemsStateType {
if (action.type === 'items/PUT_EXTERNAL') {
const { payload } = action;
Expand Down
4 changes: 2 additions & 2 deletions ts/state/ducks/network.ts
Expand Up @@ -83,8 +83,8 @@ function getEmptyState(): NetworkStateType {
}

export function reducer(
state: NetworkStateType = getEmptyState(),
action: NetworkActionType
state: Readonly<NetworkStateType> = getEmptyState(),
action: Readonly<NetworkActionType>
): NetworkStateType {
if (action.type === CHECK_NETWORK_STATUS) {
const { isOnline, socketStatus } = action.payload;
Expand Down
4 changes: 2 additions & 2 deletions ts/state/ducks/safetyNumber.ts
Expand Up @@ -163,8 +163,8 @@ function getEmptyState(): SafetyNumberStateType {
}

export function reducer(
state: SafetyNumberStateType = getEmptyState(),
action: SafetyNumberActionType
state: Readonly<SafetyNumberStateType> = getEmptyState(),
action: Readonly<SafetyNumberActionType>
): SafetyNumberStateType {
if (action.type === TOGGLE_VERIFIED_PENDING) {
const { contact } = action.payload;
Expand Down
4 changes: 2 additions & 2 deletions ts/state/ducks/search.ts
Expand Up @@ -337,8 +337,8 @@ function getEmptyState(): SearchStateType {
}

export function reducer(
state: SearchStateType = getEmptyState(),
action: SearchActionType
state: Readonly<SearchStateType> = getEmptyState(),
action: Readonly<SearchActionType>
): SearchStateType {
if (action.type === 'SHOW_ARCHIVED_CONVERSATIONS') {
return getEmptyState();
Expand Down
4 changes: 2 additions & 2 deletions ts/state/ducks/stickers.ts
Expand Up @@ -373,8 +373,8 @@ function getEmptyState(): StickersStateType {
}

export function reducer(
state: StickersStateType = getEmptyState(),
action: StickersActionType
state: Readonly<StickersStateType> = getEmptyState(),
action: Readonly<StickersActionType>
): StickersStateType {
if (action.type === 'stickers/STICKER_PACK_ADDED') {
// ts complains due to `stickers: {}` being overridden by the payload
Expand Down
4 changes: 2 additions & 2 deletions ts/state/ducks/updates.ts
Expand Up @@ -111,8 +111,8 @@ function getEmptyState(): UpdatesStateType {
}

export function reducer(
state: UpdatesStateType = getEmptyState(),
action: UpdatesActionType
state: Readonly<UpdatesStateType> = getEmptyState(),
action: Readonly<UpdatesActionType>
): UpdatesStateType {
if (action.type === SHOW_UPDATE_DIALOG) {
return {
Expand Down
4 changes: 2 additions & 2 deletions ts/state/ducks/user.ts
Expand Up @@ -83,8 +83,8 @@ function getEmptyState(): UserStateType {
}

export function reducer(
state: UserStateType = getEmptyState(),
action: UserActionType
state: Readonly<UserStateType> = getEmptyState(),
action: Readonly<UserActionType>
): UserStateType {
if (!state) {
return getEmptyState();
Expand Down

0 comments on commit eff2318

Please sign in to comment.