Convert ConfigSettingsHandler to TS

This commit is contained in:
Travis Ralston 2020-07-28 21:47:57 -06:00
parent e4d8cca861
commit 32844d4624

View file

@ -1,6 +1,6 @@
/* /*
Copyright 2017 Travis Ralston Copyright 2017 Travis Ralston
Copyright 2019 New Vector Ltd Copyright 2019, 2020 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -24,7 +24,7 @@ import {isNullOrUndefined} from "matrix-js-sdk/src/utils";
* roomId parameter. * roomId parameter.
*/ */
export default class ConfigSettingsHandler extends SettingsHandler { export default class ConfigSettingsHandler extends SettingsHandler {
getValue(settingName, roomId) { public getValue(settingName: string, roomId: string): any {
const config = SdkConfig.get() || {}; const config = SdkConfig.get() || {};
// Special case themes // Special case themes
@ -37,15 +37,15 @@ export default class ConfigSettingsHandler extends SettingsHandler {
return settingsConfig[settingName]; return settingsConfig[settingName];
} }
setValue(settingName, roomId, newValue) { public async setValue(settingName: string, roomId: string, newValue: any): Promise<void> {
throw new Error("Cannot change settings at the config level"); throw new Error("Cannot change settings at the config level");
} }
canSetValue(settingName, roomId) { public canSetValue(settingName: string, roomId: string): boolean {
return false; return false;
} }
isSupported() { public isSupported(): boolean {
return true; // SdkConfig is always there return true; // SdkConfig is always there
} }
} }