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

Auto detect variable type from context #8

Open
rmorse opened this issue May 24, 2022 · 0 comments
Open

Auto detect variable type from context #8

rmorse opened this issue May 24, 2022 · 0 comments

Comments

@rmorse
Copy link
Owner

rmorse commented May 24, 2022

It would make life a lot easier if we could detect the type automatically, so all we have to do is supply the name of the variable we want to expose...

For replace type variables, we just need to check for them being used in the output.

For list type variables, we can check for the existance of a .map or some other type of loop

And for control type variables we can check their usage in JSX expression, and if they are used in the left side of the expression...

It probably won't be 100% reliable but feels like it could be quite effective...

An additional feature worth investigating would be to have variables that have multiple "types"...

Eg, a replace variable could also be a control variable, which is not currently supported (this is a rather contrived example):

<>
    { name === '' && 'Unknown user' }
    { name !== '' && name }
</>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant