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
There isn't a standard way in Python's type hints system to express that a TypedDict should permit fields other than those explicitly enumerated.
I don't see a reason for the stdlib to add that functionality; my read is that it's largely targeted at static typecheckers like mypy and pyright, and during static analysis you have no reason to model extra fields. For runtime type checking, however, it's very useful to be able to say that a TypedDict should have this subset of fields, in case an external library adds new fields.
Is there any room in typeguard to implement a non-standard flag or option to indicate that a TypedDict should be allowed to have extra fields? Or a place to set a global configuration option?
Use case
This is quite relevant to my use-case, because the third-party in question has been adding a new field basically every week for the past several months. It's looking like typeguard isn't quite the right tool for the job, though it's helped us catch API regressions too, so I'm a little hesitant to rip it out.
The text was updated successfully, but these errors were encountered:
Things to check first
Feature description
Following up on #376:
There isn't a standard way in Python's type hints system to express that a TypedDict should permit fields other than those explicitly enumerated.
I don't see a reason for the stdlib to add that functionality; my read is that it's largely targeted at static typecheckers like mypy and pyright, and during static analysis you have no reason to model extra fields. For runtime type checking, however, it's very useful to be able to say that a
TypedDict
should have this subset of fields, in case an external library adds new fields.Is there any room in
typeguard
to implement a non-standard flag or option to indicate that aTypedDict
should be allowed to have extra fields? Or a place to set a global configuration option?Use case
This is quite relevant to my use-case, because the third-party in question has been adding a new field basically every week for the past several months. It's looking like
typeguard
isn't quite the right tool for the job, though it's helped us catch API regressions too, so I'm a little hesitant to rip it out.The text was updated successfully, but these errors were encountered: