Add type-alias-readonlydeep rule and make ducks mostly immutable
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
import { ipcRenderer } from 'electron';
|
||||
|
||||
import type { ReadonlyDeep } from 'type-fest';
|
||||
import type { BoundActionCreatorsMapObject } from '../../hooks/useBoundActions';
|
||||
import type { NoopActionType } from './noop';
|
||||
import type { ReplacementValuesType } from '../../types/Util';
|
||||
@@ -11,6 +12,7 @@ import type { ToastType } from '../../types/Toast';
|
||||
|
||||
// State
|
||||
|
||||
// eslint-disable-next-line local-rules/type-alias-readonlydeep
|
||||
export type ToastStateType = {
|
||||
toast?: {
|
||||
toastType: ToastType;
|
||||
@@ -23,10 +25,11 @@ export type ToastStateType = {
|
||||
const HIDE_TOAST = 'toast/HIDE_TOAST';
|
||||
export const SHOW_TOAST = 'toast/SHOW_TOAST';
|
||||
|
||||
type HideToastActionType = {
|
||||
type HideToastActionType = ReadonlyDeep<{
|
||||
type: typeof HIDE_TOAST;
|
||||
};
|
||||
}>;
|
||||
|
||||
// eslint-disable-next-line local-rules/type-alias-readonlydeep
|
||||
export type ShowToastActionType = {
|
||||
type: typeof SHOW_TOAST;
|
||||
payload: {
|
||||
@@ -35,6 +38,7 @@ export type ShowToastActionType = {
|
||||
};
|
||||
};
|
||||
|
||||
// eslint-disable-next-line local-rules/type-alias-readonlydeep
|
||||
export type ToastActionType = HideToastActionType | ShowToastActionType;
|
||||
|
||||
// Action Creators
|
||||
@@ -53,10 +57,12 @@ function openFileInFolder(target: string): NoopActionType {
|
||||
};
|
||||
}
|
||||
|
||||
export type ShowToastActionCreatorType = (
|
||||
toastType: ToastType,
|
||||
parameters?: ReplacementValuesType
|
||||
) => ShowToastActionType;
|
||||
export type ShowToastActionCreatorType = ReadonlyDeep<
|
||||
(
|
||||
toastType: ToastType,
|
||||
parameters?: ReplacementValuesType
|
||||
) => ShowToastActionType
|
||||
>;
|
||||
|
||||
export const showToast: ShowToastActionCreatorType = (
|
||||
toastType,
|
||||
|
Reference in New Issue
Block a user