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

323
Views
Vuejs: escribir valores de $ refs

Tengo un proyecto Vuejs (3) usando Typescript. Estoy tratando de evitar confiar en el tipo any cuando uso $refs :

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

Activa la siguiente advertencia:

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

¿Alguna idea de qué tipo puedo usar en lugar de cualquiera?

EDITAR: no quiero deshabilitar mi regla eslint :)

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Como la referencia se refiere a un componente Vue (dado que está usando $el ), puede usar las interfaces Vue o VueConstructor que se envían con Vue en lugar de any . Esto le dará acceso a las propiedades básicas de Vue del componente como $el , $data , etc., aunque no métodos y propiedades específicos que haya agregado usted mismo al componente.

Esto mantendrá contento a ESLint ya que está usando algo más específico que any archivo .

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!