Hey I think the JsonApiModel type isn't entirely correct, or very possibly I'm just not understanding it.
It has this in it's type / class declaration: [key: string]: any;, but this causes the models to accept any properties, even ones not listed on the model, for eg:
export class User extends JsonApiModel{
@Attribute()
name: string;
}
const user = datastore.createRecord(User);
user.name = 'someName'; // this is correct and should work
user.anything = true; // this IMO should throw an error in TS but doesn't because of [key: string]: any;
So my question is, should this be changed? Or does it serve a purpose I'm just not understanding?
Hey I think the
JsonApiModeltype isn't entirely correct, or very possibly I'm just not understanding it.It has this in it's type / class declaration:
[key: string]: any;, but this causes the models to accept any properties, even ones not listed on the model, for eg:So my question is, should this be changed? Or does it serve a purpose I'm just not understanding?