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

142
Visualizações
How do I fix Vetur type error Typescript / Vue

I am likely missing something in the "TYPING" of my objects but despite my interface slot is coming up as an any type.

Property 'slot' does not exist on type '{ slot?: number[] | undefined; tile?: number[] | undefined; cardOne?: number | null | undefined; cardTwo?: number | null | undefined; }[]'.Vetur(2339)

enter image description here

interface TableMatchInterface {
  slot?: (number) [];
  tile?:  (number) [];
  cardOne?: (number)|null;
  cardTwo?: (number)|null;
}

What am I doing wrong?

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

Because you are adding the "?" symbol after the slot property, typescript inferred that the object property could have 2 values, either number[] or undefined. If you are really sure that you already have a real value and not an undefined one, you can use "!" to tell typescript to relax.

siteStore.tableMatch.slot[0]!

You can have a look about the "!" symbol here:

https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#non-null-assertion-operator-postfix-

about 4 years ago · Juan Pablo Isaza Relatório

0

The error indicates that tableMatch is an array of TableMatchInterface objects. Did you mean something like

siteStore.tableMatch[0].slot

Either that or check that the typing on tableMatch is actually TableMatchInterface, and not something like TableMatchInterface[]

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