I've got the exactly same question as the one below which hasn't got any answer yet. My environment is the latest Python 3.8.8 + windows machine. Any idea? Thanks.
TypedDict didn't raise unexpected key error
from typing_extensions import TypedDict
class SalesSummary(TypedDict):
sales: int
def get_sales_summary() -> SalesSummary:
return {
"sales": 1_000,
"country": "UK",
"product_codes": 1,
"dummy" : "dummy",
}
print(get_sales_summary())
and get the return like this
{'sales': 1000, 'country': 'UK', 'product_codes': 1, 'dummy': 'dummy'}