aboutsummaryrefslogtreecommitdiff
path: root/src/settings/actions/setting.ts
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2019-05-02 11:12:28 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2019-05-02 22:07:54 +0900
commite69497fab457df486b2a7068bdd0283505461f8b (patch)
treef1cb4111bae89160d4238df9057493a50acacc39 /src/settings/actions/setting.ts
parentc059bf8be3b302173f2cab0d22a434aea4a6e0bd (diff)
Types src/settings
Diffstat (limited to 'src/settings/actions/setting.ts')
-rw-r--r--src/settings/actions/setting.ts18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/settings/actions/setting.ts b/src/settings/actions/setting.ts
index db63a45..b03cd80 100644
--- a/src/settings/actions/setting.ts
+++ b/src/settings/actions/setting.ts
@@ -1,15 +1,15 @@
-import actions from 'settings/actions';
-import * as validator from 'shared/settings/validator';
-import * as settingsValues from 'shared/settings/values';
-import * as settingsStorage from 'shared/settings/storage';
+import * as actions from './index';
+import * as validator from '../../shared/settings/validator';
+import * as settingsValues from '../../shared/settings/values';
+import * as settingsStorage from '../../shared/settings/storage';
import keymaps from '../keymaps';
-const load = async() => {
+const load = async(): Promise<actions.SettingAction> => {
let settings = await settingsStorage.loadRaw();
return set(settings);
};
-const save = async(settings) => {
+const save = async(settings: any): Promise<actions.SettingAction> => {
try {
if (settings.source === 'json') {
let value = JSON.parse(settings.json);
@@ -26,7 +26,7 @@ const save = async(settings) => {
return set(settings);
};
-const switchToForm = (json) => {
+const switchToForm = (json: string): actions.SettingAction => {
try {
validator.validate(JSON.parse(json));
let form = settingsValues.formFromJson(json, keymaps.allowedOps);
@@ -43,7 +43,7 @@ const switchToForm = (json) => {
}
};
-const switchToJson = (form) => {
+const switchToJson = (form: any): actions.SettingAction => {
let json = settingsValues.jsonFromForm(form);
return {
type: actions.SETTING_SWITCH_TO_JSON,
@@ -51,7 +51,7 @@ const switchToJson = (form) => {
};
};
-const set = (settings) => {
+const set = (settings: any): actions.SettingAction => {
return {
type: actions.SETTING_SET_SETTINGS,
source: settings.source,