Repository: plotly/dash

Issue:
[BUG] Large nr of myp errors when upgrading Dash 3.0.2 to Dash 3.0.3
We are maintaining a decent sized Dash application. We had a relatively smooth 2.18.2 -> 3.0.0 upgrade. But when upgrading from 3.0.2 to 3.0.3 we encountered a very large (~250) number of mypy issues. I could not detect anything in the release notes that would indicate a change in (mypy) typing. 

``` powershell
(venv) PS C:\Users\Python\dash-site> poetry show | Select-string "dash"

dash                        3.0.2           A Python framework for building...
dash-bootstrap-components   2.0.1           Bootstrap themed components for...


(venv) PS C:\Users\Python\dash-site> mypy
Success: no issues found in 86 source files
(venv) PS C:\Users\Python\dash-site> poetry update
Updating dependencies
Resolving dependencies... (52.5s)

Package operations: 0 installs, 2 updates, 0 removals

  - Updating narwhals (1.34.1 -> 1.35.0)
  - Updating dash (3.0.2 -> 3.0.3)

Writing lock file
(venv) PS C:\Users\Python\dash-site> poetry show | Select-string "dash"

dash                        3.0.3           A Python framework for building...
dash-bootstrap-components   2.0.1           Bootstrap themed components for...


(venv) PS C:\Users\Python\dash-site> mypy
dash\dashboards\utils\design.py:99: error: Argument "options" to "RadioItems" has incompatible type "list[dict[str, str]]"; expected "Sequence[str | SupportsFloat | SupportsInt | SupportsComplex | bool] | dict[Any, Any] | Sequence[Options[Any]] | None"  [arg-type]
dash\dashboards\utils\design.py:261: error: Incompatible return value type (got "Div", expected "RangeSlider")  [return-value]
dash\dashboards\utils\design.py:264: error: List item 1 has incompatible type "RangeSlider"; expected "str | int | float"  [list-item]
dash\dashboards\base.py:433: error: List item 0 has incompatible type "H2"; expected "str | int | float"  [list-item]
dash\dashboards\base.py:436: error: List item 1 has incompatible type "Pre"; expected "str | int | float"  [list-item]
dash\dashboards\base.py:438: error: List item 3 has incompatible type "Div | Br"; expected "str | int | float"  [list-item]
dash\dashboards\base.py:439: error: List item 4 has incompatible type "Div"; expected "str | int | float"  [list-item]
dash\wrap_dash.py:60: error: "__init__" of "Graph" gets multiple values for keyword argument "config"  [misc]
dash\wrap_dash.py:90: error: Argument 1 to "append" of "list" has incompatible type "Ul"; expected "Link"  [arg-type]
dash\wrap_dash.py:92: error: Argument 1 to "append" of "list" has incompatible type "list[Any] | Div"; expected "Link"  [arg-type]
dash\wrap_dash.py:195: error: Argument 5 to "Div" has incompatible type "**dict[str, str]"; expected "SupportsFloat | SupportsInt | SupportsComplex | None"  [arg-type]
dash\wrap_dash.py:195: error: Argument 5 to "Div" has incompatible type "**dict[str, str]"; expected "bool | None"  [arg-type]
dash\wrap_dash.py:195: error: Argument 5 to "Div" has incompatible type "**dict[str, str]"; expected "Literal['hidden', 'HIDDEN'] | bool | None"  [arg-type]
dash\wrap_dash.py:209: error: Argument 2 to "Nav" has incompatible type "**dict[str, str]"; expected "SupportsFloat | SupportsInt | SupportsComplex | None"  [arg-type]
dash\wrap_dash.py:209: error: Argument 2 to "Nav" has incompatible type "**dict[str, str]"; expected "bool | None"  [arg-type]
dash\wrap_dash.py:209: error: Argument 2 to "Nav" has incompatible type "**dict[str, str]"; expected "Literal['hidden', 'HIDDEN'] | bool | None"  [arg-type]
dash\wrap_dash.py:224: error: Argument 4 to "Div" has incompatible type "**dict[str, str]"; expected "SupportsFloat | SupportsInt | SupportsComplex | None"  [arg-type]
dash\wrap_dash.py:224: error: Argument 4 to "Div" has incompatible type "**dict[str, str]"; expected "bool | None"  [arg-type]
dash\wrap_dash.py:224: error: Argument 4 to "Div" has incompatible type "**dict[str, str]"; expected "Literal['hidden', 'HIDDEN'] | bool | None"  [arg-type]
dash\wrap_dash.py:290: error: List item 1 has incompatible type "A"; expected "str | int | float"  [list-item]
dash\dash_app.py:336: error: List item 1 has incompatible type "Img"; expected "str | int | float"  [list-item]
dash\dash_app.py:432: error: List item 1 has incompatible type "Div"; expected "str | int | float"  [list-item]
dash\dash_app.py:444: error: Argument 4 to "Div" has incompatible type "**dict[str, str]"; expected "SupportsFloat | SupportsInt | SupportsComplex | None"  [arg-type]
dash\dash_app.py:444: error: Argument 4 to "Div" has incompatible type "**dict[str, str]"; expected "bool | None"  [arg-type]
dash\dash_app.py:444: error: Argument 4 to "Div" has incompatible type "**dict[str, str]"; expected "Literal['hidden', 'HIDDEN'] | bool | None"  [arg-type]
dash\dash_app.py:450: error: Argument 4 to "Div" has incompatible type "**dict[str, str]"; expected "SupportsFloat | SupportsInt | SupportsComplex | None"  [arg-type]
dash\dash_app.py:450: error: Argument 4 to "Div" has incompatible type "**dict[str, str]"; expected "bool | None"  [arg-type]
dash\dash_app.py:450: error: Argument 4 to "Div" has incompatible type "**dict[str, str]"; expected "Literal['hidden', 'HIDDEN'] | bool | None"  [arg-type]
dash\dashboards\data_tasks.py:125: error: Argument 2 to "Td" has incompatible type "**dict[str, str]"; expected "SupportsFloat | SupportsInt | SupportsComplex | None"  [arg-type]
dash\dashboards\data_tasks.py:125: error: Argument 2 to "Td" has incompatible type "**dict[str, str]"; expected "bool | None"  [arg-type]
dash\dashboards\data_tasks.py:125: error: Argument 2 to "Td" has incompatible type "**dict[str, str]"; expected "Literal['hidden', 'HIDDEN'] | bool | None"  [arg-type]
dash\dashboards\data_status.py:121: error: Argument "className" to "Div" has incompatible type "int | str"; expected "str | None"  [arg-type]
dash\dashboards\data_status.py:123: error: Argument "title" to "Div" has incompatible type "int | str"; expected "str | None"  [arg-type]
dash\dashboards\data_castcast.py:20: error: Module has no attribute "DataTable"  [attr-defined]
dash\dashboards\data_download.py:40: error: Argument "options" to "Dropdown" has incompatible type "list[dict[str, str]]"; expected "Sequence[str | SupportsFloat | SupportsInt | SupportsComplex | bool] | dict[Any, Any] | Sequence[Options[Any]] | None"  [arg-type]
dash\dashboards\data_download.py:97: error: Argument "start_date" to "DatePickerRange" has incompatible type "date"; expected "str | datetime | None"  [arg-type]
dash\dashboards\data_download.py:98: error: Argument "end_date" to "DatePickerRange" has incompatible type "date"; expected "str | datetime | None"  [arg-type]
dash\dashboards\tension.py:33: error: Incompatible types in assignment (expression has type "Div", base class "TitleMixin" defined the type as "H2")  [assignment]
dash\dashboards\tension.py:35: error: List item 0 has incompatible type "H2"; expected "str | int | float"  [list-item]
dash\dashboards\tension.py:49: error: List item 2 has incompatible type "Interval"; expected "str | int | float"  [list-item]
dash\dashboards\ocean.py:376: error: Incompatible types in assignment (expression has type "Div", base class "TitleMixin" defined the type as "H2")  [assignment]
dash\dashboards\ocean.py:423: error: Incompatible types in assignment (expression has type "Div", base class "TitleMixin" defined the type as "H2")  [assignment]
dash\dashboards\ocean.py:497: error: Incompatible types in assignment (expression has type "Div", base class "TitleMixin" defined the type as "H2")  [assignment]
dash\dashboards\h.py:136: error: Incompatible types in assignment (expression has type "Div", base class "TitleMixin" defined the type as "H2")  [assignment]
dash\dashboards\h.py:138: error: List item 0 has incompatible type "H2"; expected "str | int | float"  [list-item]
dash\dashboards\h.py:160: error: List item 2 has incompatible type "Interval"; expected "str | int | float"  [list-item]
dash\dashboards\h.py:211: error: Incompatible types in assignment (expression has type "Div", base class "TitleMixin" defined the type as "H2")  [assignment]
dash\dashboards\kpi.py:42: error: List item 1 has incompatible type "Interval"; expected "str | int | float"  [list-item]
dash\dashboards\kpi.py:43: error: List item 2 has incompatible type "Interval"; expected "str | int | float"  [list-item]
dash\dashboards\kpi.py:241: error: Argument "className" to "Div" has incompatible type "int | str"; expected "str | None"  [arg-type]
dash\dashboards\kpi.py:243: error: Argument "title" to "Div" has incompatible type "int | str"; expected "str | None"  [arg-type]
dash\dashboards\performance.py:41: error: List item 0 has incompatible type "H2"; expected "str | int | float"  [list-item]
dash\dashboards\performance.py:42: error: List item 1 has incompatible type "Br"; expected "str | int | float"  [list-item]
dash\dashboards\performance.py:43: error: List item 2 has incompatible type "H3"; expected "str | int | float"  [list-item]
dash\dashboards\performance.py:45: error: List item 4 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\performance.py:46: error: List item 5 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\performance.py:47: error: List item 6 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\sr.py:45: error: List item 0 has incompatible type "H2"; expected "str | int | float"  [list-item]
dash\dashboards\sr.py:47: error: List item 2 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\spare_analysis.py:57: error: List item 0 has incompatible type "H2"; expected "str | int | float"  [list-item]
dash\dashboards\spare_analysis.py:58: error: List item 1 has incompatible type "Br"; expected "str | int | float"  [list-item]
dash\dashboards\spare_analysis.py:59: error: List item 2 has incompatible type "H3"; expected "str | int | float"  [list-item]
dash\dashboards\spare_analysis.py:60: error: List item 3 has incompatible type "Div"; expected "str | int | float"  [list-item]
dash\dashboards\spare_analysis.py:61: error: List item 4 has incompatible type "Br"; expected "str | int | float"  [list-item]
dash\dashboards\spare_analysis.py:62: error: List item 5 has incompatible type "H3"; expected "str | int | float"  [list-item]
dash\dashboards\spare_analysis.py:67: error: List item 8 has incompatible type "Div"; expected "str | int | float"  [list-item]
dash\dashboards\spare_analysis.py:68: error: List item 9 has incompatible type "Hr"; expected "str | int | float"  [list-item]
dash\dashboards\spare_analysis.py:69: error: List item 10 has incompatible type "H3"; expected "str | int | float"  [list-item]
dash\dashboards\spare_analysis.py:70: error: List item 11 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\spare_analysis.py:71: error: List item 12 has incompatible type "Hr"; expected "str | int | float"  [list-item]
dash\dashboards\spare_analysis.py:72: error: List item 13 has incompatible type "P"; expected "str | int | float"  [list-item]
dash\dashboards\spare_analysis.py:234: error: Argument 1 to "extend" of "list" has incompatible type "list[Component]"; expected "Iterable[str]"  [arg-type]
dash\dashboards\spare_analysis.py:236: error: Argument 1 to "append" of "list" has incompatible type "B"; expected "str"  [arg-type]
dash\dashboards\sms.py:90: error: List item 0 has incompatible type "H3"; expected "str | int | float"  [list-item]
dash\dashboards\sms.py:94: error: List item 2 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\sms.py:95: error: List item 3 has incompatible type "P"; expected "str | int | float"  [list-item]
dash\dashboards\sms.py:96: error: List item 4 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\sms.py:104: error: List item 0 has incompatible type "H3"; expected "str | int | float"  [list-item]
dash\dashboards\sms.py:108: error: List item 2 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\sms.py:109: error: List item 3 has incompatible type "Br"; expected "str | int | float"  [list-item]
dash\dashboards\sms.py:110: error: List item 4 has incompatible type "H3"; expected "str | int | float"  [list-item]
dash\dashboards\sms.py:111: error: List item 5 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\sms.py:119: error: List item 0 has incompatible type "H3"; expected "str | int | float"  [list-item]
dash\dashboards\sms.py:129: error: List item 2 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\sms.py:130: error: List item 3 has incompatible type "Div"; expected "str | int | float"  [list-item]
dash\dashboards\sms.py:131: error: List item 4 has incompatible type "Download"; expected "str | int | float"  [list-item]
dash\dashboards\sms.py:132: error: List item 5 has incompatible type "H3"; expected "str | int | float"  [list-item]
dash\dashboards\sms.py:141: error: List item 7 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\sms.py:148: error: List item 9 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\sms.py:149: error: List item 10 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\sms.py:150: error: List item 11 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\sms.py:231: error: List item 0 has incompatible type "H2"; expected "str | int | float"  [list-item]
dash\dashboards\sms.py:232: error: List item 1 has incompatible type "Br"; expected "str | int | float"  [list-item]
dash\dashboards\sms.py:233: error: List item 2 has incompatible type "P"; expected "str | int | float"  [list-item]
dash\dashboards\sms.py:237: error: List item 4 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\sms.py:238: error: List item 5 has incompatible type "Br"; expected "str | int | float"  [list-item]
dash\dashboards\sms.py:249: error: List item 8 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\sms.py:250: error: List item 9 has incompatible type "Br"; expected "str | int | float"  [list-item]
dash\dashboards\m.py:72: error: Incompatible types in assignment (expression has type "Div", base class "TitleMixin" defined the type as "H2")  [assignment]
dash\dashboards\m.py:74: error: List item 0 has incompatible type "H2"; expected "str | int | float"  [list-item]
dash\dashboards\m.py:78: error: List item 0 has incompatible type "Loading"; expected "Div"  [list-item]
dash\dashboards\m.py:79: error: List item 1 has incompatible type "Loading"; expected "Div"  [list-item]
dash\dashboards\m.py:306: error: List item 1 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\m.py:685: error: Incompatible types in assignment (expression has type "Graph", variable has type "H4")  [assignment]
dash\dashboards\m.py:970: error: List item 0 has incompatible type "H2"; expected "str | int | float"  [list-item]
dash\dashboards\m.py:972: error: List item 2 has incompatible type "P"; expected "str | int | float"  [list-item]
dash\dashboards\m.py:973: error: List item 3 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\loss.py:313: error: List item 0 has incompatible type "H2"; expected "str | int | float"  [list-item]
dash\dashboards\loss.py:314: error: List item 1 has incompatible type "Br"; expected "str | int | float"  [list-item]
dash\dashboards\loss.py:315: error: List item 2 has incompatible type "H2"; expected "str | int | float"  [list-item]
dash\dashboards\loss.py:318: error: List item 0 has incompatible type "Loading"; expected "Div"  [list-item]
dash\dashboards\loss.py:319: error: List item 1 has incompatible type "Loading"; expected "Div"  [list-item]
dash\dashboards\loss.py:322: error: List item 4 has incompatible type "RangeSlider"; expected "str | int | float"  [list-item]
dash\dashboards\loss.py:329: error: List item 5 has incompatible type "Br"; expected "str | int | float"  [list-item]
dash\dashboards\loss.py:330: error: List item 6 has incompatible type "H2"; expected "str | int | float"  [list-item]
dash\dashboards\loss.py:331: error: List item 7 has incompatible type "Div"; expected "str | int | float"  [list-item]
dash\dashboards\loss.py:332: error: List item 8 has incompatible type "P"; expected "str | int | float"  [list-item]
dash\dashboards\loss.py:333: error: List item 9 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\loss.py:339: error: List item 0 has incompatible type "Loading"; expected "Div"  [list-item]
dash\dashboards\loss.py:340: error: List item 1 has incompatible type "Loading"; expected "Div"  [list-item]
dash\dashboards\loss.py:343: error: List item 12 has incompatible type "H2"; expected "str | int | float"  [list-item]
dash\dashboards\loss.py:347: error: List item 14 has incompatible type "Div"; expected "str | int | float"  [list-item]
dash\dashboards\loss.py:348: error: List item 15 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\m_t.py:74: error: List item 0 has incompatible type "H2"; expected "str | int | float"  [list-item]
dash\dashboards\m_t.py:76: error: List item 2 has incompatible type "Br"; expected "str | int | float"  [list-item]
dash\dashboards\m_t.py:98: error: List item 4 has incompatible type "Br"; expected "str | int | float"  [list-item]
dash\dashboards\m_t.py:100: error: List item 6 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\hindcast_fatigue.py:39: error: Incompatible types in assignment (expression has type "Div", base class "TitleMixin" defined the type as "H2")  [assignment]
dash\dashboards\hindcast_fatigue.py:41: error: List item 0 has incompatible type "H2"; expected "str | int | float"  [list-item]
dash\dashboards\hindcast_fatigue.py:42: error: List item 1 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\hindcast_fatigue.py:43: error: List item 2 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\hindcast_fatigue.py:50: error: List item 4 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\hindcast_fatigue.py:53: error: List item 5 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\fl_demo.py:68: error: List item 1 has incompatible type "H2"; expected "str | int | float"  [list-item]
dash\dashboards\fl_demo.py:69: error: List item 2 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\fl_demo.py:70: error: List item 3 has incompatible type "H2"; expected "str | int | float"  [list-item]
dash\dashboards\fl_demo.py:71: error: List item 4 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\fl_demo.py:72: error: List item 5 has incompatible type "H2"; expected "str | int | float"  [list-item]
dash\dashboards\fl_demo.py:73: error: List item 6 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\fl_demo.py:74: error: List item 7 has incompatible type "H2"; expected "str | int | float"  [list-item]
dash\dashboards\fl_demo.py:75: error: List item 8 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\fl.py:69: error: List item 0 has incompatible type "H2"; expected "str | int | float"  [list-item]
dash\dashboards\fl.py:72: error: List item 3 has incompatible type "Br"; expected "str | int | float"  [list-item]
dash\dashboards\fl.py:74: error: List item 5 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\fl.py:75: error: List item 6 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\fl.py:244: error: List item 0 has incompatible type "H2"; expected "str | int | float"  [list-item]
dash\dashboards\fl.py:245: error: List item 1 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\fl.py:246: error: List item 2 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\fl.py:248: error: List item 4 has incompatible type "H2"; expected "str | int | float"  [list-item]
dash\dashboards\fl.py:249: error: List item 5 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\fl.py:250: error: List item 6 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\fl.py:251: error: List item 7 has incompatible type "H2"; expected "str | int | float"  [list-item]
dash\dashboards\fl.py:252: error: List item 8 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\f_r.py:99: error: List item 0 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\f_r.py:101: error: List item 2 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\f_r.py:150: error: List item 0 has incompatible type "H2"; expected "str | int | float"  [list-item]
dash\dashboards\f_r.py:152: error: List item 2 has incompatible type "P"; expected "str | int | float"  [list-item]
dash\dashboards\f_r.py:155: error: List item 3 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\f_r.py:156: error: List item 4 has incompatible type "Br"; expected "str | int | float"  [list-item]
dash\dashboards\f_r.py:362: error: List item 0 has incompatible type "H2"; expected "str | int | float"  [list-item]
dash\dashboards\f_r.py:365: error: List item 3 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\f_r.py:366: error: List item 4 has incompatible type "P"; expected "str | int | float"  [list-item]
dash\dashboards\cad.py:60: error: List item 0 has incompatible type "H2"; expected "str | int | float"  [list-item]
dash\dashboards\cad.py:62: error: List item 2 has incompatible type "P"; expected "str | int | float"  [list-item]
dash\dashboards\cad.py:63: error: List item 3 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\cad.py:64: error: List item 4 has incompatible type "Br"; expected "str | int | float"  [list-item]
dash\dashboards\cad.py:66: error: List item 6 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\cad.py:67: error: List item 7 has incompatible type "Hr"; expected "str | int | float"  [list-item]
dash\dashboards\cad.py:71: error: List item 9 has incompatible type "H3"; expected "str | int | float"  [list-item]
dash\dashboards\cad.py:72: error: List item 10 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\asbuilt_data.py:119: error: List item 1 has incompatible type "Hr"; expected "str | int | float"  [list-item]
dash\dashboards\umb.py:186: error: List item 0 has incompatible type "H2"; expected "str | int | float"  [list-item]
dash\dashboards\umb.py:190: error: List item 2 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\umb.py:193: error: List item 4 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\umb.py:194: error: List item 5 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\umb.py:195: error: List item 6 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\umb.py:196: error: List item 7 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\umb.py:197: error: List item 8 has incompatible type "Store"; expected "str | int | float"  [list-item]
dash\dashboards\umb.py:425: error: List item 1 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\umb.py:492: error: List item 0 has incompatible type "H2"; expected "str | int | float"  [list-item]
dash\dashboards\umb.py:493: error: List item 1 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\umb.py:494: error: List item 2 has incompatible type "H5"; expected "str | int | float"  [list-item]
dash\dashboards\umb.py:495: error: List item 3 has incompatible type "H2"; expected "str | int | float"  [list-item]
dash\dashboards\umb.py:496: error: List item 4 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\umb.py:497: error: List item 5 has incompatible type "H5"; expected "str | int | float"  [list-item]
dash\dashboards\umb.py:498: error: List item 6 has incompatible type "H5"; expected "str | int | float"  [list-item]
dash\dashboards\umb.py:501: error: List item 7 has incompatible type "Br"; expected "str | int | float"  [list-item]
dash\dashboards\umb.py:502: error: List item 8 has incompatible type "H2"; expected "str | int | float"  [list-item]
dash\dashboards\umb.py:504: error: List item 10 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\commissioning.py:53: error: List item 0 has incompatible type "H3"; expected "str | int | float"  [list-item]
dash\dashboards\commissioning.py:54: error: List item 1 has incompatible type "Br"; expected "str | int | float"  [list-item]
dash\dashboards\commissioning.py:58: error: List item 3 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\commissioning.py:66: error: List item 0 has incompatible type "H3"; expected "str | int | float"  [list-item]
dash\dashboards\commissioning.py:67: error: List item 1 has incompatible type "Br"; expected "str | int | float"  [list-item]
dash\dashboards\commissioning.py:71: error: List item 3 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\commissioning.py:72: error: List item 4 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\commissioning.py:113: error: List item 0 has incompatible type "H2"; expected "str | int | float"  [list-item]
dash\dashboards\commissioning.py:114: error: List item 1 has incompatible type "H5"; expected "str | int | float"  [list-item]
dash\dashboards\ssc.py:122: error: List item 0 has incompatible type "H2"; expected "str | int | float"  [list-item]
dash\dashboards\ssc.py:126: error: List item 2 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\ssc.py:127: error: List item 3 has incompatible type "H2"; expected "str | int | float"  [list-item]
dash\dashboards\ssc.py:128: error: List item 4 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\ssc.py:129: error: List item 5 has incompatible type "H4"; expected "str | int | float"  [list-item]
dash\dashboards\ssc.py:130: error: List item 6 has incompatible type "H5"; expected "str | int | float"  [list-item]
dash\dashboards\ssc.py:131: error: List item 7 has incompatible type "H5"; expected "str | int | float"  [list-item]
dash\dashboards\ssc.py:214: error: List item 0 has incompatible type "H2"; expected "str | int | float"  [list-item]
dash\dashboards\ssc.py:215: error: List item 1 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\ssc.py:216: error: List item 2 has incompatible type "H2"; expected "str | int | float"  [list-item]
dash\dashboards\ssc.py:219: error: List item 5 has incompatible type "H4"; expected "str | int | float"  [list-item]
dash\dashboards\ssc.py:220: error: List item 6 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\ssc.py:221: error: List item 7 has incompatible type "H4"; expected "str | int | float"  [list-item]
dash\dashboards\ssc.py:222: error: List item 8 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\ssc.py:223: error: List item 9 has incompatible type "H4"; expected "str | int | float"  [list-item]
dash\dashboards\ssc.py:225: error: List item 11 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\ssc.py:312: error: List item 0 has incompatible type "H2"; expected "str | int | float"  [list-item]
dash\dashboards\ssc.py:314: error: List item 2 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\ssc.py:315: error: List item 3 has incompatible type "H2"; expected "str | int | float"  [list-item]
dash\dashboards\ssc.py:317: error: List item 5 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\ssc.py:318: error: List item 6 has incompatible type "H2"; expected "str | int | float"  [list-item]
dash\dashboards\ssc.py:322: error: List item 10 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\ssc.py:323: error: List item 11 has incompatible type "H2"; expected "str | int | float"  [list-item]
dash\dashboards\ssc.py:324: error: List item 12 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\ssc.py:325: error: List item 13 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\ssc.py:326: error: List item 14 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\ssc.py:358: error: Incompatible types in assignment (expression has type "Div", base class "TitleMixin" defined the type as "H2")  [assignment]
dash\dashboards\ssc.py:360: error: List item 0 has incompatible type "H2"; expected "str | int | float"  [list-item]
dash\dashboards\ssc.py:361: error: List item 1 has incompatible type "Div"; expected "str | int | float"  [list-item]
dash\dashboards\ssc.py:367: error: List item 1 has incompatible type "Br"; expected "str | int | float"  [list-item]
dash\dashboards\ssc.py:368: error: List item 2 has incompatible type "Br"; expected "str | int | float"  [list-item]
dash\dashboards\ssc.py:376: error: List item 3 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\ssc.py:377: error: List item 4 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\ssc.py:378: error: List item 5 has incompatible type "Div"; expected "str | int | float"  [list-item]
dash\dashboards\ssc.py:641: error: Incompatible types in assignment (expression has type "Div", base class "TitleMixin" defined the type as "H2")  [assignment]
dash\dashboards\ssc.py:643: error: List item 0 has incompatible type "H2"; expected "str | int | float"  [list-item]
dash\dashboards\ssc.py:644: error: List item 1 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\ssc.py:645: error: List item 2 has incompatible type "H3"; expected "str | int | float"  [list-item]
dash\dashboards\ssc.py:658: error: List item 4 has incompatible type "Div"; expected "str | int | float"  [list-item]
dash\dashboards\ssc.py:659: error: Module has no attribute "DataTable"  [attr-defined]
dash\dashboards\ssc.py:828: error: List item 0 has incompatible type "H1"; expected "str | int | float"  [list-item]
dash\dashboards\ssc.py:831: error: List item 1 has incompatible type "P"; expected "str | int | float"  [list-item]
dash\dashboards\tool.py:113: error: List item 0 has incompatible type "H2"; expected "str | int | float"  [list-item]
dash\dashboards\tool.py:114: error: List item 1 has incompatible type "H3"; expected "str | int | float"  [list-item]
dash\dashboards\tool.py:122: error: List item 0 has incompatible type "Graph"; expected "Div"  [list-item]
dash\dashboards\tool.py:123: error: List item 1 has incompatible type "Graph"; expected "Div"  [list-item]
dash\dashboards\tool.py:126: error: List item 4 has incompatible type "H3"; expected "str | int | float"  [list-item]
dash\dashboards\tool.py:127: error: List item 5 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\tool.py:128: error: List item 6 has incompatible type "H3"; expected "str | int | float"  [list-item]
dash\dashboards\tool.py:129: error: List item 7 has incompatible type "Br"; expected "str | int | float"  [list-item]
dash\dashboards\tool.py:132: error: List item 0 has incompatible type "Loading"; expected "Div"  [list-item]
dash\dashboards\tool.py:133: error: List item 1 has incompatible type "Loading"; expected "Div"  [list-item]
dash\dashboards\tool.py:139: error: List item 10 has incompatible type "Loading"; expected "str | int | float"  [list-item]
dash\dashboards\tool.py:140: error: List item 11 has incompatible type "H3"; expected "str | int | float"  [list-item]
dash\dashboards\tool.py:146: error: List item 13 has incompatible type "Loading"; expected "str | int | float"  [list-item]
Found 253 errors in 29 files (checked 86 source files)
(venv) PS C:\Users\Python\dash-site>
```

