From 3736844b3062e9a23616d1f9f1f08841902cf273 Mon Sep 17 00:00:00 2001 From: Khaleel Al-Adhami Date: Wed, 16 Oct 2024 17:11:52 -0700 Subject: [PATCH] for some reason type hints aren't being interpreted --- reflex/config.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/reflex/config.py b/reflex/config.py index 4e202419a..3fc03ea01 100644 --- a/reflex/config.py +++ b/reflex/config.py @@ -10,6 +10,8 @@ import urllib.parse from pathlib import Path from typing import Any, Dict, List, Optional, Set, Union +from typing_extensions import get_type_hints + from reflex.utils.exceptions import ConfigError from reflex.utils.types import value_inside_optional @@ -253,6 +255,8 @@ class EnvironmentVariables: def __init__(self): """Initialize the environment variables.""" + type_hints = get_type_hints(type(self)) + for field in dataclasses.fields(self): raw_value = os.getenv(field.name, None) @@ -262,6 +266,8 @@ class EnvironmentVariables: else get_default_value_for_field(field) ) + field.type = type_hints[field.name] or field.type + setattr(self, field.name, value)