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

325
Visualizações
What is the TypeScript definition of a matrix defined with nester Array.fill

Any hints on what the correct TypeScript definition for this would be? Basically a 5x5 matrix with empty strings.

const arr = Array(5).fill(Array(5).fill('', 0), 0)

What I tried so far is:

const arr: Array<Array<string>> = Array(5).fill(Array(5).fill('', 0), 0)

but I get Unsafe assignment of type any[] to a variable of type string[][].

One hint I have from VSCode (mouse over the Array definition) is this:

var Array: ArrayConstructor (arrayLength?: number | undefined) => any[] (+2 overloads)

Does this mean that using ArrayConstructor I need to find a way to define the return value?

Any help would be appreciated.

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