From d2d4a5a999746ae0f01a2ce89b844252346bab27 Mon Sep 17 00:00:00 2001 From: lutangar Date: Thu, 20 Jan 2022 12:07:15 +0100 Subject: Fix plugin settings manager definition This mainly fix the `onSettingsChange` argument typing. I'm not 100% sure the setting `value` can be a boolean though. But this is how it was typed before so I just made it consistent. Feel free to change - or suggest change - to the type names / location. --- .../server/managers/plugin-settings-manager.model.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'shared/models/plugins/server/managers') diff --git a/shared/models/plugins/server/managers/plugin-settings-manager.model.ts b/shared/models/plugins/server/managers/plugin-settings-manager.model.ts index 3c28c0565..b628718dd 100644 --- a/shared/models/plugins/server/managers/plugin-settings-manager.model.ts +++ b/shared/models/plugins/server/managers/plugin-settings-manager.model.ts @@ -1,9 +1,17 @@ +export type SettingValue = string | boolean + +export interface SettingEntries { + [settingName: string]: SettingValue +} + +export type SettingsChangeCallback = (settings: SettingEntries) => Promise + export interface PluginSettingsManager { - getSetting: (name: string) => Promise + getSetting: (name: string) => Promise - getSettings: (names: string[]) => Promise<{ [settingName: string]: string | boolean }> + getSettings: (names: string[]) => Promise - setSetting: (name: string, value: string) => Promise + setSetting: (name: string, value: SettingValue) => Promise - onSettingsChange: (cb: (names: string[]) => Promise) => void + onSettingsChange: (cb: SettingsChangeCallback) => void } -- cgit v1.2.3