Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

guess_type: if the type is optional, treat it like it's "not None" #3839

Merged
merged 2 commits into from
Aug 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion reflex/ivars/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,11 @@ def to(
from .object import ObjectVar, ToObjectOperation
from .sequence import ArrayVar, StringVar, ToArrayOperation, ToStringOperation

fixed_type = get_origin(var_type) or var_type
base_type = var_type
if types.is_optional(base_type):
base_type = types.get_args(base_type)[0]

fixed_type = get_origin(base_type) or base_type

fixed_output_type = get_origin(output) or output

Expand Down
Loading