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

Complain if using Ref or Reactive and not the actual values #3036

Open
1 task done
Lilja opened this issue Jun 30, 2021 · 0 comments
Open
1 task done

Complain if using Ref or Reactive and not the actual values #3036

Lilja opened this issue Jun 30, 2021 · 0 comments

Comments

@Lilja
Copy link

Lilja commented Jun 30, 2021

  • I have searched through existing issues

Feature Request

This is more likely a typescript thing, I don't know exactly if it can be applied to Javascript. But I stumbled upon a case where

const runningInIframeContext = ref(false)
const someMethod = () => {
    if (runningInIframeContext) {
        // some logic here
    }
}

This resulted to the if statement evaluating to true all the time, I guess because it's truthy. I should have used runningInIframeContext.value which fixed that bug. But it would be wonderful if vetur could complain that you shouldn't check things in an if statement that is of type Ref or Reactive. I'm not sure if this is the right place, feel free to shout out if this a responsibility of another tool or easy to set up using typescript-eslint or whatever.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants