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
Currently TypedDict type checking rejects spread keyword arguments as a type violation, even when a TypedDict is provided as the spread source. Typing information is available and the spread operation works at runtime, so the error received is ... misleading at best, but also I think the spread should be possible, leveraging the typing from the source TypedDict.
Pitch
I would like to be able to do this (a simplified version of what I really want to do, which involves much larger typed dicts):
class Spam(TypedDict):
one: str
x = Spam(one='one')
Spam(**x)
This currently results in this error from mypy:
x.py:5: error: Expected keyword arguments, {...}, or dict(...) in TypedDict constructor [misc]
(note that the code executes successfully because the spread does work)
The text was updated successfully, but these errors were encountered:
Feature
Currently TypedDict type checking rejects spread keyword arguments as a type violation, even when a TypedDict is provided as the spread source. Typing information is available and the spread operation works at runtime, so the error received is ... misleading at best, but also I think the spread should be possible, leveraging the typing from the source TypedDict.
Pitch
I would like to be able to do this (a simplified version of what I really want to do, which involves much larger typed dicts):
This currently results in this error from mypy:
(note that the code executes successfully because the spread does work)
The text was updated successfully, but these errors were encountered: