Harden settings types (#33311)
* Harden settings types * Fix types * Update apps/web/src/emojipicker/recent.ts Co-authored-by: Will Hunt <2072976+Half-Shot@users.noreply.github.com> * Fix suggestion --------- Co-authored-by: Will Hunt <2072976+Half-Shot@users.noreply.github.com>
This commit is contained in:
co-authored by
Will Hunt
parent
4bee845010
commit
5ff302539e
@@ -557,7 +557,7 @@ describe("<MatrixChat />", () => {
|
||||
});
|
||||
|
||||
it("should not persist device language when not available", async () => {
|
||||
await SettingsStore.setValue("language", null, SettingLevel.DEVICE, undefined);
|
||||
await SettingsStore.setValue("language", null, SettingLevel.DEVICE, null);
|
||||
const languageBefore = SettingsStore.getValueAt(SettingLevel.DEVICE, "language", null, true, true);
|
||||
|
||||
jest.spyOn(Lifecycle, "attemptDelegatedAuthLogin");
|
||||
|
||||
@@ -225,7 +225,7 @@ describe("<UserSettingsDialog />", () => {
|
||||
});
|
||||
|
||||
it("watches settings", async () => {
|
||||
const watchSettingCallbacks: Record<string, CallbackFn> = {};
|
||||
const watchSettingCallbacks: Record<string, CallbackFn<any>> = {};
|
||||
|
||||
mockSettingsStore.watchSetting.mockImplementation((settingName, roomId, callback) => {
|
||||
watchSettingCallbacks[settingName] = callback;
|
||||
|
||||
@@ -28,7 +28,7 @@ describe("ReleaseAnnouncementStore", () => {
|
||||
settings = {
|
||||
releaseAnnouncementData: {},
|
||||
};
|
||||
const watchCallbacks: Array<CallbackFn> = [];
|
||||
const watchCallbacks: Array<CallbackFn<any>> = [];
|
||||
|
||||
mocked(SettingsStore.getValue).mockImplementation((setting: string) => {
|
||||
return settings[setting];
|
||||
|
||||
@@ -203,13 +203,11 @@ describe("RoomListStore", () => {
|
||||
let featureFlagValue = false;
|
||||
jest.spyOn(SettingsStore, "getValue").mockImplementation(() => featureFlagValue);
|
||||
|
||||
let watchCallback: CallbackFn | undefined;
|
||||
jest.spyOn(SettingsStore, "watchSetting").mockImplementation(
|
||||
(_settingName: string, _roomId: string | null, callbackFn: CallbackFn) => {
|
||||
watchCallback = callbackFn;
|
||||
return "dyn_pred_ref";
|
||||
},
|
||||
);
|
||||
let watchCallback: CallbackFn<any> | undefined;
|
||||
jest.spyOn(SettingsStore, "watchSetting").mockImplementation((_settingName, _roomId, callbackFn) => {
|
||||
watchCallback = callbackFn;
|
||||
return "dyn_pred_ref";
|
||||
});
|
||||
jest.spyOn(SettingsStore, "unwatchSetting");
|
||||
|
||||
const { store } = createStore();
|
||||
|
||||
Reference in New Issue
Block a user