From 4fad0cafad08fef1d2aacbdf541ee3a0e1d650e2 Mon Sep 17 00:00:00 2001 From: GleidsonDaniel Date: Thu, 20 Jan 2022 14:41:04 -0300 Subject: [PATCH] chore: update settings value types --- app/actions/settings.ts | 6 +++--- app/reducers/settings.ts | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/actions/settings.ts b/app/actions/settings.ts index 6f28570b..77b8dcc7 100644 --- a/app/actions/settings.ts +++ b/app/actions/settings.ts @@ -1,6 +1,6 @@ import { Action } from 'redux'; -import { ISettings } from '../reducers/settings'; +import { ISettings, TSettings } from '../reducers/settings'; import { SETTINGS } from './actionsTypes'; interface IAddSettings extends Action { @@ -8,7 +8,7 @@ interface IAddSettings extends Action { } interface IUpdateSettings extends Action { - payload: { id: string; value: string }; + payload: { id: string; value: TSettings }; } export type IActionSettings = IAddSettings & IUpdateSettings; @@ -20,7 +20,7 @@ export function addSettings(settings: ISettings): IAddSettings { }; } -export function updateSettings(id: string, value: string): IUpdateSettings { +export function updateSettings(id: string, value: TSettings): IUpdateSettings { return { type: SETTINGS.UPDATE, payload: { id, value } diff --git a/app/reducers/settings.ts b/app/reducers/settings.ts index bcaad301..028431ed 100644 --- a/app/reducers/settings.ts +++ b/app/reducers/settings.ts @@ -1,8 +1,9 @@ import { IActionSettings } from '../actions/settings'; import { SETTINGS } from '../actions/actionsTypes'; -// TODO UPDATE SETTINGS TYPE -export type ISettings = Record; +export type TSettings = string | number | boolean; + +export type ISettings = Record; export const initialState: ISettings = {};