Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

172
Views
Angular unit testing the localstorage, Error ts(7053)

beforeEach (() => { ...

   let store = {};
  const mockSessionStorage = {
  getItem: (key: string): string => key in store ? store[key] : null,
  setItem: (key: string, value: string) => store[key] = `${value}`,
  removeItem: (key: string) => delete store[key],
  clear: () => store = {}
};
...

and i get the Error Message The element implicitly has a type "any" because the expression of type "string" cannot be used for the index type "{}". No index signature with a parameter of type "string" was found for type "{}".ts(7053)

Also I'm new to typscript and don't know if it's because of the error message or if I'm doing something else wrong I would be happy if someone could take a quick look.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Try typing your store variable.

Something like this:

let store:{ [key: string]: string } = {};
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!