Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

228
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda