Skip to content

Instantly share code, notes, and snippets.

@mypy-play
Created March 9, 2025 09:09
Show Gist options
  • Save mypy-play/261499b056f876f7f7f91e7d6abc3b8d to your computer and use it in GitHub Desktop.
Save mypy-play/261499b056f876f7f7f91e7d6abc3b8d to your computer and use it in GitHub Desktop.
Shared via mypy Playground
from typing import TypedDict, Mapping
class FooType(TypedDict):
a: int
b: str
def foo(value: Mapping[str, int | str]):
print(value)
x = {
"a": 1,
"b": "v",
}
foo(x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment