Apply strictNullChecks to src/settings/* (#10252

* Apply strictNullChecks to src/settings/*

* Fix inherited types
This commit is contained in:
Michael Telatyński 2023-02-28 10:24:59 +00:00 committed by GitHub
parent 95223c87fe
commit eca28ac2f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 24 deletions

View file

@ -45,13 +45,13 @@ const defaultWatchManager = new WatchManager();
const defaultSettings: Record<string, any> = {};
const invertedDefaultSettings: Record<string, boolean> = {};
const featureNames: string[] = [];
for (const key of Object.keys(SETTINGS)) {
defaultSettings[key] = SETTINGS[key].default;
if (SETTINGS[key].isFeature) featureNames.push(key);
if (SETTINGS[key].invertedSettingName) {
// Invert now so that the rest of the system will invert it back
// to what was intended.
invertedDefaultSettings[SETTINGS[key].invertedSettingName] = !SETTINGS[key].default;
for (const key in SETTINGS) {
const setting = SETTINGS[key];
defaultSettings[key] = setting.default;
if (setting.isFeature) featureNames.push(key);
if (setting.invertedSettingName) {
// Invert now so that the rest of the system will invert it back to what was intended.
invertedDefaultSettings[setting.invertedSettingName] = !setting.default;
}
}
@ -250,7 +250,7 @@ export default class SettingsStore {
if (roomId === null) {
// Unregister all existing watchers and register the new one
rooms.forEach((roomId) => {
SettingsStore.unwatchSetting(this.monitors.get(settingName)!.get(roomId));
SettingsStore.unwatchSetting(this.monitors.get(settingName)!.get(roomId)!);
});
this.monitors.get(settingName)!.clear();
registerWatcher();