Skip to content

Commit

Permalink
revert to disciminated union for AnyComponent
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelcolvin committed Dec 13, 2023
1 parent bbb5d61 commit 2d34524
Showing 1 changed file with 29 additions and 26 deletions.
55 changes: 29 additions & 26 deletions src/python-fastui/fastui/components/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,30 +231,33 @@ class Custom(_p.BaseModel, extra='forbid'):
type: _t.Literal['Custom'] = 'Custom'


AnyComponent = _t.Union[
Text,
Paragraph,
PageTitle,
Div,
Page,
Heading,
Markdown,
Code,
Json,
Button,
Link,
LinkList,
Navbar,
Modal,
ServerLoad,
Image,
Iframe,
Custom,
Table,
Pagination,
Display,
Details,
Form,
FormField,
ModelForm,
AnyComponent = _te.Annotated[
_t.Union[
Text,
Paragraph,
PageTitle,
Div,
Page,
Heading,
Markdown,
Code,
Json,
Button,
Link,
LinkList,
Navbar,
Modal,
ServerLoad,
Image,
Iframe,
Custom,
Table,
Pagination,
Display,
Details,
Form,
FormField,
ModelForm,
],
_p.Field(discriminator='type'),
]

0 comments on commit 2d34524

Please sign in to comment.