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

275
Vistas
Typescript forEach/Map issue with a valid array

I was going through my code and suddenly a weird forEach/map Issue came up with a valid Array using TypeScript. The code is as follows

The Code

I tried this with both forEach and map and it was still not working.

Error while execution: The Error

package.json

{
  "name": "merk-development",
  "version": "1.0.0",
  "description": "A bot made by daysling for merk.",
  "main": "dist/index.js",
  "scripts": {
    "start": "ts-node src/index.ts",
    "build": "rm -rf dist && tsc",
    "typeorm": "node --require ts-node/register ./node_modules/typeorm/cli.js"
  },
  "author": "daysling",
  "license": "Copyright",
  "dependencies": {
    "@types/dotenv": "^8.2.0",
    "discord-ghost-transcript": "^1.0.1",
    "discord.js": "^13.6.0",
    "dotenv": "^14.0.0",
    "mojang": "^2.2.2",
    "mysql": "^2.14.1",
    "redis": "^4.0.2",
    "reflect-metadata": "^0.1.10",
    "typeorm": "0.2.41"
  },
  "devDependencies": {
    "@types/node": "^8.10.66",
    "ts-node": "10.4.0",
    "typescript": "4.5.4"
  }
}

tsconfig.json

{
  "compilerOptions": {
    "lib": ["ES2020", "ES2021"],
    "target": "ES2020",
    "strict": true,
    "module": "CommonJS",
    "declaration": false,
    "noImplicitAny": false,
    "strictNullChecks": false,
    "inlineSourceMap": true,
    "outDir": "./dist",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "allowJs": true
  },
  "include": ["src"]
}

Thanks for reading this thread and trying to help out!

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Error is at line 39:19, so the problem is in this code:

// command.alliases is undefined
command.alliases.map(/* ... */)

You need to check whether command is what you are expecting it to be.

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