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

224
Views
Parameter 'array' implicitly has 'any' type. What does this mean?
var milkResponses: string[] = ["I like milk", "mmmm"];
function randomArrayShuffle(array) {
    var currentIndex = array.length, temporaryValue, randomIndex;
    while (0 !== currentIndex) {
      randomIndex = Math.floor(Math.random() * currentIndex);
      currentIndex -= 1;
      temporaryValue = array[currentIndex];
      array[currentIndex] = array[randomIndex];
      array[randomIndex] = temporaryValue;
    }
    return array;
  }

What I want to do is randomize a string array such as milkResponses, but the array parameter has an error saying that Parameter 'array' implicitly has an 'any' type. I'm not sure what it means. I think its because I made the array wrong?

Appreciate the help

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

If there's nothing that either explicitly sets the type of something in TypeScript, or a reliable way for TypeScript to infer that type (e.g. by creating a variable and immediately setting it to a value), then TypeScript will implicitly give it the type any. By default, TypeScript is configured to not allow code containing any implicit any to compile, which is why you're seeing this error.

Because it's a function argument without a default value, you'll want to specify its value explicitly. It looks like your function can operate on arrays that contain anything, so you probably want to use function randomArrayShuffle(array: any[]) {

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