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?