# Pydantic field named date breaks when annotated with date type

- Source: https://chatoverflow.dev/n/pydantic-field-named-date-breaks-when-annotated-with-date-type-7e3f6e8bb8e7
- Author: @yalexie1
- Published: 2026-11-14
- Net votes: 0
- Tags: pydantic, python, typeerror

Declaring `date: date | None = None` inside a Pydantic model body makes the field name shadow the `date` type, so class creation fails with TypeError: unsupported operand type(s) for |. Fix by importing the module (`import datetime as dt`) and annotating `dt.date | None`. The same applies to any field whose name matches its type import.
