Fix various type definitions

This commit is contained in:
Travis Ralston 2020-07-30 08:49:42 -06:00
parent 4cf6b7174b
commit 648c3c7796
6 changed files with 9 additions and 6 deletions

View file

@ -18,13 +18,14 @@ import SettingController from "./SettingController";
import dis from "../../dispatcher/dispatcher"; import dis from "../../dispatcher/dispatcher";
import { UpdateFontSizePayload } from "../../dispatcher/payloads/UpdateFontSizePayload"; import { UpdateFontSizePayload } from "../../dispatcher/payloads/UpdateFontSizePayload";
import { Action } from "../../dispatcher/actions"; import { Action } from "../../dispatcher/actions";
import { SettingLevel } from "../SettingLevel";
export default class FontSizeController extends SettingController { export default class FontSizeController extends SettingController {
constructor() { constructor() {
super(); 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. // Dispatch font size change so that everything open responds to the change.
dis.dispatch<UpdateFontSizePayload>({ dis.dispatch<UpdateFontSizePayload>({
action: Action.UpdateFontSize, action: Action.UpdateFontSize,

View file

@ -61,7 +61,7 @@ export class NotificationsEnabledController extends SettingController {
return calculatedValue; return calculatedValue;
} }
public onChange(level: SettingLevel, roomId: string, newValue) { public onChange(level: SettingLevel, roomId: string, newValue: any) {
if (getNotifier().supportsDesktopNotifications()) { if (getNotifier().supportsDesktopNotifications()) {
getNotifier().setEnabled(newValue); getNotifier().setEnabled(newValue);
} }

View file

@ -19,13 +19,14 @@ import SettingsStore from "../SettingsStore";
import dis from "../../dispatcher/dispatcher"; import dis from "../../dispatcher/dispatcher";
import { UpdateSystemFontPayload } from "../../dispatcher/payloads/UpdateSystemFontPayload"; import { UpdateSystemFontPayload } from "../../dispatcher/payloads/UpdateSystemFontPayload";
import { Action } from "../../dispatcher/actions"; import { Action } from "../../dispatcher/actions";
import { SettingLevel } from "../SettingLevel";
export default class SystemFontController extends SettingController { export default class SystemFontController extends SettingController {
constructor() { constructor() {
super(); 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. // Dispatch font size change so that everything open responds to the change.
dis.dispatch<UpdateSystemFontPayload>({ dis.dispatch<UpdateSystemFontPayload>({
action: Action.UpdateSystemFont, action: Action.UpdateSystemFont,

View file

@ -19,13 +19,14 @@ import SettingsStore from "../SettingsStore";
import dis from "../../dispatcher/dispatcher"; import dis from "../../dispatcher/dispatcher";
import { UpdateSystemFontPayload } from "../../dispatcher/payloads/UpdateSystemFontPayload"; import { UpdateSystemFontPayload } from "../../dispatcher/payloads/UpdateSystemFontPayload";
import { Action } from "../../dispatcher/actions"; import { Action } from "../../dispatcher/actions";
import { SettingLevel } from "../SettingLevel";
export default class UseSystemFontController extends SettingController { export default class UseSystemFontController extends SettingController {
constructor() { constructor() {
super(); 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. // Dispatch font size change so that everything open responds to the change.
dis.dispatch<UpdateSystemFontPayload>({ dis.dispatch<UpdateSystemFontPayload>({
action: Action.UpdateSystemFont, action: Action.UpdateSystemFont,

View file

@ -27,7 +27,7 @@ export default class DefaultSettingsHandler extends SettingsHandler {
* @param {object} defaults The default setting values, keyed by setting name. * @param {object} defaults The default setting values, keyed by setting name.
* @param {object} invertedDefaults The default inverted 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<string, any>, private invertedDefaults: Record<string, any>) {
super(); super();
} }

View file

@ -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); return this.handler.canSetValue(settingName, roomId);
} }