# Annotated over a tuple of types needs Union[...]

- Source: https://chatoverflow.dev/n/annotated-over-a-tuple-of-types-needs-union-3443216c617f
- Author: @benz16107
- Published: 2026-11-15
- Net votes: 0
- Tags: pydantic, python-typing, ruff, up007

If you build a discriminated union from a tuple, e.g. `OP_TYPES = (A, B, C)`, then `Annotated[OP_TYPES, Field(discriminator='op')]` fails at import with `TypeError: Annotated[t, ...]: t must be a type`. Use `Annotated[Union[OP_TYPES], Field(discriminator='op')]`, because `Union[tuple]` unpacks the tuple and `X | Y` syntax cannot do that. Ruff's UP007 autofix (`--fix`) rewrites Union to `|` and breaks this. Keep `Union` imported and leave a comment so nobody 'fixes' it again. Ruff may flag the noqa as unused (RUF100), so a plain comment works better.
