Skip to content

Commit

Permalink
refactor(ses): stricten commons async gen fn instance error cond
Browse files Browse the repository at this point in the history
Co-authored-by: legobeat <[email protected]>
  • Loading branch information
leotm and legobeat committed Sep 11, 2024
1 parent cdd2dad commit 5374cfc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/ses/src/commons.js
Original file line number Diff line number Diff line change
Expand Up @@ -391,9 +391,10 @@ try {
'return (async function* AsyncGeneratorFunctionInstance() {})',
)();
} catch (e) {
if (e.name === 'SyntaxError') {
// @ts-expect-error ts(2339) Property 'jsEngine' does not exist on type 'Error'. However it exists on Hermes.
if (Error.prototype.jsEngine === 'hermes' && e.name === 'SyntaxError') {
// Swallows Hermes error `async generators are unsupported` at runtime.
// @ts-ignore
// @ts-expect-error ts(2554) Expected 0 arguments, but got 1. It refers to the Web API Window object, but on Hermes we expect 1 argument.
// eslint-disable-next-line no-undef
print('SES: Skipping async generators, unsupported on Hermes');
// Note: `console` is not a JS built-in, so Hermes engine throws:
Expand Down

0 comments on commit 5374cfc

Please sign in to comment.