Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

278
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda