Convert SettingsHandler to TS

This commit is contained in:
Travis Ralston 2020-07-28 15:25:57 -06:00
parent 7584a296e4
commit c96def81ae

View file

@ -1,6 +1,6 @@
/*
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");
you may not use this file except in compliance with the License.
@ -28,7 +28,7 @@ export default class SettingsHandler {
* @param {String} roomId The room ID to read from, may be null.
* @returns {*} The setting value, or null if not found.
*/
getValue(settingName, roomId) {
public getValue(settingName: string, roomId: string): any {
console.error("Invalid operation: getValue was not overridden");
return null;
}
@ -44,7 +44,7 @@ export default class SettingsHandler {
* @param {*} newValue The new value for the setting, may be null.
* @returns {Promise} Resolves when the setting has been saved.
*/
setValue(settingName, roomId, newValue) {
public setValue(settingName: string, roomId: string, newValue): Promise<void> {
console.error("Invalid operation: setValue was not overridden");
return Promise.reject();
}
@ -56,7 +56,7 @@ export default class SettingsHandler {
* @param {String} roomId The room ID to check in, may be null
* @returns {boolean} True if the setting can be set by the user, false otherwise.
*/
canSetValue(settingName, roomId) {
public canSetValue(settingName: string, roomId: string): boolean {
return false;
}
@ -64,7 +64,7 @@ export default class SettingsHandler {
* Determines if this level is supported on this device.
* @returns {boolean} True if this level is supported on the current device.
*/
isSupported() {
public isSupported(): boolean {
return false;
}
}