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

277
Vistas
Declaring a global property in main file, When used that global property in vue (typescript) template giving syntax error (vscode)

I am using VueJs with typescript & vite. I have an icons file contents are following:

export const ICONS = {
    CLOCK: 'kbtmbyzy',
    CALENDAR: 'gphxrzct',
}

In my main.ts file. I have attached this as a global property, after importing it from the file.

app.config.globalProperties.ICONS = ICONS;

I have component:

<animated-icon :name="ICONS.CLOCK" />

enter image description here

Notice ICONS is highlighted and shows the follow error:

Property 'ICONS' does not exist on type '{ $: ComponentInternalInstance; $data: {}; $props: Partial<{}> & Omit<Readonly<ExtractPropTypes<{}>> & VNodeProps & AllowedComponentProps & ComponentCustomProps, never>; ... 10 more ...; $watch(source: string | Function, cb: Function, options?: WatchOptions<...> | undefined): WatchStopHandle; } & ... 4 more ... & Co...'.ts(2339)

I am using vue3 composition api. It gives the error when I use composition api with setup in script tag: <script setup lang="ts"></script> However it doesn't gives the error when used export default:

export default {
  setup() {}
}
</script>

I want to use first method with setup in the script tag.

about 4 years ago · Juan Pablo Isaza
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