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

Vetur cannot find variables/methods when used inside an anonymous function for an event #2795

Open
4 tasks done
aziztitu opened this issue Mar 22, 2021 · 1 comment
Open
4 tasks done

Comments

@aziztitu
Copy link

  • I have searched through existing issues
  • I have read through docs
  • I have read FAQ
  • I have tried restarting VS Code or running Vetur: Restart VLS

Info

  • Platform: macOS
  • Vetur version: 0.33.1
  • VS Code version: 1.54

Problem

Vetur is not able to find symbols when used inside an anonymous function for an event like so:

<v-btn
  color="primary"
  depressed
  @click="
    () => {
      if (!resetPasswordSessionId) {
        sendResetPasswordEmail();   // I get an error here: "Cannot find name 'sendResetPasswordEmail'"
      } else {
        resetPassword();   // I get an error here: "Cannot find name 'resetPassword'"
      }
    }
  "
  :loading="forgotCredentialsSendingEmail || resettingPassword"
  >Submit</v-btn
>

Error message:

Cannot find name 'sendResetPasswordEmail'
Cannot find name 'resetPassword'

Reproducible Case

  • Just use an anonymous function inside the template
  • Try to reference a state/prop inside this anonymous function
  • Vetur throws error similar to the ones mentioned above
@lgarczyn
Copy link

lgarczyn commented Jan 12, 2022

Same issue. It is especially bad if a component uses @emit from vue-property-decorator, as any non-default type will cause similar errors

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

3 participants