Open ffMathy opened 1 year ago
There are some issues with type inheritance due to "philosophical" differences between how it works in the Python stack we use (Not what I'm working with, so don't know the exact details). Context
in the API means anything that is a context or that inherits fromContext
, and the incorrect typing here is one of the issues that this creates.
I think something similar to AddBasicLinkType
to correct for this might be the easiest way to fix this.
Thank you.
But isn't Context
also correct then, but without the __entity_type__
property?
Just need to make sure I understand what you mean and are proposing.
Context
is more narrow than what is, in reality, returned (Or expected, on create/update). The most obvious place that this type of behaviour shows is Assignments.Resource
for tasks, which is typed as Resource
, but in reality is a User
(Which is extended from BaseUser
which is extended from Resource
), which means we have to cast the resource to User
to access the properties on it. We don't have a good solution to this, and all the solutions I tried creating quickly became convoluted messes that still didn't work completely.
But Omit<Context, "__entity_type__">
would be better than what's there today, if we can generalize it even further ut would be even better
I see. Where would I look to contribute for this, if we go with Omit for now?
Instead of typing
parent
asContext
, it should be typed asOmit<Context, "__entity_type__">
.Currently, it can't be set to anything that extends from Context, due to this.
I couldn't find the right place to set this in the code. Is that because this is set dynamically?