Skip to content
4 changes: 2 additions & 2 deletions mypy/checkexpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -4651,8 +4651,8 @@ def union_tuple_fallback_item(self, left_type: TupleType) -> Type:
def visit_typeddict_index_expr(
self, td_type: TypedDictType, index: Expression, setitem: bool = False
) -> tuple[Type, set[str]]:
if isinstance(index, StrExpr):
key_names = [index.value]
if isinstance(folded_index := constant_fold_expr(index, "unused"), str):
key_names = [folded_index]
else:
typ = get_proper_type(self.accept(index))
if isinstance(typ, UnionType):
Expand Down