Minor: mark reducer arguments as Readonly

This commit is contained in:
Evan Hahn 2020-12-14 13:47:21 -06:00 committed by Josh Perez
parent 0c99604585
commit eff2318157
11 changed files with 23 additions and 23 deletions

View File

@ -914,7 +914,7 @@ function getExistingPeekInfo(
}
function removeConversationFromState(
state: CallingStateType,
state: Readonly<CallingStateType>,
conversationId: string
): CallingStateType {
return {
@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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 {

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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();

View File

@ -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

View File

@ -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 {

View File

@ -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();