Hints from issue comments:
@T4rk1n: The typing were not resolved by mypy before because of a decorator on the `__init__` that mypy can't handle. Sorry forgot the changelog for that fix, all the components before would resolve to `Any` instead of their class.

Some of these look like legitimate typing issues. I'd like to see if possible the type or component and prop name given to some of these errors.

The first one is suspicious, but `dict[str,str]` should resolve to a TypedDict of `RadioItems.Options`.
`dash\dashboards\utils\design.py:99: error: Argument "options" to "RadioItems" has incompatible type "list[dict[str, str]]"; expected "Sequence[str | SupportsFloat | SupportsInt | SupportsComplex | bool] | dict[Any, Any] | Sequence[Options[Any]] | None"  [arg-type]`

There is a bunch of those with `str | int | float`, but that type is not generated, if it's given to children it should have `ComponentType` in the union.
`dash\dashboards\base.py:433: error: List item 0 has incompatible type "H2"; expected "str | int | float"  [list-item]`

This one seems like  mypy auto resolving the list to the items in the initializer. Can manually type it to something like `list[Component]`:
`dash\wrap_dash.py:90: error: Argument 1 to "append" of "list" has incompatible type "Ul"; expected "Link"  [arg-type]`

Can we see a snippet for this:
`dash\dash_app.py:444: error: Argument 4 to "Div" has incompatible type "**dict[str, str]"; expected "SupportsFloat | SupportsInt | SupportsComplex | None"  [arg-type]`


