Type 'IterableIterator<[number, Module]>' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators. 1

Type ‘IterableIterator<[number, Module]>‘ is not an array type or a string type. Use compiler option ‘–downlevelIteration’ to allow iterating of iterators.

{
  "compilerOptions": {
    "target": "es5",
    "downlevelIteration": true
  }
}

Here is what the above code is Doing:
1. We’re creating a new file called tsconfig.json.
2. We’re adding a new property called compilerOptions.
3. We’re adding a new property called target and setting it to es5.
4. We’re adding a new property called downlevelIteration and setting it to true.

Now, let’s run the following command:

tsc –init

This command will create a new file called tsconfig.json.

Now, let’s run the following command:

tsc

This command will compile all the TypeScript files in the current directory.

Now, let’s run the following command:

node index.js

This command will run the compiled JavaScript file.

Now, let’s run the following command:

tsc –init –target es5 –downlevelIteration true

This command will create a new file called tsconfig.json and add the following code:

{
“compilerOptions”: {
“target”: “es5”,
“downlevelIteration”: true
}
}

Similar Posts