question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

unknown Statement of type "ForOfStatement"

See original GitHub issue

Having a for .. of loop in a generator function raise the error :

Error: path/to/file.js: unknown Statement of type "ForOfStatement"
    at Emitter.Ep.explodeStatement (/path/to/project/node_modules/babel-plugin-transform-regenerator/lib/emit.js:648:13)

other for .. of loops compile as expected

babel-plugin-transform-regenerator version : 6.3.26 babel version : 6.3.26 node version : v5.3.0

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:8

github_iconTop GitHub Comments

3reactions
wmertenscommented, Dec 18, 2016

@benjamn is this still relevant? I am encountering this error when using for..of in an async function transpiled with the babel-preset-env set to target: {node: "current"}. The reason is that Node supports for..of natively and thus it does not get transpiled.

Should regenerator just ignore ForOfStatement or will that break things?

1reaction
jneycommented, Dec 31, 2015

adding transform-runtime fixed the issue

{
  "presets": ["es2015"],
  "plugins": ["transform-runtime"]
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

unknown Statement of type "ForOfStatement" #1269 - GitHub
I am using Parcel-bundler as an express middleware and cannot get it to build at all. node_modules/parcel-bundler/src/Bundler.js: unknown ...
Read more >
How to solve syntax error of d3-array/src/number.js
Error: node_modules/d3-array/src/merge.js: unknown Statement of type "ForOfStatement" for (const array of arrays) { yield* array; } ...
Read more >
Upgrade to Babel 7 (API)
In general, we have differentiated the node types with TypeAnnotation for Flow and ... and is replace with the field await in the...
Read more >
@babel/types ForOfStatement TypeScript Examples
This page shows TypeScript code examples of @babel/types ForOfStatement. ... https://tc39.es/ecma262/#sec-return-statement let v: unknown; ...
Read more >
UNPKG - @babel/standalone
RestElement;\n Statement: t.Statement;\n User: t.Node;\n Var: t.VariableDeclaration;\n}\n\ntype VirtualTypeMapping = readonly (t.Node[\"type\"] | keyof t.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found