Skip to content

Instantly share code, notes, and snippets.

@mypy-play
Created November 13, 2025 20:38
Show Gist options
  • Select an option

  • Save mypy-play/6063ab2f7a7a97f7ee4abb1f2019d225 to your computer and use it in GitHub Desktop.

Select an option

Save mypy-play/6063ab2f7a7a97f7ee4abb1f2019d225 to your computer and use it in GitHub Desktop.
Shared via mypy Playground
import sys
from typing import final
@final
class A: ...
@final
class B: ...
if sys.version_info >= (3, 14):
type MyAlias = A | B
else:
type MyAlias = A
def f(x: MyAlias):
if isinstance(x, B):
reveal_type(x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment