Skip to content

SelectType must be Hashable #6034

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

# [Unreleased]

### Fixed

- Fix type hint for SelectType: only hashable types are allowed.

# [5.3.0] - 2025-08-07

### Added
Expand Down
4 changes: 2 additions & 2 deletions src/textual/widgets/_select.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

from dataclasses import dataclass
from typing import TYPE_CHECKING, Generic, Iterable, TypeVar, Union
from typing import TYPE_CHECKING, Generic, Hashable, Iterable, TypeVar, Union

import rich.repr
from rich.console import RenderableType
Expand Down Expand Up @@ -261,7 +261,7 @@ def _on_click(self, event: events.Click) -> None:
self.post_message(self.Toggle())


SelectType = TypeVar("SelectType")
SelectType = TypeVar("SelectType", bound=Hashable)
"""The type used for data in the Select."""
SelectOption: TypeAlias = "tuple[str, SelectType]"
"""The type used for options in the Select."""
Expand Down
Loading