reflex icon indicating copy to clipboard operation
reflex copied to clipboard

No strict type checking for indexing with vars

Open ElijahAhianyo opened this issue 2 years ago β€’ 0 comments

This code shouldnt be allowed but it compiles into a js code that doesnt fail either:

class State(rx.State):
    d: list[int] = [1, 2, 3]

    @rx.var
    def elements(self) -> dict[str, str]:
        return {"name": "reflex"}


def index():
    return rx.center(
        rx.text(State.elements[State.d]),
    )

ElijahAhianyo avatar Jul 12 '23 09:07 ElijahAhianyo