Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

329
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda