SyntaxError: Unexpected strict mode reserved word in sample code of the documentation
Closed this issue · 1 comments
geohuz commented
import { call } from 'effection';
yield* call(async function() {
return "hello world";
});
when run it with nodejs (v20.10.0) I got the error:
yield* call(async function() {
^^^^^
SyntaxError: Unexpected strict mode reserved word
cowboyd commented
@geohuz You can only use yield
inside a generator function, not the top level module scope. You need to "enter" into effection via either main()
or run()
:
import { call, main } from './mod.ts';
await main(function*() {
yield* call(async function() {
return "hello world";
});
});
Hope that helps!