Migrating some files from javascript to typescript (#24663)

* Migrating some files to typescript

* Some other files migrated

* Migrating more javascript to typescript

* Migrating more javascript to typescript

* Fixing types

* Fixing linter errors

* Fixing some imports

* Fixing linter errors

* Renaming the snapshots

* Addressing PR review comments
Этот коммит содержится в:
Jesús Espino
2023-10-10 16:22:11 +02:00
коммит произвёл GitHub
родитель 4ae44810d3
Коммит bb4aa764bc
53 изменённых файлов: 942 добавлений и 381 удалений

Просмотреть файл

@@ -3,6 +3,8 @@
// Based on https://stackoverflow.com/a/41434763
class LocalStorageMock {
store: {[key: string]: string};
constructor() {
this.store = {};
}
@@ -11,17 +13,19 @@ class LocalStorageMock {
this.store = {};
}
getItem(key) {
getItem(key: string): string | null {
return this.store[key] || null;
}
setItem(key, value) {
setItem(key: string, value: {toString: () => string}) {
this.store[key] = value.toString();
}
removeItem(key) {
removeItem(key: string) {
delete this.store[key];
}
}
global.localStorage = new LocalStorageMock();
(global as any).localStorage = new LocalStorageMock();
export {};

Просмотреть файл

@@ -20,7 +20,7 @@ Object.defineProperty(window.navigator, 'userAgent', {
export function reset() {
set(initialUA);
}
export function set(ua) {
export function set(ua: string) {
currentUA = ua;
}
export function mockSafari() {