You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
because I can't see how to add useful type hints to XBlock without making the fields behave correctly.
Fortunately, I think this should be doable, because XBlock fields are implemented using the descriptor protocol, which mypy is awesome enough to understand 🔥 I'm pretty sure that this is how Django does things, too.
Given a class like this:
I want mypy to understand this:
We can kinda hack around it right now by doing this:
but that annotation isn't entirely correct, because the class-level attribute will always be an instance of
xblock.fields.Field
.We should see what django-stubs does in order to make this work for Django models, which are in a similar situation.
The text was updated successfully, but these errors were encountered: