Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a
FlexibleAlias
to mypy_extensions
(#5436)
Currently there is no way to define generic type aliases that do not depend on their type arguments or that are just directly a type variable. `FlexibleAlias[T, typ]` creates a type that depends on `T` but that is expanded to `typ` during type alias expansion. One target use case for this is in creating conditionally defined type aliases that depend on their argument under certain configurations but not under others, for example: ``` if BOGUS: Bogus = FlexibleAlias[T, Any] else: Bogus = FlexibleAlias[T, T] ```
- Loading branch information