From d5977ffce42553bf1b6bc89c429d9132b0db5720 Mon Sep 17 00:00:00 2001 From: Masen Furer Date: Mon, 1 May 2023 16:47:33 -0700 Subject: [PATCH] Use typing.get_type_hints instead of __annotations__ (#919) --- pynecone/var.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pynecone/var.py b/pynecone/var.py index 5de4c783d..ceafc15fc 100644 --- a/pynecone/var.py +++ b/pynecone/var.py @@ -15,6 +15,7 @@ from typing import ( Type, Union, _GenericAlias, # type: ignore + get_type_hints, ) from plotly.graph_objects import Figure @@ -807,8 +808,9 @@ class ComputedVar(property, Var): Returns: The type of the var. """ - if "return" in self.fget.__annotations__: - return self.fget.__annotations__["return"] + hints = get_type_hints(self.fget) + if "return" in hints: + return hints["return"] return Any