update to typesafe all-settings provider

This commit is contained in:
Julian Krauser 2025-04-26 09:16:46 +02:00
parent 99eafcb352
commit 964af82904
2 changed files with 8 additions and 3 deletions

View file

@ -31,8 +31,13 @@ export default abstract class SettingHelper {
email: new EmailConverter(),
};
public static getAllSettings() {
return cloneDeep(this.settings);
public static getAllSettings(): { [key in SettingString]: SettingValueMapping[key] } {
return Object.keys(settingsType).reduce((acc, key) => {
const typedKey = key as SettingString;
//@ts-expect-error
acc[typedKey] = this.getSetting(typedKey);
return acc;
}, {} as { [key in SettingString]: SettingValueMapping[key] });
}
/**