Tengo el siguiente error en mi texto mecanografiado y no tengo idea de cómo solucionarlo.
El parámetro 'clave' implícitamente tiene un tipo 'cualquiera'.
A continuación se muestra mi código, no entiendo completamente el problema, incluso si any escribo, aparece el error.
let store = {}; return { getItem: (key) => { return store[key] || null; }, setItem: (key, value) => { store[key] = value.toString(); }, removeItem: (key) => { delete store[key]; }, clear: () => { store = {}; }, }; };La solución fue escribir la tecla en el punto de creación del objeto.
const fakeLocalStorage = () => { let store: { [key: string]: string } = {}; return { getItem: (key: string) => { return store[key] || null; }, setItem: (key: string, value: string) => { store[key] = value.toString(); }, removeItem: (key: string) => { delete store[key]; }, clear: () => { store = {}; }, }; };