Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

316
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!