Skip to content

provide types in __init__ signatures #554

Description

@notatallshaw

Because the children argument of a component can take a single element or a list, e.g.
html.Div(html.Div())
html.Div([html.Div(), html.Div()])

I can easily make the mistake of not putting the children in a list, e.g.:
html.Div(html.Div(), html.Div())

In this case I do not get any kind of error, and instead the 2nd Div is stringified and becomes part of the id for the parent component.

In very large applications this is easy to lose. If type information was provided then IDEs like Pycharm would highlight this issue and tools like MyPy would warn before the code was ever run.

Metadata

Metadata

Assignees

Labels

P3backlogfeaturesomething new

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions