vega / altair

Declarative statistical visualization library for Python
https://altair-viz.github.io/
BSD 3-Clause "New" or "Revised" License
9.4k stars 795 forks source link

docs(typing): Fix inaccurate `selection_interval` signature #3662

Closed dangotbanned closed 3 weeks ago

dangotbanned commented 3 weeks ago

Resolves https://github.com/vega/altair/pull/3653#issuecomment-2437209166

Primarily addresses mark: Mark, which should be mark: BrushConfig.

As @mattijn noted, interactions-parameter-composition would produce this waring:

Argument of type "BrushConfig" cannot be assigned to parameter "mark" of type "Optional[Mark]" in function "selection_interval"
  Type "BrushConfig" is not assignable to type "Optional[Mark]"
    "BrushConfig" is not assignable to "Mark"
    "BrushConfig" is not assignable to "UndefinedType"

I traced this back to:


It was also asked was whether this can be set within a theme. I found that indeed this would be possible (BrushConfigKwds).

I spotted some others which seemed useful to include (MergedStreamKwds, DerivedStreamKwds).

[!NOTE] I think the strange docs these have is due to being defined recursively.


Finally, this PR updates/corrects the typing embedded within the docstring