Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

324
Views
Vuejs: Typing $refs values

I have a Vuejs (3) project using Typescript. I'm trying to avoid relying on the type any when using $refs:

const el = (this.$refs['target'] as any).$el

It triggers the following warning:

warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

Any idea what type I can use instead of any ?

EDIT: I don't want to disable my eslint rule :)

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

As the ref refers to a Vue component (since you're using $el), you can use the interfaces Vue or VueConstructor which ship with Vue instead of any. This will give you access to the basic Vue properties of the component like $el, $data etc., though not specific methods and properties you've added yourself to the component.

This will keep ESLint happy as it's using something more specific than any.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!