The issue is with bar: dict as it seems to be a too generic type.
What worked for bar are:
from typing import Literal
bar: dict[Literal["bar"], str] = {"bar": "bar"}
# or
class BarDict(TypedDict):
bar: str
bar: BarDict = {"bar": "bar"}
This means, that it's some sort of an "all in" situation if this way of typing wants to be used.
Cool new things are coming in this area, for example have a look at extra items https://peps.python.org/pep-0728/#the-extra-items-class-parameter