Extend add_option so that it accepts selections and selection tuples

This commit is contained in:
Dave Pearson
2023-05-23 09:24:29 +01:00
parent f530efda2a
commit 9e6bf085b8

View File

@@ -448,3 +448,12 @@ class SelectionList(Generic[SelectionType], OptionList):
"Only Selection or a prompt/value tuple is supported in SelectionList" "Only Selection or a prompt/value tuple is supported in SelectionList"
) )
return super().add_options(cleaned_options) return super().add_options(cleaned_options)
def add_option(
self,
item: NewOptionListContent
| Selection
| tuple[TextType, SelectionType]
| tuple[TextType, SelectionType, bool] = None,
) -> Self:
return self.add_options([item])