From 648c3c7796449ab8cea2aaafaa4765e8f5b3c7cf Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 30 Jul 2020 08:49:42 -0600 Subject: [PATCH] Fix various type definitions --- src/settings/controllers/FontSizeController.ts | 3 ++- src/settings/controllers/NotificationControllers.ts | 2 +- src/settings/controllers/SystemFontController.ts | 3 ++- src/settings/controllers/UseSystemFontController.ts | 3 ++- src/settings/handlers/DefaultSettingsHandler.ts | 2 +- src/settings/handlers/LocalEchoWrapper.ts | 2 +- 6 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/settings/controllers/FontSizeController.ts b/src/settings/controllers/FontSizeController.ts index 6440fd32fe..b86d596040 100644 --- a/src/settings/controllers/FontSizeController.ts +++ b/src/settings/controllers/FontSizeController.ts @@ -18,13 +18,14 @@ import SettingController from "./SettingController"; import dis from "../../dispatcher/dispatcher"; import { UpdateFontSizePayload } from "../../dispatcher/payloads/UpdateFontSizePayload"; import { Action } from "../../dispatcher/actions"; +import { SettingLevel } from "../SettingLevel"; export default class FontSizeController extends SettingController { constructor() { super(); } - onChange(level, roomId, newValue) { + public onChange(level: SettingLevel, roomId: string, newValue: any) { // Dispatch font size change so that everything open responds to the change. dis.dispatch({ action: Action.UpdateFontSize, diff --git a/src/settings/controllers/NotificationControllers.ts b/src/settings/controllers/NotificationControllers.ts index 4a8a70362d..fc50af6096 100644 --- a/src/settings/controllers/NotificationControllers.ts +++ b/src/settings/controllers/NotificationControllers.ts @@ -61,7 +61,7 @@ export class NotificationsEnabledController extends SettingController { return calculatedValue; } - public onChange(level: SettingLevel, roomId: string, newValue) { + public onChange(level: SettingLevel, roomId: string, newValue: any) { if (getNotifier().supportsDesktopNotifications()) { getNotifier().setEnabled(newValue); } diff --git a/src/settings/controllers/SystemFontController.ts b/src/settings/controllers/SystemFontController.ts index e31077e4c8..f38dbdbbf6 100644 --- a/src/settings/controllers/SystemFontController.ts +++ b/src/settings/controllers/SystemFontController.ts @@ -19,13 +19,14 @@ import SettingsStore from "../SettingsStore"; import dis from "../../dispatcher/dispatcher"; import { UpdateSystemFontPayload } from "../../dispatcher/payloads/UpdateSystemFontPayload"; import { Action } from "../../dispatcher/actions"; +import { SettingLevel } from "../SettingLevel"; export default class SystemFontController extends SettingController { constructor() { super(); } - public onChange(level, roomId, newValue) { + public onChange(level: SettingLevel, roomId: string, newValue: any) { // Dispatch font size change so that everything open responds to the change. dis.dispatch({ action: Action.UpdateSystemFont, diff --git a/src/settings/controllers/UseSystemFontController.ts b/src/settings/controllers/UseSystemFontController.ts index 07a80c7d38..0b6acc590a 100644 --- a/src/settings/controllers/UseSystemFontController.ts +++ b/src/settings/controllers/UseSystemFontController.ts @@ -19,13 +19,14 @@ import SettingsStore from "../SettingsStore"; import dis from "../../dispatcher/dispatcher"; import { UpdateSystemFontPayload } from "../../dispatcher/payloads/UpdateSystemFontPayload"; import { Action } from "../../dispatcher/actions"; +import { SettingLevel } from "../SettingLevel"; export default class UseSystemFontController extends SettingController { constructor() { super(); } - public onChange(level, roomId, newValue) { + public onChange(level: SettingLevel, roomId: string, newValue: any) { // Dispatch font size change so that everything open responds to the change. dis.dispatch({ action: Action.UpdateSystemFont, diff --git a/src/settings/handlers/DefaultSettingsHandler.ts b/src/settings/handlers/DefaultSettingsHandler.ts index fc1c92c159..f54c7eafe1 100644 --- a/src/settings/handlers/DefaultSettingsHandler.ts +++ b/src/settings/handlers/DefaultSettingsHandler.ts @@ -27,7 +27,7 @@ export default class DefaultSettingsHandler extends SettingsHandler { * @param {object} defaults The default setting values, keyed by setting name. * @param {object} invertedDefaults The default inverted setting values, keyed by setting name. */ - constructor(private defaults: any, private invertedDefaults: any) { // TODO: [TS] Appropriate types + constructor(private defaults: Record, private invertedDefaults: Record) { super(); } diff --git a/src/settings/handlers/LocalEchoWrapper.ts b/src/settings/handlers/LocalEchoWrapper.ts index d940413b9b..5cfcd27aed 100644 --- a/src/settings/handlers/LocalEchoWrapper.ts +++ b/src/settings/handlers/LocalEchoWrapper.ts @@ -60,7 +60,7 @@ export default class LocalEchoWrapper extends SettingsHandler { }); } - public canSetValue(settingName, roomId): boolean { + public canSetValue(settingName: string, roomId: string): boolean { return this.handler.canSetValue(settingName, roomId); }