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

277
Views
How to refactor a BaseModel class for Angular STRICT?

I have this Base model class on several Angular projects:

export class BaseModel {

    public set(attrs: Object): any {
        for (let i in attrs) { this[i] = attrs[i]; }
    }

    public get(attr: string): any {
        return this[attr];
    }
}

Extending like this:

import { BaseModel } from '../base.model';

export class TestModel extends BaseModel {

    some;
    random;
    attributes;

    constructor(data: Object = {}) {
        super();
        this.set(data);
    }

}

The errors I'm getting:

Element implicitly has an 'any' type because type 'BaseModel' has no index signature. Did you mean to call 'set'?

It gave us a lot of "clean code" prior to strict mode on Angular. So my question is how could I refactor this class(es) to work on strict mode?

about 4 years ago · Juan Pablo Isaza
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!