-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Typing of AttributeDict return values is broken #1656
Comments
Thanks for bringing this to our attention. Unfortunately, this is likely complex to fix since For v5 I'd be willing to review and merge a fix for this if someone wants to open a PR. I don't think it's something that we'll be prioritizing ourselves. This gives me more reason to push towards converting all of the return values to use I believe that we can use the same pattern from What I'm curious about is whether there are any compelling reasons to stick with dictionary style return types. We've been using |
Yes, I thought this might be complex. Using |
linking to #1416 and adding "good first issue" even though this is really more of a good 2nd or 3rd issue. |
What was wrong?
Many data like events are returned as an
AttributeDict
, so thatevent['event']
andevent.event
both work. The typings however inherit fromTypedDict
, for example forEventData
, so that onlyevent['event']
correctly typechecks, but notevent.event
. This is annoying, as perfectly valid code does not pass typechecking.How can it be fixed?
Somehow allow (similar to the AttributeDict for runtime) for every key to in the
TypedDict
to bypass typechecking also for the attribute. I sadly do not know how to do this.The text was updated successfully, but these errors were encountered: