Hermes: Symbol.asyncIterator is not defined

Created on 24 Apr 2020  路  8Comments  路  Source: facebook/hermes

Please help. The following error appeared in run-time when I enabled Hermes in our app. Have I missed some hermes configuration?

image

Most helpful comment

The problem solved! The last undefined is not a function error was
because of asyncIterator polyfill as well. My app included running parts in separate thread - putting polyfill there did solved the problem

@tmikov , @mhorowitz, Thank you a lot!

All 8 comments

That's in ES2018, and i believe hermes only targets ES2015.

That's in ES2018, and i believe hermes only targets ES2015.

thank you, ljarb

if it is so, what should I do (asyncIterations are quite significant part of our design) ?

@ljharb our goal is to catch up with the current version of the spec, and we are working hard on it, but we are not there yet... In some places we are beyond ES2015, in others unfortunately still behind it :-)

@alexkrav would Babel plus a Symbol.asyncGenerator polyfill work?

would Babel plus a Symbol.asyncGenerator polyfill work?

no it does not:
"lib": [ "esnext.asynciterable", "es2015.promise", "es2015.core", "es5", "esnext.array" ] (in tsconfig.json)

@tmikov, thank you

Caveat: I don't really know what I'm talking about :-) but https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-3.html#caveats says you need to provide your own polyfill for the symbol, and gives one. https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/core/core-asynciterator-polyfill seems to be an npm you can just install.

Thank you all!
Polyfill works.
Now I got another one related to asyncIterator use (only with Hermes):
undefined is not a function, js engine hermes
` ...

at flush
at tryCallOne
at anonymous 
at apply 
at anonymous 
at _callTimer 
at _callImmediatesPass 
at callImmediates 
at __callImmediates 
at anonymous 
at __guard 
at flushedQueue 
at invokeCallbackAndReturnFlushedQueue (native) `

This just means you're doing something like foo.bar() where foo.bar is undefined. Usually the stack trace would include line and column numbers which would point to the place where the bug is. How did you make this stack? If you are not running metro, you should start, as that will help symbolicate the stacks you get.

The problem solved! The last undefined is not a function error was
because of asyncIterator polyfill as well. My app included running parts in separate thread - putting polyfill there did solved the problem

@tmikov , @mhorowitz, Thank you a lot!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thymikee picture thymikee  路  6Comments

tsengvn picture tsengvn  路  4Comments

jacque006 picture jacque006  路  4Comments

WilliamParks picture WilliamParks  路  3Comments

Gregoirevda picture Gregoirevda  路  3Comments