Resolve #304: Relax type requirement on pc.cond#323
Resolve #304: Relax type requirement on pc.cond#323picklelo merged 3 commits intoreflex-dev:mainfrom
Conversation
tests/components/layout/test_cond.py
Outdated
| cond_component = pc.cond( | ||
| cond_state.value, | ||
| pc.text("cond is True"), | ||
| pc.text("cond is False"), | ||
| ) |
There was a problem hiding this comment.
pyright is complaining error: Module is not callable. Any thoughts?
There was a problem hiding this comment.
This may because we do some magic to create the pc. functions. In the tests maybe we can try to import the components directly:
from pynecone.components.typography.text import Text
from pynecone.components.layout.cond import CondThen call the create method explicitly:
cond_component = Cond.create(
cond_state.value,
Text.create("cond is True"),
Text.create("cond is False"),
)There was a problem hiding this comment.
Thanks. It seems to fix it.
This may because we do some magic to create the pc. functions.
I am curious how we do this? e.g. I don't see any def cond(): for pc.cond
There was a problem hiding this comment.
This is the line that does the magic: we create pc. functions that map to each component's create method.
|
Thanks for this change! If the fix doesn't work, we can also put a |
Resolve #304: Relax type requirement on pc.cond