Open founded1898 opened 3 years ago
Just leafing through the code, it looks like the kind
property is used internally. Unless I'm misunderstanding the code (cc: @richmolj ), defining an attribute adds a getter to that record class. SpraypaintBase
kind
is later evaluated on the object, which calls that getter and triggers the error (there's no instance to read the kind
attribute from). Try it with the JS API, see if maybe you can work around it by just using the JS record definition just for this one model?
Another interesting observation, if you define the Person
association first, it works. 🤪
Model()
class Dog extends SpraypaintBase {
@BelongsTo() person: Person;
@Attr() name: string;
@Attr() kind: string;
}
Hi There
We're using spraypaint together with typescript and stumbled across an error when an attribute has the name
kind
.this code here
leads to the following error
We figured out that the error only occurs if there is some kind of relationship on the model with the attribute. See minimal demo here: https://stackblitz.com/edit/typescript-xyevlu?file=index.ts
Does someone know whats the problem here?
Thanks in advance.