@admoore0: I am seeing the same issue. I've reproduced a minimal example below:

```
from dash import Dash, html

app = Dash()

app.layout = html.Div([
    "Test",
    html.H1("This will fail"),
])
```

Running mypy on this file with dash 3.0.3 installed will give the following error:

```
app.py:7: error: List item 1 has incompatible type "H1"; expected "str | int | float"  [list-item]
Found 1 error in 1 file (checked 1 source file)
```

The order of the str and the H1 doesn't seem to matter, but replacing the str with another H1 does not give an error.

EDIT: I can also confirm that running mypy on the same file with dash 3.0.2 installed does not generate any errors.@T4rk1n: `mypy` doesn't seem to like the `ComponentType` when it's used with other types, I seem to remember introducing that because typing with Component didn't work. But I think it was because of the decorator on the `__init__`, seems to work with the intended behavior with `Component` now.@gvwilson: @ghaarsma please re-try and let us know - thanks.@T4rk1n: > please re-try and let us know - thanks.

No, it's still a work in progress, there is also a related critical bug with the generation that remove backward compatibility with previous version.@ghaarsma: @T4rk1n , Thank you for all your prompt work on this. I will be testing this shortly after it has been released.@ghaarsma: I did do a quick test on the new Dash 3.0.4 released (hot off the press). It significantly reduced the amount of mypy errors from ~250 in Dash 3.0.3 to about ~40 for Dash 3.0.4. I did do a quick scan and it looks like the remainder of the mypy errors are self inflicted and I will attempt to clean them up in the next few weeks.

