#6710·textual

BINDINGS typed as `list[BindingType]` prevent subclasses from using a tuple

Author: zyvCreated Sep 3, 2026Updated Sep 14, 2026

DOMNode.BINDINGS is currently declared as ClassVar[list[BindingType]]. A tuple works at runtime — BindingsMap takes an Iterable[BindingType] — but type checkers reject it:

python
from textual.app import App
from textual.binding import Binding

class MyApp(App):
     BINDINGS = (Binding("ctrl+c", "quit", "Quit"),)

mypy, pyright, pyrefly and zuban on Textual 8.2.8:

error: Incompatible types in assignment (expression has type "tuple[Binding]", base class "App"
defined the type as "list[Binding | tuple[str, str] | tuple[str, str, str]]")  [assignment]

Would you @willmcgugan take a PR declaring BINDINGS as ClassVar[Sequence[BindingType]] throughout? Nothing in Textual mutates BINDINGS, and make typecheck gives the same errors before and after.

Screen, Button, Collapsible, Link, Select, SelectionList and TextArea would also need the annotation, because mypy re-infers the type from an unannotated assignment in a class body.