Minor: mark reducer arguments as Readonly
This commit is contained in:
parent
0c99604585
commit
eff2318157
11 changed files with 23 additions and 23 deletions
|
@ -914,7 +914,7 @@ function getExistingPeekInfo(
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeConversationFromState(
|
function removeConversationFromState(
|
||||||
state: CallingStateType,
|
state: Readonly<CallingStateType>,
|
||||||
conversationId: string
|
conversationId: string
|
||||||
): CallingStateType {
|
): CallingStateType {
|
||||||
return {
|
return {
|
||||||
|
@ -926,8 +926,8 @@ function removeConversationFromState(
|
||||||
}
|
}
|
||||||
|
|
||||||
export function reducer(
|
export function reducer(
|
||||||
state: CallingStateType = getEmptyState(),
|
state: Readonly<CallingStateType> = getEmptyState(),
|
||||||
action: CallingActionType
|
action: Readonly<CallingActionType>
|
||||||
): CallingStateType {
|
): CallingStateType {
|
||||||
const { callsByConversation } = state;
|
const { callsByConversation } = state;
|
||||||
|
|
||||||
|
|
|
@ -811,8 +811,8 @@ function hasMessageHeightChanged(
|
||||||
}
|
}
|
||||||
|
|
||||||
export function reducer(
|
export function reducer(
|
||||||
state: ConversationsStateType = getEmptyState(),
|
state: Readonly<ConversationsStateType> = getEmptyState(),
|
||||||
action: ConversationActionType
|
action: Readonly<ConversationActionType>
|
||||||
): ConversationsStateType {
|
): ConversationsStateType {
|
||||||
if (action.type === 'CONVERSATION_ADDED') {
|
if (action.type === 'CONVERSATION_ADDED') {
|
||||||
const { payload } = action;
|
const { payload } = action;
|
||||||
|
|
|
@ -62,8 +62,8 @@ function getEmptyState(): EmojisStateType {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function reducer(
|
export function reducer(
|
||||||
state: EmojisStateType = getEmptyState(),
|
state: Readonly<EmojisStateType> = getEmptyState(),
|
||||||
action: EmojisActionType
|
action: Readonly<EmojisActionType>
|
||||||
): EmojisStateType {
|
): EmojisStateType {
|
||||||
if (action.type === 'emojis/USE_EMOJI') {
|
if (action.type === 'emojis/USE_EMOJI') {
|
||||||
const { payload } = action;
|
const { payload } = action;
|
||||||
|
|
|
@ -40,8 +40,8 @@ function getEmptyState(): ExpirationStateType {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function reducer(
|
export function reducer(
|
||||||
state: ExpirationStateType = getEmptyState(),
|
state: Readonly<ExpirationStateType> = getEmptyState(),
|
||||||
action: ExpirationActionType
|
action: Readonly<ExpirationActionType>
|
||||||
): ExpirationStateType {
|
): ExpirationStateType {
|
||||||
if (action.type === HYDRATE_EXPIRATION_STATUS) {
|
if (action.type === HYDRATE_EXPIRATION_STATUS) {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -109,8 +109,8 @@ function getEmptyState(): ItemsStateType {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function reducer(
|
export function reducer(
|
||||||
state: ItemsStateType = getEmptyState(),
|
state: Readonly<ItemsStateType> = getEmptyState(),
|
||||||
action: ItemsActionType
|
action: Readonly<ItemsActionType>
|
||||||
): ItemsStateType {
|
): ItemsStateType {
|
||||||
if (action.type === 'items/PUT_EXTERNAL') {
|
if (action.type === 'items/PUT_EXTERNAL') {
|
||||||
const { payload } = action;
|
const { payload } = action;
|
||||||
|
|
|
@ -83,8 +83,8 @@ function getEmptyState(): NetworkStateType {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function reducer(
|
export function reducer(
|
||||||
state: NetworkStateType = getEmptyState(),
|
state: Readonly<NetworkStateType> = getEmptyState(),
|
||||||
action: NetworkActionType
|
action: Readonly<NetworkActionType>
|
||||||
): NetworkStateType {
|
): NetworkStateType {
|
||||||
if (action.type === CHECK_NETWORK_STATUS) {
|
if (action.type === CHECK_NETWORK_STATUS) {
|
||||||
const { isOnline, socketStatus } = action.payload;
|
const { isOnline, socketStatus } = action.payload;
|
||||||
|
|
|
@ -163,8 +163,8 @@ function getEmptyState(): SafetyNumberStateType {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function reducer(
|
export function reducer(
|
||||||
state: SafetyNumberStateType = getEmptyState(),
|
state: Readonly<SafetyNumberStateType> = getEmptyState(),
|
||||||
action: SafetyNumberActionType
|
action: Readonly<SafetyNumberActionType>
|
||||||
): SafetyNumberStateType {
|
): SafetyNumberStateType {
|
||||||
if (action.type === TOGGLE_VERIFIED_PENDING) {
|
if (action.type === TOGGLE_VERIFIED_PENDING) {
|
||||||
const { contact } = action.payload;
|
const { contact } = action.payload;
|
||||||
|
|
|
@ -337,8 +337,8 @@ function getEmptyState(): SearchStateType {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function reducer(
|
export function reducer(
|
||||||
state: SearchStateType = getEmptyState(),
|
state: Readonly<SearchStateType> = getEmptyState(),
|
||||||
action: SearchActionType
|
action: Readonly<SearchActionType>
|
||||||
): SearchStateType {
|
): SearchStateType {
|
||||||
if (action.type === 'SHOW_ARCHIVED_CONVERSATIONS') {
|
if (action.type === 'SHOW_ARCHIVED_CONVERSATIONS') {
|
||||||
return getEmptyState();
|
return getEmptyState();
|
||||||
|
|
|
@ -373,8 +373,8 @@ function getEmptyState(): StickersStateType {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function reducer(
|
export function reducer(
|
||||||
state: StickersStateType = getEmptyState(),
|
state: Readonly<StickersStateType> = getEmptyState(),
|
||||||
action: StickersActionType
|
action: Readonly<StickersActionType>
|
||||||
): StickersStateType {
|
): StickersStateType {
|
||||||
if (action.type === 'stickers/STICKER_PACK_ADDED') {
|
if (action.type === 'stickers/STICKER_PACK_ADDED') {
|
||||||
// ts complains due to `stickers: {}` being overridden by the payload
|
// ts complains due to `stickers: {}` being overridden by the payload
|
||||||
|
|
|
@ -111,8 +111,8 @@ function getEmptyState(): UpdatesStateType {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function reducer(
|
export function reducer(
|
||||||
state: UpdatesStateType = getEmptyState(),
|
state: Readonly<UpdatesStateType> = getEmptyState(),
|
||||||
action: UpdatesActionType
|
action: Readonly<UpdatesActionType>
|
||||||
): UpdatesStateType {
|
): UpdatesStateType {
|
||||||
if (action.type === SHOW_UPDATE_DIALOG) {
|
if (action.type === SHOW_UPDATE_DIALOG) {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -83,8 +83,8 @@ function getEmptyState(): UserStateType {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function reducer(
|
export function reducer(
|
||||||
state: UserStateType = getEmptyState(),
|
state: Readonly<UserStateType> = getEmptyState(),
|
||||||
action: UserActionType
|
action: Readonly<UserActionType>
|
||||||
): UserStateType {
|
): UserStateType {
|
||||||
if (!state) {
|
if (!state) {
|
||||||
return getEmptyState();
|
return getEmptyState();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue