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
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
4ae44810d3
Коммит
bb4aa764bc
@@ -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() {
|
||||
Ссылка в новой задаче
Block a user