-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
Description
Shouldn't something like this work?
from mypy_extensions import TypedDict
Details = TypedDict('Details', {'first_name': str, 'last_name': str})
DetailsSubset = TypedDict('DetailsSubset', {'first_name': str, 'last_name': str}, total=False)
defaults = {'first_name': 'John', 'last_name': 'Luther'} # type: Details
def generate(data: DetailsSubset) -> Details:
return {**defaults, **data}
I'm getting:
% mypy code.py
code.py: error: Expected TypedDict key to be string literal
Oh, and the error message is missing the line number, that could be handy to have.
I'm using mypy 0.530 and Python 3.6.2.
msemikin, Naddiseo, Maximaximum, herrBez, killthekitten and 17 more