Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
"Fix" type issues
Browse files Browse the repository at this point in the history
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
  • Loading branch information
SimonBrandner committed Jun 27, 2022
1 parent efdecf8 commit f4704f1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
3 changes: 1 addition & 2 deletions cypress/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,12 @@ import type {
} from "matrix-js-sdk/src/matrix";
import type { MatrixDispatcher } from "../src/dispatcher/dispatcher";
import type PerformanceMonitor from "../src/performance";
import type SettingsStore from "../src/settings/SettingsStore";

declare global {
// eslint-disable-next-line @typescript-eslint/no-namespace
namespace Cypress {
interface ApplicationWindow {
mxSettingsStore: typeof SettingsStore;
mxSettingsStore: any; // XXX: Importing SettingsStore causes a bunch of type lint errors
mxMatrixClientPeg: {
matrixClient?: MatrixClient;
};
Expand Down
11 changes: 5 additions & 6 deletions cypress/support/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ limitations under the License.

import Chainable = Cypress.Chainable;
import type { SettingLevel } from "../../src/settings/SettingLevel";
import SettingsStore from "../../src/settings/SettingsStore";

declare global {
// eslint-disable-next-line @typescript-eslint/no-namespace
Expand All @@ -27,7 +26,7 @@ declare global {
/**
* Returns the SettingsStore
*/
getSettingsStore(): Chainable<typeof SettingsStore | undefined>;
getSettingsStore(): Chainable<any | undefined>; // XXX: Importing SettingsStore causes a bunch of type lint errors
/**
* Open the top left user menu, returning a handle to the resulting context menu.
*/
Expand Down Expand Up @@ -101,7 +100,7 @@ declare global {
}
}

Cypress.Commands.add("getSettingsStore", (): Chainable<typeof SettingsStore> => {
Cypress.Commands.add("getSettingsStore", (): Chainable<any> => {
return cy.window({ log: false }).then(win => win.mxSettingsStore);
});

Expand All @@ -111,14 +110,14 @@ Cypress.Commands.add("setSettingValue", (
level: SettingLevel,
value: any,
): Chainable<void> => {
return cy.getSettingsStore().then(async (store: typeof SettingsStore) => {
return cy.getSettingsStore().then(async (store: any) => {
return store.setValue(name, roomId, level, value);
});
});

Cypress.Commands.add("getSettingValue", <T = any>(name: string, roomId?: string): Chainable<T> => {
return cy.getSettingsStore().then(<T>(store: typeof SettingsStore) => {
return store.getValue<T>(name, roomId);
return cy.getSettingsStore().then((store: any) => {
return store.getValue(name, roomId);
});
});

Expand Down

0 comments on commit f4704f1

Please sign in to comment.