Twitter user @DanyX23:
TIL: pyright, the python type checking engine that is used by VS Code, has support for exhaustiveness checking for match statements with union types!
If you add the following to your pyproject.toml, you’ll get the attached warning
[tool.pyright] reportMatchNotExhaustive = true
It also does exhaustiveness checking for enums! Pyright is probably the best thing about Python.