Once again, thanks @T4rk1n for all your work 

Solution patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c695e8e93..a4d5a172f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
 - [#3278](https://github.com/plotly/dash/pull/3278) Fix loading selector with children starting at the same digit. Fix [#3276](https://github.com/plotly/dash/issues/3276)
 - [#3280](https://github.com/plotly/dash/pull/3280) Remove flask typing import not available in earlier versions.
 - [#3284](https://github.com/plotly/dash/pull/3284) Fix component as props having the same key when used in the same container.
+- [#3287](https://github.com/plotly/dash/pull/3287) Fix typing component generation & explicitize_args.
 
 ## [3.0.3] - 2025-04-14
 
diff --git a/dash/development/_py_components_generation.py b/dash/development/_py_components_generation.py
index 87aab47c5..7b23066fa 100644
--- a/dash/development/_py_components_generation.py
+++ b/dash/development/_py_components_generation.py
@@ -22,13 +22,21 @@ from .base_component import Component, ComponentType
 import_string = """# AUTO GENERATED FILE - DO NOT EDIT
 
 import typing  # noqa: F401
-import numbers # noqa: F401
 from typing_extensions import TypedDict, NotRequired, Literal # noqa: F401
-from dash.development.base_component import Component
-try:
-    from dash.development.base_component import ComponentType # noqa: F401
-except ImportError:
-    ComponentType = typing.TypeVar("ComponentType", bound=Component)
+from dash.development.base_component import Component, _explicitize_args
+{custom_imports}
+ComponentType = typing.Union[
+    str,
+    int,
+    float,
+    Component,
+    None,
+    typing.Sequence[typing.Union[str, int, float, Component, None]],
+]
+
+NumberType = typing.Union[
+    typing.SupportsFloat, typing.SupportsInt, typing.SupportsComplex
+]
 
 
 """
@@ -80,7 +88,6 @@ def generate_class_string(
     _namespace = '{namespace}'
     _type = '{typename}'
 {shapes}
-    _explicitize_dash_init = True
 
     def __init__(
         self,
@@ -98,6 +105,8 @@ def generate_class_string(
         args = {args}
         {required_validation}
         super({typename}, self).__init__({argtext})
+
+setattr({typename}, "__init__", _explicitize_args({typename}.__init__))
 '''
 
     filtered_props = (
@@ -239,7 +248,6 @@ def generate_class_file(
     Returns
     -------
     """
-    imports = import_string
 
     class_string = generate_class_string(
         typename,
@@ -255,8 +263,11 @@ def generate_class_file(
     custom_imp = custom_imp.get(typename) or custom_imp.get("*")
 
     if custom_imp:
-        imports += "\n".join(custom_imp)
-        imports += "\n\n"
+        imports = import_string.format(
+            custom_imports="\n" + "\n".join(custom_imp) + "\n\n"
+        )
+    else:
+        imports = import_string.format(custom_imports="")
 
     file_name = f"{typename:s}.py"
 
@@ -321,6 +332,9 @@ def generate_class(
         "TypedDict": TypedDict,
         "NotRequired": NotRequired,
         "Literal": Literal,
+        "NumberType": typing.Union[
+            typing.SupportsFloat, typing.SupportsComplex, typing.SupportsInt
+        ],
     }
     # pylint: disable=exec-used
     exec(string, scope)
diff --git a/dash/development/_py_prop_typing.py b/dash/development/_py_prop_typing.py
index 5b9c0f264..96b2053a1 100644
--- a/dash/development/_py_prop_typing.py
+++ b/dash/development/_py_prop_typing.py
@@ -183,16 +183,10 @@ PROP_TYPING = {
     "exact": generate_shape,
     "string": generate_type("str"),
     "bool": generate_type("bool"),
-    "number": generate_type(
-        "typing.Union[typing.SupportsFloat, typing.SupportsInt, typing.SupportsComplex]"
-    ),
-    "node": generate_type(
-        "typing.Union[str, int, float, ComponentType,"
-        " typing.Sequence[typing.Union"
-        "[str, int, float, ComponentType]]]"
-    ),
+    "number": generate_type("NumberType"),
+    "node": generate_type("ComponentType"),
     "func": generate_any,
-    "element": generate_type("ComponentType"),
+    "element": generate_type("Component"),
     "union": generate_union,
     "any": generate_any,
     "custom": generate_any,
diff --git a/dash/development/base_component.py b/dash/development/base_component.py
index a54a0a9f4..975acfd53 100644
--- a/dash/development/base_component.py
+++ b/dash/development/base_component.py
@@ -57,6 +57,9 @@ class ComponentMeta(abc.ABCMeta):
             # We only want to patch the new generated component without
             # the `@_explicitize_args` decorator for mypy support
             # See issue: https://github.com/plotly/dash/issues/3226
+            # Only for component that were generated by 3.0.3
+            # Better to setattr on the component afterwards to ensure
+            # backward compatibility.
             attributes["__init__"] = _explicitize_args(attributes["__init__"])
 
         _component = abc.ABCMeta.__new__(mcs, name, bases, attributes)
@@ -441,7 +444,15 @@ class Component(metaclass=ComponentMeta):
             warnings.warn(DeprecationWarning(textwrap.dedent(deprecation_message)))
 
 
-ComponentType = typing.TypeVar("ComponentType", bound=Component)
+# Renderable node type.
+ComponentType = typing.Union[
+    str,
+    int,
+    float,
+    Component,
+    None,
+    typing.Sequence[typing.Union[str, int, float, Component, None]],
+]
 
 ComponentTemplate = typing.TypeVar("ComponentTemplate")
 
diff --git a/requirements/ci.txt b/requirements/ci.txt
index 96495aa4f..a2d56c0a8 100644
--- a/requirements/ci.txt
+++ b/requirements/ci.txt
@@ -19,3 +19,4 @@ xlrd>=2.0.1
 pytest-rerunfailures
 jupyterlab<4.0.0
 pyright==1.1.398;python_version>="3.7"
+mypy==1.15.0;python_version>="3.12"


Test patch:
diff --git a/tests/integration/test_typing.py b/tests/integration/test_typing.py
index d2894d75c..58c81ab5c 100644
--- a/tests/integration/test_typing.py
+++ b/tests/integration/test_typing.py
@@ -11,11 +11,55 @@ from dash_generator_test_component_typescript.TypeScriptComponent import TypeScr
 t = TypeScriptComponent({0})
 """
 
+basic_app_template = """
+from dash import Dash, html, dcc, callback, Input, Output
 
-def run_pyright(codefile: str):
+app = Dash()
+
+{0}
+app.layout = {1}
+
+@callback(Output("out", "children"), Input("btn", "n_clicks"))
+def on_click() -> html.Div:
+    return {2}
+"""
+
+valid_layout = """html.Div([
+    html.H2('Valid'),
+    'String in middle',
+    123,
+    404.4,
+    dcc.Input(value='', id='in')
+])
+"""
+valid_layout_list = """[
+    html.H2('Valid'),
+    'String in middle',
+    123,
+    404.4,
+    dcc.Input(value='', id='in')
+]
+"""
+valid_layout_function = """
+def layout() -> html.Div:
+    return html.Div(["hello layout"])
+
+"""
+
+invalid_layout = """html.Div([
+    {"invalid": "dictionary in children"}
+])
+"""
+# There is not invalid layout for function & list as explicitly typed as Any to avoid special cases.
+
+valid_callback = "html.Div('Valid')"
+invalid_callback = "[]"
+
+
+def run_module(codefile: str, module: str, extra: str = ""):
 
     cmd = shlex.split(
-        f"pyright {codefile}",
+        f"{sys.executable} -m {module} {codefile}{extra}",
         posix=sys.platform != "win32",
         comments=True,
     )
@@ -32,17 +76,51 @@ def run_pyright(codefile: str):
     return out.decode(), err.decode(), proc.poll()
 
 
-def assert_pyright_output(
-    codefile: str, expected_outputs=tuple(), expected_errors=tuple(), expected_status=0
+def assert_output(
+    codefile: str,
+    code: str,
+    expected_outputs=tuple(),
+    expected_errors=tuple(),
+    expected_status=0,
+    module="pyright",
 ):
-    output, error, status = run_pyright(codefile)
+    output, error, status = run_module(codefile, module)
     assert (
         status == expected_status
-    ), f"Status: {status}\nOutput: {output}\nError: {error}"
+    ), f"Status: {status}\nOutput: {output}\nError: {error}\nCode: {code}"
     for ex_out in expected_outputs:
-        assert ex_out in output, f"Invalid output:\n {output}"
-    for ex_err in expected_errors:
-        assert ex_err in error
+        assert ex_out in output, f"Invalid output:\n {output}\n\nCode: {code}"
+
+
+def format_template_and_save(template, filename, *args):
+    formatted = template.format(*args)
+    with open(filename, "w") as f:
+        f.write(formatted)
+    return formatted
+
+
+def expect(status=None, outputs=None, modular=False):
+    data = {}
+    if status is not None:
+        data["expected_status"] = status
+    if outputs is not None:
+        data["expected_outputs"] = outputs
+    if modular:
+        # The expectations are per module.
+        data["modular"] = modular
+    return data
+
+
+@pytest.fixture()
+def change_dir():
+    original_dir = os.getcwd()
+
+    def change(dirname):
+        os.chdir(dirname)
+
+    yield change
+
+    os.chdir(original_dir)
 
 
 @pytest.mark.parametrize(
@@ -205,7 +283,7 @@ def assert_pyright_output(
                 "expected_status": 1,
                 "expected_outputs": [
                     'Argument of type "tuple[Literal[1], Literal[2]]" cannot be assigned '
-                    'to parameter "a_tuple" of type "Tuple[SupportsFloat | SupportsInt | SupportsComplex, str] | None'
+                    'to parameter "a_tuple" of type "Tuple[NumberType, str] | None'
                 ],
             },
         ),
@@ -247,9 +325,35 @@ def assert_pyright_output(
         ),
     ],
 )
-def test_component_typing(arguments, assertions, tmp_path):
+def test_typi001_component_typing(arguments, assertions, tmp_path):
     codefile = os.path.join(tmp_path, "code.py")
-    with open(codefile, "w") as f:
-        f.write(component_template.format(arguments))
+    code = format_template_and_save(component_template, codefile, arguments)
+    assert_output(codefile, code, module="pyright", **assertions)
+
+
+typing_modules = ["pyright"]
+
+if sys.version_info.minor >= 10:
+    typing_modules.append("mypy")
 
-    assert_pyright_output(codefile, **assertions)
+
+@pytest.mark.parametrize("typing_module", typing_modules)
+@pytest.mark.parametrize(
+    "prelayout, layout, callback_return, assertions",
+    [
+        ("", valid_layout, valid_callback, expect(status=0)),
+        ("", valid_layout_list, valid_callback, expect(status=0)),
+        (valid_layout_function, "layout", valid_callback, expect(status=0)),
+        ("", valid_layout, invalid_callback, expect(status=1)),
+        ("", invalid_layout, valid_callback, expect(status=1)),
+    ],
+)
+def test_typi002_typing_compliance(
+    typing_module, prelayout, layout, callback_return, assertions, tmp_path, change_dir
+):
+    codefile = os.path.join(tmp_path, "code.py")
+    os.chdir(tmp_path)
+    code = format_template_and_save(
+        basic_app_template, codefile, prelayout, layout, callback_return
+    )
+    assert_output(codefile, code, module=typing_module, **assertions)
diff --git a/tests/unit/development/metadata_test.py b/tests/unit/development/metadata_test.py
index 439ba0f3c..0ee96efde 100644
--- a/tests/unit/development/metadata_test.py
+++ b/tests/unit/development/metadata_test.py
@@ -1,13 +1,21 @@
 # AUTO GENERATED FILE - DO NOT EDIT
 
 import typing  # noqa: F401
-import numbers # noqa: F401
 from typing_extensions import TypedDict, NotRequired, Literal # noqa: F401
-from dash.development.base_component import Component
-try:
-    from dash.development.base_component import ComponentType # noqa: F401
-except ImportError:
-    ComponentType = typing.TypeVar("ComponentType", bound=Component)
+from dash.development.base_component import Component, _explicitize_args
+
+ComponentType = typing.Union[
+    str,
+    int,
+    float,
+    Component,
+    None,
+    typing.Sequence[typing.Union[str, int, float, Component, None]],
+]
+
+NumberType = typing.Union[
+    typing.SupportsFloat, typing.SupportsInt, typing.SupportsComplex
+]
 
 
 class Table(Component):
@@ -109,7 +117,7 @@ Keyword arguments:
         "OptionalObjectWithExactAndNestedDescription",
             {
             "color": NotRequired[str],
-            "fontSize": NotRequired[typing.Union[typing.SupportsFloat, typing.SupportsInt, typing.SupportsComplex]],
+            "fontSize": NotRequired[NumberType],
             "figure": NotRequired["OptionalObjectWithExactAndNestedDescriptionFigure"]
         }
     )
@@ -126,30 +134,29 @@ Keyword arguments:
         "OptionalObjectWithShapeAndNestedDescription",
             {
             "color": NotRequired[str],
-            "fontSize": NotRequired[typing.Union[typing.SupportsFloat, typing.SupportsInt, typing.SupportsComplex]],
+            "fontSize": NotRequired[NumberType],
             "figure": NotRequired["OptionalObjectWithShapeAndNestedDescriptionFigure"]
         }
     )
 
-    _explicitize_dash_init = True
 
     def __init__(
         self,
-        children: typing.Optional[typing.Union[str, int, float, ComponentType, typing.Sequence[typing.Union[str, int, float, ComponentType]]]] = None,
+        children: typing.Optional[ComponentType] = None,
         optionalArray: typing.Optional[typing.Sequence] = None,
         optionalBool: typing.Optional[bool] = None,
         optionalFunc: typing.Optional[typing.Any] = None,
-        optionalNumber: typing.Optional[typing.Union[typing.SupportsFloat, typing.SupportsInt, typing.SupportsComplex]] = None,
+        optionalNumber: typing.Optional[NumberType] = None,
         optionalObject: typing.Optional[dict] = None,
         optionalString: typing.Optional[str] = None,
         optionalSymbol: typing.Optional[typing.Any] = None,
-        optionalNode: typing.Optional[typing.Union[str, int, float, ComponentType, typing.Sequence[typing.Union[str, int, float, ComponentType]]]] = None,
-        optionalElement: typing.Optional[ComponentType] = None,
+        optionalNode: typing.Optional[ComponentType] = None,
+        optionalElement: typing.Optional[Component] = None,
         optionalMessage: typing.Optional[typing.Any] = None,
         optionalEnum: typing.Optional[Literal["News", "Photos"]] = None,
-        optionalUnion: typing.Optional[typing.Union[str, typing.Union[typing.SupportsFloat, typing.SupportsInt, typing.SupportsComplex], typing.Any]] = None,
-        optionalArrayOf: typing.Optional[typing.Sequence[typing.Union[typing.SupportsFloat, typing.SupportsInt, typing.SupportsComplex]]] = None,
-        optionalObjectOf: typing.Optional[typing.Dict[typing.Union[str, float, int], typing.Union[typing.SupportsFloat, typing.SupportsInt, typing.SupportsComplex]]] = None,
+        optionalUnion: typing.Optional[typing.Union[str, NumberType, typing.Any]] = None,
+        optionalArrayOf: typing.Optional[typing.Sequence[NumberType]] = None,
+        optionalObjectOf: typing.Optional[typing.Dict[typing.Union[str, float, int], NumberType]] = None,
         optionalObjectWithExactAndNestedDescription: typing.Optional["OptionalObjectWithExactAndNestedDescription"] = None,
         optionalObjectWithShapeAndNestedDescription: typing.Optional["OptionalObjectWithShapeAndNestedDescription"] = None,
         optionalAny: typing.Optional[typing.Any] = None,
@@ -168,3 +175,5 @@ Keyword arguments:
         args = {k: _locals[k] for k in _explicit_args if k != 'children'}
 
         super(Table, self).__init__(children=children, **args)
+
+setattr(Table, "__init__", _explicitize_args(Table.__init__))
diff --git a/tests/unit/development/test_generate_class_file.py b/tests/unit/development/test_generate_class_file.py
index f79121bf0..7269670c9 100644
--- a/tests/unit/development/test_generate_class_file.py
+++ b/tests/unit/development/test_generate_class_file.py
@@ -33,7 +33,7 @@ def expected_class_string():
 
 @pytest.fixture
 def component_class_string(make_component_dir):
-    return import_string + generate_class_string(
+    return import_string.format(custom_imports="") + generate_class_string(
         typename="Table",
         props=make_component_dir["props"],
         description=make_component_dir["description"],