Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: parent is typed wrong #20

Open
ffMathy opened this issue Sep 25, 2023 · 4 comments
Open

bug: parent is typed wrong #20

ffMathy opened this issue Sep 25, 2023 · 4 comments

Comments

@ffMathy
Copy link
Contributor

ffMathy commented Sep 25, 2023

Instead of typing parent as Context, it should be typed as Omit<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?

@gismya
Copy link
Contributor

gismya commented Sep 25, 2023

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.

@ffMathy
Copy link
Contributor Author

ffMathy commented Sep 25, 2023

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.

@gismya
Copy link
Contributor

gismya commented Sep 25, 2023

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

@ffMathy
Copy link
Contributor Author

ffMathy commented Sep 25, 2023

I see. Where would I look to contribute for this, if we go with Omit for now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants