Chore: Type improvements 🧹 (#75271)

* fix some e2e flows types

* some type fixes

* must... fix... more...

* MOAR

* MOREMOREMORE

* 1 more
This commit is contained in:
Ashley Harrison
2023-09-22 15:06:49 +01:00
committed by GitHub
parent eba74f0408
commit ff0642bf6e
65 changed files with 217 additions and 387 deletions
+5 -7
View File
@@ -1,10 +1,9 @@
// @todo this actually returns type `Cypress.Chainable`
const get = (key: string): any =>
const get = (key: string) =>
cy.wrap({ getLocalStorage: () => localStorage.getItem(key) }, { log: false }).invoke('getLocalStorage');
// @todo this actually returns type `Cypress.Chainable`
export const getLocalStorage = (key: string): any =>
get(key).then((value: any) => {
export const getLocalStorage = (key: string) =>
get(key).then((value) => {
if (value === null) {
return value;
} else {
@@ -12,8 +11,7 @@ export const getLocalStorage = (key: string): any =>
}
});
// @todo this actually returns type `Cypress.Chainable`
export const requireLocalStorage = (key: string): any =>
export const requireLocalStorage = (key: string) =>
get(key) // `getLocalStorage()` would turn 'null' into `null`
.should('not.equal', null)
.then((value: any) => JSON.parse(value as string));
.then((value) => JSON.parse(value));