Skip to content

Commit f3a14f9

Browse files
committed
Make NumberType import backwards-compatible in generated components
1 parent 98ea9ee commit f3a14f9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

dash/development/_py_components_generation.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,12 @@
2424
import typing # noqa: F401
2525
from typing_extensions import TypedDict, NotRequired, Literal # noqa: F401
2626
from dash.development.base_component import Component, _explicitize_args
27-
from dash.types import NumberType # noqa: F401
27+
try:
28+
from dash.types import NumberType # noqa: F401
29+
except ImportError:
30+
NumberType = typing.Union[ # noqa: F401
31+
typing.SupportsFloat, typing.SupportsInt, typing.SupportsComplex
32+
]
2833
{custom_imports}
2934
ComponentSingleType = typing.Union[str, int, float, Component, None]
3035
ComponentType = typing.Union[

0 commit comments

Comments
 (0)