Skip to content

Gtk.ListBox sort and filter function raise error #311

@lovetox

Description

@lovetox

Gtk.ListBox.set_filter_func() and Gtk.ListBox.set_sort_func(), expect a Gtk.ListBoxRow in the callback, but usually it will be a object that inherits from ListBoxRow.

This currently raises an error.

Example:

error: Argument of type "(row1: BaseRow, row2: BaseRow) -> int" cannot be assigned to parameter "sort_func" of type "((ListBoxRow, ListBoxRow, *_DataTs@set_sort_func) -> int) | None" in function "set_sort_func"
    Type "(row1: BaseRow, row2: BaseRow) -> int" is not assignable to type "((ListBoxRow, ListBoxRow) -> int) | None"
      Type "(row1: BaseRow, row2: BaseRow) -> int" is not assignable to type "(ListBoxRow, ListBoxRow) -> int"
        Parameter 1: type "ListBoxRow" is incompatible with type "BaseRow"
          "ListBoxRow" is not assignable to "BaseRow"
        Parameter 2: type "ListBoxRow" is incompatible with type "BaseRow"
          "ListBoxRow" is not assignable to "BaseRow"
      "FunctionType" is not assignable to "None" (reportArgumentType)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions